Sci::SciEngine Class Reference

#include <sci.h>

+ Inheritance diagram for Sci::SciEngine:
+ Collaboration diagram for Sci::SciEngine:

Public Member Functions

 SciEngine (OSystem *syst, const ADGameDescription *desc, SciGameId gameId)
 ~SciEngine () override
Common::Error run () override
 Init the engine and start its main loop. More...
bool hasFeature (EngineFeature f) const override
 Determine whether the engine supports the specified feature. More...
void pauseEngineIntern (bool pause) override
 Actual implementation of pauseEngine by subclasses. More...
void severeError ()
ConsolegetSciDebugger ()
Common::Error loadGameState (int slot) override
 Load a game state. More...
Common::Error saveGameState (int slot, const Common::String &desc, bool isAutosave=false) override
 Save a game state. More...
bool canLoadGameStateCurrently () override
 Indicates whether a game state can be loaded. More...
bool canSaveGameStateCurrently () override
 Indicates whether a game state can be saved. More...
void syncSoundSettings () override
 from ScummVM to the game More...
void updateSoundMixerVolumes ()
uint32 getTickCount ()
void setTickCount (const uint32 ticks)
const SciGameIdgetGameId () const
const char * getGameIdStr () const
Common::Language getLanguage () const
Common::Platform getPlatform () const
bool isDemo () const
bool isCD () const
bool forceHiresGraphics () const
bool isBE () const
 Returns true if the game's original platform is big-endian. More...
bool hasParser () const
bool hasMacIconBar () const
bool hasMacSaveRestoreDialogs () const
ResourceManagergetResMan () const
ScriptPatchergetScriptPatcher () const
KernelgetKernel () const
EngineStategetEngineState () const
VocabularygetVocabulary () const
EventManagergetEventManager () const
reg_t getGameObject () const
Common::RandomSourcegetRNG ()
Common::String getSavegameName (int nr) const
Common::String getSavegamePattern () const
Common::String getFilePrefix () const
Common::String wrapFilename (const Common::String &name) const
 Prepend 'TARGET-' to the given filename. More...
Common::String unwrapFilename (const Common::String &name) const
 Remove the 'TARGET-' prefix of the given filename, if present. More...
const char * getGameObjectName ()
int inQfGImportRoom () const
 Checks if we are in a QfG import screen, where special handling of file-listings is performed. More...
void showQfgImportMessageBox () const
void sleep (uint32 msecs)
void scriptDebug ()
bool checkExportBreakpoint (uint16 script, uint16 pubfunct)
bool checkSelectorBreakpoint (BreakpointType breakpointType, reg_t send_obj, int selector)
bool checkAddressBreakpoint (const reg_t &address)
bool checkKernelBreakpoint (const Common::String &name)
Common::String strSplitLanguage (const char *str, uint16 *splitLanguage, const char *sep="\r----------\r")
 Processes a multilanguage string based on the current language settings and returns a string that is ready to be displayed. More...
Common::String strSplit (const char *str, const char *sep="\r----------\r")
kLanguage getSciLanguage ()
void setSciLanguage (kLanguage lang)
void setSciLanguage ()
Common::String getSciLanguageString (const Common::String &str, kLanguage lang, kLanguage *lang2=NULL, uint16 *languageSplitter=NULL) const
void checkVocabularySwitch ()
void initGraphics ()
void suggestDownloadGK2SubTitlesPatch ()
Common::MacResManagergetMacExecutable ()
- Public Member Functions inherited from Engine
 Engine (OSystem *syst)
virtual ~Engine ()
virtual void initializePath (const Common::FSNode &gamePath)
 Init SearchMan according to the game path. More...
virtual void errorString (const char *buf_input, char *buf_output, int buf_output_size)
 Prepare an error string, which is printed by the error() function. More...
virtual GUI::DebuggergetDebugger ()
 Return the engine's debugger instance, if any. More...
void setDebugger (GUI::Debugger *debugger)
 Sets the engine's debugger. More...
GUI::DebuggergetOrCreateDebugger ()
 Return the engine's debugger instance, or create one if none is present. More...
virtual void flipMute ()
 Flip mute all sound option. More...
