From f878820bbee1e7e4659ca601872674082334fa63 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Tue, 24 Jun 2008 21:15:30 +0000 Subject: Created Global Main Menu Dialog. Made a uniform _quit flag for engines. So far agi, agos, and cine are now using the new _quit flag. svn-id: r32770 --- base/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index dbf740c2ec..b4b075a415 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -229,8 +229,8 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St Common::File::resetDefaultDirectories(); - - return 1; // Changing from return 0, in order to return to launcher + // If result=1 return to the launcher, else quit ScummVM + return result; } -- cgit v1.2.3 From a4f56de13ac2a7daaf5654c75f07ad6331f375e6 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Mon, 7 Jul 2008 22:34:45 +0000 Subject: Implemented Common::EventManager::pushEvent() to insert fake events into the event queue. Quit and RTL events have been added, and are now tracked by the DefaultEventManager using shouldQuit() and shouldRTL(). AGOS is working with this new implementation, other engines to follow. svn-id: r32952 --- base/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index b4b075a415..b836b423a4 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -38,6 +38,7 @@ #include "base/version.h" #include "common/config-manager.h" +#include "common/events.h" #include "common/file.h" #include "common/fs.h" #include "common/system.h" @@ -315,6 +316,11 @@ extern "C" int scummvm_main(int argc, char *argv[]) { // TODO: We should keep running if starting the selected game failed // (so instead of just quitting, show a nice error dialog to the // user and let him pick another game). + + // Reset RTL and Quit flags in case we want to load another engine + g_system->getEventManager()->resetRTL(); + g_system->getEventManager()->resetQuit(); + if (result == 0) break; -- cgit v1.2.3 From 7f480ac571f978802a3ecd5cf6169d0271d1f561 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Wed, 16 Jul 2008 04:22:56 +0000 Subject: Quit and RTL code is more modular now. EVENT_RTL no longer sets _shouldQuit, shouldQuit is only set if there's an EVENT_QUIT. EVENT_RTL and EVENT_QUIT are completely separate from each other. Engine::quit() method now checks both _shouldQuit and _shouldRTL to determine if the engine should exit. There is no longer a need for resetQuit(), so it's removed svn-id: r33082 --- base/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index f91574ffc4..bb7a17b901 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -317,9 +317,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) { // (so instead of just quitting, show a nice error dialog to the // user and let him pick another game). - // Reset RTL and Quit flags in case we want to load another engine + // Reset RTL flag in case we want to load another engine g_system->getEventManager()->resetRTL(); - g_system->getEventManager()->resetQuit(); if (result == 0) break; -- cgit v1.2.3 From 92d6ee3d7611617abfe1c4cdcf3a838116c34c95 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 4 Aug 2008 17:17:37 +0000 Subject: Moved ConfMan.registerDefault calls for savepath to DefaultSaveFileManager (eventually, should be pushed into backends/platform/ code) svn-id: r33614 --- base/commandLine.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index ea0e1465b6..84f2013ae9 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -34,22 +34,6 @@ #include "sound/mididrv.h" -#ifdef IPHONE -#include "backends/platform/iphone/osys_iphone.h" -#endif - -#ifdef UNIX -#ifdef MACOSX -#define DEFAULT_SAVE_PATH "Documents/ScummVM Savegames" -#else -#define DEFAULT_SAVE_PATH ".scummvm" -#endif -#elif defined(__SYMBIAN32__) -#define DEFAULT_SAVE_PATH "Savegames" -#elif defined(PALMOS_MODE) -#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved" -#endif - #define DETECTOR_TESTING_HACK namespace Base { @@ -181,9 +165,6 @@ void registerDefaults() { // Game specific ConfMan.registerDefault("path", ""); - ConfMan.registerDefault("savepath", ""); - -// ConfMan.registerDefault("amiga", false); ConfMan.registerDefault("platform", Common::kPlatformPC); ConfMan.registerDefault("language", "en"); ConfMan.registerDefault("subtitles", false); @@ -216,28 +197,6 @@ void registerDefaults() { ConfMan.registerDefault("alsa_port", "65:0"); #endif - // Register default savepath -#ifdef DEFAULT_SAVE_PATH - char savePath[MAXPATHLEN]; -#if defined(UNIX) && !defined(IPHONE) - const char *home = getenv("HOME"); - if (home && *home && strlen(home) < MAXPATHLEN) { - snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH); - ConfMan.registerDefault("savepath", savePath); - } -#elif defined(__SYMBIAN32__) - strcpy(savePath, Symbian::GetExecutablePath()); - strcat(savePath, DEFAULT_SAVE_PATH); - strcat(savePath, "\\"); - ConfMan.registerDefault("savepath", savePath); -#elif defined (IPHONE) - ConfMan.registerDefault("savepath", OSystem_IPHONE::getSavePath()); - -#elif defined(PALMOS_MODE) - ConfMan.registerDefault("savepath", DEFAULT_SAVE_PATH); -#endif -#endif // #ifdef DEFAULT_SAVE_PATH - ConfMan.registerDefault("record_mode", "none"); ConfMan.registerDefault("record_file_name", "record.bin"); ConfMan.registerDefault("record_temp_file_name", "record.tmp"); -- cgit v1.2.3 From 4e66938e8c39778422e1d6a7e17f0f1979e6e0df Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 5 Aug 2008 21:43:10 +0000 Subject: Committed my patch #2026097 ("ALSA: Try both 65:0 and 17:0 by default"), with a slight modification to the README changes. (I don't know how to interpret all the output from aconnect, so I'm only documenting "the most important bit".) svn-id: r33648 --- base/commandLine.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 84f2013ae9..f8ca8a90cd 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -193,9 +193,6 @@ void registerDefaults() { ConfMan.registerDefault("joystick_num", -1); ConfMan.registerDefault("confirm_exit", false); ConfMan.registerDefault("disable_sdl_parachute", false); -#ifdef USE_ALSA - ConfMan.registerDefault("alsa_port", "65:0"); -#endif ConfMan.registerDefault("record_mode", "none"); ConfMan.registerDefault("record_file_name", "record.bin"); -- cgit v1.2.3 From 20f0bb7a40776f4ed64de29898c3939f1c13a8ba Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Sat, 16 Aug 2008 02:57:30 +0000 Subject: Added documentation to the README, also added --list-saves to the HELP_STRING in commandline.cpp svn-id: r33922 --- base/commandLine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index f8ca8a90cd..47ba3cb9ed 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -56,6 +56,7 @@ static const char HELP_STRING[] = " -h, --help Display a brief help text and exit\n" " -z, --list-games Display list of supported games and exit\n" " -t, --list-targets Display list of configured targets and exit\n" + " --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n" "\n" " -c, --config=CONFIG Use alternate configuration file\n" " -p, --path=PATH Path to where the game is installed\n" -- cgit v1.2.3 From 2b2bfc04c152aaa1ab4dab7662937f314e3af9f3 Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Mon, 25 Aug 2008 08:11:52 +0000 Subject: patch 1984130: Add Tremolo info svn-id: r34138 --- base/version.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'base') diff --git a/base/version.cpp b/base/version.cpp index 8de96d0b78..3f41e4febe 100644 --- a/base/version.cpp +++ b/base/version.cpp @@ -62,7 +62,12 @@ const char *gScummVMVersionDate = SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")" const char *gScummVMFullVersion = "ScummVM " SCUMMVM_VERSION " (" __DATE__ " " __TIME__ ")"; const char *gScummVMFeatures = "" #ifdef USE_TREMOR +#ifdef USE_TREMOLO + // libTremolo is used on WinCE for better ogg performance + "Tremolo " +#else "Tremor " +#endif #else #ifdef USE_VORBIS "Vorbis " -- cgit v1.2.3 From 31320430de82972224b12461c241c3633d2534a6 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 27 Aug 2008 18:52:21 +0000 Subject: Partial commit of patch #2012839: Atari Patch for adding Native MIDI and Fix Compile svn-id: r34194 --- base/plugins.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'base') diff --git a/base/plugins.cpp b/base/plugins.cpp index 216c6ef1af..90e615e709 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -157,9 +157,12 @@ public: #if defined(UNIX) && defined(USE_ALSA) LINK_PLUGIN(ALSA) #endif - #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) + #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) LINK_PLUGIN(SEQ) #endif + #if defined(__MINT__) + LINK_PLUGIN(STMIDI) + #endif #if defined(IRIX) LINK_PLUGIN(DMEDIA) #endif -- cgit v1.2.3 From 4d1df20cfde9c48b469dfd0cb7b0eb28a3b49750 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Sep 2008 08:57:39 +0000 Subject: If launching scummvm with no game selected, clear the transient domain (and hence the effect of all command line args) before opening the launcher (may cause regressions) svn-id: r34293 --- base/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 4283b6cacf..7337c94a40 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -263,13 +263,13 @@ extern "C" int scummvm_main(int argc, char *argv[]) { // Unless a game was specified, show the launcher dialog if (0 == ConfMan.getActiveDomain()) { - launcherDialog(system); - // Discard any command line options. Those that affect the graphics // mode etc. already have should have been handled by the backend at // this point. And the others (like bootparam etc.) should not // blindly be passed to the first game launched from the launcher. ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear(); + + launcherDialog(system); } // FIXME: We're now looping the launcher. This, of course, doesn't -- cgit v1.2.3 From 531bcf847ceef2b9eca82e0b3ef8473612889632 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Sep 2008 11:22:51 +0000 Subject: Moved FilesystemNode / FSList to namespace Common; also got rid of some 'typedef Common::String String;' name aliases svn-id: r34302 --- base/commandLine.cpp | 18 +++++++++--------- base/plugins.cpp | 23 ++++++++++++----------- base/plugins.h | 9 +++++---- 3 files changed, 26 insertions(+), 24 deletions(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 47ba3cb9ed..410777209f 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -365,7 +365,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar END_OPTION DO_OPTION('p', "path") - FilesystemNode path(option); + Common::FilesystemNode path(option); if (!path.exists()) { usage("Non-existent game path '%s'", option); } else if (!path.isReadable()) { @@ -408,7 +408,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar END_OPTION DO_LONG_OPTION("soundfont") - FilesystemNode path(option); + Common::FilesystemNode path(option); if (!path.exists()) { usage("Non-existent soundfont path '%s'", option); } else if (!path.isReadable()) { @@ -438,7 +438,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar END_OPTION DO_LONG_OPTION("savepath") - FilesystemNode path(option); + Common::FilesystemNode path(option); if (!path.exists()) { usage("Non-existent savegames path '%s'", option); } else if (!path.isWritable()) { @@ -447,7 +447,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar END_OPTION DO_LONG_OPTION("extrapath") - FilesystemNode path(option); + Common::FilesystemNode path(option); if (!path.exists()) { usage("Non-existent extra path '%s'", option); } else if (!path.isReadable()) { @@ -465,7 +465,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, char **ar END_OPTION DO_LONG_OPTION("themepath") - FilesystemNode path(option); + Common::FilesystemNode path(option); if (!path.exists()) { usage("Non-existent theme path '%s'", option); } else if (!path.isReadable()) { @@ -623,9 +623,9 @@ static void runDetectorTest() { gameid = name; } - FilesystemNode dir(path); - FSList files; - if (!dir.getChildren(files, FilesystemNode::kListAll)) { + Common::FilesystemNode dir(path); + Common::FSList files; + if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) { printf(" ... invalid path, skipping\n"); continue; } @@ -736,7 +736,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings) { if (!settings.contains("savepath")) { const char *dir = getenv("SCUMMVM_SAVEPATH"); if (dir && *dir && strlen(dir) < MAXPATHLEN) { - FilesystemNode saveDir(dir); + Common::FilesystemNode saveDir(dir); if (!saveDir.exists()) { warning("Non-existent SCUMMVM_SAVEPATH save path. It will be ignored."); } else if (!saveDir.isWritable()) { diff --git a/base/plugins.cpp b/base/plugins.cpp index 90e615e709..7b372587a1 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -29,6 +29,7 @@ #ifdef DYNAMIC_MODULES #include "common/config-manager.h" +#include "common/fs.h" #endif // Plugin versioning @@ -203,11 +204,11 @@ PluginList FilePluginProvider::getPlugins() { PluginList pl; // Prepare the list of directories to search - FSList pluginDirs; + Common::FSList pluginDirs; // Add the default directories - pluginDirs.push_back(FilesystemNode(".")); - pluginDirs.push_back(FilesystemNode("plugins")); + pluginDirs.push_back(Common::FilesystemNode(".")); + pluginDirs.push_back(Common::FilesystemNode("plugins")); // Add the provider's custom directories addCustomDirectories(pluginDirs); @@ -215,21 +216,21 @@ PluginList FilePluginProvider::getPlugins() { // Add the user specified directory Common::String pluginsPath(ConfMan.get("pluginspath")); if (!pluginsPath.empty()) - pluginDirs.push_back(FilesystemNode(pluginsPath)); + pluginDirs.push_back(Common::FilesystemNode(pluginsPath)); - FSList::const_iterator dir; + Common::FSList::const_iterator dir; for (dir = pluginDirs.begin(); dir != pluginDirs.end(); dir++) { // Load all plugins. // Scan for all plugins in this directory - FSList files; - if (!dir->getChildren(files, FilesystemNode::kListFilesOnly)) { + Common::FSList files; + if (!dir->getChildren(files, Common::FilesystemNode::kListFilesOnly)) { debug(1, "Couldn't open plugin directory '%s'", dir->getPath().c_str()); continue; } else { debug(1, "Reading plugins from plugin directory '%s'", dir->getPath().c_str()); } - for (FSList::const_iterator i = files.begin(); i != files.end(); ++i) { + for (Common::FSList::const_iterator i = files.begin(); i != files.end(); ++i) { if (isPluginFilename(i->getName())) { pl.push_back(createPlugin(i->getPath())); } @@ -255,9 +256,9 @@ bool FilePluginProvider::isPluginFilename(const Common::String &filename) const return true; } -void FilePluginProvider::addCustomDirectories(FSList &dirs) const { +void FilePluginProvider::addCustomDirectories(Common::FSList &dirs) const { #ifdef PLUGIN_DIRECTORY - dirs.push_back(FilesystemNode(PLUGIN_DIRECTORY)); + dirs.push_back(Common::FilesystemNode(PLUGIN_DIRECTORY)); #endif } @@ -379,7 +380,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng return result; } -GameList EngineManager::detectGames(const FSList &fslist) const { +GameList EngineManager::detectGames(const Common::FSList &fslist) const { GameList candidates; const EnginePlugin::List &plugins = getPlugins(); diff --git a/base/plugins.h b/base/plugins.h index 02116f6433..90c4469e4d 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -30,9 +30,10 @@ #include "common/singleton.h" #include "common/util.h" -#ifdef DYNAMIC_MODULES -#include "common/fs.h" -#endif +namespace Common { + class FSList; +} + /** * @page pagePlugins An overview of the ScummVM plugin system @@ -258,7 +259,7 @@ protected: * @param dirs the reference to the list of directories to be used when * searching for plugins. */ - virtual void addCustomDirectories(FSList &dirs) const; + virtual void addCustomDirectories(Common::FSList &dirs) const; }; #endif // DYNAMIC_MODULES -- cgit v1.2.3 From d3642080def2d9ae5035724dab00565547a52a5e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Sep 2008 16:56:40 +0000 Subject: Moved check for shouldRTL() from engines to scummvm_main svn-id: r34310 --- base/main.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 7337c94a40..822df125b8 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -201,8 +201,8 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St // Reset the file/directory mappings Common::File::resetDefaultDirectories(); - // If result=1 return to the launcher, else quit ScummVM - return result; + // Return result (== 0 means no error) + return result; } @@ -285,16 +285,19 @@ extern "C" int scummvm_main(int argc, char *argv[]) { // Try to run the game int result = runGame(plugin, system, specialDebug); - // TODO: We should keep running if starting the selected game failed - // (so instead of just quitting, show a nice error dialog to the - // user and let him pick another game). - - // Reset RTL flag in case we want to load another engine - g_system->getEventManager()->resetRTL(); - - if (result == 0) + + // Did an error occur ? + if (result != 0) { + // TODO: Show an informative error dialog if starting the selected game failed. + } + + // Quit unless an error occurred, or Return to launcher was requested + if (result == 0 && !g_system->getEventManager()->shouldRTL()) break; + // Reset RTL flag in case we want to load another engine + g_system->getEventManager()->resetRTL(); + // Discard any command line options. It's unlikely that the user // wanted to apply them to *all* games ever launched. ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear(); -- cgit v1.2.3 From 2c36f00ff2c3ed2b09880dbc53f13fd85e2f21f9 Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Fri, 5 Sep 2008 18:45:04 +0000 Subject: Remove usage of main_features.inl and the file svn-id: r34361 --- base/version.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'base') diff --git a/base/version.cpp b/base/version.cpp index 3f41e4febe..eabafecc30 100644 --- a/base/version.cpp +++ b/base/version.cpp @@ -96,12 +96,6 @@ const char *gScummVMFeatures = "" #ifdef USE_FLUIDSYNTH "FluidSynth " -#endif - -#ifdef __SYMBIAN32__ -// we want a list of compiled in engines visible in the program, -// because we also release special builds with only one engine -#include "backends/platform/symbian/src/main_features.inl" #endif ; -- cgit v1.2.3 From fbc62e56fa1feda9f0c69b91a6e8f4dc6467ff54 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 8 Sep 2008 14:38:07 +0000 Subject: Made searching the game path recursive (with the default depth of 4 levels). This is a temporary fix to make some games work, until we decide what to do with the file/directory searching. svn-id: r34450 --- base/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 822df125b8..4cb7751a4f 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -156,7 +156,7 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St } // Add the game path to the directory search list - Common::File::addDefaultDirectory(path); + Common::File::addDefaultDirectoryRecursive(path); // Add extrapath (if any) to the directory search list if (ConfMan.hasKey("extrapath")) @@ -285,12 +285,12 @@ extern "C" int scummvm_main(int argc, char *argv[]) { // Try to run the game int result = runGame(plugin, system, specialDebug); - + // Did an error occur ? if (result != 0) { // TODO: Show an informative error dialog if starting the selected game failed. } - + // Quit unless an error occurred, or Return to launcher was requested if (result == 0 && !g_system->getEventManager()->shouldRTL()) break; -- cgit v1.2.3 From 83e09d1aa499c827d167642de0a8ffb783c4818e Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 8 Sep 2008 23:24:20 +0000 Subject: Documented commit 34450 (game path searched recursively). svn-id: r34456 --- base/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 4cb7751a4f..897c9fe2eb 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -155,6 +155,14 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St system.setWindowCaption(caption.c_str()); } + // FIXME: at this moment, game path handling is being discussed in the mailing list, + // while Common::File is being reworked under the hood. After commit 34444, which + // changed the implementation of Common::File (specifically removing usage of fopen + // and fOpenNoCase, which implicitly supported backslashes in file names), some games + // stopped working. Example of this are the HE games which use subdirectories: Kirben + // found this issue on lost-win-demo at first. Thus, in commit 34450, searching the + // game path was made recursive as a temporary fix/workaround. + // Add the game path to the directory search list Common::File::addDefaultDirectoryRecursive(path); -- cgit v1.2.3 From 78d7a276cf113b7db6eeab051c9b16fa21bb332f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 14 Sep 2008 18:59:43 +0000 Subject: Fix for bug #2089275: "GUI: Returning to launcher may trigger an error". svn-id: r34532 --- base/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 897c9fe2eb..3e560aa605 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -61,6 +61,11 @@ static bool launcherDialog(OSystem &system) { system.setGraphicsMode(ConfMan.get("gfx_mode").c_str()); system.initSize(320, 200); + + if (ConfMan.hasKey("aspect_ratio")) + system.setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); + if (ConfMan.hasKey("fullscreen")) + system.setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); system.endGFXTransaction(); // Set initial window caption -- cgit v1.2.3 From 259d87a8a68d443d2bbb2bcc1887b4f11b7d342e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 16 Sep 2008 14:10:55 +0000 Subject: Added "querySaveMetaInfos" to MetaEngine. -> Allows easy addition of save state specific infos like playtime, save date atc. -> Removed MetaEngine::loadThumbnailFromSlot, superseded by meta infos -> Changed SCUMM / KYRA to implement the newly added functionallity -> Removed hack in KYRAs listSavefiles, which is now handled via meta infos svn-id: r34581 --- base/game.cpp | 29 +++++++++++++++++++++++++---- base/game.h | 39 ++++++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 19 deletions(-) (limited to 'base') diff --git a/base/game.cpp b/base/game.cpp index e65c891dc7..30fd5fc850 100644 --- a/base/game.cpp +++ b/base/game.cpp @@ -69,9 +69,30 @@ void GameDescriptor::updateDesc(const char *extra) { } void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) { - if (_thumbnail && _thumbnail != t) { - _thumbnail->free(); - delete _thumbnail; + if (_thumbnail.get() == t) + return; + + _thumbnail = Common::SharedPtr(t, Graphics::SharedPtrSurfaceDeleter()); +} + +bool SaveStateDescriptor::getBool(const Common::String &key) const { + if (contains(key)) { + Common::String value = getVal(key); + if (value.equalsIgnoreCase("true") || + value.equalsIgnoreCase("yes") || + value.equals("1")) + return true; + if (value.equalsIgnoreCase("false") || + value.equalsIgnoreCase("no") || + value.equals("0")) + return false; + error("SaveStateDescriptor: %s '%s' has unknown value '%s' for boolean '%s'", + save_slot().c_str(), description().c_str(), value.c_str(), key.c_str()); } - _thumbnail = t; + return false; } + +void SaveStateDescriptor::setDeletableFlag(bool state) { + setVal("is_deletable", state ? "true" : "false"); +} + diff --git a/base/game.h b/base/game.h index d81f2afb8a..6f9030c56f 100644 --- a/base/game.h +++ b/base/game.h @@ -29,6 +29,7 @@ #include "common/str.h" #include "common/array.h" #include "common/hash-str.h" +#include "common/ptr.h" namespace Graphics { struct Surface; @@ -119,15 +120,16 @@ public: */ class SaveStateDescriptor : public Common::StringMap { protected: - Graphics::Surface *_thumbnail; // can be NULL + Common::SharedPtr _thumbnail; // can be 0 + public: - SaveStateDescriptor() : _thumbnail(0) { + SaveStateDescriptor() : _thumbnail() { setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ? setVal("description", ""); setVal("filename", ""); } - SaveStateDescriptor(int s, const Common::String &d, const Common::String &f) : _thumbnail(0) { + SaveStateDescriptor(int s, const Common::String &d, const Common::String &f) : _thumbnail() { char buf[16]; sprintf(buf, "%d", s); setVal("save_slot", buf); @@ -135,16 +137,12 @@ public: setVal("filename", f); } - SaveStateDescriptor(const Common::String &s, const Common::String &d, const Common::String &f) : _thumbnail(0) { + SaveStateDescriptor(const Common::String &s, const Common::String &d, const Common::String &f) : _thumbnail() { setVal("save_slot", s); setVal("description", d); setVal("filename", f); } - ~SaveStateDescriptor() { - setThumbnail(0); - } - /** The saveslot id, as it would be passed to the "-x" command line switch. */ Common::String &save_slot() { return getVal("save_slot"); } @@ -163,19 +161,30 @@ public: /** The filename of the savestate, for use with the SaveFileManager API (read-only variant). */ const Common::String &filename() const { return getVal("filename"); } + /** Optional entries only included when querying via MetaEngine::querySaveMetaInfo */ + + /** + * Returns the value of a given key as boolean. + * It accepts 'true', 'yes' and '1' for true and + * 'false', 'no' and '0' for false. + * (FIXME:) On unknown value it errors out ScummVM. + * On unknown key it returns false as default. + */ + bool getBool(const Common::String &key) const; + + /** + * Sets the 'is_deletable' key, which indicates, if the + * given savestate is safe for deletion. + */ + void setDeletableFlag(bool state); + /** * Return a thumbnail graphics surface representing the savestate visually * This is usually a scaled down version of the game graphics. The size * should be either 160x100 or 160x120 pixels, depending on the aspect * ratio of the game. If another ratio is required, contact the core team. - * - * TODO: it is probably a bad idea to read this for *all* games at once, - * at least on low-end devices. So this info should probably normally only - * be included optionally. I.e. only upon a query for a specific savegame... - * To this end, add a getFullSaveStateInfo(target, slot) to the plugin API. */ - const Graphics::Surface *getThumbnail() const { return _thumbnail; } - + const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); } void setThumbnail(Graphics::Surface *t); }; -- cgit v1.2.3 From 3739662b75dbd04715731071e3b89d1d06a50a8e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 16 Sep 2008 14:56:02 +0000 Subject: Added support for SCUMM savestates date/time and playtime info in the launcher load dialog. svn-id: r34583 --- base/game.cpp | 18 ++++++++++++++++++ base/game.h | 15 +++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'base') diff --git a/base/game.cpp b/base/game.cpp index 30fd5fc850..7dff13e5f2 100644 --- a/base/game.cpp +++ b/base/game.cpp @@ -96,3 +96,21 @@ void SaveStateDescriptor::setDeletableFlag(bool state) { setVal("is_deletable", state ? "true" : "false"); } +void SaveStateDescriptor::setSaveDate(int year, int month, int day) { + char buffer[32]; + snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year); + setVal("save_date", buffer); +} + +void SaveStateDescriptor::setSaveTime(int hour, int min) { + char buffer[32]; + snprintf(buffer, 32, "%.2d:%.2d", hour, min); + setVal("save_time", buffer); +} + +void SaveStateDescriptor::setPlayTime(int hours, int minutes) { + char buffer[32]; + snprintf(buffer, 32, "%.2d:%.2d", hours, minutes); + setVal("play_time", buffer); +} + diff --git a/base/game.h b/base/game.h index 6f9030c56f..8fd1b47422 100644 --- a/base/game.h +++ b/base/game.h @@ -187,6 +187,21 @@ public: const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); } void setThumbnail(Graphics::Surface *t); + + /** + * Sets the 'save_date' key properly, based on the given values + */ + void setSaveDate(int year, int month, int day); + + /** + * Sets the 'save_time' key properly, based on the given values + */ + void setSaveTime(int hour, int min); + + /** + * Sets the 'play_time' key properly, based on the given values + */ + void setPlayTime(int hours, int minutes); }; /** List of savestates. */ -- cgit v1.2.3 From a6dd4b7d4d8e3f5f4e63c20334f7f8b0ab9f0bef Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 17 Sep 2008 17:31:29 +0000 Subject: Moved base/game.* to engines/game.* svn-id: r34589 --- base/game.cpp | 116 ------------------------------- base/game.h | 210 --------------------------------------------------------- base/module.mk | 1 - 3 files changed, 327 deletions(-) delete mode 100644 base/game.cpp delete mode 100644 base/game.h (limited to 'base') diff --git a/base/game.cpp b/base/game.cpp deleted file mode 100644 index 7dff13e5f2..0000000000 --- a/base/game.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "base/game.h" -#include "base/plugins.h" -#include "graphics/surface.h" - - -const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list) { - const PlainGameDescriptor *g = list; - while (g->gameid) { - if (0 == scumm_stricmp(gameid, g->gameid)) - return g; - g++; - } - return 0; -} - -void GameDescriptor::updateDesc(const char *extra) { - // TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone. - // We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or - // the seperator (instead of '/' use ', ' or ' '). - const bool hasCustomLanguage = (language() != Common::UNK_LANG); - const bool hasCustomPlatform = (platform() != Common::kPlatformUnknown); - const bool hasExtraDesc = (extra && extra[0]); - - // Adapt the description string if custom platform/language is set. - if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) { - Common::String descr = description(); - - descr += " ("; - if (hasExtraDesc) - descr += extra; - if (hasCustomPlatform) { - if (hasExtraDesc) - descr += "/"; - descr += Common::getPlatformDescription(platform()); - } - if (hasCustomLanguage) { - if (hasExtraDesc || hasCustomPlatform) - descr += "/"; - descr += Common::getLanguageDescription(language()); - } - descr += ")"; - setVal("description", descr); - } -} - -void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) { - if (_thumbnail.get() == t) - return; - - _thumbnail = Common::SharedPtr(t, Graphics::SharedPtrSurfaceDeleter()); -} - -bool SaveStateDescriptor::getBool(const Common::String &key) const { - if (contains(key)) { - Common::String value = getVal(key); - if (value.equalsIgnoreCase("true") || - value.equalsIgnoreCase("yes") || - value.equals("1")) - return true; - if (value.equalsIgnoreCase("false") || - value.equalsIgnoreCase("no") || - value.equals("0")) - return false; - error("SaveStateDescriptor: %s '%s' has unknown value '%s' for boolean '%s'", - save_slot().c_str(), description().c_str(), value.c_str(), key.c_str()); - } - return false; -} - -void SaveStateDescriptor::setDeletableFlag(bool state) { - setVal("is_deletable", state ? "true" : "false"); -} - -void SaveStateDescriptor::setSaveDate(int year, int month, int day) { - char buffer[32]; - snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year); - setVal("save_date", buffer); -} - -void SaveStateDescriptor::setSaveTime(int hour, int min) { - char buffer[32]; - snprintf(buffer, 32, "%.2d:%.2d", hour, min); - setVal("save_time", buffer); -} - -void SaveStateDescriptor::setPlayTime(int hours, int minutes) { - char buffer[32]; - snprintf(buffer, 32, "%.2d:%.2d", hours, minutes); - setVal("play_time", buffer); -} - diff --git a/base/game.h b/base/game.h deleted file mode 100644 index 8fd1b47422..0000000000 --- a/base/game.h +++ /dev/null @@ -1,210 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BASE_GAME_H -#define BASE_GAME_H - -#include "common/str.h" -#include "common/array.h" -#include "common/hash-str.h" -#include "common/ptr.h" - -namespace Graphics { - struct Surface; -} - -/** - * A simple structure used to map gameids (like "monkey", "sword1", ...) to - * nice human readable and descriptive game titles (like "The Secret of Monkey Island"). - * This is a plain struct to make it possible to declare NULL-terminated C arrays - * consisting of PlainGameDescriptors. - */ -struct PlainGameDescriptor { - const char *gameid; - const char *description; -}; - -/** - * Given a list of PlainGameDescriptors, returns the first PlainGameDescriptor - * matching the given gameid. If not match is found return 0. - * The end of the list must marked by a PlainGameDescriptor with gameid equal to 0. - */ -const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list); - -/** - * A hashmap describing details about a given game. In a sense this is a refined - * version of PlainGameDescriptor, as it also contains a gameid and a description string. - * But in addition, platform and language settings, as well as arbitrary other settings, - * can be contained in a GameDescriptor. - * This is an essential part of the glue between the game engines and the launcher code. - */ -class GameDescriptor : public Common::StringMap { -public: - GameDescriptor() { - setVal("gameid", ""); - setVal("description", ""); - } - - GameDescriptor(const PlainGameDescriptor &pgd) { - setVal("gameid", pgd.gameid); - setVal("description", pgd.description); - } - - GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l = Common::UNK_LANG, - Common::Platform p = Common::kPlatformUnknown) { - setVal("gameid", g); - setVal("description", d); - if (l != Common::UNK_LANG) - setVal("language", Common::getLanguageCode(l)); - if (p != Common::kPlatformUnknown) - setVal("platform", Common::getPlatformCode(p)); - } - - /** - * Update the description string by appending (LANG/PLATFORM/EXTRA) to it. - */ - void updateDesc(const char *extra = 0); - - Common::String &gameid() { return getVal("gameid"); } - Common::String &description() { return getVal("description"); } - const Common::String &gameid() const { return getVal("gameid"); } - const Common::String &description() const { return getVal("description"); } - Common::Language language() const { return contains("language") ? Common::parseLanguage(getVal("language")) : Common::UNK_LANG; } - Common::Platform platform() const { return contains("platform") ? Common::parsePlatform(getVal("platform")) : Common::kPlatformUnknown; } - - const Common::String &preferredtarget() const { - return contains("preferredtarget") ? getVal("preferredtarget") : getVal("gameid"); - } -}; - -/** List of games. */ -class GameList : public Common::Array { -public: - GameList() {} - GameList(const GameList &list) : Common::Array(list) {} - GameList(const PlainGameDescriptor *g) { - while (g->gameid) { - push_back(GameDescriptor(g->gameid, g->description)); - g++; - } - } -}; - -/** - * A hashmap describing details about a given save state. - * TODO - * Guaranteed to contain save_slot, filename and description values. - * Additional ideas: Playtime, creation date, thumbnail, ... - */ -class SaveStateDescriptor : public Common::StringMap { -protected: - Common::SharedPtr _thumbnail; // can be 0 - -public: - SaveStateDescriptor() : _thumbnail() { - setVal("save_slot", "-1"); // FIXME: default to 0 (first slot) or to -1 (invalid slot) ? - setVal("description", ""); - setVal("filename", ""); - } - - SaveStateDescriptor(int s, const Common::String &d, const Common::String &f) : _thumbnail() { - char buf[16]; - sprintf(buf, "%d", s); - setVal("save_slot", buf); - setVal("description", d); - setVal("filename", f); - } - - SaveStateDescriptor(const Common::String &s, const Common::String &d, const Common::String &f) : _thumbnail() { - setVal("save_slot", s); - setVal("description", d); - setVal("filename", f); - } - - /** The saveslot id, as it would be passed to the "-x" command line switch. */ - Common::String &save_slot() { return getVal("save_slot"); } - - /** The saveslot id, as it would be passed to the "-x" command line switch (read-only variant). */ - const Common::String &save_slot() const { return getVal("save_slot"); } - - /** A human readable description of the save state. */ - Common::String &description() { return getVal("description"); } - - /** A human readable description of the save state (read-only variant). */ - const Common::String &description() const { return getVal("description"); } - - /** The filename of the savestate, for use with the SaveFileManager API. */ - Common::String &filename() { return getVal("filename"); } - - /** The filename of the savestate, for use with the SaveFileManager API (read-only variant). */ - const Common::String &filename() const { return getVal("filename"); } - - /** Optional entries only included when querying via MetaEngine::querySaveMetaInfo */ - - /** - * Returns the value of a given key as boolean. - * It accepts 'true', 'yes' and '1' for true and - * 'false', 'no' and '0' for false. - * (FIXME:) On unknown value it errors out ScummVM. - * On unknown key it returns false as default. - */ - bool getBool(const Common::String &key) const; - - /** - * Sets the 'is_deletable' key, which indicates, if the - * given savestate is safe for deletion. - */ - void setDeletableFlag(bool state); - - /** - * Return a thumbnail graphics surface representing the savestate visually - * This is usually a scaled down version of the game graphics. The size - * should be either 160x100 or 160x120 pixels, depending on the aspect - * ratio of the game. If another ratio is required, contact the core team. - */ - const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); } - - void setThumbnail(Graphics::Surface *t); - - /** - * Sets the 'save_date' key properly, based on the given values - */ - void setSaveDate(int year, int month, int day); - - /** - * Sets the 'save_time' key properly, based on the given values - */ - void setSaveTime(int hour, int min); - - /** - * Sets the 'play_time' key properly, based on the given values - */ - void setPlayTime(int hours, int minutes); -}; - -/** List of savestates. */ -typedef Common::Array SaveStateList; - -#endif diff --git a/base/module.mk b/base/module.mk index dd89c5fb2d..f12a710920 100644 --- a/base/module.mk +++ b/base/module.mk @@ -3,7 +3,6 @@ MODULE := base MODULE_OBJS := \ main.o \ commandLine.o \ - game.o \ plugins.o \ version.o -- cgit v1.2.3 From 7166d43774e0f790415bdf52a95b2bc5c28f020b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 23 Sep 2008 16:40:41 +0000 Subject: Fix for bug #2120780 "GUI: gui-theme command-line option ignored", '-f' and '-g' command line switch behavior. svn-id: r34637 --- base/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 3e560aa605..d571363f4a 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -68,6 +68,17 @@ static bool launcherDialog(OSystem &system) { system.setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); system.endGFXTransaction(); + // When starting up launcher for the first time, the user might have specified + // a --gui-theme option, to allow that option to be working, we need to initialize + // GUI here. + // FIXME: Find a nicer way to allow --gui-theme to be working + GUI::NewGui::instance(); + + // Discard any command line options. Those that affect the graphics + // mode and the others (like bootparam etc.) should not + // blindly be passed to the first game launched from the launcher. + ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear(); + // Set initial window caption system.setWindowCaption(gScummVMFullVersion); @@ -275,15 +286,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) { system.initBackend(); // Unless a game was specified, show the launcher dialog - if (0 == ConfMan.getActiveDomain()) { - // Discard any command line options. Those that affect the graphics - // mode etc. already have should have been handled by the backend at - // this point. And the others (like bootparam etc.) should not - // blindly be passed to the first game launched from the launcher. - ConfMan.getDomain(Common::ConfigManager::kTransientDomain)->clear(); - + if (0 == ConfMan.getActiveDomain()) launcherDialog(system); - } // FIXME: We're now looping the launcher. This, of course, doesn't // work as well as it should. In theory everything should be destroyed -- cgit v1.2.3