mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
WINCE: Make scummvm compile and run again for WinCE platform (patch #3202337)
This commit is contained in:
parent
6a31e398f7
commit
aa452d3aeb
327
backends/events/wincesdl/wincesdl-events.cpp
Normal file
327
backends/events/wincesdl/wincesdl-events.cpp
Normal file
@ -0,0 +1,327 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
#include "common/config-manager.h"
|
||||
|
||||
#include "backends/events/wincesdl/wincesdl-events.h"
|
||||
#include "backends/graphics/wincesdl/wincesdl-graphics.h"
|
||||
#include "backends/platform/wince/CEActionsPocket.h"
|
||||
#include "backends/platform/wince/CEActionsSmartphone.h"
|
||||
#include "backends/platform/wince/CEDevice.h"
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
|
||||
WINCESdlEventSource::WINCESdlEventSource()
|
||||
: _tapTime(0), _closeClick(false), _rbutton(false),
|
||||
_freeLook(false) {
|
||||
}
|
||||
|
||||
void WINCESdlEventSource::fillMouseEvent(Common::Event &event, int x, int y) {
|
||||
event.mouse.x = x;
|
||||
event.mouse.y = y;
|
||||
|
||||
// Update the "keyboard mouse" coords
|
||||
_km.x = event.mouse.x;
|
||||
_km.y = event.mouse.y;
|
||||
|
||||
// Adjust for the screen scaling
|
||||
if (((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_zoomDown)
|
||||
event.mouse.y += 240;
|
||||
|
||||
event.mouse.x = event.mouse.x * ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_scaleFactorXd / ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_scaleFactorXm;
|
||||
event.mouse.y = event.mouse.y * ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_scaleFactorYd / ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_scaleFactorYm;
|
||||
}
|
||||
|
||||
bool WINCESdlEventSource::pollEvent(Common::Event &event) {
|
||||
SDL_Event ev;
|
||||
ev.type = SDL_NOEVENT;
|
||||
DWORD currentTime;
|
||||
bool keyEvent = false;
|
||||
int deltaX, deltaY;
|
||||
|
||||
memset(&event, 0, sizeof(Common::Event));
|
||||
|
||||
handleKbdMouse();
|
||||
|
||||
// If the screen changed, send an Common::EVENT_SCREEN_CHANGED
|
||||
int screenID = ((OSystem_SDL *)g_system)->getGraphicsManager()->getScreenChangeID();
|
||||
if (screenID != _lastScreenID) {
|
||||
_lastScreenID = screenID;
|
||||
event.type = Common::EVENT_SCREEN_CHANGED;
|
||||
return true;
|
||||
}
|
||||
|
||||
CEDevice::wakeUp();
|
||||
|
||||
currentTime = GetTickCount();
|
||||
|
||||
while (SDL_PollEvent(&ev)) {
|
||||
switch (ev.type) {
|
||||
case SDL_KEYDOWN:
|
||||
debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym));
|
||||
// KMOD_RESERVED is used if the key has been injected by an external buffer
|
||||
if (ev.key.keysym.mod != KMOD_RESERVED && !GUI::Actions::Instance()->mappingActive()) {
|
||||
keyEvent = true;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed = ev.key.keysym.sym;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeatTime = currentTime;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeat = 0;
|
||||
|
||||
if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, true))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GUI_Actions::Instance()->mappingActive())
|
||||
event.kbd.flags = 0xFF;
|
||||
else if (ev.key.keysym.sym == SDLK_PAUSE) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed = 0;
|
||||
event.type = Common::EVENT_PREDICTIVE_DIALOG;
|
||||
return true;
|
||||
} event.type = Common::EVENT_KEYDOWN;
|
||||
if (!GUI::Actions::Instance()->mappingActive())
|
||||
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
|
||||
else
|
||||
event.kbd.keycode = (Common::KeyCode)mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, GUI::Actions::Instance()->mappingActive());
|
||||
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, GUI::Actions::Instance()->mappingActive());
|
||||
|
||||
if (ev.key.keysym.mod == KMOD_RESERVED && ev.key.keysym.unicode == KMOD_SHIFT) {
|
||||
event.kbd.ascii ^= 0x20;
|
||||
event.kbd.flags = Common::KBD_SHIFT;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_KEYUP:
|
||||
debug(1, "Key up %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym));
|
||||
// KMOD_RESERVED is used if the key has been injected by an external buffer
|
||||
if (ev.key.keysym.mod != KMOD_RESERVED && !GUI::Actions::Instance()->mappingActive()) {
|
||||
keyEvent = true;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed = 0;
|
||||
|
||||
if (!GUI_Actions::Instance()->mappingActive() && GUI_Actions::Instance()->performMapped(ev.key.keysym.sym, false))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GUI_Actions::Instance()->mappingActive())
|
||||
event.kbd.flags = 0xFF;
|
||||
else if (ev.key.keysym.sym == SDLK_PAUSE) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed = 0;
|
||||
return false; // chew up the show agi dialog key up event
|
||||
}
|
||||
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
if (!GUI::Actions::Instance()->mappingActive())
|
||||
event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
|
||||
else
|
||||
event.kbd.keycode = (Common::KeyCode)mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, GUI::Actions::Instance()->mappingActive());
|
||||
event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, GUI::Actions::Instance()->mappingActive());
|
||||
|
||||
if (ev.key.keysym.mod == KMOD_RESERVED && ev.key.keysym.unicode == KMOD_SHIFT) {
|
||||
event.kbd.ascii ^= 0x20;
|
||||
event.kbd.flags = Common::KBD_SHIFT;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
fillMouseEvent(event, ev.motion.x, ev.motion.y);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->setMousePos(event.mouse.x, event.mouse.y);
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = Common::EVENT_LBUTTONDOWN;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
else
|
||||
break;
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
||||
|
||||
if (event.mouse.x > _tapX)
|
||||
deltaX = event.mouse.x - _tapX;
|
||||
else
|
||||
deltaX = _tapX - event.mouse.x;
|
||||
if (event.mouse.y > _tapY)
|
||||
deltaY = event.mouse.y - _tapY;
|
||||
else
|
||||
deltaY = _tapY - event.mouse.y;
|
||||
_closeClick = (deltaX <= 5 && deltaY <= 5);
|
||||
|
||||
if (!_isSmartphone) {
|
||||
// handle double-taps
|
||||
if (_tapTime) { // second tap
|
||||
if (_closeClick && (GetTickCount() - _tapTime < 1000)) {
|
||||
if ( event.mouse.y <= 20 &&
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_panelInitialized) {
|
||||
// top of screen (show panel)
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel_visibility();
|
||||
} else if (!((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_noDoubleTapRMB) {
|
||||
// right click
|
||||
event.type = Common::EVENT_RBUTTONDOWN;
|
||||
_rbutton = true;
|
||||
}
|
||||
}
|
||||
_tapTime = 0;
|
||||
} else {
|
||||
_tapTime = GetTickCount();
|
||||
_tapX = event.mouse.x;
|
||||
_tapY = event.mouse.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (_freeLook && !_closeClick) {
|
||||
_rbutton = false;
|
||||
_tapTime = 0;
|
||||
_tapX = event.mouse.x;
|
||||
_tapY = event.mouse.y;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->setMousePos(event.mouse.x, event.mouse.y);
|
||||
}
|
||||
|
||||
|
||||
if (((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHandler.action(event.mouse.x, event.mouse.y, true)) {
|
||||
if (!((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHandler.drawn()) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHighDrawn = false;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->internUpdateScreen();
|
||||
}
|
||||
if (((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_newOrientation != ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_orientationLandscape){
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_orientationLandscape = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_newOrientation;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHighDrawn = false;
|
||||
ConfMan.setInt("landscape", ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_orientationLandscape);
|
||||
ConfMan.flushToDisk();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->hotswapGFXMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.button.button == SDL_BUTTON_LEFT)
|
||||
event.type = Common::EVENT_LBUTTONUP;
|
||||
else if (ev.button.button == SDL_BUTTON_RIGHT)
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
else
|
||||
break;
|
||||
|
||||
if (_rbutton) {
|
||||
event.type = Common::EVENT_RBUTTONUP;
|
||||
_rbutton = false;
|
||||
}
|
||||
|
||||
fillMouseEvent(event, ev.button.x, ev.button.y);
|
||||
|
||||
if (_freeLook && !_closeClick) {
|
||||
_tapX = event.mouse.x;
|
||||
_tapY = event.mouse.y;
|
||||
event.type = Common::EVENT_MOUSEMOVE;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->setMousePos(event.mouse.x, event.mouse.y);
|
||||
}
|
||||
|
||||
if (((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHandler.action(event.mouse.x, event.mouse.y, false)) {
|
||||
if (!((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHandler.drawn()) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_toolbarHighDrawn = false;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->internUpdateScreen();
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
case SDL_VIDEOEXPOSE:
|
||||
// HACK: Send a fake event, handled by SdlGraphicsManager
|
||||
event.type = (Common::EventType)OSystem_SDL::kSdlEventExpose;
|
||||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
event.type = Common::EVENT_QUIT;
|
||||
return true;
|
||||
|
||||
case SDL_ACTIVEEVENT:
|
||||
if (ev.active.state & SDL_APPMOUSEFOCUS)
|
||||
debug(2, "%s mouse focus.", ev.active.gain ? "Got" : "Lost");
|
||||
if (ev.active.state & SDL_APPINPUTFOCUS)
|
||||
debug(2, "%s input focus.", ev.active.gain ? "Got" : "Lost");
|
||||
if (ev.active.state & SDL_APPACTIVE)
|
||||
debug(2, "%s total focus.", ev.active.gain ? "Got" : "Lost");
|
||||
if (ev.active.state & SDL_APPINPUTFOCUS) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_hasfocus = ev.active.gain;
|
||||
SDL_PauseAudio(!((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_hasfocus);
|
||||
if (((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_hasfocus) {
|
||||
event.type = (Common::EventType)OSystem_SDL::kSdlEventExpose;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Simulate repeated key for backend
|
||||
if (!keyEvent && ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed && (int)currentTime > ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeatTime + ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeatTrigger) {
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeatTime = currentTime;
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_keyRepeat++;
|
||||
GUI_Actions::Instance()->performMapped(((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->_lastKeyPressed, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int WINCESdlEventSource::mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool unfilter) {
|
||||
if (GUI::Actions::Instance()->mappingActive())
|
||||
return key;
|
||||
|
||||
if (unfilter) {
|
||||
switch (key) {
|
||||
case SDLK_ESCAPE:
|
||||
return SDLK_BACKSPACE;
|
||||
case SDLK_F8:
|
||||
return SDLK_ASTERISK;
|
||||
case SDLK_F9:
|
||||
return SDLK_HASH;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
if (key >= SDLK_KP0 && key <= SDLK_KP9) {
|
||||
return key - SDLK_KP0 + '0';
|
||||
} else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
|
||||
return key;
|
||||
} else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
|
||||
return 0;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
void WINCESdlEventSource::swap_freeLook() {
|
||||
_freeLook = !_freeLook;
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
62
backends/events/wincesdl/wincesdl-events.h
Normal file
62
backends/events/wincesdl/wincesdl-events.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_EVENTS_SDL_WINCE_H
|
||||
#define BACKENDS_EVENTS_SDL_WINCE_H
|
||||
|
||||
#include "backends/events/sdl/sdl-events.h"
|
||||
|
||||
extern bool _isSmartphone;
|
||||
|
||||
class WINCESdlEventSource : public SdlEventSource {
|
||||
public:
|
||||
WINCESdlEventSource();
|
||||
|
||||
void loadDeviceConfiguration();
|
||||
|
||||
// Overloaded from SDL backend (toolbar handling)
|
||||
bool pollEvent(Common::Event &event);
|
||||
// Overloaded from SDL backend (mouse and new scaler handling)
|
||||
void fillMouseEvent(Common::Event &event, int x, int y);
|
||||
|
||||
void swap_freeLook();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool unfilter);
|
||||
|
||||
// Keyboard tap
|
||||
int _tapX;
|
||||
int _tapY;
|
||||
long _tapTime;
|
||||
|
||||
bool _closeClick; // flag when taps are spatially close together
|
||||
bool _rbutton; // double tap -> right button simulation
|
||||
bool _freeLook; // freeLook mode (do not send mouse button events)
|
||||
|
||||
};
|
||||
|
||||
#endif /* BACKENDS_EVENTS_SDL_WINCE_H */
|
@ -161,13 +161,6 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *sdlEventSource)
|
||||
|
||||
_graphicsMutex = g_system->createMutex();
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
if (ConfMan.hasKey("use_GDI") && ConfMan.getBool("use_GDI")) {
|
||||
SDL_VideoInit("windib", 0);
|
||||
sdlFlags ^= SDL_INIT_VIDEO;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
|
||||
memset(&_oldVideoMode, 0, sizeof(_oldVideoMode));
|
||||
|
1638
backends/graphics/wincesdl/wincesdl-graphics.cpp
Normal file
1638
backends/graphics/wincesdl/wincesdl-graphics.cpp
Normal file
File diff suppressed because it is too large
Load Diff
206
backends/graphics/wincesdl/wincesdl-graphics.h
Normal file
206
backends/graphics/wincesdl/wincesdl-graphics.h
Normal file
@ -0,0 +1,206 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_GRAPHICS_WINCE_SDL_H
|
||||
#define BACKENDS_GRAPHICS_WINCE_SDL_H
|
||||
|
||||
#include "backends/graphics/sdl/sdl-graphics.h"
|
||||
#include "backends/platform/wince/CEgui/CEGUI.h"
|
||||
|
||||
// Internal GUI names
|
||||
#define NAME_MAIN_PANEL "MainPanel"
|
||||
#define NAME_PANEL_KEYBOARD "Keyboard"
|
||||
#define NAME_ITEM_OPTIONS "Options"
|
||||
#define NAME_ITEM_SKIP "Skip"
|
||||
#define NAME_ITEM_SOUND "Sound"
|
||||
#define NAME_ITEM_ORIENTATION "Orientation"
|
||||
#define NAME_ITEM_BINDKEYS "Bindkeys"
|
||||
|
||||
#define TOTAL_ZONES 3
|
||||
|
||||
extern bool _hasSmartphoneResolution;
|
||||
|
||||
class WINCESdlGraphicsManager : public SdlGraphicsManager {
|
||||
public:
|
||||
WINCESdlGraphicsManager(SdlEventSource *sdlEventSource);
|
||||
|
||||
const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
||||
void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
|
||||
|
||||
bool hasFeature(OSystem::Feature f);
|
||||
void setFeatureState(OSystem::Feature f, bool enable);
|
||||
bool getFeatureState(OSystem::Feature f);
|
||||
|
||||
int getDefaultGraphicsMode() const;
|
||||
bool setGraphicsMode(int mode);
|
||||
bool loadGFXMode();
|
||||
void unloadGFXMode();
|
||||
bool hotswapGFXMode();
|
||||
|
||||
// Overloaded from SDL backend (toolbar handling)
|
||||
void drawMouse();
|
||||
// Overloaded from SDL backend (new scaler handling)
|
||||
void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false);
|
||||
// Overloaded from SDL backend (new scaler handling)
|
||||
void warpMouse(int x, int y);
|
||||
|
||||
// Update the dirty areas of the screen
|
||||
void internUpdateScreen();
|
||||
bool saveScreenshot(const char *filename);
|
||||
|
||||
// Overloaded from SDL_Common (FIXME)
|
||||
void internDrawMouse();
|
||||
void undrawMouse();
|
||||
bool showMouse(bool visible);
|
||||
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend
|
||||
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
||||
void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
|
||||
Graphics::Surface *lockScreen();
|
||||
void unlockScreen();
|
||||
void blitCursor();
|
||||
void showOverlay();
|
||||
void hideOverlay();
|
||||
void setMousePos(int x, int y);
|
||||
|
||||
// GUI and action stuff
|
||||
void swap_panel_visibility();
|
||||
void swap_panel();
|
||||
void swap_smartphone_keyboard();
|
||||
void swap_zoom_up();
|
||||
void swap_zoom_down();
|
||||
void swap_mouse_visibility();
|
||||
|
||||
|
||||
//#ifdef WIN32_PLATFORM_WFSP
|
||||
void move_cursor_up();
|
||||
void move_cursor_down();
|
||||
void move_cursor_left();
|
||||
void move_cursor_right();
|
||||
|
||||
void retrieve_mouse_location(int &x, int &y);
|
||||
void switch_zone();
|
||||
|
||||
void add_right_click(bool pushed);
|
||||
void add_left_click(bool pushed);
|
||||
|
||||
void initZones();
|
||||
void smartphone_rotate_display();
|
||||
//#endif
|
||||
|
||||
bool _panelInitialized; // only initialize the toolbar once
|
||||
bool _noDoubleTapRMB; // disable double tap -> rmb click
|
||||
|
||||
CEGUI::ToolbarHandler _toolbarHandler;
|
||||
|
||||
bool _toolbarHighDrawn; // cache toolbar 640x80
|
||||
int _newOrientation; // new orientation
|
||||
int _orientationLandscape; // current orientation
|
||||
|
||||
int _scaleFactorXm; // scaler X *
|
||||
int _scaleFactorXd; // scaler X /
|
||||
int _scaleFactorYm; // scaler Y *
|
||||
int _scaleFactorYd; // scaler Y /
|
||||
|
||||
bool _hasfocus; // scummvm has the top window
|
||||
|
||||
bool hasPocketPCResolution();
|
||||
bool hasDesktopResolution();
|
||||
bool hasSquareQVGAResolution();
|
||||
bool hasWideResolution() const;
|
||||
|
||||
MousePos _mouseCurState;
|
||||
|
||||
bool _zoomUp; // zooming up mode
|
||||
bool _zoomDown; // zooming down mode
|
||||
|
||||
bool _usesEmulatedMouse; // emulated mousemove ever been used in this session
|
||||
|
||||
int _mouseXZone[TOTAL_ZONES];
|
||||
int _mouseYZone[TOTAL_ZONES];
|
||||
int _currentZone;
|
||||
|
||||
// Smartphone specific variables
|
||||
int _lastKeyPressed; // last key pressed
|
||||
int _keyRepeat; // number of time the last key was repeated
|
||||
int _keyRepeatTime; // elapsed time since the key was pressed
|
||||
int _keyRepeatTrigger; // minimum time to consider the key was repeated
|
||||
|
||||
struct zoneDesc {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
static zoneDesc _zones[TOTAL_ZONES];
|
||||
|
||||
protected:
|
||||
virtual void adjustMouseEvent(const Common::Event &event);
|
||||
|
||||
private:
|
||||
bool update_scalers();
|
||||
void update_game_settings();
|
||||
void drawToolbarMouse(SDL_Surface *surf, bool draw);
|
||||
|
||||
void create_toolbar();
|
||||
bool _panelVisible; // panel visibility
|
||||
bool _panelStateForced; // panel visibility forced by external call
|
||||
String _saveActiveToolbar; // save active toolbar when forced
|
||||
|
||||
bool _canBeAspectScaled; // game screen size allows for aspect scaling
|
||||
|
||||
SDL_Rect _dirtyRectOut[NUM_DIRTY_RECT];
|
||||
bool _scalersChanged;
|
||||
|
||||
bool isOzone();
|
||||
|
||||
bool _saveToolbarState; // save visibility when forced
|
||||
bool _saveToolbarZoom; // save visibility when zooming
|
||||
|
||||
SDL_Surface *_toolbarLow; // toolbar 320x40
|
||||
SDL_Surface *_toolbarHigh; // toolbar 640x80
|
||||
|
||||
// Mouse
|
||||
int _mouseHotspotX, _mouseHotspotY;
|
||||
byte *_mouseBackupOld;
|
||||
uint16 *_mouseBackupToolbar;
|
||||
uint16 _mouseBackupDim;
|
||||
|
||||
bool _forceHideMouse; // force invisible mouse cursor
|
||||
|
||||
// Smartphone specific variables
|
||||
void loadDeviceConfigurationElement(Common::String element, int &value, int defaultValue);
|
||||
int _repeatX; // repeat trigger for left and right cursor moves
|
||||
int _repeatY; // repeat trigger for up and down cursor moves
|
||||
int _stepX1; // offset for left and right cursor moves (slowest)
|
||||
int _stepX2; // offset for left and right cursor moves (faster)
|
||||
int _stepX3; // offset for left and right cursor moves (fastest)
|
||||
int _stepY1; // offset for up and down cursor moves (slowest)
|
||||
int _stepY2; // offset for up and down cursor moves (faster)
|
||||
int _stepY3; // offset for up and down cursor moves (fastest)
|
||||
};
|
||||
|
||||
#endif /* BACKENDS_GRAPHICS_WINCE_SDL_H */
|
||||
|
183
backends/mixer/wincesdl/wincesdl-mixer.cpp
Normal file
183
backends/mixer/wincesdl/wincesdl-mixer.cpp
Normal file
@ -0,0 +1,183 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
// Disable symbol overrides so that we can use system headers.
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "backends/platform/wince/wince-sdl.h"
|
||||
#include "backends/mixer/wincesdl/wincesdl-mixer.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
#ifndef USE_TREMOR
|
||||
#include <vorbis/vorbisfile.h>
|
||||
#else
|
||||
#include <tremor/ivorbisfile.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SAMPLES_PER_SEC_OLD 11025
|
||||
#define SAMPLES_PER_SEC_NEW 22050
|
||||
|
||||
WINCESdlMixerManager::WINCESdlMixerManager() {
|
||||
|
||||
}
|
||||
|
||||
WINCESdlMixerManager::~WINCESdlMixerManager() {
|
||||
|
||||
}
|
||||
|
||||
void WINCESdlMixerManager::init() {
|
||||
SDL_AudioSpec desired;
|
||||
int thread_priority;
|
||||
|
||||
uint32 sampleRate = compute_sample_rate();
|
||||
if (sampleRate == 0)
|
||||
warning("OSystem_WINCE3::setupMixer called with sample rate 0 - audio will not work");
|
||||
else if (_mixer && _mixer->getOutputRate() == sampleRate) {
|
||||
debug(1, "Skipping sound mixer re-init: samplerate is good");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&desired, 0, sizeof(desired));
|
||||
desired.freq = sampleRate;
|
||||
desired.format = AUDIO_S16SYS;
|
||||
desired.channels = 2;
|
||||
desired.samples = 128;
|
||||
desired.callback = private_sound_proc;
|
||||
desired.userdata = this;
|
||||
|
||||
// Create the mixer instance
|
||||
if (_mixer == 0)
|
||||
_mixer = new Audio::MixerImpl(g_system, sampleRate);
|
||||
|
||||
// Add sound thread priority
|
||||
if (!ConfMan.hasKey("sound_thread_priority"))
|
||||
thread_priority = THREAD_PRIORITY_NORMAL;
|
||||
else
|
||||
thread_priority = ConfMan.getInt("sound_thread_priority");
|
||||
|
||||
desired.thread_priority = thread_priority;
|
||||
|
||||
SDL_CloseAudio();
|
||||
if (SDL_OpenAudio(&desired, NULL) != 0) {
|
||||
warning("Could not open audio device: %s", SDL_GetError());
|
||||
_mixer->setReady(false);
|
||||
|
||||
} else {
|
||||
debug(1, "Sound opened OK, mixing at %d Hz", sampleRate);
|
||||
|
||||
// Re-create mixer to match the output rate
|
||||
int vol1 = _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType);
|
||||
int vol2 = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
|
||||
int vol3 = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
|
||||
int vol4 = _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType);
|
||||
delete _mixer;
|
||||
_mixer = new Audio::MixerImpl(g_system, sampleRate);
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol1);
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol2);
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol3);
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, vol4);
|
||||
_mixer->setReady(true);
|
||||
SDL_PauseAudio(0);
|
||||
}
|
||||
}
|
||||
|
||||
void WINCESdlMixerManager::private_sound_proc(void *param, byte *buf, int len) {
|
||||
WINCESdlMixerManager *this_ = (WINCESdlMixerManager *)param;
|
||||
assert(this_);
|
||||
|
||||
if (this_->_mixer)
|
||||
this_->_mixer->mixCallback(buf, len);
|
||||
if (!OSystem_WINCE3::_soundMaster)
|
||||
memset(buf, 0, len);
|
||||
}
|
||||
|
||||
uint32 WINCESdlMixerManager::compute_sample_rate() {
|
||||
uint32 sampleRate;
|
||||
|
||||
// Force at least medium quality FM synthesis for FOTAQ
|
||||
Common::String gameid(ConfMan.get("gameid"));
|
||||
if (gameid == "queen") {
|
||||
if (!((ConfMan.hasKey("FM_high_quality") && ConfMan.getBool("FM_high_quality")) ||
|
||||
(ConfMan.hasKey("FM_medium_quality") && ConfMan.getBool("FM_medium_quality")))) {
|
||||
ConfMan.setBool("FM_medium_quality", true);
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
}
|
||||
// See if the output frequency is forced by the game
|
||||
if (gameid == "ft" || gameid == "dig" || gameid == "comi" || gameid == "queen" || gameid == "sword" || gameid == "agi")
|
||||
sampleRate = SAMPLES_PER_SEC_NEW;
|
||||
else {
|
||||
if (ConfMan.hasKey("high_sample_rate") && ConfMan.getBool("high_sample_rate"))
|
||||
sampleRate = SAMPLES_PER_SEC_NEW;
|
||||
else
|
||||
sampleRate = SAMPLES_PER_SEC_OLD;
|
||||
}
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
// Modify the sample rate on the fly if OGG is involved
|
||||
if (sampleRate == SAMPLES_PER_SEC_OLD)
|
||||
if (checkOggHighSampleRate())
|
||||
sampleRate = SAMPLES_PER_SEC_NEW;
|
||||
#endif
|
||||
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
bool WINCESdlMixerManager::checkOggHighSampleRate() {
|
||||
char trackFile[255];
|
||||
FILE *testFile;
|
||||
OggVorbis_File *test_ov_file = new OggVorbis_File;
|
||||
|
||||
// FIXME: The following sprintf assumes that "path" is always
|
||||
// terminated by a path separator. This is *not* true in general.
|
||||
// This code really should check for the path separator, or even
|
||||
// better, use the FSNode API.
|
||||
sprintf(trackFile, "%sTrack1.ogg", ConfMan.get("path").c_str());
|
||||
// Check if we have an OGG audio track
|
||||
testFile = fopen(trackFile, "rb");
|
||||
if (testFile) {
|
||||
if (!ov_open(testFile, test_ov_file, NULL, 0)) {
|
||||
bool highSampleRate = (ov_info(test_ov_file, -1)->rate == 22050);
|
||||
ov_clear(test_ov_file);
|
||||
delete test_ov_file;
|
||||
return highSampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not test for OGG samples - too big and too slow anyway :)
|
||||
|
||||
delete test_ov_file;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
53
backends/mixer/wincesdl/wincesdl-mixer.h
Normal file
53
backends/mixer/wincesdl/wincesdl-mixer.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_MIXER_WINCE_SDL_H
|
||||
#define BACKENDS_MIXER_WINCE_SDL_H
|
||||
|
||||
#include "backends/mixer/sdl/sdl-mixer.h"
|
||||
|
||||
/**
|
||||
* SDL mixer manager for WinCE
|
||||
*/
|
||||
class WINCESdlMixerManager : public SdlMixerManager {
|
||||
public:
|
||||
WINCESdlMixerManager();
|
||||
virtual ~WINCESdlMixerManager();
|
||||
|
||||
virtual void init();
|
||||
|
||||
private:
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
bool checkOggHighSampleRate();
|
||||
#endif
|
||||
|
||||
static void private_sound_proc(void *param, byte *buf, int len);
|
||||
uint32 compute_sample_rate();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,7 @@ MODULE_OBJS := \
|
||||
events/samsungtvsdl/samsungtvsdl-events.o \
|
||||
events/sdl/sdl-events.o \
|
||||
events/symbiansdl/symbiansdl-events.o \
|
||||
events/wincesdl/wincesdl-events.o \
|
||||
fs/abstract-fs.o \
|
||||
fs/stdiostream.o \
|
||||
fs/amigaos4/amigaos4-fs-factory.o \
|
||||
@ -27,6 +28,7 @@ MODULE_OBJS := \
|
||||
graphics/openglsdl/openglsdl-graphics.o \
|
||||
graphics/sdl/sdl-graphics.o \
|
||||
graphics/symbiansdl/symbiansdl-graphics.o \
|
||||
graphics/wincesdl/wincesdl-graphics.o \
|
||||
keymapper/action.o \
|
||||
keymapper/keymap.o \
|
||||
keymapper/keymapper.o \
|
||||
@ -44,6 +46,7 @@ MODULE_OBJS := \
|
||||
mixer/doublebuffersdl/doublebuffersdl-mixer.o \
|
||||
mixer/sdl/sdl-mixer.o \
|
||||
mixer/symbiansdl/symbiansdl-mixer.o \
|
||||
mixer/wincesdl/wincesdl-mixer.o \
|
||||
mutex/sdl/sdl-mutex.o \
|
||||
plugins/elf/elf-loader.o \
|
||||
plugins/elf/mips-loader.o \
|
||||
|
@ -239,10 +239,12 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
|
||||
if (!pushed) {
|
||||
switch (action) {
|
||||
case POCKET_ACTION_RIGHTCLICK:
|
||||
_CESystem->add_right_click(false);
|
||||
//_CESystem->add_right_click(false);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
|
||||
return true;
|
||||
case POCKET_ACTION_LEFTCLICK:
|
||||
_CESystem->add_left_click(false);
|
||||
//_CESystem->add_left_click(false);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
|
||||
return true;
|
||||
case POCKET_ACTION_PAUSE:
|
||||
case POCKET_ACTION_SAVE:
|
||||
@ -272,43 +274,55 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
|
||||
EventsBuffer::simulateKey(&_key_action[action], true);
|
||||
return true;
|
||||
case POCKET_ACTION_KEYBOARD:
|
||||
_CESystem->swap_panel();
|
||||
//_CESystem->swap_panel();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel();
|
||||
return true;
|
||||
case POCKET_ACTION_HIDE:
|
||||
_CESystem->swap_panel_visibility();
|
||||
//_CESystem->swap_panel_visibility();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel_visibility();
|
||||
return true;
|
||||
case POCKET_ACTION_SOUND:
|
||||
_CESystem->swap_sound_master();
|
||||
return true;
|
||||
case POCKET_ACTION_RIGHTCLICK:
|
||||
_CESystem->add_right_click(true);
|
||||
//_CESystem->add_right_click(true);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
|
||||
return true;
|
||||
case POCKET_ACTION_CURSOR:
|
||||
_CESystem->swap_mouse_visibility();
|
||||
//_CESystem->swap_mouse_visibility();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_mouse_visibility();
|
||||
return true;
|
||||
case POCKET_ACTION_FREELOOK:
|
||||
_CESystem->swap_freeLook();
|
||||
//_CESystem->swap_freeLook();
|
||||
((WINCESdlEventSource *)((OSystem_SDL *)g_system)->getEventManager())->swap_freeLook();
|
||||
return true;
|
||||
case POCKET_ACTION_ZOOM_UP:
|
||||
_CESystem->swap_zoom_up();
|
||||
//_CESystem->swap_zoom_up();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_up();
|
||||
return true;
|
||||
case POCKET_ACTION_ZOOM_DOWN:
|
||||
_CESystem->swap_zoom_down();
|
||||
//_CESystem->swap_zoom_down();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_down();
|
||||
return true;
|
||||
case POCKET_ACTION_LEFTCLICK:
|
||||
_CESystem->add_left_click(true);
|
||||
//_CESystem->add_left_click(true);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
|
||||
return true;
|
||||
case POCKET_ACTION_UP:
|
||||
_CESystem->move_cursor_up();
|
||||
//_CESystem->move_cursor_up();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
|
||||
return true;
|
||||
case POCKET_ACTION_DOWN:
|
||||
_CESystem->move_cursor_down();
|
||||
//_CESystem->move_cursor_down();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
|
||||
return true;
|
||||
case POCKET_ACTION_LEFT:
|
||||
_CESystem->move_cursor_left();
|
||||
//_CESystem->move_cursor_left();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
|
||||
return true;
|
||||
case POCKET_ACTION_RIGHT:
|
||||
_CESystem->move_cursor_right();
|
||||
//_CESystem->move_cursor_right();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
|
||||
return true;
|
||||
case POCKET_ACTION_QUIT:
|
||||
if (!quitdialog) {
|
||||
|
@ -205,10 +205,12 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
|
||||
if (!pushed) {
|
||||
switch (action) {
|
||||
case SMARTPHONE_ACTION_RIGHTCLICK:
|
||||
_CESystem->add_right_click(false);
|
||||
//_CESystem->add_right_click(false);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_LEFTCLICK:
|
||||
_CESystem->add_left_click(false);
|
||||
//_CESystem->add_left_click(false);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_SAVE:
|
||||
case SMARTPHONE_ACTION_SKIP:
|
||||
@ -235,25 +237,32 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
|
||||
EventsBuffer::simulateKey(&_key_action[action], true);
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_RIGHTCLICK:
|
||||
_CESystem->add_right_click(true);
|
||||
//_CESystem->add_right_click(true);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_LEFTCLICK:
|
||||
_CESystem->add_left_click(true);
|
||||
//_CESystem->add_left_click(true);
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_UP:
|
||||
_CESystem->move_cursor_up();
|
||||
//_CESystem->move_cursor_up();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_DOWN:
|
||||
_CESystem->move_cursor_down();
|
||||
//_CESystem->move_cursor_down();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_LEFT:
|
||||
_CESystem->move_cursor_left();
|
||||
//_CESystem->move_cursor_left();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_RIGHT:
|
||||
_CESystem->move_cursor_right();
|
||||
//_CESystem->move_cursor_right();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_ZONE:
|
||||
_CESystem->switch_zone();
|
||||
//_CESystem->switch_zone();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_BINDKEYS:
|
||||
if (!keydialogrunning) {
|
||||
@ -265,10 +274,12 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
|
||||
}
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_KEYBOARD:
|
||||
_CESystem->swap_smartphone_keyboard();
|
||||
//_CESystem->swap_smartphone_keyboard();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_ROTATE:
|
||||
_CESystem->smartphone_rotate_display();
|
||||
//_CESystem->smartphone_rotate_display();
|
||||
((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
|
||||
return true;
|
||||
case SMARTPHONE_ACTION_QUIT:
|
||||
if (!quitdialog) {
|
||||
|
@ -44,7 +44,7 @@ extern "C" void WINAPI SystemIdleTimerReset(void);
|
||||
|
||||
#define TIMER_TRIGGER 9000
|
||||
|
||||
DWORD CEDevice::reg_access(TCHAR *key, TCHAR *val, DWORD data) {
|
||||
DWORD CEDevice::reg_access(const TCHAR *key, const TCHAR *val, DWORD data) {
|
||||
HKEY regkey;
|
||||
DWORD tmpval, cbdata;
|
||||
|
||||
@ -70,7 +70,7 @@ DWORD CEDevice::reg_access(TCHAR *key, TCHAR *val, DWORD data) {
|
||||
void CEDevice::backlight_xchg() {
|
||||
HANDLE h;
|
||||
|
||||
REG_bat = reg_access(TEXT("ControlPanel\\BackLight"), TEXT("BatteryTimeout"), REG_bat);
|
||||
REG_bat = reg_access(TEXT("ControlPanel\\BackLight"), (const TCHAR*)TEXT("BatteryTimeout"), REG_bat);
|
||||
REG_ac = reg_access(TEXT("ControlPanel\\BackLight"), TEXT("ACTimeout"), REG_ac);
|
||||
REG_disp = reg_access(TEXT("ControlPanel\\Power"), TEXT("Display"), REG_disp);
|
||||
|
||||
@ -127,6 +127,10 @@ bool CEDevice::hasSquareQVGAResolution() {
|
||||
return (OSystem_WINCE3::getScreenWidth() == 240 && OSystem_WINCE3::getScreenHeight() == 240);
|
||||
}
|
||||
|
||||
bool CEDevice::hasWideResolution() {
|
||||
return (OSystem_WINCE3::getScreenWidth() >= 640 || OSystem_WINCE3::getScreenHeight() >= 640);
|
||||
}
|
||||
|
||||
bool CEDevice::hasPocketPCResolution() {
|
||||
if (OSystem_WINCE3::isOzone() && hasWideResolution())
|
||||
return true;
|
||||
@ -139,10 +143,6 @@ bool CEDevice::hasDesktopResolution() {
|
||||
return (OSystem_WINCE3::getScreenWidth() > 320);
|
||||
}
|
||||
|
||||
bool CEDevice::hasWideResolution() {
|
||||
return (OSystem_WINCE3::getScreenWidth() >= 640 || OSystem_WINCE3::getScreenHeight() >= 640);
|
||||
}
|
||||
|
||||
bool CEDevice::hasSmartphoneResolution() {
|
||||
return (OSystem_WINCE3::getScreenWidth() < 240);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
static bool isSmartphone();
|
||||
|
||||
private:
|
||||
static DWORD reg_access(TCHAR *key, TCHAR *val, DWORD data);
|
||||
static DWORD reg_access(const TCHAR *key, const TCHAR *val, DWORD data);
|
||||
static void backlight_xchg();
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,10 @@
|
||||
#include "backends/platform/wince/CEkeys/CEKeys.h"
|
||||
#include "backends/platform/wince/CEDevice.h"
|
||||
|
||||
#define TOTAL_ZONES 3
|
||||
#include "backends/graphics/wincesdl/wincesdl-graphics.h"
|
||||
#include "backends/events/wincesdl/wincesdl-events.h"
|
||||
#include "backends/timer/default/default-timer.h"
|
||||
#include "backends/fs/windows/windows-fs-factory.h"
|
||||
|
||||
// defines used for implementing the raw frame buffer access method (2003+)
|
||||
#define GETRAWFRAMEBUFFER 0x00020001
|
||||
@ -46,202 +49,45 @@
|
||||
class OSystem_WINCE3 : public OSystem_SDL {
|
||||
public:
|
||||
OSystem_WINCE3();
|
||||
|
||||
// Update the dirty areas of the screen
|
||||
void internUpdateScreen();
|
||||
virtual ~OSystem_WINCE3();
|
||||
|
||||
void setGraphicsModeIntern();
|
||||
void initSize(uint w, uint h, const Graphics::PixelFormat *format);
|
||||
void initBackend();
|
||||
|
||||
// Overloaded from SDL backend (toolbar handling)
|
||||
bool pollEvent(Common::Event &event);
|
||||
// Overloaded from SDL backend (toolbar handling)
|
||||
void drawMouse();
|
||||
// Overloaded from SDL backend (mouse and new scaler handling)
|
||||
void fillMouseEvent(Common::Event &event, int x, int y);
|
||||
// Overloaded from SDL backend (new scaler handling)
|
||||
void addDirtyRect(int x, int y, int w, int h, bool mouseRect = false);
|
||||
// Overloaded from SDL backend (new scaler handling)
|
||||
void warpMouse(int x, int y);
|
||||
// Overloaded from SDL backend
|
||||
void quit();
|
||||
// Overloaded from SDL backend (master volume and sample rate subtleties)
|
||||
void setupMixer();
|
||||
// Overloaded from OSystem
|
||||
void engineInit();
|
||||
void getTimeAndDate(TimeDate &t) const;
|
||||
|
||||
virtual Common::String getDefaultConfigFileName();
|
||||
virtual FilesystemFactory *getFilesystemFactory();
|
||||
|
||||
|
||||
// Overloaded from SDL_Common (FIXME)
|
||||
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend
|
||||
void undrawMouse();
|
||||
void blitCursor();
|
||||
bool showMouse(bool visible);
|
||||
void setMousePos(int x, int y);
|
||||
void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
|
||||
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
||||
void showOverlay();
|
||||
void hideOverlay();
|
||||
Graphics::Surface *lockScreen();
|
||||
void unlockScreen();
|
||||
|
||||
// GUI and action stuff
|
||||
void swap_panel_visibility();
|
||||
void swap_panel();
|
||||
void swap_sound_master();
|
||||
void add_right_click(bool pushed);
|
||||
void swap_mouse_visibility();
|
||||
void swap_freeLook();
|
||||
void swap_zoom_up();
|
||||
void swap_zoom_down();
|
||||
void swap_smartphone_keyboard();
|
||||
|
||||
//#ifdef WIN32_PLATFORM_WFSP
|
||||
// Smartphone actions
|
||||
|
||||
void initZones();
|
||||
void loadDeviceConfigurationElement(String element, int &value, int defaultValue);
|
||||
void loadDeviceConfiguration();
|
||||
void add_left_click(bool pushed);
|
||||
void move_cursor_up();
|
||||
void move_cursor_down();
|
||||
void move_cursor_left();
|
||||
void move_cursor_right();
|
||||
void switch_zone();
|
||||
void smartphone_rotate_display();
|
||||
//#endif
|
||||
|
||||
static int getScreenWidth();
|
||||
static int getScreenHeight();
|
||||
static void initScreenInfos();
|
||||
static bool isOzone();
|
||||
|
||||
protected:
|
||||
bool loadGFXMode();
|
||||
void unloadGFXMode();
|
||||
bool hotswapGFXMode();
|
||||
bool saveScreenshot(const char *filename);
|
||||
|
||||
|
||||
const GraphicsMode *getSupportedGraphicsModes() const;
|
||||
bool setGraphicsMode(int mode);
|
||||
//int getGraphicsMode() const;
|
||||
int getDefaultGraphicsMode() const;
|
||||
|
||||
bool hasFeature(Feature f);
|
||||
void setFeatureState(Feature f, bool enable);
|
||||
bool getFeatureState(Feature f);
|
||||
|
||||
void internDrawMouse();
|
||||
void drawToolbarMouse(SDL_Surface *surf, bool draw);
|
||||
|
||||
private:
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
bool checkOggHighSampleRate();
|
||||
#endif
|
||||
|
||||
static void private_sound_proc(void *param, byte *buf, int len);
|
||||
|
||||
bool update_scalers();
|
||||
void create_toolbar();
|
||||
void update_game_settings();
|
||||
void check_mappings();
|
||||
uint32 compute_sample_rate();
|
||||
|
||||
void retrieve_mouse_location(int &x, int &y);
|
||||
|
||||
CEGUI::ToolbarHandler _toolbarHandler;
|
||||
|
||||
SDL_Surface *_toolbarLow; // toolbar 320x40
|
||||
SDL_Surface *_toolbarHigh; // toolbar 640x80
|
||||
bool _toolbarHighDrawn; // cache toolbar 640x80
|
||||
|
||||
bool _freeLook; // freeLook mode (do not send mouse button events)
|
||||
|
||||
bool _forceHideMouse; // force invisible mouse cursor
|
||||
|
||||
bool _forcePanelInvisible; // force panel visibility for some cases
|
||||
bool _panelVisible; // panel visibility
|
||||
bool _panelStateForced; // panel visibility forced by external call
|
||||
|
||||
bool _panelInitialized; // only initialize the toolbar once
|
||||
|
||||
bool _unfilteredkeys; // discard key mapping temporarily (agi pred. dialog)
|
||||
static bool _soundMaster; // turn off sound after all calculations
|
||||
// static since needed by the SDL callback
|
||||
int _orientationLandscape; // current orientation
|
||||
int _newOrientation; // new orientation
|
||||
|
||||
bool _saveToolbarState; // save visibility when forced
|
||||
String _saveActiveToolbar; // save active toolbar when forced
|
||||
protected:
|
||||
void initSDL();
|
||||
Audio::MixerImpl *_mixer;
|
||||
DefaultTimerManager *_timer;
|
||||
FilesystemFactory *_fsFactory;
|
||||
|
||||
bool _saveToolbarZoom; // save visibility when zooming
|
||||
bool _zoomUp; // zooming up mode
|
||||
bool _zoomDown; // zooming down mode
|
||||
private:
|
||||
void check_mappings();
|
||||
|
||||
bool _noDoubleTapRMB; // disable double tap -> rmb click
|
||||
bool _rbutton; // double tap -> right button simulation
|
||||
bool _closeClick; // flag when taps are spatially close together
|
||||
|
||||
bool _usesEmulatedMouse; // emulated mousemove ever been used in this session
|
||||
|
||||
bool _canBeAspectScaled; // game screen size allows for aspect scaling
|
||||
|
||||
int _scaleFactorXm; // scaler X *
|
||||
int _scaleFactorXd; // scaler X /
|
||||
int _scaleFactorYm; // scaler Y *
|
||||
int _scaleFactorYd; // scaler Y /
|
||||
SDL_Rect _dirtyRectOut[NUM_DIRTY_RECT];
|
||||
bool _scalersChanged;
|
||||
bool _hasfocus; // scummvm has the top window
|
||||
bool _forcePanelInvisible; // force panel visibility for some cases
|
||||
|
||||
static int _platformScreenWidth;
|
||||
static int _platformScreenHeight;
|
||||
static bool _isOzone; // true if running on Windows 2003 SE
|
||||
|
||||
// Keyboard tap
|
||||
int _tapX;
|
||||
int _tapY;
|
||||
long _tapTime;
|
||||
|
||||
// Mouse
|
||||
int _mouseHotspotX, _mouseHotspotY;
|
||||
byte *_mouseBackupOld;
|
||||
uint16 *_mouseBackupToolbar;
|
||||
uint16 _mouseBackupDim;
|
||||
|
||||
// Smartphone specific variables
|
||||
|
||||
int _lastKeyPressed; // last key pressed
|
||||
int _keyRepeat; // number of time the last key was repeated
|
||||
int _keyRepeatTime; // elapsed time since the key was pressed
|
||||
int _keyRepeatTrigger; // minimum time to consider the key was repeated
|
||||
|
||||
int _repeatX; // repeat trigger for left and right cursor moves
|
||||
int _repeatY; // repeat trigger for up and down cursor moves
|
||||
int _stepX1; // offset for left and right cursor moves (slowest)
|
||||
int _stepX2; // offset for left and right cursor moves (faster)
|
||||
int _stepX3; // offset for left and right cursor moves (fastest)
|
||||
int _stepY1; // offset for up and down cursor moves (slowest)
|
||||
int _stepY2; // offset for up and down cursor moves (faster)
|
||||
int _stepY3; // offset for up and down cursor moves (fastest)
|
||||
|
||||
int _mouseXZone[TOTAL_ZONES];
|
||||
int _mouseYZone[TOTAL_ZONES];
|
||||
int _currentZone;
|
||||
|
||||
struct zoneDesc {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
static zoneDesc _zones[TOTAL_ZONES];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user