mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
BACKENDS: Refactor some things to make getDoubleClickTime behavior with event recorder simpler.
This commit is contained in:
parent
126ccc5983
commit
6c8ceeae25
@ -89,9 +89,7 @@ OSystem_SDL::OSystem_SDL()
|
||||
_logger(nullptr),
|
||||
_eventSource(nullptr),
|
||||
_eventSourceWrapper(nullptr),
|
||||
_window(nullptr),
|
||||
_haveDoubleClickTime(false),
|
||||
_doubleClickTime(0)
|
||||
_window(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -192,14 +190,6 @@ bool OSystem_SDL::hasFeature(Feature f) {
|
||||
if (f == kFeatureShadersForGame) return _supportsShaders;
|
||||
#endif
|
||||
|
||||
if (f == kFeatureDoubleClickTime) {
|
||||
bool haveDoubleClickTime = _haveDoubleClickTime;
|
||||
#ifdef ENABLE_EVENTRECORDER
|
||||
g_eventRec.processHaveDoubleClickTime(haveDoubleClickTime);
|
||||
#endif
|
||||
return haveDoubleClickTime;
|
||||
}
|
||||
|
||||
return ModularGraphicsBackend::hasFeature(f);
|
||||
}
|
||||
|
||||
@ -775,11 +765,10 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
|
||||
}
|
||||
|
||||
uint32 OSystem_SDL::getDoubleClickTime() const {
|
||||
uint32 doubleClickTime = _doubleClickTime;
|
||||
#ifdef ENABLE_EVENTRECORDER
|
||||
g_eventRec.processDoubleClickTime(doubleClickTime);
|
||||
#endif
|
||||
return doubleClickTime;
|
||||
if (ConfMan.hasKey("double_click_time"))
|
||||
return ConfMan.getInt("double_click_time");
|
||||
|
||||
return getOSDoubleClickTime();
|
||||
}
|
||||
|
||||
//Not specified in base class
|
||||
|
@ -189,8 +189,7 @@ protected:
|
||||
int getGraphicsMode() const override;
|
||||
#endif
|
||||
|
||||
bool _haveDoubleClickTime;
|
||||
uint32 _doubleClickTime;
|
||||
virtual uint32 getOSDoubleClickTime() const { return 0; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -83,7 +83,6 @@ void OSystem_Win32::init() {
|
||||
#if defined(USE_JPEG)
|
||||
initializeJpegLibraryForWin95();
|
||||
#endif
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::init();
|
||||
}
|
||||
@ -505,6 +504,10 @@ AudioCDManager *OSystem_Win32::createAudioCDManager() {
|
||||
return createWin32AudioCDManager();
|
||||
}
|
||||
|
||||
uint32 OSystem_Win32::getOSDoubleClickTime() const {
|
||||
return GetDoubleClickTime();
|
||||
}
|
||||
|
||||
// libjpeg-turbo uses SSE instructions that error on at least some Win95 machines.
|
||||
// These can be disabled with an environment variable. Fixes bug #13643
|
||||
#if defined(USE_JPEG)
|
||||
|
@ -62,6 +62,8 @@ protected:
|
||||
|
||||
HWND getHwnd() { return ((SdlWindow_Win32*)_window)->getHwnd(); }
|
||||
|
||||
uint32 getOSDoubleClickTime() const override;
|
||||
|
||||
private:
|
||||
bool _isPortable;
|
||||
bool detectPortableConfigFile();
|
||||
|
@ -549,11 +549,6 @@ public:
|
||||
* For platforms that should not have a Quit button.
|
||||
*/
|
||||
kFeatureNoQuit,
|
||||
|
||||
/**
|
||||
* Supports getDoubleClickTime call.
|
||||
*/
|
||||
kFeatureDoubleClickTime,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1396,11 +1391,9 @@ public:
|
||||
|
||||
|
||||
|
||||
/** Get the system-configured double-click time interval.
|
||||
*
|
||||
* Backends which implement this should have the kFeatureDoubleClickTime flag set.
|
||||
*
|
||||
* @see kFeatureDoubleClickTime
|
||||
/**
|
||||
* Get the system-configured double-click time interval.
|
||||
* If the system doesn't support configuring double-click time, returns 0.
|
||||
*/
|
||||
virtual uint32 getDoubleClickTime() const { return 0; }
|
||||
|
||||
|
@ -512,8 +512,7 @@ void EventRecorder::getConfigFromDomain(const Common::ConfigManager::Domain *dom
|
||||
}
|
||||
|
||||
void EventRecorder::getConfig() {
|
||||
if (g_system->hasFeature(OSystem::kFeatureDoubleClickTime))
|
||||
_recordFile->getHeader().settingsRecords["double_click_time"] = Common::String::format("%u", static_cast<unsigned int>(g_system->getDoubleClickTime()));
|
||||
_recordFile->getHeader().settingsRecords["double_click_time"] = Common::String::format("%u", static_cast<unsigned int>(g_system->getDoubleClickTime()));
|
||||
|
||||
getConfigFromDomain(ConfMan.getDomain(ConfMan.kApplicationDomain));
|
||||
getConfigFromDomain(ConfMan.getActiveDomain());
|
||||
@ -690,27 +689,6 @@ Common::SeekableReadStream *EventRecorder::processSaveStream(const Common::Strin
|
||||
}
|
||||
}
|
||||
|
||||
void EventRecorder::processHaveDoubleClickTime(bool &haveDoubleClickTime) {
|
||||
if (_initialized && (_recordMode == kRecorderPlayback || _recordMode == kRecorderUpdate))
|
||||
haveDoubleClickTime = _playbackFile->getHeader().settingsRecords.contains("double_click_time");
|
||||
}
|
||||
|
||||
void EventRecorder::processDoubleClickTime(uint32 &doubleClickTime) {
|
||||
if (_initialized && (_recordMode == kRecorderPlayback || _recordMode == kRecorderUpdate)) {
|
||||
const Common::StringMap &settings = _playbackFile->getHeader().settingsRecords;
|
||||
Common::StringMap::const_iterator it = settings.find("double_click_time");
|
||||
if (it == settings.end())
|
||||
doubleClickTime = 0;
|
||||
else {
|
||||
unsigned int temp = 0;
|
||||
if (sscanf(it->_value.c_str(), "%u", &temp))
|
||||
doubleClickTime = temp;
|
||||
else
|
||||
doubleClickTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Common::SaveFileManager *EventRecorder::getSaveManager(Common::SaveFileManager *realSaveManager) {
|
||||
_realSaveManager = realSaveManager;
|
||||
if (_recordMode != kPassthrough) {
|
||||
|
@ -87,8 +87,6 @@ public:
|
||||
void processGameDescription(const ADGameDescription *desc);
|
||||
bool processAutosave();
|
||||
Common::SeekableReadStream *processSaveStream(const Common::String & fileName);
|
||||
void processHaveDoubleClickTime(bool &haveDoubleClickTime);
|
||||
void processDoubleClickTime(uint32 &doubleClickTime);
|
||||
|
||||
/** Hooks for intercepting into GUI processing, so required events could be shoot
|
||||
* or filtered out */
|
||||
|
Loading…
x
Reference in New Issue
Block a user