Patch from begasus to allow building under haiku and beos. The program is crashing when you launch it (segmentation violation).
I'm not sure the way to get the program directory we use is ok for beos, but the official way of doing that is using C++ code. Maybe it's time to switch to some more unix way to store the config files... This should also fix watcom build (very untested as i'm using mingw to cross compile windows builds now) Also added begasus to the credits screen. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@325 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									b11d9e3ff9
								
							
						
					
					
						commit
						3422eeff46
					
				
							
								
								
									
										30
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								Makefile
									
									
									
									
									
								
							@ -47,7 +47,31 @@ else
 | 
			
		||||
    NOTTF = 1
 | 
			
		||||
  else
 | 
			
		||||
 | 
			
		||||
    # Linux specific
 | 
			
		||||
  #BeOS specific
 | 
			
		||||
  ifeq ($(PLATFORM),BeOS)
 | 
			
		||||
    DELCOMMAND = rm -rf
 | 
			
		||||
    MKDIR = mkdir -p
 | 
			
		||||
    BIN = grafx2
 | 
			
		||||
    CFGBIN = gfxcfg
 | 
			
		||||
    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
			
		||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
			
		||||
    CC = gcc
 | 
			
		||||
    OBJDIR = obj/beos
 | 
			
		||||
  else
 | 
			
		||||
 | 
			
		||||
  #Haiku specific
 | 
			
		||||
  ifeq ($(PLATFORM),Haiku)
 | 
			
		||||
    DELCOMMAND = rm -rf
 | 
			
		||||
    MKDIR = mkdir -p
 | 
			
		||||
    BIN = grafx2
 | 
			
		||||
    CFGBIN = gfxcfg
 | 
			
		||||
    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
			
		||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
			
		||||
    CC = gcc
 | 
			
		||||
    OBJDIR = obj/haiku
 | 
			
		||||
  else
 | 
			
		||||
  
 | 
			
		||||
      # Linux specific
 | 
			
		||||
    DELCOMMAND = rm -rf
 | 
			
		||||
    MKDIR = mkdir -p
 | 
			
		||||
    ifdef WIN32CROSS
 | 
			
		||||
@ -68,6 +92,8 @@ else
 | 
			
		||||
    endif
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
#TrueType is optional: make NOTTF=1 to disable support and dependencies.
 | 
			
		||||
ifeq ($(NOTTF),1)
 | 
			
		||||
@ -77,7 +103,7 @@ ifeq ($(NOTTF),1)
 | 
			
		||||
  TTFLABEL = -nottf
 | 
			
		||||
else
 | 
			
		||||
  TTFCOPT = 
 | 
			
		||||
  TTFLOPT = -L/usr/local/lib -lSDL_ttf
 | 
			
		||||
  TTFLOPT = `sdl-config --libs` -lSDL_ttf
 | 
			
		||||
  TTFLIBS = libfreetype-6.dll SDL_ttf.dll
 | 
			
		||||
  TTFLABEL = 
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								aide.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								aide.c
									
									
									
									
									
								
							@ -45,9 +45,13 @@
 | 
			
		||||
  #endif
 | 
			
		||||
#else
 | 
			
		||||
#ifndef __amigaos4__
 | 
			
		||||
#ifndef __BEOS__
 | 
			
		||||
#ifndef __HAIKU__
 | 
			
		||||
    #include <windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern char SVNRevision[];
 | 
			
		||||
 | 
			
		||||
@ -317,7 +321,7 @@ void Bouton_Stats(void)
 | 
			
		||||
    struct statfs Informations_Disque;
 | 
			
		||||
    uint64_t Taille = 0;
 | 
			
		||||
  #else
 | 
			
		||||
    #ifdef __amigaos4__
 | 
			
		||||
    #if defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__)
 | 
			
		||||
      uint64_t Taille = 0;
 | 
			
		||||
    #else
 | 
			
		||||
      unsigned __int64 Taille;
 | 
			
		||||
@ -368,11 +372,11 @@ void Bouton_Stats(void)
 | 
			
		||||
  #ifdef __linux__
 | 
			
		||||
    statfs(Principal_Repertoire_courant,&Informations_Disque);
 | 
			
		||||
    Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize;
 | 
			
		||||
  #else
 | 
			
		||||
    #ifdef __amigaos4__
 | 
			
		||||
    #else
 | 
			
		||||
      GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL);
 | 
			
		||||
      Taille = tailleU.QuadPart;
 | 
			
		||||
      #if defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__)
 | 
			
		||||
    #else
 | 
			
		||||
     GetDiskFreeSpaceEx(Principal_Repertoire_courant,&tailleU,NULL,NULL);
 | 
			
		||||
     Taille = tailleU.QuadPart;
 | 
			
		||||
    #endif
 | 
			
		||||
  #endif
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								divers.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								divers.c
									
									
									
									
									
								
							@ -156,6 +156,7 @@ void Get_input(void)
 | 
			
		||||
  SDL_Event event;
 | 
			
		||||
 | 
			
		||||
  Touche=0;
 | 
			
		||||
  {
 | 
			
		||||
  byte ok = 0;
 | 
			
		||||
 | 
			
		||||
  if( SDL_PollEvent(&event)) /* Il y a un évènement en attente */
 | 
			
		||||
@ -363,6 +364,7 @@ void Get_input(void)
 | 
			
		||||
  // Vidage de toute mise à jour de l'affichage à l'écran qui serait encore en attente. 
 | 
			
		||||
  // (c'est fait ici car on est sur que cette fonction est apellée partout ou on a besoin d'interragir avec l'utilisateur)
 | 
			
		||||
  Flush_update();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								files.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								files.c
									
									
									
									
									
								
							@ -44,7 +44,7 @@
 | 
			
		||||
#include "io.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
#if defined(__linux__)||defined(__BEOS__)||defined(__HAIKU__)
 | 
			
		||||
    #include <dirent.h>
 | 
			
		||||
    #define isHidden(Enreg) ((Enreg)->d_name[0]=='.')
 | 
			
		||||
#elif defined(__amigaos4__)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								graph.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								graph.c
									
									
									
									
									
								
							@ -997,6 +997,7 @@ void Initialiser_mode_video(int Largeur, int Hauteur, int Fullscreen)
 | 
			
		||||
  int Sensibilite_X;
 | 
			
		||||
  int Sensibilite_Y;
 | 
			
		||||
  int Indice;
 | 
			
		||||
  int Facteur;
 | 
			
		||||
  
 | 
			
		||||
  if (Largeur_ecran!=Largeur ||
 | 
			
		||||
      Hauteur_ecran!=Hauteur ||
 | 
			
		||||
@ -1011,7 +1012,6 @@ void Initialiser_mode_video(int Largeur, int Hauteur, int Fullscreen)
 | 
			
		||||
    Largeur = (Largeur + 3 ) & 0xFFFFFFFC;
 | 
			
		||||
 | 
			
		||||
    // Taille des menus
 | 
			
		||||
    int Facteur;
 | 
			
		||||
    if (Largeur/320 > Hauteur/200)
 | 
			
		||||
      Facteur=Hauteur/200;
 | 
			
		||||
    else
 | 
			
		||||
@ -4484,13 +4484,14 @@ void Rectifier_coordonnees_a_45_degres(short AX, short AY, short* BX, short* BY)
 | 
			
		||||
//	- une droite avec une pente de 45 degrés
 | 
			
		||||
{
 | 
			
		||||
    int dx, dy;
 | 
			
		||||
    float tan;
 | 
			
		||||
 | 
			
		||||
    dx = (*BX)-AX;
 | 
			
		||||
    dy = AY- *BY; // On prend l'opposée car à l'écran les Y sont positifs en bas, et en maths, positifs en haut
 | 
			
		||||
 | 
			
		||||
    if (dx==0) return; // On est en lockx et de toutes façons le X n'a pas bougé, on sort tout de suite pour éviter une méchante division par 0
 | 
			
		||||
 | 
			
		||||
    float tan = (float)dy/(float)dx;
 | 
			
		||||
    tan = (float)dy/(float)dx;
 | 
			
		||||
 | 
			
		||||
    if (tan <= 0.4142 && tan >= -0.4142)
 | 
			
		||||
    {
 | 
			
		||||
@ -5221,11 +5222,13 @@ void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX,
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
	Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2));
 | 
			
		||||
	short a = (VBY - VAY)/(VBX - VAX);
 | 
			
		||||
	short b = VAY - a*VAX;
 | 
			
		||||
	short a,b;
 | 
			
		||||
	int Distance_X, Distance_Y;
 | 
			
		||||
 | 
			
		||||
	Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2));
 | 
			
		||||
	a = (VBY - VAY)/(VBX - VAX);
 | 
			
		||||
	b = VAY - a*VAX;
 | 
			
		||||
 | 
			
		||||
	for (Pos_Y=RAY;Pos_Y<=RBY;Pos_Y++)
 | 
			
		||||
	    for (Pos_X = RAX;Pos_X<=RBX;Pos_X++)
 | 
			
		||||
	    {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								init.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								init.c
									
									
									
									
									
								
							@ -50,9 +50,13 @@
 | 
			
		||||
 | 
			
		||||
#ifndef __linux__
 | 
			
		||||
#ifndef __amigaos4__
 | 
			
		||||
#ifndef __BEOS__
 | 
			
		||||
#ifndef __HAIKU__
 | 
			
		||||
#include "windows.h"
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __macosx__
 | 
			
		||||
  #import <corefoundation/corefoundation.h>
 | 
			
		||||
@ -112,7 +116,10 @@ void Rechercher_drives(void)
 | 
			
		||||
	char * Home = getenv("HOME");
 | 
			
		||||
	Ajouter_lecteur('/', LECTEUR_HDD, "/");
 | 
			
		||||
	Ajouter_lecteur('~', LECTEUR_HDD, Home ? Home : "");
 | 
			
		||||
 | 
			
		||||
  #elif defined(__BEOS__) || defined(__HAIKU__)
 | 
			
		||||
	char * Home = getenv("$HOME");
 | 
			
		||||
	Ajouter_lecteur('/', LECTEUR_HDD, "/");
 | 
			
		||||
	Ajouter_lecteur('~', LECTEUR_HDD, Home ? Home : "");
 | 
			
		||||
  #elif defined(__amigaos4__)
 | 
			
		||||
  // No icons by default.
 | 
			
		||||
  // It's possible to add some here.
 | 
			
		||||
@ -189,10 +196,10 @@ void Charger_DAT(void)
 | 
			
		||||
      case EBADF:  puts("filedes est un mauvais descripteur."); break;
 | 
			
		||||
      case EFAULT: puts("Un pointeur se trouve en dehors de l'espace d'adressage."); break;
 | 
			
		||||
      case ENAMETOOLONG: puts("Nom de fichier trop long."); break;
 | 
			
		||||
      case ENOENT: puts("Un composant du chemin path n'existe pas, ou il s'agit d'une chaîne vide."); break;
 | 
			
		||||
      case ENOENT: puts("The file path is empty or points to a non-existing directory."); break;
 | 
			
		||||
      case ENOMEM: puts("Pas assez de mémoire pour le noyau."); break;
 | 
			
		||||
      case ENOTDIR: puts("Un composant du chemin d'accès n'est pas un répertoire."); break;
 | 
			
		||||
      #if defined(__linux__)||defined(__amigaos4__)
 | 
			
		||||
      #if defined(__linux__)||defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__)
 | 
			
		||||
          case ELOOP:  puts("Trop de liens symboliques rencontrés dans le chemin d'accès."); break;
 | 
			
		||||
      #endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								linux.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								linux.c
									
									
									
									
									
								
							@ -20,7 +20,7 @@
 | 
			
		||||
    59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 | 
			
		||||
*/
 | 
			
		||||
// Diverses fonctions qui existaient sous dos mais pas sous linux...
 | 
			
		||||
#if defined(__linux__)||defined(__amigaos4__)
 | 
			
		||||
#if defined(__linux__)||defined(__amigaos4__)||defined(__BEOS__)||defined(__HAIKU__)
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.c
									
									
									
									
									
								
							@ -51,12 +51,16 @@
 | 
			
		||||
 | 
			
		||||
#ifndef __linux__
 | 
			
		||||
#ifndef __amigaos4__
 | 
			
		||||
#ifndef __BEOS__
 | 
			
		||||
#ifndef __HAIKU__
 | 
			
		||||
    #include <windows.h>
 | 
			
		||||
    #include <shlwapi.h>
 | 
			
		||||
    #define chdir(dir) SetCurrentDirectory(dir)
 | 
			
		||||
    #define M_PI 3.14159265358979323846
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __macosx__
 | 
			
		||||
#import <corefoundation/corefoundation.h>
 | 
			
		||||
@ -223,7 +227,7 @@ void Analyse_de_la_ligne_de_commande(int argc,char * argv[])
 | 
			
		||||
 | 
			
		||||
        // On récupère le chemin complet du paramètre
 | 
			
		||||
        // Et on découpe ce chemin en répertoire(path) + fichier(.ext)
 | 
			
		||||
        #if defined(__linux__) || defined(__amigaos4__)
 | 
			
		||||
        #if defined(__linux__) || defined(__amigaos4__) || defined(__BEOS__) || defined(__HAIKU__)
 | 
			
		||||
          Buffer=realpath(argv[Indice],NULL);
 | 
			
		||||
        #else
 | 
			
		||||
          Buffer = malloc(TAILLE_CHEMIN_FICHIER);
 | 
			
		||||
@ -233,9 +237,13 @@ void Analyse_de_la_ligne_de_commande(int argc,char * argv[])
 | 
			
		||||
        Extraire_nom_fichier(Principal_Nom_fichier, Buffer);
 | 
			
		||||
        #ifndef __linux__
 | 
			
		||||
        #ifndef __amigaos4__
 | 
			
		||||
        #ifndef __BEOS__
 | 
			
		||||
        #ifndef __HAIKU__
 | 
			
		||||
          free(Buffer);
 | 
			
		||||
        #endif
 | 
			
		||||
        #endif
 | 
			
		||||
        #endif
 | 
			
		||||
        #endif
 | 
			
		||||
        chdir(Principal_Repertoire_fichier);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
 | 
			
		||||
@ -4239,7 +4239,7 @@ void Rectangle_Degrade_0_5(void)
 | 
			
		||||
  short RAX;
 | 
			
		||||
  short RAY;
 | 
			
		||||
  short RBX;
 | 
			
		||||
  short RBY;
 | 
			
		||||
  short RBY, largeur,hauteur;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // Tracé propre du rectangle
 | 
			
		||||
@ -4252,8 +4252,8 @@ void Rectangle_Degrade_0_5(void)
 | 
			
		||||
  Pinceau_Y = RAY;
 | 
			
		||||
  Effacer_curseur();
 | 
			
		||||
 | 
			
		||||
  short largeur = abs(RBX-RAX);
 | 
			
		||||
  short hauteur = abs(RBY-RAY);
 | 
			
		||||
  largeur = abs(RBX-RAX);
 | 
			
		||||
  hauteur = abs(RBY-RAY);
 | 
			
		||||
  Ligne_horizontale_XOR(Min(RAX,RBX),Min(RAY,RBY),largeur);
 | 
			
		||||
  Ligne_horizontale_XOR(Min(RAX,RBX),Max(RAY,RBY)-1,largeur);
 | 
			
		||||
  Ligne_verticale_XOR(Min(RAX,RBX),Min(RAY,RBY),hauteur);
 | 
			
		||||
 | 
			
		||||
@ -255,6 +255,10 @@ static const char * TableAideCredits[] =
 | 
			
		||||
  AIDE_TEXTE("")                                          //
 | 
			
		||||
  AIDE_TEXTE("  hitchhikr")                               //
 | 
			
		||||
  AIDE_TEXTE("")
 | 
			
		||||
  AIDE_BOLD ("           HAIKU OS AND BEOS PORT")         //
 | 
			
		||||
  AIDE_TEXTE("")                                          //
 | 
			
		||||
  AIDE_TEXTE("  Luc Schrijvers (begasus@skynet.be)")      //
 | 
			
		||||
  AIDE_TEXTE("")
 | 
			
		||||
  AIDE_BOLD("                 BUGFINDERS")                //
 | 
			
		||||
  AIDE_TEXTE("")                                          //
 | 
			
		||||
  AIDE_TEXTE("  Ced       El Topo   fallenblood Frost")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user