Mac os X port. Compiles and runs slowly

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@256 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2008-10-14 20:42:05 +00:00
parent 0794f573cb
commit 584c4696c1
10 changed files with 157 additions and 3 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

28
Info.plist Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>http://grafx2.googlecode.com/</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>SDLMain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

66
Makefile.os4 Normal file
View File

@ -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 <http://www.gnu.org/licenses/> 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

5
aide.c
View File

@ -33,7 +33,12 @@
#include <string.h>
#ifdef __linux__
#ifdef __macosx__
#include <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/vfs.h>
#endif
#else
#ifndef __amigaos4__
#include <windows.h>

View File

@ -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())

22
graph.c
View File

@ -22,7 +22,11 @@
#include "graph.h"
#include "divers.h"
#include <math.h>
#include <malloc.h>
#ifdef __macosx__
#include <sys/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include <stdlib.h>
@ -34,7 +38,11 @@
#include "erreurs.h"
#ifdef __linux__
#ifdef __macosx__
#include <sys/sysctl.h>
#else
#include <sys/sysinfo.h>
#endif
#elif __WATCOMC__
#define _WIN32_WINNT 0x0500
#include <windows.h>
@ -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);

14
init.c
View File

@ -52,10 +52,22 @@
#endif
#endif
#ifdef __macosx__
#import <corefoundation/corefoundation.h>
#import <sys/param.h>
#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
}

1
main.c
View File

@ -55,6 +55,7 @@
#endif
#endif
byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran

18
pages.c
View File

@ -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;