aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-03 17:17:27 -0400
committerMatthew Hoops2011-05-03 17:25:41 -0400
commit9cb600099f4c29298707787cafad2741a1cd6686 (patch)
treefb1930fa56b611317831d66442cba19b18d2e57a /base
parent3b2283daf850605ca897002afbafe44489c35473 (diff)
parent95a6098f672191dc0792bd4f9bfa18706bbe8e3a (diff)
downloadscummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.gz
scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.bz2
scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp38
-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.cpp40
-rw-r--r--base/plugins.cpp6
-rw-r--r--base/plugins.h10
8 files changed, 78 insertions, 48 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 36218376c8..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"
@@ -178,6 +182,9 @@ void registerDefaults() {
ConfMan.registerDefault("midi_gain", 100);
// ConfMan.registerDefault("music_driver", ???);
+ ConfMan.registerDefault("mt32_device", "null");
+ ConfMan.registerDefault("gm_device", "null");
+
ConfMan.registerDefault("cdrom", 0);
// Game specific
@@ -259,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",
@@ -638,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..fc4523b895 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,11 @@ 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) {
+ 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 +430,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.cpp b/base/plugins.cpp
index 21db7ff023..36faa87cda 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -175,6 +175,9 @@ public:
#if PLUGIN_ENABLED_STATIC(TOON)
LINK_PLUGIN(TOON)
#endif
+ #if PLUGIN_ENABLED_STATIC(TSAGE)
+ LINK_PLUGIN(TSAGE)
+ #endif
#if PLUGIN_ENABLED_STATIC(TOUCHE)
LINK_PLUGIN(TOUCHE)
#endif
@@ -215,6 +218,9 @@ public:
#ifdef USE_MT32EMU
LINK_PLUGIN(MT32)
#endif
+ #if defined(__ANDROID__)
+ LINK_PLUGIN(EAS)
+ #endif
LINK_PLUGIN(ADLIB)
LINK_PLUGIN(PCSPK)
LINK_PLUGIN(PCJR)
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