aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-10-28 09:03:02 +0000
committerJames Brown2002-10-28 09:03:02 +0000
commit959a9acf1456f2b39a3b8a20779c71a2637754d2 (patch)
treed9bf3ded96371a8e958d17ce772a8b5b831aa067
parent2e027179e030600a58ee84cd52780b201f817232 (diff)
downloadscummvm-rg350-959a9acf1456f2b39a3b8a20779c71a2637754d2.tar.gz
scummvm-rg350-959a9acf1456f2b39a3b8a20779c71a2637754d2.tar.bz2
scummvm-rg350-959a9acf1456f2b39a3b8a20779c71a2637754d2.zip
Add support for aliased scummvm config entries.
Eg: [germandott] path=/games/german/dott gameid=tentacle description=the german version of DOTT I havn't finished the Launcher changes to show aliased entries yet, as I need to parse the whole domainmap to do so. svn-id: r5341
-rw-r--r--README10
-rw-r--r--common/config-file.cpp25
-rw-r--r--common/config-file.h7
-rw-r--r--common/gameDetector.cpp11
-rw-r--r--common/gameDetector.h1
-rw-r--r--gui/launcher.cpp16
-rw-r--r--scumm/saveload.cpp2
-rw-r--r--scumm/scumm.h3
-rw-r--r--scumm/scummvm.cpp3
9 files changed, 62 insertions, 16 deletions
diff --git a/README b/README
index 425b9fa2a2..68de5c546a 100644
--- a/README
+++ b/README
@@ -123,11 +123,6 @@ the section on Reporting Bugs.
way, we do not know where to buy or download a copy of this
game. Petition LucasArts to re-release it :)
-
- The Dig:
- - Walking around the Nexus room may leave trails of Boston
- at the 'seam' of the circular room
-
All CD games:
- If you are experiencing random crashes, and your game
plays music from CD, you have encountered a Windows bug.
@@ -492,6 +487,11 @@ An example config file is as follows:
fullscreen=true
savepath=C:\saves\
+ [germandott]
+ gameid=tentacle
+ path=C:\german\tentacle\
+ description=German version of DOTT
+
[tentacle]
path=C:\tentacle\
nosubtitles=true
diff --git a/common/config-file.cpp b/common/config-file.cpp
index d772dff812..699c959eb0 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -238,3 +238,28 @@ void Config::set_writing(bool w)
{
willwrite = w;
}
+
+const int Config::count_domains() {
+ int count = 0;
+ DomainMap::Iterator d, end(domains.end());
+ for (d = domains.begin(); d != end; ++d)
+ count++;
+
+ return 0;
+}
+
+int Config::get_domains(char (*ptr)[100]) {
+ int index = 0;
+ DomainMap::Iterator d, end(domains.end());
+ for (d = domains.begin(); d != end; ++d) {
+ //printf("Key %d is %s\n", index, d->_key.c_str());
+ strcpy(ptr[index], d->_key.c_str());
+ index++;
+
+ if (index>99)
+ return 99;
+ }
+
+ return index;
+}
+
diff --git a/common/config-file.h b/common/config-file.h
index 5372e9cefe..c581e0181d 100644
--- a/common/config-file.h
+++ b/common/config-file.h
@@ -30,6 +30,8 @@
class Config {
public:
typedef ScummVM::String String;
+ typedef ScummVM::StringMap StringMap;
+ typedef ScummVM::Map<String, StringMap> DomainMap;
Config (const String & = String("config.cfg"), const String & = String("default"));
const char *get(const String &key, const String &dom = String()) const;
@@ -49,10 +51,9 @@ public:
void merge_config(const Config &);
void set_writing(bool);
+ const int count_domains();
+ int Config::get_domains(char (*ptr)[100]);
protected:
- typedef ScummVM::StringMap StringMap;
- typedef ScummVM::Map<String, StringMap> DomainMap;
-
DomainMap domains;
String filename;
String defaultDomain;
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 615220c863..ed129e4397 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -518,13 +518,18 @@ const VersionSettings version_settings[] = {
bool GameDetector::detectGame()
{
const VersionSettings *gnl = version_settings;
-
+ char *detectGame;
_gameId = 0;
_gameText.clear();
+
+ if (!(detectGame = (char*)g_config->get("gameid")))
+ detectGame = (char*)_gameFileName.c_str();
+ printf("Looking for %s\n", detectGame);
+
do {
- if (!scumm_stricmp(_gameFileName.c_str(), gnl->filename)) {
+ if (!scumm_stricmp(detectGame, gnl->filename)) {
_gameId = gnl->id;
-
+ _gameRealName = gnl->filename;
_features = gnl->features;
_gameText = gnl->gamename;
debug(1, "Detected game '%s', version %d.%d.%d",
diff --git a/common/gameDetector.h b/common/gameDetector.h
index 0e10f62484..9799e25b86 100644
--- a/common/gameDetector.h
+++ b/common/gameDetector.h
@@ -72,6 +72,7 @@ public:
int _midi_driver;
String _gameFileName;
String _gameText;
+ String _gameRealName;
uint32 _features;
int _gfx_driver;
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index f0c3ad3b7d..80494f79e6 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -70,13 +70,25 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector)
const VersionSettings *v = version_settings;
ScummVM::StringList l;
-
// TODO - maybe only display those games for which settings are known
// (i.e. a path to the game data was set and is accesible) ?
+
+
+ char domains[255][100];
+ int count = g_config->get_domains(domains);
+ //printf("First domain is %s, out of %d\n", domains[0], count);
while (v->filename && v->gamename) {
if (g_config->has_domain(v->filename)) {
- String name = v->gamename;
+ String name;
+ char *txtname;
int pos = 0, size = l.size();
+
+ if ((txtname = (char*)g_config->get("description", v->filename))) {
+ name = txtname;
+ } else {
+ name = v->gamename;
+ }
+
while (pos < size && (name > l[pos]))
pos++;
l.insert_at(pos, name);
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 228bc09b07..eb3bb70eb6 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -181,7 +181,7 @@ void Scumm::makeSavegameName(char *out, int slot, bool compatible)
const char *dir = getSavePath();
// snprintf should be used here, but it's not portable enough
- sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot);
+ sprintf(out, "%s%s.%c%.2d", dir, _game_name, compatible ? 'c' : 's', slot);
}
bool Scumm::getSavegameName(int slot, char *desc)
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 46485e3918..9117c44d7a 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -571,7 +571,8 @@ public:
File _fileHandle;
char *_resFilePrefix, *_resFilePath;
uint32 _fileOffset;
- char *_exe_name;
+ char *_exe_name; // This is the name we use for opening resource files
+ char *_game_name; // This is the game the user calls it, so use for saving
bool _dynamicRoomOffsets;
byte _resourceMapper[128];
uint32 _allocatedSize;
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index b215529764..78c430f205 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -80,7 +80,8 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_debugMode = detector->_debugMode;
_bootParam = detector->_bootParam;
- _exe_name = (char*)detector->_gameFileName.c_str();
+ _exe_name = (char*)detector->_gameRealName.c_str();
+ _game_name = (char*)detector->_gameFileName.c_str();
_gameId = detector->_gameId;
_features = detector->_features;
_soundCardType = detector->_soundCardType;