added option for window icon file to run-time special edition support
authorHolger Schemel <info@artsoft.org>
Wed, 15 Apr 2015 07:26:04 +0000 (09:26 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 15 Apr 2015 07:26:04 +0000 (09:26 +0200)
ChangeLog
src/files.c
src/libgame/sdl.c
src/libgame/system.c
src/libgame/system.h
src/main.c
src/main.h

index 9c67528f4129d25a08a97cc17367ae1d0ebd55f1..4d7295a6db4a0e333c20ab2cd0c86b74323a6b28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-04-15
+       * added option "program_icon_file" to run-time "special edition" support
+
 2015-04-14
        * added run-time "special edition" support;
          this change is especially targeted to the "R'n'D jue" special edition
index 62bab2023a81ae4acb279af213678824a6d0dec6..6382467a7cace58ca39ef89e9eab7b4e4b13e2ea 100644 (file)
@@ -8028,16 +8028,17 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_INT_PROGRAM_WEBSITE                3
 #define SETUP_TOKEN_INT_PROGRAM_COPYRIGHT      4
 #define SETUP_TOKEN_INT_PROGRAM_COMPANY                5
-#define SETUP_TOKEN_INT_DEFAULT_GRAPHICS_SET   6
-#define SETUP_TOKEN_INT_DEFAULT_SOUNDS_SET     7
-#define SETUP_TOKEN_INT_DEFAULT_MUSIC_SET      8
-#define SETUP_TOKEN_INT_FALLBACK_GRAPHICS_FILE 9
-#define SETUP_TOKEN_INT_FALLBACK_SOUNDS_FILE   10
-#define SETUP_TOKEN_INT_FALLBACK_MUSIC_FILE    11
-#define SETUP_TOKEN_INT_DEFAULT_LEVEL_SERIES   12
-#define SETUP_TOKEN_INT_CHOOSE_FROM_TOP_LEVELDIR 13
-
-#define NUM_INTERNAL_SETUP_TOKENS              14
+#define SETUP_TOKEN_INT_PROGRAM_ICON_FILE      6
+#define SETUP_TOKEN_INT_DEFAULT_GRAPHICS_SET   7
+#define SETUP_TOKEN_INT_DEFAULT_SOUNDS_SET     8
+#define SETUP_TOKEN_INT_DEFAULT_MUSIC_SET      9
+#define SETUP_TOKEN_INT_FALLBACK_GRAPHICS_FILE 10
+#define SETUP_TOKEN_INT_FALLBACK_SOUNDS_FILE   11
+#define SETUP_TOKEN_INT_FALLBACK_MUSIC_FILE    12
+#define SETUP_TOKEN_INT_DEFAULT_LEVEL_SERIES   13
+#define SETUP_TOKEN_INT_CHOOSE_FROM_TOP_LEVELDIR 14
+
+#define NUM_INTERNAL_SETUP_TOKENS              15
 
 /* options setup */
 #define SETUP_TOKEN_OPTIONS_VERBOSE            0
@@ -8200,6 +8201,7 @@ static struct TokenInfo internal_setup_tokens[] =
   { TYPE_STRING, &sxi.program_website,         "program_website"       },
   { TYPE_STRING, &sxi.program_copyright,       "program_copyright"     },
   { TYPE_STRING, &sxi.program_company,         "program_company"       },
+  { TYPE_STRING, &sxi.program_icon_file,       "program_icon_file"     },
   { TYPE_STRING, &sxi.default_graphics_set,    "default_graphics_set"  },
   { TYPE_STRING, &sxi.default_sounds_set,      "default_sounds_set"    },
   { TYPE_STRING, &sxi.default_music_set,       "default_music_set"     },
@@ -8357,6 +8359,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->internal.program_copyright = getStringCopy(PROGRAM_COPYRIGHT_STRING);
   si->internal.program_company   = getStringCopy(PROGRAM_COMPANY_STRING);
 
+  si->internal.program_icon_file = getStringCopy(PROGRAM_ICON_FILENAME);
+
   si->internal.default_graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR);
   si->internal.default_sounds_set   = getStringCopy(SND_CLASSIC_SUBDIR);
   si->internal.default_music_set    = getStringCopy(MUS_CLASSIC_SUBDIR);
