From 655116bd37138864870e9dbc70b4d35c8252291b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 16 Jan 2010 16:31:03 +0000 Subject: [PATCH] -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 --- gfx2def.ini | 2 ++ misc.c | 9 ++++++--- readini.c | 12 ++++++++++-- saveini.c | 7 +++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gfx2def.ini b/gfx2def.ini index 35ce7e3c..64d85ac0 100644 --- a/gfx2def.ini +++ b/gfx2def.ini @@ -344,5 +344,7 @@ ; ; Valid values are 1 to 255. Grid_XOR_color = 255; (Default 255) + + Pixel_ratio = 1; ; end of configuration diff --git a/misc.c b/misc.c index 4227bc37..e1d7854b 100644 --- a/misc.c +++ b/misc.c @@ -731,6 +731,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line, #include // 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 (a2.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); diff --git a/saveini.c b/saveini.c index 6a18f757..de57d625 100644 --- a/saveini.c +++ b/saveini.c @@ -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; } @@ -652,6 +653,12 @@ int Save_INI(T_Config * conf) values[0]=(conf->Grid_XOR_color); 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);