diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/dc/selector.cpp | 2 | ||||
-rw-r--r-- | backends/platform/tizen/application.cpp | 22 | ||||
-rw-r--r-- | backends/platform/tizen/audio.cpp | 36 | ||||
-rw-r--r-- | backends/platform/tizen/audio.h | 4 | ||||
-rw-r--r-- | backends/platform/tizen/form.cpp | 25 | ||||
-rw-r--r-- | backends/platform/tizen/form.h | 9 | ||||
-rw-r--r-- | backends/platform/tizen/fs.cpp | 1 | ||||
-rw-r--r-- | backends/platform/tizen/graphics.cpp | 7 | ||||
-rw-r--r-- | backends/platform/tizen/sscanf.cpp | 2 | ||||
-rw-r--r-- | backends/platform/tizen/system.cpp | 6 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard-gui.cpp | 34 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard-gui.h | 6 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard.h | 4 |
13 files changed, 106 insertions, 52 deletions
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 339e5df62d..4026c7dde6 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -219,7 +219,7 @@ static int findGames(Game *games, int max, bool use_ini) if (use_ini) { ConfMan.loadDefaultConfigFile(); - Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); + const Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); for(Common::ConfigManager::DomainMap::const_iterator i = game_domains.begin(); curr_game < max && i != game_domains.end(); i++) { Common::String path = (*i)._value["path"]; diff --git a/backends/platform/tizen/application.cpp b/backends/platform/tizen/application.cpp index 8236ebef67..a73efacf58 100644 --- a/backends/platform/tizen/application.cpp +++ b/backends/platform/tizen/application.cpp @@ -31,7 +31,7 @@ Application *TizenScummVM::createInstance() { return new TizenScummVM(); } -TizenScummVM::TizenScummVM() : _appForm(0) { +TizenScummVM::TizenScummVM() : _appForm(NULL) { logEntered(); } @@ -41,7 +41,7 @@ TizenScummVM::~TizenScummVM() { TizenSystem *system = (TizenSystem *)g_system; system->destroyBackend(); delete system; - g_system = 0; + g_system = NULL; } } @@ -68,17 +68,19 @@ bool TizenScummVM::OnAppTerminating(AppRegistry &appRegistry, bool forcedTermina } void TizenScummVM::OnUserEventReceivedN(RequestId requestId, IList *args) { + logEntered(); MessageBox messageBox; int modalResult; + String *message; - logEntered(); - - if (requestId == USER_MESSAGE_EXIT) { + switch (requestId) { + case USER_MESSAGE_EXIT: // normal program termination Terminate(); - } else if (requestId == USER_MESSAGE_EXIT_ERR) { + break; + + case USER_MESSAGE_EXIT_ERR: // assertion failure termination - String *message = NULL; if (args) { message = (String *)args->GetAt(0); } @@ -88,12 +90,15 @@ void TizenScummVM::OnUserEventReceivedN(RequestId requestId, IList *args) { messageBox.Construct(L"Oops...", *message, MSGBOX_STYLE_OK); messageBox.ShowAndWait(modalResult); Terminate(); - } else if (requestId == USER_MESSAGE_EXIT_ERR_CONFIG) { + break; + + case USER_MESSAGE_EXIT_ERR_CONFIG: // the config file was corrupted messageBox.Construct(L"Config file corrupted", L"Settings have been reverted, please restart.", MSGBOX_STYLE_OK); messageBox.ShowAndWait(modalResult); Terminate(); + break; } } @@ -132,7 +137,6 @@ void TizenScummVM::pauseGame(bool pause) { if (pause && g_engine && !g_engine->isPaused()) { _appForm->pushKey(Common::KEYCODE_SPACE); } - if (g_system) { ((TizenSystem *)g_system)->setMute(pause); } diff --git a/backends/platform/tizen/audio.cpp b/backends/platform/tizen/audio.cpp index 313a10eaa8..f9ac80a583 100644 --- a/backends/platform/tizen/audio.cpp +++ b/backends/platform/tizen/audio.cpp @@ -26,8 +26,9 @@ #include "backends/platform/tizen/audio.h" #include "backends/platform/tizen/system.h" -#define TIMER_INTERVAL 10 -#define VOLUME 99 +#define TIMER_INTERVAL 10 +#define VOLUME 96 +#define MIN_TIMER_INTERVAL 5 AudioThread::AudioThread() : _mixer(0), @@ -38,6 +39,7 @@ AudioThread::AudioThread() : _ready(0), _interval(TIMER_INTERVAL), _playing(-1), + _size(0), _muted(true) { } @@ -70,7 +72,7 @@ void AudioThread::setMute(bool on) { if (on) { _timer->Cancel(); } else { - _timer->StartAsRepeatable(_interval); + _timer->Start(_interval); } } } @@ -105,13 +107,14 @@ bool AudioThread::OnStart(void) { } } + _size = _audioBuffer[0].GetCapacity(); _timer = new Timer(); if (!_timer || IsFailed(_timer->Construct(*this))) { AppLog("Failed to create audio timer"); return false; } - if (IsFailed(_timer->StartAsRepeatable(_interval))) { + if (IsFailed(_timer->Start(_interval))) { AppLog("failed to start audio timer"); return false; } @@ -137,6 +140,7 @@ void AudioThread::OnStop(void) { if (_audioOut) { _audioOut->Reset(); + _audioOut->Unprepare(); delete _audioOut; } } @@ -161,21 +165,33 @@ void AudioThread::OnAudioOutBufferEndReached(Tizen::Media::AudioOut &src) { _tail = (_tail + 1) % NUM_AUDIO_BUFFERS; _ready--; } else { - // audio buffer empty: decrease timer inverval + // audio buffer empty: decrease timer interval _playing = -1; + _interval -= 1; + if (_interval < MIN_TIMER_INTERVAL) { + _interval = MIN_TIMER_INTERVAL; + } } + } void AudioThread::OnTimerExpired(Timer &timer) { if (_ready < NUM_AUDIO_BUFFERS) { - uint len = _audioBuffer[_head].GetCapacity(); - int samples = _mixer->mixCallback((byte *)_audioBuffer[_head].GetPointer(), len); - if (samples) { - _head = (_head + 1) % NUM_AUDIO_BUFFERS; - _ready++; + if (_playing != _head) { + if (_mixer->mixCallback((byte *)_audioBuffer[_head].GetPointer(), _size)) { + _head = (_head + 1) % NUM_AUDIO_BUFFERS; + _ready++; + } } + } else { + // audio buffer full: restore timer interval + _interval = TIMER_INTERVAL; } + if (_ready && _playing == -1) { OnAudioOutBufferEndReached(*_audioOut); } + + _timer->Start(_interval); } + diff --git a/backends/platform/tizen/audio.h b/backends/platform/tizen/audio.h index 8d7835042d..a304231578 100644 --- a/backends/platform/tizen/audio.h +++ b/backends/platform/tizen/audio.h @@ -54,6 +54,7 @@ public: bool isSilentMode(); void setMute(bool on); +private: bool OnStart(void); void OnStop(void); void OnAudioOutErrorOccurred(Tizen::Media::AudioOut &src, result r); @@ -62,12 +63,11 @@ public: void OnAudioOutBufferEndReached(Tizen::Media::AudioOut &src); void OnTimerExpired(Timer &timer); -private: Audio::MixerImpl *_mixer; Tizen::Base::Runtime::Timer *_timer; Tizen::Media::AudioOut *_audioOut; Tizen::Base::ByteBuffer _audioBuffer[NUM_AUDIO_BUFFERS]; - int _head, _tail, _ready, _interval, _playing; + int _head, _tail, _ready, _interval, _playing, _size; bool _muted; }; diff --git a/backends/platform/tizen/form.cpp b/backends/platform/tizen/form.cpp index 5050699ca9..10d51cc610 100644 --- a/backends/platform/tizen/form.cpp +++ b/backends/platform/tizen/form.cpp @@ -52,7 +52,7 @@ TizenAppForm::TizenAppForm() : _eventQueueLock(NULL), _state(kInitState), _buttonState(kLeftButton), - _shortcut(kShowKeypad) { + _shortcut(kEscapeKey) { } result TizenAppForm::Construct() { @@ -157,6 +157,8 @@ result TizenAppForm::OnInitializing(void) { AddOrientationEventListener(*this); AddTouchEventListener(*this); SetMultipointTouchEnabled(true); + SetFormBackEventListener(this); + SetFormMenuEventListener(this); // set focus to enable receiving key events SetEnabled(true); @@ -316,16 +318,16 @@ void TizenAppForm::invokeShortcut() { case kControlMouse: setButtonShortcut(); break; - + case kEscapeKey: pushKey(Common::KEYCODE_ESCAPE); break; - + case kGameMenu: _buttonState = kLeftButton; pushKey(Common::KEYCODE_F5); break; - + case kShowKeypad: showKeypad(); break; @@ -354,8 +356,6 @@ void TizenAppForm::OnTouchDoublePressed(const Control &source, if (_buttonState != kMoveOnly) { pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, currentPosition); - pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, - currentPosition); } } @@ -417,3 +417,16 @@ void TizenAppForm::OnTouchReleased(const Control &source, } } +void TizenAppForm::OnFormBackRequested(Form &source) { + logEntered(); + if (_state == kActiveState) { + invokeShortcut(); + } +} + +void TizenAppForm::OnFormMenuRequested(Form &source) { + logEntered(); + if (_state == kActiveState) { + setShortcut(); + } +} diff --git a/backends/platform/tizen/form.h b/backends/platform/tizen/form.h index 64c447d409..e419c14d24 100644 --- a/backends/platform/tizen/form.h +++ b/backends/platform/tizen/form.h @@ -29,6 +29,8 @@ #include <FBase.h> #include <FUiITouchEventListener.h> #include <FUiITextEventListener.h> +#include <FUiCtrlIFormBackEventListener.h> +#include <FUiCtrlIFormMenuEventListener.h> #include "config.h" #include "common/scummsys.h" @@ -40,6 +42,7 @@ using namespace Tizen::Ui; using namespace Tizen::Graphics; using namespace Tizen::Base::Runtime; +using namespace Tizen::Ui::Controls; // // TizenAppForm @@ -48,7 +51,9 @@ class TizenAppForm : public Controls::Form, public IRunnable, public IOrientationEventListener, - public ITouchEventListener { + public ITouchEventListener, + public IFormBackEventListener, + public IFormMenuEventListener { public: TizenAppForm(); @@ -89,6 +94,8 @@ private: void OnTouchReleased(const Control &source, const Point ¤tPosition, const TouchEventInfo &touchInfo); + void OnFormBackRequested(Form &source); + void OnFormMenuRequested(Form &source); void pushEvent(Common::EventType type, const Point ¤tPosition); void terminate(); diff --git a/backends/platform/tizen/fs.cpp b/backends/platform/tizen/fs.cpp index f8b32f4239..8145cd5638 100644 --- a/backends/platform/tizen/fs.cpp +++ b/backends/platform/tizen/fs.cpp @@ -339,7 +339,6 @@ bool TizenFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo if (_isVirtualDir && mode != Common::FSNode::kListFilesOnly && _path == "/") { // present well known TIZEN file system areas myList.push_back(new TizenFilesystemNode(kData)); - myList.push_back(new TizenFilesystemNode(kResource)); myList.push_back(new TizenFilesystemNode(kSdCard)); myList.push_back(new TizenFilesystemNode(kMedia)); myList.push_back(new TizenFilesystemNode(kShared)); diff --git a/backends/platform/tizen/graphics.cpp b/backends/platform/tizen/graphics.cpp index bf255cd264..2cafb9f781 100644 --- a/backends/platform/tizen/graphics.cpp +++ b/backends/platform/tizen/graphics.cpp @@ -100,6 +100,8 @@ void TizenGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { } void TizenGraphicsManager::setReady() { + logEntered(); + _appForm->GetVisualElement()->SetShowState(true); _initState = false; } @@ -176,7 +178,9 @@ bool TizenGraphicsManager::loadEgl() { systemError("eglMakeCurrent() failed"); return false; } - + if (!_initState) { + _appForm->GetVisualElement()->SetShowState(true); + } logLeaving(); return true; } @@ -213,6 +217,7 @@ void TizenGraphicsManager::internUpdateScreen() { void TizenGraphicsManager::unloadGFXMode() { logEntered(); + _appForm->GetVisualElement()->SetShowState(false); if (_eglDisplay != EGL_NO_DISPLAY) { eglMakeCurrent(_eglDisplay, NULL, NULL, NULL); diff --git a/backends/platform/tizen/sscanf.cpp b/backends/platform/tizen/sscanf.cpp index aa846698f6..75f009cc61 100644 --- a/backends/platform/tizen/sscanf.cpp +++ b/backends/platform/tizen/sscanf.cpp @@ -93,7 +93,7 @@ bool scanStringUntil(const char **in, va_list *ap, char c_end) { char *arg = va_arg(*ap, char*); while (**in && **in != c_end) { *arg = **in; - *arg++; + arg++; (*in)++; } *arg = 0; diff --git a/backends/platform/tizen/system.cpp b/backends/platform/tizen/system.cpp index 54d92146e5..3448dc1421 100644 --- a/backends/platform/tizen/system.cpp +++ b/backends/platform/tizen/system.cpp @@ -513,13 +513,15 @@ TizenAppForm *systemStart(Tizen::App::Application *app) { } if (E_SUCCESS != appForm->Construct() || - E_SUCCESS != appFrame->AddControl(*appForm)) { + E_SUCCESS != appFrame->AddControl(appForm)) { delete appForm; AppLog("Failed to construct appForm"); return NULL; } appFrame->SetCurrentForm(appForm); + appForm->GetVisualElement()->SetShowState(false); + logLeaving(); return appForm; } @@ -531,7 +533,7 @@ void systemError(const char *message) { AppLog("Fatal system error: %s", message); if (strspn(message, "Config file buggy:") > 0) { - Tizen::Io::File::Remove(DEFAULT_CONFIG_FILE); + Tizen::Io::File::Remove(App::GetInstance()->GetAppDataPath() + DEFAULT_CONFIG_FILE); Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR_CONFIG, NULL); } else { ArrayList *args = new ArrayList(); diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 8bf9a54251..ec4cbf1de2 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -32,11 +32,9 @@ namespace Common { -static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, OverlayColor transparent) { - if (surf_dst->format.bytesPerPixel != sizeof(OverlayColor) || surf_src->format.bytesPerPixel != sizeof(OverlayColor)) - return; - - const OverlayColor *src = (const OverlayColor *)surf_src->getPixels(); +template<typename ColorType> +static void blitImplementation(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, ColorType transparent) { + const ColorType *src = (const ColorType *)surf_src->getPixels(); int blitW = surf_src->w; int blitH = surf_src->h; @@ -58,13 +56,13 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 if (blitW <= 0 || blitH <= 0) return; - OverlayColor *dst = (OverlayColor *)surf_dst->getBasePtr(x, y); + ColorType *dst = (ColorType *)surf_dst->getBasePtr(x, y); int dstAdd = surf_dst->w - blitW; int srcAdd = surf_src->w - blitW; for (int i = 0; i < blitH; ++i) { for (int j = 0; j < blitW; ++j, ++dst, ++src) { - OverlayColor col = *src; + ColorType col = *src; if (col != transparent) *dst = col; } @@ -73,6 +71,16 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 } } +static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 x, int16 y, uint32 transparent) { + if (surf_dst->format.bytesPerPixel != surf_src->format.bytesPerPixel) + return; + + if (surf_dst->format.bytesPerPixel == 2) + blitImplementation<uint16>(surf_dst, surf_src, x, y, transparent); + else if (surf_dst->format.bytesPerPixel == 4) + blitImplementation<uint32>(surf_dst, surf_src, x, y, transparent); +} + VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) : _kbd(kbd), _displaying(false), _drag(false), _drawCaret(false), _displayEnabled(false), _firstRun(true), @@ -111,7 +119,7 @@ void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { } } -void VirtualKeyboardGUI::setupDisplayArea(Rect &r, OverlayColor forecolor) { +void VirtualKeyboardGUI::setupDisplayArea(Rect &r, uint32 forecolor) { _dispFont = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); if (!fontIsSuitable(_dispFont, r)) { @@ -356,13 +364,13 @@ void VirtualKeyboardGUI::redraw() { Graphics::Surface surf; surf.create(w, h, _system->getOverlayFormat()); - OverlayColor *dst = (OverlayColor *)surf.getPixels(); - const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); + byte *dst = (byte *)surf.getPixels(); + const byte *src = (const byte *)_overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); while (h--) { - memcpy(dst, src, surf.w * sizeof(OverlayColor)); - dst += surf.w; - src += _overlayBackup.w; + memcpy(dst, src, surf.pitch); + dst += surf.pitch; + src += _overlayBackup.pitch; } blit(&surf, _kbdSurface, _kbdBound.left - _dirtyRect.left, diff --git a/backends/vkeybd/virtual-keyboard-gui.h b/backends/vkeybd/virtual-keyboard-gui.h index d0f9c884ed..a2000adea0 100644 --- a/backends/vkeybd/virtual-keyboard-gui.h +++ b/backends/vkeybd/virtual-keyboard-gui.h @@ -99,7 +99,7 @@ private: VirtualKeyboard *_kbd; Rect _kbdBound; Graphics::Surface *_kbdSurface; - OverlayColor _kbdTransparentColor; + uint32 _kbdTransparentColor; Point _dragPoint; bool _drag; @@ -113,7 +113,7 @@ private: const Graphics::Font *_dispFont; int16 _dispX, _dispY; uint _dispI; - OverlayColor _dispForeColor, _dispBackColor; + uint32 _dispForeColor, _dispBackColor; int _lastScreenChanged; int16 _screenW, _screenH; @@ -121,7 +121,7 @@ private: bool _displaying; bool _firstRun; - void setupDisplayArea(Rect &r, OverlayColor forecolor); + void setupDisplayArea(Rect &r, uint32 forecolor); void move(int16 x, int16 y); void moveToDefaultPosition(); void screenChanged(); diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 4ab5ad446d..3b2b2196bd 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -112,11 +112,11 @@ protected: String resolution; String bitmapName; Graphics::Surface *image; - OverlayColor transparentColor; + uint32 transparentColor; ImageMap imageMap; VKEventMap events; Rect displayArea; - OverlayColor displayFontColor; + uint32 displayFontColor; Mode() : image(0) {} ~Mode() { |