index 327d20b5be58a33ef9d664a594d4ae13dde4e73d..32635b5341a6f4ff7bfb6530742ae22482628e1b 100644 (file)
@@ -454,7 +454,7 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
 
   /* !!! SDL2 can only set the window icon if the window already exists !!! */
   /* set window icon */
-  SDLSetWindowIcon(program.sdl_icon_filename);
+  SDLSetWindowIcon(program.icon_filename);
 
   /* set window and icon title */
 #if defined(TARGET_SDL2)
index 9a0bed5a93e27442626a319da746fe613b655475..1088f17cc657b5c7229eb2b6bcebc47a76f18a43 100644 (file)
@@ -67,7 +67,7 @@ int                   FrameCounter = 0;
 void InitProgramInfo(char *argv0, char *config_filename,
                     char *userdata_subdir, char *userdata_subdir_unix,
                     char *program_title, char *icon_title,
-                    char *sdl_icon_filename, char *cookie_prefix,
+                    char *icon_filename, char *cookie_prefix,
                     int program_version)
 {
   program.command_basepath = getBasePath(argv0);
@@ -83,7 +83,7 @@ void InitProgramInfo(char *argv0, char *config_filename,
   program.window_title = "(undefined)";
   program.icon_title = icon_title;
 
-  program.sdl_icon_filename = sdl_icon_filename;
+  program.icon_filename = icon_filename;
 
   program.cookie_prefix = cookie_prefix;
 
index d0a22f24ff030bc9d609626e9ea94782d69847ed..b2840a2456f4f337b06a34d182434f2eadfc8321 100644 (file)
@@ -673,7 +673,7 @@ struct ProgramInfo
   char *window_title;
   char *icon_title;
 
-  char *sdl_icon_filename;
+  char *icon_filename;
 
   char *cookie_prefix;
 
@@ -945,6 +945,8 @@ struct SetupInternalInfo
   char *program_copyright;
   char *program_company;
 
+  char *program_icon_file;
+
   char *default_graphics_set;
   char *default_sounds_set;
   char *default_music_set;
index 1e9124777cf9a13e80b6866339d075efa7b8f883..5bc7e681553d3d85e9254fa16ad0b9adfa731bae 100644 (file)
@@ -5630,6 +5630,7 @@ static void InitProgramConfig(char *command_filename)
   char *command_basename = getBaseName(command_filename);
   char *config_filename = getProgramConfigFilename(command_filename);
   char *program_title = PROGRAM_TITLE_STRING;
+  char *program_icon_file = PROGRAM_ICON_FILENAME;
   char *userdata_subdir;
   char *userdata_subdir_unix;
 
@@ -5642,6 +5643,11 @@ static void InitProgramConfig(char *command_filename)
       strlen(setup.internal.program_title) > 0)
     program_title = getStringCopy(setup.internal.program_title);
 
+  // set program icon file from potentially redefined program icon file
+  if (setup.internal.program_icon_file != NULL &&
+      strlen(setup.internal.program_icon_file) > 0)
+    program_icon_file = getStringCopy(setup.internal.program_icon_file);
+
   // strip trailing executable suffix from command basename
   if (strSuffix(command_basename, ".exe"))
     command_basename[strlen(command_basename) - 4] = '\0';
@@ -5662,7 +5668,7 @@ static void InitProgramConfig(char *command_filename)
                  userdata_subdir_unix,
                  program_title,
                  program_title,
-                 SDL_ICON_FILENAME,
+                 program_icon_file,
                  COOKIE_PREFIX,
                  GAME_VERSION_ACTUAL);
 }
index 5b919cd3efd764edec0cf685e78eb1d531032db4..812f09516a44ddb1cdfb97cad08d55577e7a56b9 100644 (file)
 #define PROGRAM_COPYRIGHT_STRING       "Copyright \xa9""1995-2015 by Holger Schemel"
 #define PROGRAM_COMPANY_STRING         "A Game by Artsoft Entertainment"
 
+#define PROGRAM_ICON_FILENAME          "RocksIcon32x32.png"
+
 #define COOKIE_PREFIX                  "ROCKSNDIAMONDS"
 
 #define USERDATA_DIRECTORY_OTHER       "userdata"
 
-#define SDL_ICON_FILENAME              "RocksIcon32x32.png"
-
 /* file version numbers for resource files (levels, tapes, score, setup, etc.)
 ** currently supported/known file version numbers:
 **     1.0 (old)