diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000..f17b12ef
Binary files /dev/null and b/.DS_Store differ
diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings
new file mode 100644
index 00000000..00b513ac
Binary files /dev/null and b/English.lproj/InfoPlist.strings differ
diff --git a/Info.plist b/Info.plist
new file mode 100644
index 00000000..e2b73ab1
--- /dev/null
+++ b/Info.plist
@@ -0,0 +1,28 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ http://grafx2.googlecode.com/
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ APPL
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ NSMainNibFile
+ SDLMain
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/Makefile.os4 b/Makefile.os4
new file mode 100644
index 00000000..dddb5596
--- /dev/null
+++ b/Makefile.os4
@@ -0,0 +1,66 @@
+# Grafx2 - The Ultimate 256-color bitmap paint program
+#
+# Copyright 2007 Adrien Destugues
+# 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.
+
+# Aaaameeeegaaaaa
+DELCOMMAND = rm -rf
+BIN = grafx2
+CFGBIN = gfxcfg
+COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags`
+LOPT = `sdl-config --libs`
+CC = gcc
+
+.PHONY : all debug release clean depend zip
+
+OBJ = main.o init.o graph.o sdlscreen.o divers.o special.o boutons.o palette.o aide.o operatio.o pages.o loadsave.o readline.o moteur.o files.o op_c.o linux.o op_asm.o readini.o saveini.o shade.o clavier.o io.o
+CFGOBJ = gfxcfg.o SFont.o clavier.o io.o
+
+OBJDIR = obj/
+
+all : $(BIN) $(CFGBIN)
+
+debug : $(BIN)
+
+release : $(BIN) $(CFGBIN)
+ strip $(BIN)
+ strip $(CFGBIN)
+
+# A release zip archive
+ziprelease:
+ tar cvzf src-svn`svnversion`.tgz *.c *.h Makefile Makefile.dep
+ zip grafx2-beta-svn`svnversion`-win32.zip $(BIN) $(CFGBIN) gfx2.dat gfx2.ico doc/gpl-2.0.txt SDL.dll 8pxfont.png SDL_image.dll
+
+$(BIN) : $(OBJ)
+ $(CC) $(OBJ) -o $(BIN) $(LOPT)
+
+$(CFGBIN) : $(CFGOBJ)
+ $(CC) $(CFGOBJ) -o $(CFGBIN) $(LOPT) -lSDL_image -lz -lpng -ljpeg
+
+%.o :
+ $(CC) $(COPT) -c $*.c -o $*.o
+
+depend :
+ $(CC) -MM $(OBJ:.o=.c) $(CFGOBJ:.o=.c) > Makefile.dep
+
+clean :
+ $(DELCOMMAND) *.o
+ $(DELCOMMAND) $(BIN)
+ $(DELCOMMAND) $(CFGBIN)
+
+include Makefile.dep
diff --git a/aide.c b/aide.c
index 124271bd..edb0ce51 100644
--- a/aide.c
+++ b/aide.c
@@ -33,7 +33,12 @@
#include
#ifdef __linux__
+ #ifdef __macosx__
+ #include
+ #include
+ #else
#include
+ #endif
#else
#ifndef __amigaos4__
#include
diff --git a/gfxcfg.c b/gfxcfg.c
index e7d7a3a2..af34a737 100644
--- a/gfxcfg.c
+++ b/gfxcfg.c
@@ -661,6 +661,12 @@ int main(int argc, char * argv[])
/* On initialise SFont */
MyFont = SFont_InitFont(IMG_Load("8pxfont.png"));
+ if(MyFont==NULL)
+ {
+ SDL_Quit();
+ exit(0);
+ }
+
Dessiner_ecran_principal();
if(!Initialiser_config())
diff --git a/graph.c b/graph.c
index 3ec1c7a3..52eb74ad 100644
--- a/graph.c
+++ b/graph.c
@@ -22,7 +22,11 @@
#include "graph.h"
#include "divers.h"
#include
-#include
+#ifdef __macosx__
+ #include
+#else
+ #include
+#endif
#include
#include
@@ -34,7 +38,11 @@
#include "erreurs.h"
#ifdef __linux__
+ #ifdef __macosx__
+ #include
+ #else
#include
+ #endif
#elif __WATCOMC__
#define _WIN32_WINNT 0x0500
#include
@@ -485,9 +493,21 @@ unsigned long Memoire_libre(void)
_heapmin();
*/
#ifdef __linux__
+ #ifdef __macosx__
+ int mib[2];
+ int maxmem;
+ size_t len;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_USERMEM;
+ len = sizeof(maxmem);
+ sysctl(mib,2,&maxmem,&len,NULL,0);
+ return maxmem;
+ #else
struct sysinfo info;
sysinfo(&info);
return info.freeram*info.mem_unit;
+ #endif
#elif __WATCOMC__
MEMORYSTATUSEX mstt;
mstt.dwLength = sizeof(MEMORYSTATUSEX);
diff --git a/init.c b/init.c
index 16aa6352..9799dca3 100644
--- a/init.c
+++ b/init.c
@@ -52,10 +52,22 @@
#endif
#endif
+#ifdef __macosx__
+ #import
+ #import
+#endif
+
// Chercher le répertoire contenant GFX2.EXE
void Chercher_repertoire_du_programme(char * Chaine)
{
- Extraire_chemin(Repertoire_du_programme, Chaine);
+ #ifdef __macosx__
+ CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+ CFURLGetFileSystemRepresentation(url,true,(UInt8*)Repertoire_du_programme,MAXPATHLEN);
+ CFRelease(url);
+ strcat(Repertoire_du_programme,"Contents/Resources");
+ #else
+ Extraire_chemin(Repertoire_du_programme, Chaine);
+ #endif
}
diff --git a/main.c b/main.c
index 5b4950c2..49c4b2b1 100644
--- a/main.c
+++ b/main.c
@@ -55,6 +55,7 @@
#endif
#endif
+
byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran
diff --git a/pages.c b/pages.c
index da2973d2..c2df380b 100644
--- a/pages.c
+++ b/pages.c
@@ -827,13 +827,25 @@ void Backup(void)
// Sauve la page courante comme première page de backup et crée une nouvelle page
// pur continuer à dessiner. Utilisé par exemple pour le fill
{
- S_Page * Nouvelle_page;
+ #ifdef __macosx__
+ S_Page Nouvelle_page;
+ #else
+ S_Page * Nouvelle_page;
+ #endif
// On remet à jour l'état des infos de la page courante (pour pouvoir les
// retrouver plus tard)
Upload_infos_page_principal(Principal_Backups->Pages);
// On crée un descripteur pour la nouvelle page courante
+#ifdef __macosx__
+ Initialiser_S_Page(&Nouvelle_page);
+
+ // Enrichissement de l'historique
+ Copier_S_page(&Nouvelle_page,Principal_Backups->Pages);
+ Creer_nouvelle_page(&Nouvelle_page,Principal_Backups,Brouillon_Backups);
+ Download_infos_page_principal(&Nouvelle_page);
+#else
Nouvelle_page=(S_Page *)malloc(sizeof(S_Page));
Initialiser_S_Page(Nouvelle_page);
@@ -841,13 +853,17 @@ void Backup(void)
Copier_S_page(Nouvelle_page,Principal_Backups->Pages);
Creer_nouvelle_page(Nouvelle_page,Principal_Backups,Brouillon_Backups);
Download_infos_page_principal(Nouvelle_page);
+#endif
+
Download_infos_backup(Principal_Backups);
// On copie l'image du backup vers la page courante:
memcpy(Principal_Ecran,Ecran_backup,Principal_Largeur_image*Principal_Hauteur_image);
// On détruit le descripteur de la page courante
+#ifndef __macosx__
free(Nouvelle_page);
+#endif
// On allume l'indicateur de modification de l'image
Principal_Image_modifiee=1;