Save_C64(): add dropdown to choose save Format (FLI/multicolor/etc)
This commit is contained in:
parent
9f45f4ef4c
commit
fddc79c8e9
@ -2216,6 +2216,26 @@ void Save_NEO(T_IO_Context * context)
|
|||||||
|
|
||||||
//////////////////////////////////// C64 ////////////////////////////////////
|
//////////////////////////////////// C64 ////////////////////////////////////
|
||||||
|
|
||||||
|
/** C64 file formats
|
||||||
|
*/
|
||||||
|
enum c64_format
|
||||||
|
{
|
||||||
|
F_invalid = -1,
|
||||||
|
F_hires = 0, ///< 320x200
|
||||||
|
F_multi = 1, ///< 160x200
|
||||||
|
F_bitmap = 2, ///< 320x200 monochrome
|
||||||
|
F_fli = 3 ///< FLI (Flexible Line Interpretation)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** C64 file formats names
|
||||||
|
*/
|
||||||
|
static const char *c64_format_names[] = {
|
||||||
|
"Hires",
|
||||||
|
"Multicolor",
|
||||||
|
"Bitmap",
|
||||||
|
"FLI"
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for a C64 picture file
|
* Test for a C64 picture file
|
||||||
*
|
*
|
||||||
@ -2503,8 +2523,7 @@ void Load_C64(T_IO_Context * context)
|
|||||||
long file_size;
|
long file_size;
|
||||||
byte hasLoadAddr=0;
|
byte hasLoadAddr=0;
|
||||||
word load_addr;
|
word load_addr;
|
||||||
enum c64_format {F_invalid=-1, F_hires=0,F_multi=1,F_bitmap=2,F_fli=3} loadFormat = F_invalid;
|
enum c64_format loadFormat = F_invalid;
|
||||||
static const char *c64_format_names[]={"Hires","Multicolor","Bitmap","FLI"};
|
|
||||||
|
|
||||||
/// Set C64 Palette from http://www.pepto.de/projects/colorvic/
|
/// Set C64 Palette from http://www.pepto.de/projects/colorvic/
|
||||||
static const byte pal[48]={
|
static const byte pal[48]={
|
||||||
@ -2787,11 +2806,18 @@ void Load_C64(T_IO_Context * context)
|
|||||||
File_error = 1;
|
File_error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Save_C64_window(byte *saveWhat, byte *loadAddr)
|
/**
|
||||||
|
* Display the dialog for C64 save parameters
|
||||||
|
*
|
||||||
|
* @param save
|
||||||
|
* @return true to proceed, false to abort
|
||||||
|
*/
|
||||||
|
static int Save_C64_window(enum c64_format *saveFormat, byte *saveWhat, byte *loadAddr)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
T_Dropdown_button *what, *addr;
|
T_Dropdown_button *what, *addr;
|
||||||
|
T_Dropdown_button *format;
|
||||||
static const char * what_label[] = {
|
static const char * what_label[] = {
|
||||||
"All",
|
"All",
|
||||||
"Bitmap",
|
"Bitmap",
|
||||||
@ -2809,7 +2835,7 @@ int Save_C64_window(byte *saveWhat, byte *loadAddr)
|
|||||||
"$E000"
|
"$E000"
|
||||||
};
|
};
|
||||||
|
|
||||||
Open_window(200,120,"c64 settings");
|
Open_window(200,120,"C64 saving settings");
|
||||||
Window_set_normal_button(110,100,80,15,"Save",1,1,KEY_RETURN); // 1
|
Window_set_normal_button(110,100,80,15,"Save",1,1,KEY_RETURN); // 1
|
||||||
Window_set_normal_button(10,100,80,15,"Cancel",1,1,KEY_ESCAPE); // 2
|
Window_set_normal_button(10,100,80,15,"Cancel",1,1,KEY_ESCAPE); // 2
|
||||||
|
|
||||||
@ -2825,6 +2851,19 @@ int Save_C64_window(byte *saveWhat, byte *loadAddr)
|
|||||||
for (i=0; i<sizeof(address_label)/sizeof(address_label[0]); i++)
|
for (i=0; i<sizeof(address_label)/sizeof(address_label[0]); i++)
|
||||||
Window_dropdown_add_item(addr,i,address_label[i]);
|
Window_dropdown_add_item(addr,i,address_label[i]);
|
||||||
|
|
||||||
|
Print_in_window(13,46,"Format:",MC_Dark,MC_Light);
|
||||||
|
format = Window_set_dropdown_button(10,56,90,15,88,c64_format_names[*saveFormat],1, 0, 1, LEFT_SIDE,0); // 5
|
||||||
|
if (*saveFormat == F_hires || *saveFormat == F_bitmap)
|
||||||
|
{
|
||||||
|
Window_dropdown_add_item(format, F_hires, c64_format_names[F_hires]);
|
||||||
|
Window_dropdown_add_item(format, F_bitmap, c64_format_names[F_bitmap]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Window_dropdown_add_item(format, F_multi, c64_format_names[F_multi]);
|
||||||
|
Window_dropdown_add_item(format, F_fli, c64_format_names[F_fli]);
|
||||||
|
}
|
||||||
|
|
||||||
Update_window_area(0,0,Window_width,Window_height);
|
Update_window_area(0,0,Window_width,Window_height);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
@ -2843,6 +2882,11 @@ int Save_C64_window(byte *saveWhat, byte *loadAddr)
|
|||||||
GFX2_Log(GFX2_DEBUG, "Save_C64_Window() : addr=$%02x00 (%d)\n",*loadAddr,Window_attribute2);
|
GFX2_Log(GFX2_DEBUG, "Save_C64_Window() : addr=$%02x00 (%d)\n",*loadAddr,Window_attribute2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
*saveFormat = Window_attribute2;
|
||||||
|
GFX2_Log(GFX2_DEBUG, "Save_C64_Window() : format=%d\n", Window_attribute2);
|
||||||
|
break;
|
||||||
|
|
||||||
case 0: break;
|
case 0: break;
|
||||||
}
|
}
|
||||||
} while(button!=1 && button!=2);
|
} while(button!=1 && button!=2);
|
||||||
@ -3263,7 +3307,7 @@ int Save_C64_multi(T_IO_Context *context, byte saveWhat, byte loadAddr)
|
|||||||
// candidate background colors left ?
|
// candidate background colors left ?
|
||||||
if (cand==0)
|
if (cand==0)
|
||||||
{
|
{
|
||||||
Warning_message("No possible global background color found");
|
Warning_message("No possible global background color");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3436,6 +3480,7 @@ int Save_C64_fli(T_IO_Context * context, byte saveWhat, byte loadAddr)
|
|||||||
*/
|
*/
|
||||||
void Save_C64(T_IO_Context * context)
|
void Save_C64(T_IO_Context * context)
|
||||||
{
|
{
|
||||||
|
enum c64_format saveFormat = F_invalid;
|
||||||
static byte saveWhat=0, loadAddr=0;
|
static byte saveWhat=0, loadAddr=0;
|
||||||
|
|
||||||
if (((context->Width!=320) && (context->Width!=160)) || context->Height!=200)
|
if (((context->Width!=320) && (context->Width!=160)) || context->Height!=200)
|
||||||
@ -3445,24 +3490,37 @@ void Save_C64(T_IO_Context * context)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Save_C64_window(&saveWhat,&loadAddr))
|
saveFormat = (context->Width == 320) ? F_hires : F_multi;
|
||||||
|
|
||||||
|
GFX2_Log(GFX2_DEBUG, "Save_C64() extension : %s\n", context->File_name + strlen(context->File_name) - 4);
|
||||||
|
if (strcasecmp(context->File_name + strlen(context->File_name) - 4, ".fli") == 0)
|
||||||
|
saveFormat = F_fli;
|
||||||
|
|
||||||
|
if(!Save_C64_window(&saveFormat, &saveWhat,&loadAddr))
|
||||||
{
|
{
|
||||||
File_error = 1;
|
File_error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX2_Log(GFX2_DEBUG, "Save_C64() extension : %s\n", context->File_name + strlen(context->File_name) - 4);
|
switch (saveFormat)
|
||||||
if (strcasecmp(context->File_name + strlen(context->File_name) - 4, ".fli") == 0)
|
|
||||||
{
|
{
|
||||||
// FIXME moving FLI to a separate format in the fileselector would be smarter
|
case F_fli:
|
||||||
if (Main.backups->Pages->Nb_layers < 3)
|
if (Main.backups->Pages->Nb_layers < 3)
|
||||||
File_error = Save_C64_fli_monolayer(context, saveWhat, loadAddr);
|
File_error = Save_C64_fli_monolayer(context, saveWhat, loadAddr);
|
||||||
else
|
else
|
||||||
File_error = Save_C64_fli(context, saveWhat, loadAddr);
|
File_error = Save_C64_fli(context, saveWhat, loadAddr);
|
||||||
} else if (context->Width==320) {
|
break;
|
||||||
File_error = Save_C64_hires(context, saveWhat, loadAddr);
|
case F_multi:
|
||||||
} else {
|
|
||||||
File_error = Save_C64_multi(context, saveWhat, loadAddr);
|
File_error = Save_C64_multi(context, saveWhat, loadAddr);
|
||||||
|
break;
|
||||||
|
case F_bitmap:
|
||||||
|
saveWhat = 1; // force save bitmap
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 7)
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
|
#endif
|
||||||
|
case F_hires:
|
||||||
|
default:
|
||||||
|
File_error = Save_C64_hires(context, saveWhat, loadAddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user