本文整理汇总了C++中OSystem::engineDone方法的典型用法代码示例。如果您正苦于以下问题:C++ OSystem::engineDone方法的具体用法?C++ OSystem::engineDone怎么用?C++ OSystem::engineDone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSystem
的用法示例。
在下文中一共展示了OSystem::engineDone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
// TODO: specify the possible return values here
static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
// Determine the game data path, for validation and error messages
Common::FSNode dir(ConfMan.get("path"));
Common::Error err = Common::kNoError;
Engine *engine = 0;
// Verify that the game path refers to an actual directory
if (!(dir.exists() && dir.isDirectory()))
err = Common::kInvalidPathError;
// Create the game engine
if (err == Common::kNoError)
err = (*plugin)->createInstance(&system, &engine);
// Check for errors
if (!engine || err != Common::kNoError) {
// TODO: An errorDialog for this and engine related errors is displayed already in the scummvm_main function
// Is a separate dialog here still required?
//GUI::displayErrorDialog("ScummVM could not find any game in the specified directory!");
const char *errMsg = _(Common::errorToString(err));
warning("%s failed to instantiate engine: %s (target '%s', path '%s')",
plugin->getName(),
errMsg,
ConfMan.getActiveDomainName().c_str(),
dir.getPath().c_str()
);
// Autoadded is set only when no path was provided and
// the game is run from command line.
//
// Thus, we remove this garbage entry
//
// Fixes bug #1544799
if (ConfMan.hasKey("autoadded")) {
ConfMan.removeGameDomain(ConfMan.getActiveDomainName().c_str());
}
return err;
}
// Set the window caption to the game name
Common::String caption(ConfMan.get("description"));
if (caption.empty()) {
caption = EngineMan.findGame(ConfMan.get("gameid")).description();
}
if (caption.empty())
caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
if (!caption.empty()) {
system.setWindowCaption(caption.c_str());
}
//
// Setup various paths in the SearchManager
//
// Add the game path to the directory search list
SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
// Add extrapath (if any) to the directory search list
if (ConfMan.hasKey("extrapath")) {
dir = Common::FSNode(ConfMan.get("extrapath"));
SearchMan.addDirectory(dir.getPath(), dir);
}
// If a second extrapath is specified on the app domain level, add that as well.
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain)) {
dir = Common::FSNode(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain));
SearchMan.addDirectory(dir.getPath(), dir);
}
// On creation the engine should have set up all debug levels so we can use
// the command line arugments here
Common::StringTokenizer tokenizer(edebuglevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
if (!DebugMan.enableDebugChannel(token))
warning(_("Engine does not support debug level '%s'"), token.c_str());
}
// Inform backend that the engine is about to be run
system.engineInit();
// Run the engine
Common::Error result = engine->run();
// Inform backend that the engine finished
system.engineDone();
// Free up memory
delete engine;
// We clear all debug levels again even though the engine should do it
DebugMan.clearAllDebugChannels();
// Reset the file/directory mappings
//.........这里部分代码省略.........
示例2: dir
//.........这里部分代码省略.........
plugin->getName(),
err.getDesc().c_str(),
ConfMan.getActiveDomainName().c_str(),
dir.getPath().c_str()
);
// Autoadded is set only when no path was provided and
// the game is run from command line.
//
// Thus, we remove this garbage entry
//
// Fixes bug #1544799
if (ConfMan.hasKey("autoadded")) {
ConfMan.removeGameDomain(ConfMan.getActiveDomainName().c_str());
}
return err;
}
// Set the window caption to the game name
Common::String caption(ConfMan.get("description"));
if (caption.empty()) {
caption = EngineMan.findGame(ConfMan.get("gameid")).description();
}
if (caption.empty())
caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
if (!caption.empty()) {
system.setWindowCaption(caption.c_str());
}
//
// Setup various paths in the SearchManager
//
// Add the game path to the directory search list
engine->initializePath(dir);
// Add extrapath (if any) to the directory search list
if (ConfMan.hasKey("extrapath")) {
dir = Common::FSNode(ConfMan.get("extrapath"));
SearchMan.addDirectory(dir.getPath(), dir);
}
// If a second extrapath is specified on the app domain level, add that as well.
// However, since the default hasKey() and get() check the app domain level,
// verify that it's not already there before adding it. The search manager will
// check for that too, so this check is mostly to avoid a warning message.
if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain)) {
Common::String extraPath = ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain);
if (!SearchMan.hasArchive(extraPath)) {
dir = Common::FSNode(extraPath);
SearchMan.addDirectory(dir.getPath(), dir);
}
}
// On creation the engine should have set up all debug levels so we can use
// the command line arguments here
Common::StringTokenizer tokenizer(edebuglevels, " ,");
while (!tokenizer.empty()) {
Common::String token = tokenizer.nextToken();
if (token.equalsIgnoreCase("all"))
DebugMan.enableAllDebugChannels();
else if (!DebugMan.enableDebugChannel(token))
warning(_("Engine does not support debug level '%s'"), token.c_str());
}
// Initialize any game-specific keymaps
engine->initKeymap();
// Set default values for all of the custom engine options
const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(Common::String());
for (uint i = 0; i < engineOptions.size(); i++) {
ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
}
// Inform backend that the engine is about to be run
system.engineInit();
// Run the engine
Common::Error result = engine->run();
// Inform backend that the engine finished
system.engineDone();
// Clean up any game-specific keymaps
engine->deinitKeymap();
// Free up memory
delete engine;
// We clear all debug levels again even though the engine should do it
DebugMan.clearAllDebugChannels();
// Reset the file/directory mappings
SearchMan.clear();
// Return result (== 0 means no error)
return result;
}