[Scummvm-cvs-logs] CVS: scummvm/common config-file.cpp,1.6,1.7 config-file.h,1.4,1.5 gameDetector.cpp,1.23,1.24 gameDetector.h,1.8,1.9
James Brown
ender at users.sourceforge.net
Mon Oct 28 01:04:02 CET 2002
Update of /cvsroot/scummvm/scummvm/common
In directory usw-pr-cvs1:/tmp/cvs-serv23319/common
Modified Files:
config-file.cpp config-file.h gameDetector.cpp gameDetector.h
Log Message:
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.
Index: config-file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-file.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- config-file.cpp 8 Oct 2002 23:58:55 -0000 1.6
+++ config-file.cpp 28 Oct 2002 09:03:01 -0000 1.7
@@ -238,3 +238,28 @@
{
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;
+}
+
Index: config-file.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-file.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- config-file.h 29 Sep 2002 23:08:24 -0000 1.4
+++ config-file.h 28 Oct 2002 09:03:01 -0000 1.5
@@ -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 @@
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;
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- gameDetector.cpp 24 Oct 2002 09:40:20 -0000 1.23
+++ gameDetector.cpp 28 Oct 2002 09:03:01 -0000 1.24
@@ -518,13 +518,18 @@
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",
Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gameDetector.h 23 Oct 2002 12:56:30 -0000 1.8
+++ gameDetector.h 28 Oct 2002 09:03:01 -0000 1.9
@@ -72,6 +72,7 @@
int _midi_driver;
String _gameFileName;
String _gameText;
+ String _gameRealName;
uint32 _features;
int _gfx_driver;
More information about the Scummvm-git-logs
mailing list