AmigaOS 4 port from xeron.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@253 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-10-14 19:45:39 +00:00
parent 70a750e187
commit ff9fc1633b
8 changed files with 2867 additions and 2812 deletions

17
aide.c
View File

@ -35,8 +35,10 @@
#ifdef __linux__ #ifdef __linux__
#include <sys/vfs.h> #include <sys/vfs.h>
#else #else
#ifndef __amigaos4__
#include <windows.h> #include <windows.h>
#endif #endif
#endif
// -- Menu d'aide ----------------------------------------------------------- // -- Menu d'aide -----------------------------------------------------------
@ -304,8 +306,12 @@ void Bouton_Stats(void)
struct statfs Informations_Disque; struct statfs Informations_Disque;
uint64_t Taille = 0; uint64_t Taille = 0;
#else #else
unsigned __int64 Taille; #ifdef __amigaos4__
ULARGE_INTEGER tailleU; uint64_t Taille = 0;
#else
unsigned __int64 Taille;
ULARGE_INTEGER tailleU;
#endif
#endif #endif
@ -347,8 +353,11 @@ void Bouton_Stats(void)
statfs(Principal_Repertoire_courant,&Informations_Disque); statfs(Principal_Repertoire_courant,&Informations_Disque);
Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize; Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize;
#else #else
GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL); #ifdef __amigaos4__
Taille = tailleU.QuadPart; #else
GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL);
Taille = tailleU.QuadPart;
#endif
#endif #endif
if(Taille > (100ULL*1024*1024*1024)) if(Taille > (100ULL*1024*1024*1024))

View File

@ -39,6 +39,9 @@
#ifdef __linux__ #ifdef __linux__
#include <dirent.h> #include <dirent.h>
#define isHidden(Enreg) ((Enreg)->d_name[0]=='.') #define isHidden(Enreg) ((Enreg)->d_name[0]=='.')
#elif defined(__amigaos4__)
#include <dirent.h>
#define isHidden(Enreg) (0)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
#include <direct.h> #include <direct.h>
#define isHidden(Enreg) ((Enreg)->d_attr & _A_HIDDEN) #define isHidden(Enreg) ((Enreg)->d_attr & _A_HIDDEN)

View File

@ -29,7 +29,7 @@
//SDL //SDL
#include <SDL.h> #include <SDL.h>
#include <SDL_image.h> #include <SDL/SDL_image.h>
#include <SDL_events.h> #include <SDL_events.h>
//#include <SDL_gfxPrimitives.h> //#include <SDL_gfxPrimitives.h>
@ -587,7 +587,13 @@ void Setup()
/* Checks if we can write the config file */ /* Checks if we can write the config file */
bool Verifier_ecriture_possible() bool Verifier_ecriture_possible()
{ {
#ifdef __amigaos4__
// TODO: Make it work :)
return 1;
#else
// Doesn't work on OS4.
return access("./",W_OK) == 0; return access("./",W_OK) == 0;
#endif
} }
/* Save the config file */ /* Save the config file */

4426
init.c

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// Diverses fonctions qui existaient sous dos mais pas sous linux... // Diverses fonctions qui existaient sous dos mais pas sous linux...
#ifdef __linux__ #if defined(__linux__)||defined(__amigaos4__)
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>

1203
main.c

File diff suppressed because it is too large Load Diff

View File

@ -402,15 +402,23 @@ int Charger_INI(struct S_Config * Conf)
Nom_du_fichier=(char *)malloc(256); Nom_du_fichier=(char *)malloc(256);
// On calcule le nom du fichier qu'on manipule: // On calcule le nom du fichier qu'on manipule:
#ifdef __amigaos4__
strcpy(Nom_du_fichier,"PROGDIR:gfx2.ini");
#else
strcpy(Nom_du_fichier,Repertoire_du_programme); strcpy(Nom_du_fichier,Repertoire_du_programme);
strcat(Nom_du_fichier,"gfx2.ini"); strcat(Nom_du_fichier,"gfx2.ini");
#endif
Fichier=fopen(Nom_du_fichier,"rb"); Fichier=fopen(Nom_du_fichier,"rb");
if (Fichier==0) if (Fichier==0)
{ {
// Si le fichier ini est absent on le relit depuis gfx2.dat // Si le fichier ini est absent on le relit depuis gfx2.dat
#ifdef __amigaos4__
strcpy(Nom_du_fichier,"PROGDIR:gfx2.dat");
#else
strcpy(Nom_du_fichier,Repertoire_du_programme); strcpy(Nom_du_fichier,Repertoire_du_programme);
strcat(Nom_du_fichier,"gfx2.dat"); strcat(Nom_du_fichier,"gfx2.dat");
#endif
Fichier=fopen(Nom_du_fichier,"rb"); Fichier=fopen(Nom_du_fichier,"rb");
if (Fichier == 0) if (Fichier == 0)
{ {

View File

@ -398,14 +398,22 @@ int Sauver_INI(struct S_Config * Conf)
Buffer=(char *)malloc(1024); Buffer=(char *)malloc(1024);
// On calcule les noms des fichiers qu'on manipule: // On calcule les noms des fichiers qu'on manipule:
#ifdef __amigaos4__
strcpy(Nom_du_fichier,"PROGDIR:gfx2.ini");
#else
strcpy(Nom_du_fichier,Repertoire_du_programme); strcpy(Nom_du_fichier,Repertoire_du_programme);
strcat(Nom_du_fichier,"gfx2.ini"); strcat(Nom_du_fichier,"gfx2.ini");
#endif
// On vérifie si le fichier INI existe // On vérifie si le fichier INI existe
if ((Ini_existe = Fichier_existe(Nom_du_fichier))) if ((Ini_existe = Fichier_existe(Nom_du_fichier)))
{ {
#ifdef __amigaos4__
strcpy(Nom_du_fichier_temporaire,"PROGDIR:gfx2.$$$");
#else
strcpy(Nom_du_fichier_temporaire,Repertoire_du_programme); strcpy(Nom_du_fichier_temporaire,Repertoire_du_programme);
strcat(Nom_du_fichier_temporaire,"gfx2.$$$"); strcat(Nom_du_fichier_temporaire,"gfx2.$$$");
#endif
// On renome l'ancienne version du fichier INI vers un fichier temporaire: // On renome l'ancienne version du fichier INI vers un fichier temporaire:
if (rename(Nom_du_fichier,Nom_du_fichier_temporaire)!=0) if (rename(Nom_du_fichier,Nom_du_fichier_temporaire)!=0)
@ -414,8 +422,12 @@ int Sauver_INI(struct S_Config * Conf)
} }
} }
// On récupère un fichier INI "propre" dans GFX2.DAT // On récupère un fichier INI "propre" dans GFX2.DAT
#ifdef __amigaos4__
strcpy(Nom_du_fichier_DAT,"PROGDIR:gfx2.dat");
#else
strcpy(Nom_du_fichier_DAT,Repertoire_du_programme); strcpy(Nom_du_fichier_DAT,Repertoire_du_programme);
strcat(Nom_du_fichier_DAT,"gfx2.dat"); strcat(Nom_du_fichier_DAT,"gfx2.dat");
#endif
Ancien_fichier=fopen(Nom_du_fichier_DAT,"rb"); Ancien_fichier=fopen(Nom_du_fichier_DAT,"rb");
if (Ancien_fichier==0) if (Ancien_fichier==0)
{ {