ScummVM API documentation
Miscellaneous

Description

Functions

virtual void OSystem::quit ()=0
 
virtual void OSystem::fatalError ()
 
virtual void OSystem::setWindowCaption (const char *caption)
 
virtual void OSystem::displayMessageOnOSD (const Common::U32String &msg)=0
 
virtual void OSystem::displayActivityIconOnOSD (const Graphics::Surface *icon)=0
 
virtual void OSystem::addSysArchivesToSearchSet (Common::SearchSet &s, int priority=0)
 
virtual Common::SeekableReadStreamOSystem::createConfigReadStream ()
 
virtual Common::WriteStreamOSystem::createConfigWriteStream ()
 
virtual Common::String OSystem::getDefaultConfigFileName ()
 
virtual void OSystem::logMessage (LogMessageType::Type type, const char *message)=0
 
virtual bool OSystem::displayLogFile ()
 
virtual bool OSystem::hasTextInClipboard ()
 
virtual Common::U32String OSystem::getTextFromClipboard ()
 
virtual bool OSystem::setTextInClipboard (const Common::U32String &text)
 
virtual bool OSystem::openUrl (const Common::String &url)
 
virtual Common::String OSystem::getSystemLanguage () const
 
virtual bool OSystem::isConnectionLimited ()
 
virtual char * OSystem::convertEncoding (const char *to, const char *from, const char *string, size_t length)
 

Function Documentation

◆ quit()

virtual void OSystem::quit ( )
pure virtual

Quit (exit) the application.

◆ fatalError()

virtual void OSystem::fatalError ( )
virtual

Signal that a fatal error inside the client code has occurred.

This should quit the application.

◆ setWindowCaption()

virtual void OSystem::setWindowCaption ( const char *  caption)
inlinevirtual

Set a window caption or any other comparable status display to the given value.

The caption must be a pure ISO LATIN 1 string. Passing a string with a different encoding may lead to unexpected behavior, even crashes.

Parameters
captionThe window caption to use, as an ISO LATIN 1 string.

◆ displayMessageOnOSD()

virtual void OSystem::displayMessageOnOSD ( const Common::U32String &  msg)
pure virtual

Display a message in an 'on-screen display'.

Displays a message in such a way that it is visible on or near the screen, for example in a transparent rectangle over the regular screen content, or in a message box beneath it.

The message is expected to be provided in the current TranslationManager charset.

Note
There is a default implementation in BaseBackend that uses a TimedMessageDialog to display the message. Hence, implementing this is optional.
Parameters
msgThe message to display on the screen.

◆ displayActivityIconOnOSD()

virtual void OSystem::displayActivityIconOnOSD ( const Graphics::Surface *  icon)
pure virtual

Display an icon that indicates background activity.

The icon is displayed in an 'on-screen display'. It is visible above the regular screen content or near it.

The caller keeps ownership of the icon. It is acceptable to free the surface just after the call.

There is no preferred pixel format for the icon. The backend should convert its copy of the icon to an appropriate format.

The caller must call this method again with a null pointer as a parameter to indicate the icon should no longer be displayed.

Parameters
iconThe icon to display on the screen.

◆ addSysArchivesToSearchSet()

virtual void OSystem::addSysArchivesToSearchSet ( Common::SearchSet &  s,
int  priority = 0 
)
inlinevirtual

Add system-specific Common::Archive objects to the given SearchSet. For example, on Unix, the directory corresponding to DATA_PATH (if set), or, on Mac OS X, the 'Resource' dir in the app bundle.

Parameters
sSearchSet to which the system-specific dirs, if any, are added.
priorityPriority with which those dirs are added.

◆ createConfigReadStream()

virtual Common::SeekableReadStream* OSystem::createConfigReadStream ( )
virtual

Open the default config file for reading by returning a suitable ReadStream instance.

It is the caller's responsiblity to delete the stream after use.

◆ createConfigWriteStream()

virtual Common::WriteStream* OSystem::createConfigWriteStream ( )
virtual

Open the default config file for writing by returning a suitable WriteStream instance.