virtual Common::String getSaveStateName (int slot) const
 Generates the savegame filename. More...
virtual Common::Error loadGameStream (Common::SeekableReadStream *stream)
 Load a game state. More...
void setGameToLoadSlot (int slot)
 Sets the game slot for a savegame to be loaded after global main menu execution. More...
virtual Common::Error saveGameStream (Common::WriteStream *stream, bool isAutosave=false)
 Save a game state. More...
bool saveGameDialog ()
 Shows the ScummVM save dialog, allowing users to save their game. More...
bool loadGameDialog ()
 Shows the ScummVM Restore dialog, allowing users to load a game. More...
void pauseEngine (bool pause)
 Pause or resume the engine. More...
bool isPaused () const
 Return whether the engine is currently paused or not. More...
void openMainMenuDialog ()
 Run the Global Main Menu Dialog. More...
uint32 getTotalPlayTime () const
 Get the total play time. More...
void setTotalPlayTime (uint32 time=0)
 Set the game time counter to the specified time. More...
Common::TimerManagergetTimerManager ()
Common::EventManagergetEventManager ()
Common::SaveFileManagergetSaveFileManager ()
void checkCD ()
 On some systems, check if the game appears to be run from CD. More...
void handleAutoSave ()
 Checks for whether it's time to do an autosave, and if so, does it. More...
void saveAutosaveIfEnabled ()
 Does an autosave immediately if autosaves are turned on. More...
virtual bool canSaveAutosaveCurrently ()
 Indicates whether an autosave can currently be saved. More...
virtual int getAutosaveSlot () const
 Returns the slot that should be used for autosaves. More...
bool shouldPerformAutoSave (int lastSaveTime)

Public Attributes

opcode_format(* _opcode_formats )[4]
DebugState _debugState
- Public Attributes inherited from Engine

Private Member Functions

bool initGame ()
 Initializes a SCI game This function must be run before script_run() is executed. More...
void runGame ()
 Runs a SCI game This is the main function for SCI games. More...
void exitGame ()
 Uninitializes an initialized SCI game This function should be run after each script_run() call. More...
void loadMacExecutable ()
 Loads the Mac executable for SCI1 games. More...
void initStackBaseWithSelector (Selector selector)
bool gameHasFanMadePatch ()
void setLauncherLanguage ()

Private Attributes

const ADGameDescription_gameDescription
const SciGameId _gameId
 The resource manager. More...
 The script patcher. More...
int16 _vocabularyLanguage
reg_t _gameObjectAddress
 Pointer to the game object. More...
Common::RandomSource _rng
Common::MacResManager _macExecutable
bool _forceHiresGraphics


class Console

Additional Inherited Members

- Public Types inherited from Engine
enum  EngineFeature { kSupportsSubtitleOptions, kSupportsRTL, kSupportsLoadingDuringRuntime, kSupportsSavingDuringRuntime }
 A feature in this context means an ability of the engine which can be either available or not. More...
- Static Public Member Functions inherited from Engine
static void quitGame ()
 Request the engine to quit. More...
static bool shouldQuit ()
 Return whether the ENGINE should quit respectively should return to the launcher. More...
static MetaEnginegetMetaEngine ()
static bool warnUserAboutUnsupportedGame ()
 Display a warning to the user that the game is not fully supported. More...
- Protected Member Functions inherited from Engine
virtual int runDialog (GUI::Dialog &dialog)
- Protected Attributes inherited from Engine
const Common::String _targetName

Detailed Description

Definition at line 250 of file sci.h.

Constructor & Destructor Documentation

◆ SciEngine()

