[Scummvm-cvs-logs] SF.net SVN: scummvm:[41504] scummvm/trunk/backends/platform/dc

marcus_c at users.sourceforge.net marcus_c at users.sourceforge.net
Sun Jun 14 01:42:39 CEST 2009


Revision: 41504
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41504&view=rev
Author:   marcus_c
Date:     2009-06-13 23:42:39 +0000 (Sat, 13 Jun 2009)

Log Message:
-----------
Detected games with different language or platform are now
no longer treated as duplicates, even if they have the same
target and directory.  Also, pass these parameters to the
ConfMan, so that the correct version of the game is started.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/dc/dc.h
    scummvm/trunk/backends/platform/dc/dcmain.cpp
    scummvm/trunk/backends/platform/dc/selector.cpp

Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h	2009-06-13 23:04:26 UTC (rev 41503)
+++ scummvm/trunk/backends/platform/dc/dc.h	2009-06-13 23:42:39 UTC (rev 41504)
@@ -232,5 +232,5 @@
 extern int handleInput(struct mapledev *pad,
 		       int &mouse_x, int &mouse_y,
 		       byte &shiftFlags, Interactive *inter = NULL);
-extern bool selectGame(char *&, char *&, class Icon &);
+extern bool selectGame(char *&, char *&, Common::Language &, Common::Platform &, class Icon &);
 

Modified: scummvm/trunk/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/dcmain.cpp	2009-06-13 23:04:26 UTC (rev 41503)
+++ scummvm/trunk/backends/platform/dc/dcmain.cpp	2009-06-13 23:42:39 UTC (rev 41504)
@@ -234,8 +234,10 @@
 int DCLauncherDialog::runModal()
 {
   char *base = NULL, *dir = NULL;
+  Common::Language language = Common::UNK_LANG;
+  Common::Platform platform = Common::kPlatformUnknown;
 
-  if (!selectGame(base, dir, icon))
+  if (!selectGame(base, dir, language, platform, icon))
     g_system->quit();
 
   // Set the game path.
@@ -243,6 +245,14 @@
   if (dir != NULL)
     ConfMan.set("path", dir, base);
 
+  // Set the game language.
+  if (language != Common::UNK_LANG)
+    ConfMan.set("language", Common::getLanguageCode(language), base);
+
+  // Set the game platform.
+  if (platform != Common::kPlatformUnknown)
+    ConfMan.set("platform", Common::getPlatformCode(platform), base);
+
   // Set the target.
   ConfMan.setActiveDomain(base);
 

Modified: scummvm/trunk/backends/platform/dc/selector.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/selector.cpp	2009-06-13 23:04:26 UTC (rev 41503)
+++ scummvm/trunk/backends/platform/dc/selector.cpp	2009-06-13 23:42:39 UTC (rev 41504)
@@ -138,6 +138,8 @@
   char dir[256];
   char filename_base[256];
   char text[256];
+  Common::Language language;
+  Common::Platform platform;
   Icon icon;
   Label label;
 };
@@ -183,11 +185,15 @@
   icon.load(scummvm_icon, sizeof(scummvm_icon));
 }
 
-static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt)
+static bool uniqueGame(const char *base, const char *dir,
+		       Common::Language lang, Common::Platform plf,
+		       Game *games, int cnt)
 {
   while (cnt--)
     if (!strcmp(dir, games->dir) &&
-       !stricmp(base, games->filename_base))
+	!stricmp(base, games->filename_base) &&
+	lang == games->language &&
+	plf == games->platform)
       return false;
     else
       games++;
@@ -227,14 +233,20 @@
       if (curr_game < max) {
 	strcpy(games[curr_game].filename_base, ge->gameid().c_str());
 	strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
+	games[curr_game].language = ge->language();
+	games[curr_game].platform = ge->platform();
 	if (uniqueGame(games[curr_game].filename_base,
-		      games[curr_game].dir, games, curr_game)) {
+		       games[curr_game].dir,
+		       games[curr_game].language,
+		       games[curr_game].platform, games, curr_game)) {
 
 	  strcpy(games[curr_game].text, ge->description().c_str());
 #if 0
-	  printf("Registered game <%s> in <%s> <%s> because of <%s> <*>\n",
-		 games[curr_game].text, games[curr_game].dir,
-		 games[curr_game].filename_base,
+	  printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
+		 games[curr_game].text,
+		 (int)games[curr_game].language,
+		 (int)games[curr_game].platform,
+		 games[curr_game].dir, games[curr_game].filename_base,
 		 dirs[curr_dir-1].name);
 #endif
 	  curr_game++;
@@ -405,7 +417,7 @@
   }
 }
 
-bool selectGame(char *&ret, char *&dir_ret, Icon &icon)
+bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon)
 {
   Game *games = new Game[MAX_GAMES];
   int selected, num_games;
@@ -449,6 +461,8 @@
     dir_ret = the_game.dir;
 #endif
     ret = the_game.filename_base;
+    lang_ret = the_game.language;
+    plf_ret = the_game.platform;
     icon = the_game.icon;
     return true;
   } else


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list