It is the callers responsiblity to delete the stream after use.

May return 0 to indicate that writing to the config file is not possible.

◆ getDefaultConfigFileName()

virtual Common::String OSystem::getDefaultConfigFileName ( )
virtual

Get the default file name (or even path) where the user configuration of ScummVM will be saved.

Note that not all ports can use this.

◆ logMessage()

virtual void OSystem::logMessage ( LogMessageType::Type  type,
const char *  message 
)
pure virtual

Log the given message.

It is up to the backend where to log the different messages. The backend should aim at using a non-buffered output for it, so that no log data is lost in case of a crash.

The default implementation outputs them on stdout/stderr.

Parameters
typeType of the message.
messageThe message itself.

◆ displayLogFile()

virtual bool OSystem::displayLogFile ( )
inlinevirtual

Open the log file in a way that allows the user to review it, and possibly email it (or parts of it) to the ScummVM team, for example as part of a bug report.

On a desktop operating system, this would typically launch some kind of an (external) text editor / viewer. On a phone, it can also cause a context switch to another application. Finally, on some ports, it might not be supported at all, and do nothing.

The kFeatureDisplayLogFile feature flag can be used to test whether this call has been implemented by the active backend.

Returns
True on success, false if an error occurred.
Note
An error might mean that the log file did not exist, or that the editor could not launch. However, a return value of true does not guarantee that the user will actually see the log file.
It is up to the backend to ensure that the system is in a state that allows the user to actually see the displayed log files. This might for example require leaving fullscreen mode.

◆ hasTextInClipboard()

virtual bool OSystem::hasTextInClipboard ( )
inlinevirtual

Check whether there is text available in the clipboard.

The kFeatureClipboardSupport feature flag can be used to test whether this call has been implemented by the active backend.

Returns
True if there is text in the clipboard, false otherwise.

◆ getTextFromClipboard()

virtual Common::U32String OSystem::getTextFromClipboard ( )
inlinevirtual

Return clipboard contents as a string.

The kFeatureClipboardSupport feature flag can be used to test whether this call has been implemented by the active backend.

Returns
clipboard contents ("" if hasTextInClipboard() == false).

◆ setTextInClipboard()

virtual bool OSystem::setTextInClipboard ( const Common::U32String &  text)
inlinevirtual

Set the content of the clipboard to the given string.

The kFeatureClipboardSupport feature flag can be used to test whether this call has been implemented by the active backend.

Returns
True if the text has been properly set in the clipboard, false otherwise.

◆ openUrl()

virtual bool OSystem::openUrl ( const Common::String &  url)
inlinevirtual

Open the given URL in the default browser (if available on the target system).

Returns
True on success, false otherwise.
Note
It is up to the backend to ensure that the system is in a state that allows the user to actually see the web page. This might for example require leaving fullscreen mode.
Parameters
urlThe URL to open.

◆ getSystemLanguage()

virtual Common::String OSystem::getSystemLanguage ( ) const
virtual

Return the locale of the system.

This returns the currently set locale of the system on which ScummVM is run.

The format of the locale is language_country. These should match the POSIX locale values.

For information about POSIX locales, see the following link: https://en.wikipedia.org/wiki/Locale_(computer_software)#POSIX_platforms

The default implementation returns "en_US".

Returns
Locale of the system.

◆ isConnectionLimited()

virtual bool OSystem::isConnectionLimited ( )
virtual

Return whether the connection is limited (if available on the target system).

Returns
True if the connection is limited.

◆ convertEncoding()

virtual char* OSystem::convertEncoding ( const char *  to,
const char *  from,
const char *  string,
size_t  length 
)
inlineprotectedvirtual

This allows derived classes to implement encoding conversion using platform specific API. This method shouldn't be called directly. Use Common::Encoding instead.

Parameters
toEncoding to convert the string to
fromEncoding to convert the string from
stringThe string that should be converted
lengthSize of the string in bytes
Returns
Converted string, which must be freed by the caller (using free() and not delete[]), or nullptr if the conversion isn't possible.