From be5422f7ad68048c4d293cc791864b8e1288b5de Mon Sep 17 00:00:00 2001 From: Pete Gordon Date: Wed, 31 Dec 2008 11:04:35 +0000 Subject: [PATCH] FINALLY fixed the load/save bugs in OS4. It was just a stupid mistake in io.h... wrong seperator! git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@446 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- io.h | 167 +++++++++++++++++++++++++++++++++++------------------ loadsave.c | 5 +- 2 files changed, 113 insertions(+), 59 deletions(-) diff --git a/io.h b/io.h index 2742e57e..2aa6ee7b 100644 --- a/io.h +++ b/io.h @@ -1,57 +1,112 @@ -/* Grafx2 - The Ultimate 256-color bitmap paint program +/* Grafx2 - The Ultimate 256-color bitmap paint program + + + + Copyright 2008 Yves Rizoud + + Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) + + + + Grafx2 is free software; you can redistribute it and/or + + modify it under the terms of the GNU General Public License + + as published by the Free Software Foundation; version 2 + + of the License. + + + + Grafx2 is distributed in the hope that it will be useful, + + but WITHOUT ANY WARRANTY; without even the implied warranty of + + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + + GNU General Public License for more details. + + + + You should have received a copy of the GNU General Public License + + along with Grafx2; if not, see or + + write to the Free Software Foundation, Inc., + + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + + + +word endian_magic16(word x); + +dword endian_magic32(dword x); + + + +int read_byte(FILE *Fichier, byte *Dest); + +int write_byte(FILE *Fichier, byte Byte); + + + +int read_bytes(FILE *Fichier, void *Dest, size_t Taille); + +int write_bytes(FILE *Fichier, void *Dest, size_t Taille); + + + +int read_word_le(FILE *Fichier, word *Dest); + +int write_word_le(FILE *Fichier, word Mot); + +int read_dword_le(FILE *Fichier, dword *Dest); + +int write_dword_le(FILE *Fichier, dword Mot); + + + +int read_word_be(FILE *Fichier, word *Dest); + +int write_word_be(FILE *Fichier, word Mot); + +int read_dword_be(FILE *Fichier, dword *Dest); + +int write_dword_be(FILE *Fichier, dword Mot); + + + +void Extraire_nom_fichier(char *Destination, const char *Source); + +void Extraire_chemin(char *Destination, const char *Source); + + + +char * Position_dernier_slash(const char * Chaine); + - Copyright 2008 Yves Rizoud - Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) - - Grafx2 is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 - of the License. - - Grafx2 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Grafx2; if not, see or - write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -word endian_magic16(word x); -dword endian_magic32(dword x); - -int read_byte(FILE *Fichier, byte *Dest); -int write_byte(FILE *Fichier, byte Byte); - -int read_bytes(FILE *Fichier, void *Dest, size_t Taille); -int write_bytes(FILE *Fichier, void *Dest, size_t Taille); - -int read_word_le(FILE *Fichier, word *Dest); -int write_word_le(FILE *Fichier, word Mot); -int read_dword_le(FILE *Fichier, dword *Dest); -int write_dword_le(FILE *Fichier, dword Mot); - -int read_word_be(FILE *Fichier, word *Dest); -int write_word_be(FILE *Fichier, word Mot); -int read_dword_be(FILE *Fichier, dword *Dest); -int write_dword_be(FILE *Fichier, dword Mot); - -void Extraire_nom_fichier(char *Destination, const char *Source); -void Extraire_chemin(char *Destination, const char *Source); - -char * Position_dernier_slash(const char * Chaine); - -#if defined(__amigaos4__) || defined(__WIN32__) - #define SEPARATEUR_CHEMIN "\\" -#else - #define SEPARATEUR_CHEMIN "/" -#endif - -// Détermine si un fichier passé en paramètre existe ou non dans le -// répertoire courant. -int Fichier_existe(char * Fichier); -// Détermine si un répertoire passé en paramètre existe ou non dans le -// répertoire courant. -int Repertoire_existe(char * Repertoire); +#if defined(__WIN32__) + #define SEPARATEUR_CHEMIN "\\" + +#else + + #define SEPARATEUR_CHEMIN "/" + +#endif + + + +// Détermine si un fichier passé en paramètre existe ou non dans le + +// répertoire courant. + +int Fichier_existe(char * Fichier); + +// Détermine si un répertoire passé en paramètre existe ou non dans le + +// répertoire courant. + +int Repertoire_existe(char * Repertoire); + diff --git a/loadsave.c b/loadsave.c index ce1ab3d2..e34f4fbf 100644 --- a/loadsave.c +++ b/loadsave.c @@ -487,7 +487,6 @@ void Charger_image(byte Image) // Si on a su déterminer avec succès le format du fichier: if (!Erreur_fichier) { - // On peut charger le fichier: Image_24b=0; Format_Load[Format](); @@ -896,7 +895,7 @@ void Test_PKM(void) Nom_fichier_complet(Nom_du_fichier,0); - + Erreur_fichier=1; // Ouverture du fichier @@ -937,7 +936,7 @@ void Load_PKM(void) Nom_fichier_complet(Nom_du_fichier,0); Erreur_fichier=0; - + if ((Fichier=fopen(Nom_du_fichier, "rb"))) { stat(Nom_du_fichier,&Informations_Fichier);