2011-04-16 14:08:33 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2008-06-13 14:57:47 +00:00
|
|
|
*
|
2011-04-16 14:08:33 +02:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2008-06-13 14:57:47 +00:00
|
|
|
* file distributed with this source distribution.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
2009-10-04 14:40:09 +00:00
|
|
|
* 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.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2009-10-04 14:40:09 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2006-04-02 14:20:45 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2009-10-04 14:40:09 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-04-05 18:18:42 +02:00
|
|
|
*
|
2009-10-04 14:40:09 +00:00
|
|
|
* 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.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-02-05 17:19:44 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#ifndef PLATFORM_SDL_H
|
|
|
|
#define PLATFORM_SDL_H
|
2006-02-05 17:19:44 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#include "backends/platform/sdl/sdl-sys.h"
|
2008-07-03 12:04:12 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#include "backends/modular-backend.h"
|
|
|
|
#include "backends/mixer/sdl/sdl-mixer.h"
|
|
|
|
#include "backends/events/sdl/sdl-events.h"
|
|
|
|
#include "backends/log/log.h"
|
2015-04-19 07:43:34 +02:00
|
|
|
#include "backends/platform/sdl/sdl-window.h"
|
2020-09-03 02:01:03 +02:00
|
|
|
|
|
|
|
#include "common/array.h"
|
|
|
|
|
|
|
|
#ifdef USE_DISCORD
|
|
|
|
class DiscordPresence;
|
|
|
|
#endif
|
2020-05-12 23:46:03 +02:00
|
|
|
// ResidualVM - Start
|
|
|
|
#ifdef USE_OPENGL
|
2020-09-25 10:35:26 +02:00
|
|
|
#include "backends/graphics/resvm-openglsdl/resvm-openglsdl-graphics.h"
|
2020-05-12 23:46:03 +02:00
|
|
|
#endif
|
|
|
|
// ResidualVM - End
|
2009-05-07 23:06:06 +00:00
|
|
|
|
2011-07-20 06:58:19 +02:00
|
|
|
/**
|
2011-04-14 12:41:26 +02:00
|
|
|
* Base OSystem class for all SDL ports.
|
|
|
|
*/
|
2020-09-03 02:01:03 +02:00
|
|
|
class OSystem_SDL : public ModularMutexBackend, public ModularMixerBackend, public ModularGraphicsBackend {
|
2006-02-05 17:19:44 +00:00
|
|
|
public:
|
2009-05-07 19:06:31 +00:00
|
|
|
OSystem_SDL();
|
|
|
|
virtual ~OSystem_SDL();
|
2008-07-03 12:04:12 +00:00
|
|
|
|
2011-07-20 06:58:19 +02:00
|
|
|
/**
|
2011-04-14 12:41:26 +02:00
|
|
|
* Pre-initialize backend. It should be called after
|
|
|
|
* instantiating the backend. Early needed managers are
|
|
|
|
* created here.
|
|
|
|
*/
|
2020-09-03 02:01:03 +02:00
|
|
|
virtual void init() override;
|
2011-04-14 12:41:26 +02:00
|
|
|
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual bool hasFeature(Feature f) override;
|
2016-11-12 12:59:06 +01:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
// Override functions from ModularBackend and OSystem
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual void initBackend() override;
|
|
|
|
virtual void engineInit() override;
|
|
|
|
virtual void engineDone() override;
|
|
|
|
virtual void quit() override;
|
|
|
|
virtual void fatalError() override;
|
|
|
|
Common::KeymapArray getGlobalKeymaps() override;
|
|
|
|
Common::HardwareInputSet *getHardwareInputSet() override;
|
2009-10-04 14:11:35 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
// Logging
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual void logMessage(LogMessageType::Type type, const char *message) override;
|
2011-04-11 02:28:51 +02:00
|
|
|
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual Common::String getSystemLanguage() const override;
|
2009-08-23 10:51:20 +00:00
|
|
|
|
2019-12-07 15:31:33 +01:00
|
|
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
2016-11-12 12:59:06 +01:00
|
|
|
// Clipboard
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual bool hasTextInClipboard() override;
|
2020-09-03 02:01:03 +02:00
|
|
|
virtual Common::U32String getTextFromClipboard() override;
|
|
|
|
virtual bool setTextInClipboard(const Common::U32String &text) override;
|
2019-12-07 15:31:33 +01:00
|
|
|
#endif
|
2016-11-12 12:59:06 +01:00
|
|
|
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual void setWindowCaption(const char *caption) override;
|
|
|
|
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
|
|
|
|
virtual uint32 getMillis(bool skipRecord = false) override;
|
|
|
|
virtual void delayMillis(uint msecs) override;
|
|
|
|
virtual void getTimeAndDate(TimeDate &td) const override;
|
2020-09-03 02:01:03 +02:00
|
|
|
virtual MixerManager *getMixerManager() override;
|
2020-05-09 20:05:54 +02:00
|
|
|
virtual Common::TimerManager *getTimerManager() override;
|
|
|
|
virtual Common::SaveFileManager *getSavefileManager() override;
|
2016-06-17 19:59:42 +02:00
|
|
|
|
2017-09-02 13:27:05 +02:00
|
|
|
//Screenshots
|
|
|
|
virtual Common::String getScreenshotsPath();
|
|
|
|
|
2020-05-12 23:46:03 +02:00
|
|
|
// ResidualVM - Start
|
|
|
|
#ifdef USE_OPENGL
|
2016-06-17 19:59:42 +02:00
|
|
|
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) override;
|
2020-09-25 18:51:18 +02:00
|
|
|
Common::Array<uint> getSupportedAntiAliasingLevels() const override;
|
2020-05-12 23:46:03 +02:00
|
|
|
#endif
|
|
|
|
virtual void launcherInitSize(uint w, uint h) override;
|
|
|
|
// ResidualVM - End
|
2016-06-17 19:59:42 +02:00
|
|
|
|
2009-10-04 16:33:49 +00:00
|
|
|
protected:
|
2011-04-14 12:41:26 +02:00
|
|
|
bool _inited;
|
|
|
|
bool _initedSDL;
|
2016-11-12 12:59:06 +01:00
|
|
|
#ifdef USE_SDL_NET
|
|
|
|
bool _initedSDLnet;
|
|
|
|
#endif
|
2011-04-14 12:41:26 +02:00
|
|
|
|
2020-09-03 02:01:03 +02:00
|
|
|
#ifdef USE_DISCORD
|
|
|
|
DiscordPresence *_presence;
|
|
|
|
#endif
|
|
|
|
|
2019-12-07 15:31:33 +01:00
|
|
|
/**
|
|
|
|
* The path of the currently open log file, if any.
|
|
|
|
*
|
|
|
|
* @note This is currently a string and not an FSNode for simplicity;
|
|
|
|
* e.g. we don't need to include fs.h here, and currently the
|
|
|
|
* only use of this value is to use it to open the log file in an
|
|
|
|
* editor; for that, we need it only as a string anyway.
|
|
|
|
*/
|
|
|
|
Common::String _logFilePath;
|
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
/**
|
|
|
|
* The event source we use for obtaining SDL events.
|
|
|
|
*/
|
|
|
|
SdlEventSource *_eventSource;
|
2020-05-09 20:05:54 +02:00
|
|
|
Common::EventSource *_eventSourceWrapper;
|
2011-04-14 12:41:26 +02:00
|
|
|
|
2015-04-19 07:43:34 +02:00
|
|
|
/**
|
|
|
|
* The SDL output window.
|
|
|
|
*/
|
|
|
|
SdlWindow *_window;
|
|
|
|
|
2020-05-12 23:46:03 +02:00
|
|
|
// ResidualVM specific code - start
|
|
|
|
#ifdef USE_OPENGL
|
2016-06-19 10:13:01 +02:00
|
|
|
// Graphics capabilities
|
2016-06-21 07:16:16 +02:00
|
|
|
void detectFramebufferSupport();
|
2019-05-16 22:23:32 +02:00
|
|
|
void detectAntiAliasingSupport();
|
2020-09-24 20:22:49 +02:00
|
|
|
ResVmOpenGLSdlGraphicsManager::Capabilities _capabilities;
|
2020-05-12 23:46:03 +02:00
|
|
|
#endif
|
2016-06-19 10:13:01 +02:00
|
|
|
// End of ResidualVM specific code
|
|
|
|
|
2011-06-09 11:17:15 +02:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
/**
|
|
|
|
* Initialze the SDL library.
|
|
|
|
*/
|
|
|
|
virtual void initSDL();
|
|
|
|
|
2016-11-12 08:49:29 +01:00
|
|
|
/**
|
|
|
|
* Create the audio CD manager
|
|
|
|
*/
|
|
|
|
virtual AudioCDManager *createAudioCDManager();
|
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
// Logging
|
2019-12-07 15:31:33 +01:00
|
|
|
virtual Common::String getDefaultLogFileName() { return Common::String(); }
|
|
|
|
virtual Common::WriteStream *createLogFile();
|
2011-04-14 12:41:26 +02:00
|
|
|
Backends::Log::Log *_logger;
|
2020-05-12 23:46:03 +02:00
|
|
|
|
|
|
|
#if 0 // ResidualVM - not used
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
typedef Common::Array<GraphicsMode> GraphicsModeArray;
|
|
|
|
GraphicsModeArray _graphicsModes;
|
|
|
|
Common::Array<int> _graphicsModeIds;
|
|
|
|
int _graphicsMode;
|
|
|
|
int _firstGLMode;
|
|
|
|
int _defaultSDLMode;
|
|
|
|
int _defaultGLMode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the merged graphics modes list
|
|
|
|
*/
|
|
|
|
void setupGraphicsModes();
|
|
|
|
|
|
|
|
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
|
|
|
|
virtual int getDefaultGraphicsMode() const override;
|
|
|
|
virtual bool setGraphicsMode(int mode) override;
|
|
|
|
virtual int getGraphicsMode() const override;
|
|
|
|
#endif
|
|
|
|
#endif // ResidulVM
|
2020-05-09 20:05:54 +02:00
|
|
|
protected:
|
|
|
|
virtual char *convertEncoding(const char *to, const char *from, const char *string, size_t length) override;
|
2006-02-05 17:19:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|