scummvm/engines/wintermute/base/base_engine.h
lolbot-iichan 13dbfbd8d7 WINTERMUTE: Fix slider bugs in several games
There is a bug introduced in WME Lite.

Testcase:
1. Download https://github.com/lolbot-iichan/wme_testsuite/tree/master/slider_test/packages
2. Download https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/wmelite/wmelite_10_win.zip
3a. Run game.exe -> Slider moves with the mouse while it is pressed and
released when mouse is released
3b. Run wmelite.exe -> Slider is never released
3c. Run ScummVM -> Slider is never released

Related bugs:
https://bugs.scummvm.org/ticket/6567
https://bugs.scummvm.org/ticket/9861

Reason: slider is a button object that changes it's X until "LeftRelease" event is revieved and breaks the endless loop.
Sample code: https://github.com/lolbot-iichan/wme_testsuite/blob/master/slider_test/data/interface/system/speechvolume.script
However, WME Lite does not send "LeftRelease" events to any objects, if Game object can handle such event, even is game is frozen and UI is shown.

Original code: https://github.com/lolbot-iichan/Wintermute-Engine/blob/master/src/engine_core/wme_ad/AdGame.cpp#L2218
Changed in WME Lite: https://github.com/lolbot-iichan/wmelite/blob/master/src/AdGame.cpp#L2120

This behaviour was introduced in SVN period of wmelite, I believe it was
made on purpose for handling some iOS scenarios at commit #37 mentioned
on page https://code.google.com/archive/p/wmelite/source/default/commits

My proposal is to mark iOS apps as WME_LITE and fill exact WME_1_X_X/WME_LITE versions for all known
games. WME_1_X_X can be seen by right-clicking on main executable and seems to be non-empty for almost all existing WME games.
2019-07-02 08:00:30 +03:00

103 lines
3 KiB
C++

/* 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.
*
*/
/*
* This file is based on WME Lite.
* http://dead-code.org/redir.php?target=wmelite
* Copyright (c) 2011 Jan Nedoma
*/
#ifndef WINTERMUTE_BASE_ENGINE_H
#define WINTERMUTE_BASE_ENGINE_H
#include "common/str.h"
#include "common/singleton.h"
#include "common/random.h"
#include "common/language.h"
namespace Wintermute {
enum WMETargetExecutable {
OLDEST_VERSION,
WME_1_0_0,
WME_1_1_0,
WME_1_2_0,
WME_1_3_0,
WME_1_4_0,
WME_1_5_0,
WME_1_6_0,
WME_1_7_0,
WME_1_8_0,
WME_1_8_6,
WME_1_9_0,
WME_1_9_3, //displayed version of 1.10.1beta is "1.9.3"
WME_LITE,
LATEST_VERSION
};
class BaseFileManager;
class BaseRegistry;
class BaseGame;
class BaseSoundMgr;
class BaseRenderer;
class SystemClassRegistry;
class Timer;
class BaseEngine : public Common::Singleton<Wintermute::BaseEngine> {
void init();
BaseFileManager *_fileManager;
Common::String _gameId;
Common::String _targetName;
BaseGame *_gameRef;
// We need random numbers
Common::RandomSource *_rnd;
SystemClassRegistry *_classReg;
Common::Language _language;
WMETargetExecutable _targetExecutable;
public:
BaseEngine();
~BaseEngine();
static void createInstance(const Common::String &targetName, const Common::String &gameId, Common::Language lang, WMETargetExecutable targetExecutable = LATEST_VERSION);
void setGameRef(BaseGame *gameRef) { _gameRef = gameRef; }
Common::RandomSource *getRandomSource() { return _rnd; }
uint32 randInt(int from, int to);
SystemClassRegistry *getClassRegistry() { return _classReg; }
BaseGame *getGameRef() { return _gameRef; }
BaseFileManager *getFileManager() { return _fileManager; }
BaseSoundMgr *getSoundMgr();
static BaseRenderer *getRenderer();
static const Timer *getTimer();
static const Timer *getLiveTimer();
static void LOG(bool res, const char *fmt, ...);
Common::String getGameTargetName() const { return _targetName; }
Common::String getGameId() const { return _gameId; }
Common::Language getLanguage() const { return _language; }
WMETargetExecutable getTargetExecutable() const {
return _targetExecutable;
}
};
} // End of namespace Wintermute
#endif