Sci::SciEngine::SciEngine ( OSystem syst,
const ADGameDescription desc,
SciGameId  gameId 

Definition at line 86 of file sci.cpp.

◆ ~SciEngine()

Sci::SciEngine::~SciEngine ( )

Definition at line 204 of file sci.cpp.

Member Function Documentation

◆ canLoadGameStateCurrently()

bool Sci::SciEngine::canLoadGameStateCurrently ( )

Indicates whether a game state can be loaded.

Reimplemented from Engine.

Definition at line 965 of file detection.cpp.

◆ canSaveGameStateCurrently()

bool Sci::SciEngine::canSaveGameStateCurrently ( )

Indicates whether a game state can be saved.

Reimplemented from Engine.

Definition at line 980 of file detection.cpp.

◆ checkAddressBreakpoint()

bool Sci::SciEngine::checkAddressBreakpoint ( const reg_t address)

◆ checkExportBreakpoint()

bool Sci::SciEngine::checkExportBreakpoint ( uint16  script,
uint16  pubfunct 

◆ checkKernelBreakpoint()

bool Sci::SciEngine::checkKernelBreakpoint ( const Common::String name)

◆ checkSelectorBreakpoint()

bool Sci::SciEngine::checkSelectorBreakpoint ( BreakpointType  breakpointType,
reg_t  send_obj,
int  selector 

◆ checkVocabularySwitch()

void Sci::SciEngine::checkVocabularySwitch ( )

Definition at line 383 of file state.cpp.

◆ exitGame()

void Sci::SciEngine::exitGame ( )

Uninitializes an initialized SCI game This function should be run after each script_run() call.

[in]sThe state to operate on

Definition at line 742 of file sci.cpp.

◆ forceHiresGraphics()

bool Sci::SciEngine::forceHiresGraphics ( ) const

Definition at line 799 of file sci.cpp.

◆ gameHasFanMadePatch()

bool Sci::SciEngine::gameHasFanMadePatch ( )

Definition at line 449 of file sci.cpp.

◆ getEngineState()

EngineState* Sci::SciEngine::getEngineState ( ) const

Definition at line 289 of file sci.h.

◆ getEventManager()

EventManager* Sci::SciEngine::getEventManager ( ) const

Definition at line 291 of file sci.h.

◆ getFilePrefix()

Common::String Sci::SciEngine::getFilePrefix ( ) const

Definition at line 841 of file sci.cpp.

◆ getGameId()

const SciGameId& Sci::SciEngine::getGameId ( ) const

Definition at line 271 of file sci.h.

◆ getGameIdStr()

const char * Sci::SciEngine::getGameIdStr ( ) const

Definition at line 779 of file sci.cpp.

◆ getGameObject()

reg_t Sci::SciEngine::getGameObject ( ) const

Definition at line 292 of file sci.h.

◆ getGameObjectName()

const char * Sci::SciEngine::getGameObjectName ( )

Definition at line 861 of file sci.cpp.

◆ getKernel()

Kernel* Sci::SciEngine::getKernel ( ) const

Definition at line 288 of file sci.h.

◆ getLanguage()

Common::Language Sci::SciEngine::getLanguage ( ) const

Definition at line 783 of file sci.cpp.

◆ getMacExecutable()

Common::MacResManager* Sci::SciEngine::getMacExecutable ( )

Definition at line 397 of file sci.h.

◆ getPlatform()

Common::Platform Sci::SciEngine::getPlatform ( ) const

Definition at line 787 of file sci.cpp.

◆ getResMan()

ResourceManager* Sci::SciEngine::getResMan ( ) const

Definition at line 286 of file sci.h.

◆ getRNG()

Common::RandomSource& Sci::SciEngine::getRNG ( )

Definition at line 294 of file sci.h.

◆ getSavegameName()

Common::String Sci::SciEngine::getSavegameName ( int  nr) const

Definition at line 833 of file sci.cpp.

◆ getSavegamePattern()

Common::String Sci::SciEngine::getSavegamePattern ( ) const

Definition at line 837 of file sci.cpp.

◆ getSciDebugger()

Console * Sci::SciEngine::getSciDebugger ( )

Definition at line 775 of file sci.cpp.

◆ getSciLanguage()

kLanguage Sci::SciEngine::getSciLanguage ( )

Definition at line 303 of file state.cpp.

◆ getSciLanguageString()

Common::String Sci::SciEngine::getSciLanguageString ( const Common::String str,
kLanguage  lang,
kLanguage lang2 = NULL,
uint16 languageSplitter = NULL 
) const

Definition at line 209 of file state.cpp.

◆ getScriptPatcher()

ScriptPatcher* Sci::SciEngine::getScriptPatcher ( ) const

Definition at line 287 of file sci.h.

◆ getTickCount()

uint32 Sci::SciEngine::getTickCount ( )

Definition at line 1008 of file sci.cpp.

◆ getVocabulary()

Vocabulary* Sci::SciEngine::getVocabulary ( ) const

Definition at line 290 of file sci.h.

◆ hasFeature()

bool Sci::SciEngine::hasFeature ( EngineFeature  f) const

Determine whether the engine supports the specified feature.

Reimplemented from Engine.

Definition at line 801 of file detection.cpp.

◆ hasMacIconBar()

bool Sci::SciEngine::hasMacIconBar ( ) const

Definition at line 820 of file sci.cpp.

◆ hasMacSaveRestoreDialogs()

bool Sci::SciEngine::hasMacSaveRestoreDialogs ( ) const

Definition at line 825 of file sci.cpp.

◆ hasParser()

bool Sci::SciEngine::hasParser ( ) const

Definition at line 813 of file sci.cpp.

◆ initGame()

bool Sci::SciEngine::initGame ( )

Initializes a SCI game This function must be run before script_run() is executed.

Graphics data is initialized iff s->gfx_state != NULL.

[in]sThe state to operate on
true on success, false if an error occurred.

Definition at line 542 of file sci.cpp.

◆ initGraphics()

void Sci::SciEngine::initGraphics ( )

Definition at line 592 of file sci.cpp.

◆ initStackBaseWithSelector()

void Sci::SciEngine::initStackBaseWithSelector ( Selector  selector)

Definition at line 683 of file sci.cpp.

◆ inQfGImportRoom()

int Sci::SciEngine::inQfGImportRoom ( ) const

Checks if we are in a QfG import screen, where special handling of file-listings is performed.

Definition at line 865 of file sci.cpp.

◆ isBE()

bool Sci::SciEngine::isBE ( ) const

Returns true if the game's original platform is big-endian.

Definition at line 803 of file sci.cpp.

◆ isCD()

bool Sci::SciEngine::isCD ( ) const

Definition at line 795 of file sci.cpp.

◆ isDemo()

bool Sci::SciEngine::isDemo ( ) const

Definition at line 791 of file sci.cpp.

◆ loadGameState()

Common::Error Sci::SciEngine::loadGameState ( int  slot)

Load a game state.

slotthe slot from which a savestate should be loaded
returns kNoError on success, else an error code.

Reimplemented from Engine.

Definition at line 935 of file detection.cpp.

◆ loadMacExecutable()

void Sci::SciEngine::loadMacExecutable ( )

Loads the Mac executable for SCI1 games.

Definition at line 978 of file sci.cpp.

◆ pauseEngineIntern()

void Sci::SciEngine::pauseEngineIntern ( bool  pause)

Actual implementation of pauseEngine by subclasses.

See there for details.

Reimplemented from Engine.

Definition at line 954 of file sci.cpp.

◆ run()

Common::Error Sci::SciEngine::run ( )

Init the engine and start its main loop.

returns kNoError on success, else an error code.

Implements Engine.

Definition at line 261 of file sci.cpp.

◆ runGame()

void Sci::SciEngine::runGame ( )

Runs a SCI game This is the main function for SCI games.

It takes a valid state, loads script 0 to it, finds the game object, allocates a stack, and runs the init method of the game object. In layman's terms, this runs a SCI game.

[in]sPointer to the pointer of the state to operate on

Definition at line 695 of file sci.cpp.

◆ saveGameState()

Common::Error Sci::SciEngine::saveGameState ( int  slot,
const Common::String desc,
bool  isAutosave = false 

Save a game state.

slotthe slot into which the savestate should be stored
desca description for the savestate, entered by the user
isAutosaveExpected to be true if an autosave is being created
returns kNoError on success, else an error code.

Reimplemented from Engine.

Definition at line 940 of file detection.cpp.

◆ scriptDebug()

void Sci::SciEngine::scriptDebug ( )

◆ setLauncherLanguage()

void Sci::SciEngine::setLauncherLanguage ( )

Definition at line 923 of file sci.cpp.

◆ setSciLanguage() [1/2]

void Sci::SciEngine::setSciLanguage ( )

Definition at line 355 of file state.cpp.

◆ setSciLanguage() [2/2]

void Sci::SciEngine::setSciLanguage ( kLanguage  lang)

Definition at line 350 of file state.cpp.

◆ setTickCount()

void Sci::SciEngine::setTickCount ( const uint32  ticks)

Definition at line 1011 of file sci.cpp.

◆ severeError()

void Sci::SciEngine::severeError ( )

Definition at line 762 of file sci.cpp.

◆ showQfgImportMessageBox()

void Sci::SciEngine::showQfgImportMessageBox ( ) const

Definition at line 878 of file sci.cpp.

◆ sleep()

void Sci::SciEngine::sleep ( uint32  msecs)

Definition at line 887 of file sci.cpp.

◆ strSplit()

Common::String Sci::SciEngine::strSplit ( const char *  str,
const char *  sep = "\r----------\r" 

Definition at line 337 of file sci.h.

◆ strSplitLanguage()

Common::String Sci::SciEngine::strSplitLanguage ( const char *  str,
uint16 splitLanguage,
const char *  sep = "\r----------\r" 

Processes a multilanguage string based on the current language settings and returns a string that is ready to be displayed.

strthe multilanguage string
sepoptional seperator between main language and subtitle language, if NULL is passed no subtitle will be added to the returned string
processed string

Definition at line 359 of file state.cpp.

◆ suggestDownloadGK2SubTitlesPatch()

void Sci::SciEngine::suggestDownloadGK2SubTitlesPatch ( )

Definition at line 512 of file sci.cpp.

◆ syncSoundSettings()

void Sci::SciEngine::syncSoundSettings ( )

from ScummVM to the game

Reimplemented from Engine.

Definition at line 960 of file sci.cpp.

◆ unwrapFilename()

Common::String Sci::SciEngine::unwrapFilename ( const Common::String name) const

Remove the 'TARGET-' prefix of the given filename, if present.

Definition at line 853 of file sci.cpp.

◆ updateSoundMixerVolumes()

void Sci::SciEngine::updateSoundMixerVolumes ( )

Definition at line 965 of file sci.cpp.

◆ wrapFilename()

Common::String Sci::SciEngine::wrapFilename ( const Common::String name) const

Prepend 'TARGET-' to the given filename.

Definition at line 845 of file sci.cpp.

Friends And Related Function Documentation

◆ Console

friend class Console

Definition at line 251 of file sci.h.

Member Data Documentation

◆ _audio

AudioPlayer* Sci::SciEngine::_audio

Definition at line 387 of file sci.h.

◆ _audio32

Audio32* Sci::SciEngine::_audio32

Definition at line 380 of file sci.h.

◆ _console

Console* Sci::SciEngine::_console

Definition at line 445 of file sci.h.

◆ _debugState

DebugState Sci::SciEngine::_debugState

Definition at line 395 of file sci.h.

◆ _eventMan

EventManager* Sci::SciEngine::_eventMan

Definition at line 443 of file sci.h.

◆ _features

GameFeatures* Sci::SciEngine::_features

Definition at line 390 of file sci.h.

◆ _forceHiresGraphics

bool Sci::SciEngine::_forceHiresGraphics

Definition at line 448 of file sci.h.

◆ _gameDescription

const ADGameDescription* Sci::SciEngine::_gameDescription

Definition at line 435 of file sci.h.

◆ _gameId

const SciGameId Sci::SciEngine::_gameId

Definition at line 436 of file sci.h.

◆ _gameObjectAddress

reg_t Sci::SciEngine::_gameObjectAddress

Pointer to the game object.

Definition at line 444 of file sci.h.

◆ _gamestate

EngineState* Sci::SciEngine::_gamestate

Definition at line 439 of file sci.h.

◆ _gfxAnimate

GfxAnimate* Sci::SciEngine::_gfxAnimate

Definition at line 358 of file sci.h.

◆ _gfxCache

GfxCache* Sci::SciEngine::_gfxCache

Definition at line 359 of file sci.h.

◆ _gfxCompare

GfxCompare* Sci::SciEngine::_gfxCompare

Definition at line 360 of file sci.h.

◆ _gfxControls16

GfxControls16* Sci::SciEngine::_gfxControls16

Definition at line 361 of file sci.h.

◆ _gfxControls32

GfxControls32* Sci::SciEngine::_gfxControls32

Definition at line 362 of file sci.h.

◆ _gfxCoordAdjuster

GfxCoordAdjuster16* Sci::SciEngine::_gfxCoordAdjuster

Definition at line 363 of file sci.h.

◆ _gfxCursor

GfxCursor* Sci::SciEngine::_gfxCursor

Definition at line 364 of file sci.h.

◆ _gfxCursor32

GfxCursor32* Sci::SciEngine::_gfxCursor32

Definition at line 384 of file sci.h.

◆ _gfxFrameout

GfxFrameout* Sci::SciEngine::_gfxFrameout

Definition at line 382 of file sci.h.

◆ _gfxMacIconBar

GfxMacIconBar* Sci::SciEngine::_gfxMacIconBar

Definition at line 377 of file sci.h.

◆ _gfxMenu

GfxMenu* Sci::SciEngine::_gfxMenu

Definition at line 365 of file sci.h.

◆ _gfxPaint16

GfxPaint16* Sci::SciEngine::_gfxPaint16

Definition at line 370 of file sci.h.

◆ _gfxPaint32

GfxPaint32* Sci::SciEngine::_gfxPaint32

Definition at line 371 of file sci.h.

◆ _gfxPalette16

GfxPalette* Sci::SciEngine::_gfxPalette16

Definition at line 366 of file sci.h.

◆ _gfxPalette32

GfxPalette32* Sci::SciEngine::_gfxPalette32

Definition at line 367 of file sci.h.

◆ _gfxPorts

GfxPorts* Sci::SciEngine::_gfxPorts

Definition at line 372 of file sci.h.

◆ _gfxRemap16

GfxRemap* Sci::SciEngine::_gfxRemap16

Definition at line 368 of file sci.h.

◆ _gfxRemap32

GfxRemap32* Sci::SciEngine::_gfxRemap32

Definition at line 369 of file sci.h.

◆ _gfxScreen

GfxScreen* Sci::SciEngine::_gfxScreen

Definition at line 373 of file sci.h.

◆ _gfxText16

GfxText16* Sci::SciEngine::_gfxText16

Definition at line 374 of file sci.h.

◆ _gfxText32

GfxText32* Sci::SciEngine::_gfxText32

Definition at line 375 of file sci.h.

◆ _gfxTransitions

GfxTransitions* Sci::SciEngine::_gfxTransitions

Definition at line 376 of file sci.h.

◆ _gfxTransitions32

GfxTransitions32* Sci::SciEngine::_gfxTransitions32

Definition at line 383 of file sci.h.

◆ _guestAdditions

GuestAdditions* Sci::SciEngine::_guestAdditions

Definition at line 391 of file sci.h.

◆ _kernel

Kernel* Sci::SciEngine::_kernel

Definition at line 440 of file sci.h.

◆ _macExecutable

Common::MacResManager Sci::SciEngine::_macExecutable

Definition at line 447 of file sci.h.

◆ _opcode_formats

opcode_format(* Sci::SciEngine::_opcode_formats)[4]

Definition at line 393 of file sci.h.

◆ _resMan

ResourceManager* Sci::SciEngine::_resMan

The resource manager.

Definition at line 437 of file sci.h.

◆ _rng

Common::RandomSource Sci::SciEngine::_rng

Definition at line 446 of file sci.h.

◆ _scriptPatcher

ScriptPatcher* Sci::SciEngine::_scriptPatcher

The script patcher.

Definition at line 438 of file sci.h.

◆ _soundCmd

SoundCommandParser* Sci::SciEngine::_soundCmd

Definition at line 389 of file sci.h.

◆ _sync

Sync* Sci::SciEngine::_sync

Definition at line 388 of file sci.h.

◆ _video32

Video32* Sci::SciEngine::_video32

Definition at line 381 of file sci.h.

◆ _vocabulary

Vocabulary* Sci::SciEngine::_vocabulary

Definition at line 441 of file sci.h.

◆ _vocabularyLanguage

int16 Sci::SciEngine::_vocabularyLanguage

Definition at line 442 of file sci.h.

The documentation for this class was generated from the following files: