-Save pixel ratio in infile
-Fix a bug if a wrong grid xor value was set (was mostly harmless) -Some cleanup. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1257 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
70a61a07ef
commit
655116bd37
@ -345,4 +345,6 @@
|
||||
; Valid values are 1 to 255.
|
||||
Grid_XOR_color = 255; (Default 255)
|
||||
|
||||
Pixel_ratio = 1;
|
||||
|
||||
; end of configuration
|
||||
|
||||
9
misc.c
9
misc.c
@ -731,6 +731,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
|
||||
#include <sys/sysinfo.h> // sysinfo() for free RAM
|
||||
#endif
|
||||
|
||||
|
||||
// Indique quelle est la mémoire disponible
|
||||
unsigned long Memory_free(void)
|
||||
{
|
||||
@ -786,6 +787,7 @@ short Round(float value)
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
// Arrondir le résultat d'une division à la valeur entière supérieure
|
||||
short Round_div_max(short numerator,short divisor)
|
||||
{
|
||||
@ -795,12 +797,14 @@ short Round_div_max(short numerator,short divisor)
|
||||
return (numerator/divisor)+1;
|
||||
}
|
||||
|
||||
|
||||
// Retourne le minimum entre deux nombres
|
||||
int Min(int a,int b)
|
||||
{
|
||||
return (a<b)?a:b;
|
||||
}
|
||||
|
||||
|
||||
// Retourne le maximum entre deux nombres
|
||||
int Max(int a,int b)
|
||||
{
|
||||
@ -808,7 +812,6 @@ int Max(int a,int b)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Fonction retournant le libellé d'une mode (ex: " 320x200")
|
||||
char * Mode_label(int mode)
|
||||
{
|
||||
@ -820,6 +823,7 @@ char * Mode_label(int mode)
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
// Trouve un mode video à partir d'une chaine: soit "window",
|
||||
// soit de la forme "320x200"
|
||||
// Renvoie -1 si la chaine n'est pas convertible
|
||||
@ -833,6 +837,5 @@ int Convert_videomode_arg(const char *argument)
|
||||
return mode_index;
|
||||
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
12
readini.c
12
readini.c
@ -394,13 +394,16 @@ int Load_INI_get_values(FILE * file,char * buffer,char * option_name,int nb_expe
|
||||
if ( ((++nb_values) == nb_expected_values) &&
|
||||
(upper_buffer[buffer_index]!='\0') )
|
||||
{
|
||||
// Too many values !
|
||||
free(upper_buffer);
|
||||
free(option_upper);
|
||||
return ERROR_INI_CORRUPTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (nb_values<nb_expected_values)
|
||||
{
|
||||
// Not enough values !
|
||||
free(upper_buffer);
|
||||
free(option_upper);
|
||||
return ERROR_INI_CORRUPTED;
|
||||
@ -416,7 +419,6 @@ int Load_INI_get_values(FILE * file,char * buffer,char * option_name,int nb_expe
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Load_INI(T_Config * conf)
|
||||
{
|
||||
FILE * file;
|
||||
@ -836,10 +838,16 @@ int Load_INI(T_Config * conf)
|
||||
// Optional, XOR color for grid overlay (>2.0)
|
||||
if (!Load_INI_get_values (file,buffer,"Grid_XOR_color",1,values))
|
||||
{
|
||||
if ((values[0]>0) || (values[0]<=255))
|
||||
if ((values[0]>0) && (values[0]<=255))
|
||||
conf->Grid_XOR_color=values[0];
|
||||
}
|
||||
|
||||
// Optional, "fake hardware zoom" factor (>2.1)
|
||||
if (!Load_INI_get_values (file, buffer,"Pixel_ratio",1,values))
|
||||
{
|
||||
Pixel_ratio = values[0];
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
free(filename);
|
||||
|
||||
@ -335,6 +335,7 @@ int Save_INI_set_values(FILE * old_file,FILE * new_file,char * buffer,char * opt
|
||||
free(result_buffer);
|
||||
free(upper_buffer);
|
||||
free(option_upper);
|
||||
DEBUG("END OF FILE",0);
|
||||
return ERROR_INI_CORRUPTED;
|
||||
}
|
||||
|
||||
@ -653,6 +654,12 @@ int Save_INI(T_Config * conf)
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Grid_XOR_color",1,values,0)))
|
||||
goto Erreur_Retour;
|
||||
|
||||
values[0]=(Pixel_ratio);
|
||||
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Pixel_ratio",1,values,0))) {
|
||||
DEBUG("saving pixel ratio",return_code);
|
||||
goto Erreur_Retour;
|
||||
}
|
||||
|
||||
Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);
|
||||
|
||||
fclose(Nouveau_fichier);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user