aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-11 00:30:02 -0400
committerMatthew Hoops2011-05-11 00:30:28 -0400
commita1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch)
tree8c51419daa486f1d4833757db4715dadab6c3497 /base
parentaccb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff)
parent33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff)
downloadscummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: audio/decoders/qdm2.h common/util.cpp engines/groovie/music.cpp engines/groovie/resource.h video/qt_decoder.cpp video/qt_decoder.h
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp35
-rw-r--r--base/commandLine.h12
-rw-r--r--base/internal_revision.h.in6
-rw-r--r--base/internal_version.h8
-rw-r--r--base/internal_version.h.in6
-rw-r--r--base/main.cpp41
-rw-r--r--base/plugins.h10
7 files changed, 70 insertions, 48 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index f920dd0170..05e1d2c131 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -23,6 +23,9 @@
*
*/
+// FIXME: Avoid using printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "engines/metaengine.h"
#include "base/commandLine.h"
#include "base/plugins.h"
@@ -30,6 +33,7 @@
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/fs.h"
#include "gui/ThemeEngine.h"
@@ -262,7 +266,7 @@ void registerDefaults() {
#define DO_OPTION_INT(shortCmd, longCmd) \
DO_OPTION(shortCmd, longCmd) \
char *endptr = 0; \
- int intValue; intValue = (int)strtol(option, &endptr, 0); \
+ strtol(option, &endptr, 0); \
if (endptr == NULL || *endptr != 0) usage("--%s: Invalid number '%s'", longCmd, option);
// Use this for boolean options; this distinguishes between "-x" and "-X",
@@ -641,29 +645,30 @@ static Common::Error listSaves(const char *target) {
GameDescriptor game = EngineMan.findGame(gameid, &plugin);
if (!plugin) {
- warning("Could not find any plugin to handle target '%s' (gameid '%s')", target, gameid.c_str());
- return Common::kPluginNotFound;
+ return Common::Error(Common::kEnginePluginNotFound,
+ Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
}
if (!(*plugin)->hasFeature(MetaEngine::kSupportsListSaves)) {
// TODO: Include more info about the target (desc, engine name, ...) ???
- printf("ScummVM does not support listing save states for target '%s' (gameid '%s') .\n", target, gameid.c_str());
- result = Common::kPluginNotSupportSaves;
+ return Common::Error(Common::kEnginePluginNotSupportSaves,
+ Common::String::format("target '%s', gameid '%s", target, gameid.c_str()));
} else {
// Query the plugin for a list of savegames
SaveStateList saveList = (*plugin)->listSaves(target);
- // TODO: Include more info about the target (desc, engine name, ...) ???
- printf("Saves for target '%s' (gameid '%s'):\n", target, gameid.c_str());
- printf(" Slot Description \n"
- " ---- ------------------------------------------------------\n");
-
- if (saveList.size() == 0)
- result = Common::kNoSavesError;
+ if (saveList.size() > 0) {
+ // TODO: Include more info about the target (desc, engine name, ...) ???
+ printf("Save states for target '%s' (gameid '%s'):\n", target, gameid.c_str());
+ printf(" Slot Description \n"
+ " ---- ------------------------------------------------------\n");
- for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
- printf(" %-4s %s\n", x->save_slot().c_str(), x->description().c_str());
- // TODO: Could also iterate over the full hashmap, printing all key-value pairs
+ for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
+ printf(" %-4s %s\n", x->save_slot().c_str(), x->description().c_str());
+ // TODO: Could also iterate over the full hashmap, printing all key-value pairs
+ }
+ } else {
+ printf("There are no save states for target '%s' (gameid '%s'):\n", target, gameid.c_str());
}
}
diff --git a/base/commandLine.h b/base/commandLine.h
index c7e8d8b0d0..6205c914e0 100644
--- a/base/commandLine.h
+++ b/base/commandLine.h
@@ -23,11 +23,15 @@
*
*/
-#ifndef BASE_OPTIONS_H
-#define BASE_OPTIONS_H
+#ifndef COMMON_COMMAND_LINE_H
+#define COMMON_COMMAND_LINE_H
-#include "common/str.h"
-#include "common/config-manager.h"
+#include "common/hash-str.h"
+
+namespace Common {
+class Error;
+class String;
+}
namespace Base {
diff --git a/base/internal_revision.h.in b/base/internal_revision.h.in
new file mode 100644
index 0000000000..63f58a4b77
--- /dev/null
+++ b/base/internal_revision.h.in
@@ -0,0 +1,6 @@
+#ifndef SCUMMVM_INTERNAL_REVISION_H
+#define SCUMMVM_INTERNAL_REVISION_H
+
+#define SCUMMVM_REVISION "@REVISION@"
+
+#endif
diff --git a/base/internal_version.h b/base/internal_version.h
index fc7b5350f5..bb25bce4e4 100644
--- a/base/internal_version.h
+++ b/base/internal_version.h
@@ -2,6 +2,12 @@
#error This file may only be included by base/version.cpp
#endif
+// Reads revision number from file
+// (this is used when building with Visual Studio)
+#ifdef SCUMMVM_INTERNAL_REVISION
+#include "internal_revision.h"
+#endif
+
#ifdef RELEASE_BUILD
#undef SCUMMVM_REVISION
#endif
@@ -10,4 +16,4 @@
#define SCUMMVM_REVISION
#endif
-#define SCUMMVM_VERSION "1.3.0git" SCUMMVM_REVISION
+#define SCUMMVM_VERSION "1.4.0git" SCUMMVM_REVISION
diff --git a/base/internal_version.h.in b/base/internal_version.h.in
index 5eb3c904ee..e2b46f54ce 100644
--- a/base/internal_version.h.in
+++ b/base/internal_version.h.in
@@ -2,6 +2,12 @@
#error This file may only be included by base/version.cpp
#endif
+// Reads revision number from file
+// (this is used when building with Visual Studio)
+#ifdef SCUMMVM_INTERNAL_REVISION
+#include "internal_revision.h"
+#endif
+
#ifdef RELEASE_BUILD
#undef SCUMMVM_REVISION
#endif
diff --git a/base/main.cpp b/base/main.cpp
index 65aa0ab43f..b34eb6966a 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -31,6 +31,9 @@
* of almost all the classes, methods and variables, and how they interact.
*/
+// FIXME: Avoid using printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "engines/engine.h"
#include "engines/metaengine.h"
#include "base/commandLine.h"
@@ -43,14 +46,13 @@
#include "common/debug-channels.h" /* for debug manager */
#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/file.h"
#include "common/fs.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/tokenizer.h"
#include "common/translation.h"
#include "gui/gui-manager.h"
-#include "gui/message.h"
#include "gui/error.h"
#include "audio/mididrv.h"
@@ -111,13 +113,12 @@ static const EnginePlugin *detectPlugin() {
if (plugin == 0) {
printf("failed\n");
warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str());
- return 0;
} else {
printf("%s\n", plugin->getName());
- }
- // FIXME: Do we really need this one?
- printf(" Starting '%s'\n", game.description().c_str());
+ // FIXME: Do we really need this one?
+ printf(" Starting '%s'\n", game.description().c_str());
+ }
return plugin;
}
@@ -131,24 +132,20 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
// Verify that the game path refers to an actual directory
if (!(dir.exists() && dir.isDirectory()))
- err = Common::kInvalidPathError;
+ err = Common::kPathNotDirectory;
// Create the game engine
- if (err == Common::kNoError)
+ if (err.getCode() == 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));
+ if (!engine || err.getCode() != Common::kNoError) {
+ // Print a warning; note that scummvm_main will also
+ // display an error dialog, so we don't have to do this here.
warning("%s failed to instantiate engine: %s (target '%s', path '%s')",
plugin->getName(),
- errMsg,
+ err.getDesc().c_str(),
ConfMan.getActiveDomainName().c_str(),
dir.getPath().c_str()
);
@@ -355,8 +352,12 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
Common::Error res;
// TODO: deal with settings that require plugins to be loaded
- if ((res = Base::processSettings(command, settings)) != Common::kArgumentNotProcessed)
- return res;
+ res = Base::processSettings(command, settings);
+ if (res.getCode() != Common::kArgumentNotProcessed) {
+ if (res.getCode() != Common::kNoError)
+ warning("%s", res.getDesc().c_str());
+ return res.getCode();
+ }
// Init the backend. Must take place after all config data (including
// the command line params) was read.
@@ -430,14 +431,14 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
#endif
// Did an error occur ?
- if (result != Common::kNoError) {
+ if (result.getCode() != Common::kNoError) {
// Shows an informative error dialog if starting the selected game failed.
GUI::displayErrorDialog(result, _("Error running game:"));
}
// Quit unless an error occurred, or Return to launcher was requested
#ifndef FORCE_RTL
- if (result == 0 && !g_system->getEventManager()->shouldRTL())
+ if (result.getCode() == Common::kNoError && !g_system->getEventManager()->shouldRTL())
break;
#endif
// Reset RTL flag in case we want to load another engine
diff --git a/base/plugins.h b/base/plugins.h
index 976e606a8b..d8f1cb96ee 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -27,16 +27,10 @@
#define BASE_PLUGINS_H
#include "common/array.h"
-#include "common/error.h"
-#include "common/singleton.h"
-#include "common/util.h"
+#include "common/fs.h"
+#include "common/str.h"
#include "backends/plugins/elf/version.h"
-namespace Common {
- class FSList;
- class FSNode;
-}
-
/**
* @page pagePlugins An overview of the ScummVM plugin system