Load "default.pal" at startup

This commit is contained in:
Thomas Bernard 2018-12-08 18:26:52 +01:00
parent 0761b3005c
commit ec4ad8adb2
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
2 changed files with 29 additions and 0 deletions

View File

@ -1136,6 +1136,28 @@ int Init_program(int argc,char * argv[])
case 0:
if (Config.Opening_message)
Button_Message_initial();
// Load default palette
{
FILE * f;
Init_context_layered_image(&context, DEFAULTPAL_FILENAME, Config_directory);
context.Type = CONTEXT_PALETTE;
context.Format = FORMAT_PAL;
f = Open_file_read(&context);
if (f != NULL) // silently fail if the file cannot be open
{
fclose(f);
Load_image(&context);
if (File_error == 0)
{
Hide_cursor();
Compute_optimal_menu_colors(Main.palette);
Display_menu();
Display_cursor();
memcpy(Spare.palette, Main.palette, sizeof(T_Palette));
}
}
Destroy_context(&context);
}
break;
case 2:

View File

@ -122,6 +122,13 @@ void Set_config_directory(const char * program_dir, char * config_dir);
#define INIDEF_FILENAME "gfx2def.ini"
#endif
/// Name of the default palette file
#if defined (__MINT__)
#define DEFAULTPAL_FILENAME "DEFAULT.PAL"
#else
#define DEFAULTPAL_FILENAME "default.pal"
#endif
/// Prefix for filenames of safety backups (main)
#if defined (__MINT__)
#define SAFETYBACKUP_PREFIX_A "A"