Merge of r1709 into trunk: Atari Falcon port

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1710 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2011-02-06 19:30:55 +00:00
parent 57a1bda6de
commit d0aaabf6b2
23 changed files with 536 additions and 90 deletions

View File

@ -1,5 +1,6 @@
# Grafx2 - The Ultimate 256-color bitmap paint program # Grafx2 - The Ultimate 256-color bitmap paint program
# #
# Copyright 2011 Pawel Góralski
# Copyright 2009 Per Olofsson # Copyright 2009 Per Olofsson
# Copyright 2008 Peter Gordon # Copyright 2008 Peter Gordon
# Copyright 2008-2010 Yves Rizoud # Copyright 2008-2010 Yves Rizoud
@ -206,6 +207,7 @@ else
CP = cp CP = cp
ZIP = zip ZIP = zip
PLATFORMFILES = gfx2.png PLATFORMFILES = gfx2.png
ifneq ($(ATARICROSS),1)
ifeq ($(NOLUA),1) ifeq ($(NOLUA),1)
LUACOPT = LUACOPT =
LUALOPT = LUALOPT =
@ -213,7 +215,7 @@ else
LUACOPT = `pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags` LUACOPT = `pkg-config lua --cflags --silence-errors ||pkg-config lua5.1 --cflags --silence-errors ||pkg-config lua-5.1 --cflags`
LUALOPT = `pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs` LUALOPT = `pkg-config lua --libs --silence-errors ||pkg-config lua5.1 --libs --silence-errors ||pkg-config lua-5.1 --libs`
endif endif
endif
# These can only be used under linux and maybe freebsd. They allow to compile for the gp2x or to create a windows binary # These can only be used under linux and maybe freebsd. They allow to compile for the gp2x or to create a windows binary
ifdef WIN32CROSS ifdef WIN32CROSS
#cross compile a Win32 executable #cross compile a Win32 executable
@ -248,6 +250,17 @@ else
PLATFORM = AROS PLATFORM = AROS
ZIP = lha ZIP = lha
ZIPOPT = a ZIPOPT = a
else ifdef ATARICROSS
#cross compile an exec for atari TOS/MiNT machine
CC = m68k-atari-mint-gcc
BIN = ../bin/grafx2.ttp
LUALOPT = -llua
OBJDIR = ../obj/m68k-atari-mint
PLATFORM = m68k-atari-mint
STRIP = m68k-atari-mint-strip -s
X11LOPT =
COPT = -W -Wall -m68020-60 -fomit-frame-pointer -pedantic -std=c99 -Wdeclaration-after-statement -D__MINT__ -DNO_INLINE_MATH -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $() $(JOYCOPT) $(LAYERCOPT) $(LUACOPT)
LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) $(LAYERLOPT)
else else
# Compiles a regular linux executable for the native platform # Compiles a regular linux executable for the native platform
@ -274,6 +287,7 @@ endif
### BUILD SETTINGS are set according to vars set in the platform selection, the "overridable defaults", and environment variables set before launching make ### BUILD SETTINGS are set according to vars set in the platform selection, the "overridable defaults", and environment variables set before launching make
#TrueType is optional: make NOTTF=1 to disable support and dependencies. #TrueType is optional: make NOTTF=1 to disable support and dependencies.
ifndef ($(ATARICROSS,1))
ifeq ($(NOTTF),1) ifeq ($(NOTTF),1)
TTFCOPT = -DNOTTF=1 TTFCOPT = -DNOTTF=1
TTFLOPT = TTFLOPT =
@ -281,10 +295,23 @@ ifeq ($(NOTTF),1)
TTFLABEL = -nottf TTFLABEL = -nottf
else else
TTFCOPT = TTFCOPT =
TTFLOPT = -L/usr/local/lib -lSDL_ttf $(X11LOPT) TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT)
TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll
TTFLABEL = TTFLABEL =
endif endif
else
ifeq ($(NOTTF),1)
TTFCOPT = -DNOTTF=1
TTFLOPT =
TTFLIBS =
TTFLABEL = -nottf
else
TTFCOPT =
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT)
TTFLIBS =
TTFLABEL =
endif
endif
#Lua scripting is optional too #Lua scripting is optional too
ifeq ($(NOLUA),1) ifeq ($(NOLUA),1)

View File

@ -6,9 +6,10 @@ $(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h engine.h \
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \ $(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
readline.h filesel.h loadsave.h init.h buttons.h operatio.h pages.h \ readline.h filesel.h loadsave.h init.h buttons.h operatio.h pages.h \
palette.h errors.h readini.h saveini.h shade.h io.h help.h text.h \ palette.h errors.h readini.h saveini.h shade.h io.h help.h text.h \
sdlscreen.h windows.h brush.h input.h special.h sdlscreen.h windows.h brush.h input.h special.h setup.h
$(OBJDIR)/buttons_effects.o: buttons_effects.c buttons.h struct.h const.h engine.h \ $(OBJDIR)/buttons_effects.o: buttons_effects.c buttons.h struct.h const.h engine.h \
global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h global.h graph.h help.h input.h misc.h readline.h sdlscreen.h windows.h \
brush.h
$(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h \ $(OBJDIR)/engine.o: engine.c const.h struct.h global.h graph.h misc.h special.h \
buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \ buttons.h operatio.h shade.h errors.h sdlscreen.h windows.h brush.h \
input.h engine.h pages.h layers.h factory.h loadsave.h io.h input.h engine.h pages.h layers.h factory.h loadsave.h io.h
@ -32,7 +33,7 @@ $(OBJDIR)/init.o: init.c buttons.h struct.h const.h errors.h global.h graph.h \
mountlist.h operatio.h palette.h sdlscreen.h setup.h transform.h \ mountlist.h operatio.h palette.h sdlscreen.h setup.h transform.h \
windows.h layers.h windows.h layers.h
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \ $(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h sdlscreen.h \
windows.h errors.h misc.h input.h loadsave.h windows.h errors.h misc.h buttons.h input.h loadsave.h
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h $(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h $(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \ $(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \
@ -40,7 +41,7 @@ $(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h $(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h
$(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io.h \ $(OBJDIR)/loadsave.o: loadsave.c buttons.h struct.h const.h errors.h global.h io.h \
loadsave.h misc.h graph.h op_c.h pages.h palette.h sdlscreen.h windows.h \ loadsave.h misc.h graph.h op_c.h pages.h palette.h sdlscreen.h windows.h \
engine.h engine.h brush.h setup.h
$(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \ $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h misc.h init.h buttons.h \
engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \ engine.h pages.h loadsave.h sdlscreen.h errors.h readini.h saveini.h \
io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h io.h text.h setup.h windows.h brush.h palette.h realpath.h input.h
@ -49,7 +50,8 @@ $(OBJDIR)/misc.o: misc.c struct.h const.h sdlscreen.h global.h errors.h buttons.
$(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \ $(OBJDIR)/miscfileformats.o: miscfileformats.c engine.h struct.h const.h errors.h \
global.h io.h libraw2crtc.h loadsave.h misc.h sdlscreen.h windows.h global.h io.h libraw2crtc.h loadsave.h misc.h sdlscreen.h windows.h
$(OBJDIR)/mountlist.o: mountlist.c $(OBJDIR)/mountlist.o: mountlist.c
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h $(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h errors.h global.h engine.h \
windows.h
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \ $(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h \ operatio.h buttons.h pages.h errors.h sdlscreen.h brush.h windows.h \
input.h input.h
@ -75,12 +77,13 @@ $(OBJDIR)/pxwide.o: pxwide.c global.h struct.h const.h sdlscreen.h misc.h graph.
pxwide.h pxwide.h
$(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \ $(OBJDIR)/pxwide2.o: pxwide2.c global.h struct.h const.h sdlscreen.h misc.h graph.h \
pxwide2.h pxwide2.h
$(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h $(OBJDIR)/readini.o: readini.c const.h errors.h global.h struct.h misc.h readini.h \
setup.h
$(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \ $(OBJDIR)/readline.o: readline.c const.h struct.h global.h misc.h errors.h \
sdlscreen.h readline.h windows.h input.h sdlscreen.h readline.h windows.h input.h
$(OBJDIR)/realpath.o: realpath.c $(OBJDIR)/realpath.o: realpath.c
$(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h errors.h \ $(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h errors.h \
misc.h saveini.h misc.h saveini.h setup.h
$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h errors.h \ $(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h errors.h \
misc.h misc.h
$(OBJDIR)/setup.o: setup.c struct.h const.h io.h setup.h $(OBJDIR)/setup.o: setup.c struct.h const.h io.h setup.h
@ -89,7 +92,7 @@ $(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h engine.h errors.h \
$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \ $(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h engine.h windows.h \
special.h pages.h misc.h buttons.h special.h pages.h misc.h buttons.h
$(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \ $(OBJDIR)/text.o: text.c SFont.h struct.h const.h global.h sdlscreen.h io.h \
errors.h windows.h errors.h windows.h misc.h setup.h
$(OBJDIR)/tiles.o: tiles.c $(OBJDIR)/tiles.o: tiles.c
$(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.h \ $(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.h \
sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h pages.h sdlscreen.h windows.h input.h help.h misc.h readline.h buttons.h pages.h

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2007-2010 Adrien Destugues (PulkoMandy) Copyright 2007-2010 Adrien Destugues (PulkoMandy)
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -72,11 +73,28 @@
#include "brush.h" #include "brush.h"
#include "input.h" #include "input.h"
#include "special.h" #include "special.h"
#include "setup.h"
#ifdef __VBCC__ #ifdef __VBCC__
#define __attribute__(x) #define __attribute__(x)
#endif #endif
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/dos.h>
#include <dirent.h>
#define isHidden(x) (0)
#elif defined(__MINT__)
#include <mint/sysbind.h>
#include <dirent.h>
#define isHidden(x) (0)
#elif defined(__WIN32__)
#include <dirent.h>
#include <windows.h>
#define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN)
#else
#include <dirent.h>
#define isHidden(x) ((x)->d_name[0]=='.')
#endif
extern char Program_version[]; // generated in pversion.c extern char Program_version[]; // generated in pversion.c
@ -1176,7 +1194,7 @@ char * Format_font_filename(const char * fname)
int c; int c;
int length; int length;
fname+=5; // Assume "font_" prefix fname+=strlen(FONT_PREFIX); // Omit file prefix
length=strlen(fname) - 4; // assume .png extension length=strlen(fname) - 4; // assume .png extension
for (c=0;c<11 && c<length ;c++) for (c=0;c<11 && c<length ;c++)
@ -1203,7 +1221,7 @@ void Add_font_or_skin(const char *name)
else else
fname = name; fname = name;
namelength = strlen(fname); namelength = strlen(fname);
if (namelength>=10 && fname[0]!='_' && !strncasecmp(fname, "skin_", 5) if (namelength>=10 && fname[0]!='_' && !strncasecmp(fname, SKIN_PREFIX, strlen(SKIN_PREFIX))
&& (!strcasecmp(fname + namelength - 4,".png") && (!strcasecmp(fname + namelength - 4,".png")
|| !strcasecmp(fname + namelength - 4,".gif"))) || !strcasecmp(fname + namelength - 4,".gif")))
{ {
@ -1212,7 +1230,7 @@ void Add_font_or_skin(const char *name)
if (fname[0]=='\0') if (fname[0]=='\0')
return; return;
} }
else if (namelength>=10 && !strncasecmp(fname, "font_", 5) else if (namelength>=10 && !strncasecmp(fname, FONT_PREFIX, strlen(FONT_PREFIX))
&& (!strcasecmp(fname + namelength - 4, ".png"))) && (!strcasecmp(fname + namelength - 4, ".png")))
{ {
Add_element_to_list(&Font_files_list, fname, Format_font_filename(fname), 0, ICON_NONE); Add_element_to_list(&Font_files_list, fname, Format_font_filename(fname), 0, ICON_NONE);
@ -1269,7 +1287,7 @@ void Button_Skins(void)
Free_fileselector_list(&Font_files_list); Free_fileselector_list(&Font_files_list);
// Browse the "skins" directory // Browse the "skins" directory
strcpy(skinsdir, Data_directory); strcpy(skinsdir, Data_directory);
strcat(skinsdir, "skins"); strcat(skinsdir, SKINS_SUBDIRECTORY);
// Add each found file to the list // Add each found file to the list
For_each_file(skinsdir, Add_font_or_skin); For_each_file(skinsdir, Add_font_or_skin);
// Sort it // Sort it
@ -1514,9 +1532,11 @@ void Button_Page(void)
Exchange_main_and_spare(); Exchange_main_and_spare();
// On fait le reste du travail "à la main": // On fait le reste du travail "à la main":
#ifndef NOLAYERS
SWAP_PBYTES(Main_visible_image.Image,Spare_visible_image.Image) SWAP_PBYTES(Main_visible_image.Image,Spare_visible_image.Image)
SWAP_WORDS (Main_visible_image.Width,Spare_visible_image.Width) SWAP_WORDS (Main_visible_image.Width,Spare_visible_image.Width)
SWAP_WORDS (Main_visible_image.Height,Spare_visible_image.Height) SWAP_WORDS (Main_visible_image.Height,Spare_visible_image.Height)
#endif
SWAP_SHORTS(Main_offset_X,Spare_offset_X) SWAP_SHORTS(Main_offset_X,Spare_offset_X)
SWAP_SHORTS(Main_offset_Y,Spare_offset_Y) SWAP_SHORTS(Main_offset_Y,Spare_offset_Y)
SWAP_SHORTS(Main_separator_position,Spare_separator_position) SWAP_SHORTS(Main_separator_position,Spare_separator_position)

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2009 Petter Lindquist Copyright 2009 Petter Lindquist
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -72,11 +73,11 @@ void Test_IMG(T_IO_Context * context)
if ((file=fopen(filename, "rb"))) if ((file=fopen(filename, "rb")))
{ {
// Lecture et vérification de la signature // Lecture et vérification de la signature
if (Read_bytes(file,IMG_header.Filler1,sizeof(IMG_header.Filler1)) if (Read_bytes(file,IMG_header.Filler1,6)
&& Read_word_le(file,&(IMG_header.Width)) && Read_word_le(file,&(IMG_header.Width))
&& Read_word_le(file,&(IMG_header.Height)) && Read_word_le(file,&(IMG_header.Height))
&& Read_bytes(file,IMG_header.Filler2,sizeof(IMG_header.Filler2)) && Read_bytes(file,IMG_header.Filler2,118)
&& Read_bytes(file,IMG_header.Palette,sizeof(IMG_header.Palette)) && Read_bytes(file,IMG_header.Palette,sizeof(T_Palette))
) )
{ {
if ( (!memcmp(IMG_header.Filler1,signature,6)) if ( (!memcmp(IMG_header.Filler1,signature,6))
@ -107,11 +108,11 @@ void Load_IMG(T_IO_Context * context)
{ {
file_size=File_length_file(file); file_size=File_length_file(file);
if (Read_bytes(file,IMG_header.Filler1,sizeof(IMG_header.Filler1)) if (Read_bytes(file,IMG_header.Filler1,6)
&& Read_word_le(file,&(IMG_header.Width)) && Read_word_le(file,&(IMG_header.Width))
&& Read_word_le(file,&(IMG_header.Height)) && Read_word_le(file,&(IMG_header.Height))
&& Read_bytes(file,IMG_header.Filler2,sizeof(IMG_header.Filler2)) && Read_bytes(file,IMG_header.Filler2,118)
&& Read_bytes(file,IMG_header.Palette,sizeof(IMG_header.Palette)) && Read_bytes(file,IMG_header.Palette,sizeof(T_Palette))
) )
{ {
@ -180,11 +181,11 @@ void Save_IMG(T_IO_Context * context)
memcpy(IMG_header.Palette,context->Palette,sizeof(T_Palette)); memcpy(IMG_header.Palette,context->Palette,sizeof(T_Palette));
if (Write_bytes(file,IMG_header.Filler1,sizeof(IMG_header.Filler1)) if (Write_bytes(file,IMG_header.Filler1,6)
&& Write_word_le(file,IMG_header.Width) && Write_word_le(file,IMG_header.Width)
&& Write_word_le(file,IMG_header.Height) && Write_word_le(file,IMG_header.Height)
&& Write_bytes(file,IMG_header.Filler2,sizeof(IMG_header.Filler2)) && Write_bytes(file,IMG_header.Filler2,118)
&& Write_bytes(file,IMG_header.Palette,sizeof(IMG_header.Palette)) && Write_bytes(file,IMG_header.Palette,sizeof(T_Palette))
) )
{ {
@ -2379,9 +2380,16 @@ void Save_GIF(T_IO_Context * context)
Write_byte(GIF_file,LSDB.Aspect) ) Write_byte(GIF_file,LSDB.Aspect) )
{ {
// Le LSDB a été correctement écrit. // Le LSDB a été correctement écrit.
int i;
// On sauve la palette // On sauve la palette
if (Write_bytes(GIF_file,context->Palette,768)) for(i=0;i<256 && !File_error;i++)
{
if (!Write_byte(GIF_file,context->Palette[i].R)
||!Write_byte(GIF_file,context->Palette[i].G)
||!Write_byte(GIF_file,context->Palette[i].B))
File_error=1;
}
if (!File_error)
{ {
// La palette a été correctement écrite. // La palette a été correctement écrite.
@ -3153,14 +3161,14 @@ void Save_PCX(T_IO_Context * context)
Write_word_le(file,PCX_header.Y_max) && Write_word_le(file,PCX_header.Y_max) &&
Write_word_le(file,PCX_header.X_dpi) && Write_word_le(file,PCX_header.X_dpi) &&
Write_word_le(file,PCX_header.Y_dpi) && Write_word_le(file,PCX_header.Y_dpi) &&
Write_bytes(file,&(PCX_header.Palette_16c),sizeof(PCX_header.Palette_16c)) && Write_bytes(file,&(PCX_header.Palette_16c),48) &&
Write_bytes(file,&(PCX_header.Reserved),1) && Write_bytes(file,&(PCX_header.Reserved),1) &&
Write_bytes(file,&(PCX_header.Plane),1) && Write_bytes(file,&(PCX_header.Plane),1) &&
Write_word_le(file,PCX_header.Bytes_per_plane_line) && Write_word_le(file,PCX_header.Bytes_per_plane_line) &&
Write_word_le(file,PCX_header.Palette_info) && Write_word_le(file,PCX_header.Palette_info) &&
Write_word_le(file,PCX_header.Screen_X) && Write_word_le(file,PCX_header.Screen_X) &&
Write_word_le(file,PCX_header.Screen_Y) && Write_word_le(file,PCX_header.Screen_Y) &&
Write_bytes(file,&(PCX_header.Filler),sizeof(PCX_header.Filler)) ) Write_bytes(file,&(PCX_header.Filler),54) )
{ {
line_size=PCX_header.Bytes_per_plane_line*PCX_header.Plane; line_size=PCX_header.Bytes_per_plane_line*PCX_header.Plane;
@ -3245,7 +3253,7 @@ void Test_SCx(T_IO_Context * context)
if ((file=fopen(filename, "rb"))) if ((file=fopen(filename, "rb")))
{ {
// Lecture et vérification de la signature // Lecture et vérification de la signature
if (Read_bytes(file,SCx_header.Filler1,sizeof(SCx_header.Filler1)) if (Read_bytes(file,SCx_header.Filler1,4)
&& Read_word_le(file, &(SCx_header.Width)) && Read_word_le(file, &(SCx_header.Width))
&& Read_word_le(file, &(SCx_header.Height)) && Read_word_le(file, &(SCx_header.Height))
&& Read_byte(file, &(SCx_header.Filler2)) && Read_byte(file, &(SCx_header.Filler2))
@ -3281,7 +3289,7 @@ void Load_SCx(T_IO_Context * context)
{ {
file_size=File_length_file(file); file_size=File_length_file(file);
if (Read_bytes(file,SCx_header.Filler1,sizeof(SCx_header.Filler1)) if (Read_bytes(file,SCx_header.Filler1,4)
&& Read_word_le(file, &(SCx_header.Width)) && Read_word_le(file, &(SCx_header.Width))
&& Read_word_le(file, &(SCx_header.Height)) && Read_word_le(file, &(SCx_header.Height))
&& Read_byte(file, &(SCx_header.Filler2)) && Read_byte(file, &(SCx_header.Filler2))
@ -3402,7 +3410,7 @@ void Save_SCx(T_IO_Context * context)
SCx_header.Filler2=0xAF; SCx_header.Filler2=0xAF;
SCx_header.Planes=0x00; SCx_header.Planes=0x00;
if (Write_bytes(file,SCx_header.Filler1,sizeof(SCx_header.Filler1)) if (Write_bytes(file,SCx_header.Filler1,4)
&& Write_word_le(file, SCx_header.Width) && Write_word_le(file, SCx_header.Width)
&& Write_word_le(file, SCx_header.Height) && Write_word_le(file, SCx_header.Height)
&& Write_byte(file, SCx_header.Filler2) && Write_byte(file, SCx_header.Filler2)
@ -3860,9 +3868,9 @@ void Save_PNG(T_IO_Context * context)
{-1, "Software", "Grafx2", 6, 0, NULL, NULL}, {-1, "Software", "Grafx2", 6, 0, NULL, NULL},
{-1, "Title", NULL, 0, 0, NULL, NULL} {-1, "Title", NULL, 0, 0, NULL, NULL}
#else #else
png_text text_ptr[2] = { png_text text_ptr[2] = {
{-1, "Software", "Grafx2", 6}, {-1, "Software", "Grafx2", 6},
{-1, "Title", NULL, 0} {-1, "Title", NULL, 0}
#endif #endif
}; };
int nb_text_chunks=1; int nb_text_chunks=1;

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2009 Franck Charlet Copyright 2009 Franck Charlet
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
@ -29,6 +30,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#define isHidden(x) (0) #define isHidden(x) (0)
#elif defined (__MINT__)
#include <mint/sysbind.h>
#include <dirent.h>
#define isHidden(x) (0)
#elif defined(__WIN32__) #elif defined(__WIN32__)
#include <dirent.h> #include <dirent.h>
#include <windows.h> #include <windows.h>
@ -354,8 +360,25 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
// Après effacement, il ne reste ni fichier ni répertoire dans la liste // Après effacement, il ne reste ni fichier ni répertoire dans la liste
// On lit tous les répertoires: // On lit tous les répertoires:
#if defined (__MINT__)
static char path[1024];
static char path2[1024];
path[0]='\0';
path2[0]='\0';
char currentDrive='A';
currentDrive=currentDrive+Dgetdrv();
Dgetpath(path,0);
sprintf(path2,"%c:\%s",currentDrive,path);
strcat(path2,PATH_SEPARATOR);
current_directory=opendir(path2);
#else
current_path=getcwd(NULL,0); current_path=getcwd(NULL,0);
current_directory=opendir(current_path); current_directory=opendir(current_path);
#endif
while ((entry=readdir(current_directory))) while ((entry=readdir(current_directory)))
{ {
// On ignore le répertoire courant // On ignore le répertoire courant
@ -404,10 +427,33 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
#if defined(__MORPHOS__) || defined(__AROS__) || defined (__amigaos4__) || defined(__amigaos__) #if defined(__MORPHOS__) || defined(__AROS__) || defined (__amigaos4__) || defined(__amigaos__)
Add_element_to_list(list, "/", Format_filename("/",19,1), 1, ICON_NONE); // on amiga systems, / means parent. And there is no .. Add_element_to_list(list, "/", Format_filename("/",19,1), 1, ICON_NONE); // on amiga systems, / means parent. And there is no ..
list->Nb_directories ++; list->Nb_directories ++;
#elif defined (__MINT__)
T_Fileselector_item *item=NULL;
// check if ".." exists if not add it
// FreeMinT lists ".." already, but this is not so for TOS
// simply adding it will cause double PARENT_DIR under FreeMiNT
bool bFound= false;
for (item = list->First; (((item != NULL) && (bFound==false))); item = item->Next){
if (item->Type == 1){
if(strncmp(item->Full_name,"..",(sizeof(char)*2))==0) bFound=true;
}
}
if(!bFound){
Add_element_to_list(list, "..",1); // add if not present
list->Nb_directories ++;
}
#endif #endif
closedir(current_directory); closedir(current_directory);
#if defined (__MINT__)
#else
free(current_path); free(current_path);
#endif
current_path = NULL; current_path = NULL;
Recount_files(list); Recount_files(list);
@ -504,6 +550,23 @@ void Read_list_of_drives(T_Fileselector *list)
} }
} }
} }
#elif defined(__MINT__)
char drive_name[]="A:\\";
unsigned long drive_bits = Drvmap(); //get drive map bitfield
int drive_index;
int bit_index;
drive_index = 0;
for (bit_index=0; bit_index<32; bit_index++)
{
if ( (1 << bit_index) & drive_bits )
{
drive_name[0]='A'+bit_index;
Add_element_to_list(list, drive_name,2);
list->Nb_directories++;
drive_index++;
}
}
#else #else
{ {
//Sous les différents unix, on va mettre //Sous les différents unix, on va mettre
@ -1342,13 +1405,30 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
// On prend bien soin de passer dans le répertoire courant (le bon qui faut! Oui madame!) // On prend bien soin de passer dans le répertoire courant (le bon qui faut! Oui madame!)
if (load) if (load)
{ {
#if defined(__MINT__)
chdir(Main_current_directory);
static char path[1024]={0};
Dgetpath(path,0);
strcat(path,PATH_SEPARATOR);
strcpy(Main_current_directory,path);
#else
chdir(Main_current_directory); chdir(Main_current_directory);
getcwd(Main_current_directory,256); getcwd(Main_current_directory,256);
#endif
} }
else else
{ {
#if defined(__MINT__)
chdir(context->File_directory); chdir(context->File_directory);
static char path[1024]={0};
Dgetpath(path,0);
strcat(path,PATH_SEPARATOR);
strcpy(Main_current_directory,path);
#else
getcwd(Main_current_directory,256); getcwd(Main_current_directory,256);
#endif
} }
// Affichage des premiers fichiers visibles: // Affichage des premiers fichiers visibles:
@ -1832,8 +1912,15 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context)
// On doit rentrer dans le répertoire: // On doit rentrer dans le répertoire:
if (!chdir(Selector_filename)) if (!chdir(Selector_filename))
{ {
#if defined (__MINT__)
static char path[1024]={0};
char currentDrive='A';
currentDrive=currentDrive+Dgetdrv();
Dgetpath(path,0);
sprintf(Main_current_directory,"%c:\%s",currentDrive,path);
#else
getcwd(Main_current_directory,256); getcwd(Main_current_directory,256);
#endif
// On lit le nouveau répertoire // On lit le nouveau répertoire
Read_list_of_files(&Filelist, Main_format); Read_list_of_files(&Filelist, Main_format);
Sort_list_of_files(&Filelist); Sort_list_of_files(&Filelist);

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -33,6 +34,10 @@
#include <sys/vfs.h> #include <sys/vfs.h>
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
#include "haiku.h" #include "haiku.h"
#elif defined (__MINT__)
#include <mint/sysbind.h>
#include <mint/osbind.h>
#include <mint/ostruct.h>
#endif #endif
#include "const.h" #include "const.h"
@ -640,7 +645,51 @@ void Button_Stats(void)
Print_in_window(10,35,"Build options:",STATS_TITLE_COLOR,MC_Black); Print_in_window(10,35,"Build options:",STATS_TITLE_COLOR,MC_Black);
Print_in_window(146,35,TrueType_is_supported()?"TTF fonts":"no TTF fonts",STATS_DATA_COLOR,MC_Black); Print_in_window(146,35,TrueType_is_supported()?"TTF fonts":"no TTF fonts",STATS_DATA_COLOR,MC_Black);
#if defined (__MINT__)
// Affichage de la mémoire restante
Print_in_window(10,43,"Free memory: ",STATS_TITLE_COLOR,MC_Black);
freeRam=0;
char helpBuf[64];
unsigned long STRAM,TTRAM;
Atari_Memory_free(&STRAM,&TTRAM);
freeRam=STRAM+TTRAM;
buffer[0]='\0';
if(STRAM > (100*1024*1024))
sprintf(helpBuf,"ST:%u Mb ",(unsigned int)(STRAM/(1024*1024)));
else if(freeRam > 100*1024)
sprintf(helpBuf,"ST:%u Kb ",(unsigned int)(STRAM/1024));
else
sprintf(helpBuf,"ST:%u b ",(unsigned int)STRAM);
strncat(buffer,helpBuf,sizeof(char)*37);
if(TTRAM > (100ULL*1024*1024*1024))
sprintf(helpBuf,"TT:%u Gb",(unsigned int)(TTRAM/(1024*1024*1024)));
else if(TTRAM > (100*1024*1024))
sprintf(helpBuf,"TT:%u Mb",(unsigned int)(TTRAM/(1024*1024)));
else if(freeRam > 100*1024)
sprintf(helpBuf,"TT:%u Kb",(unsigned int)(TTRAM/1024));
else
sprintf(helpBuf,"TT:%u b",(unsigned int)TTRAM);
strncat(buffer,helpBuf,sizeof(char)*37);
if(freeRam > (100ULL*1024*1024*1024))
sprintf(helpBuf,"(%u Gb)",(unsigned int)(freeRam/(1024*1024*1024)));
else if(freeRam > (100*1024*1024))
sprintf(helpBuf,"(%u Mb)",(unsigned int)(freeRam/(1024*1024)));
else if(freeRam > 100*1024)
sprintf(helpBuf,"(%u Kb)",(unsigned int)(freeRam/1024));
else
sprintf(helpBuf,"(%u b)",(unsigned int)freeRam);
strncat(buffer,helpBuf,sizeof(char)*37);
Print_in_window(18,51,buffer,STATS_DATA_COLOR,MC_Black);
#else
// Affichage de la mémoire restante // Affichage de la mémoire restante
Print_in_window(10,51,"Free memory: ",STATS_TITLE_COLOR,MC_Black); Print_in_window(10,51,"Free memory: ",STATS_TITLE_COLOR,MC_Black);
@ -654,8 +703,12 @@ void Button_Stats(void)
sprintf(buffer,"%u Kilobytes",(unsigned int)(freeRam/1024)); sprintf(buffer,"%u Kilobytes",(unsigned int)(freeRam/1024));
else else
sprintf(buffer,"%u bytes",(unsigned int)freeRam); sprintf(buffer,"%u bytes",(unsigned int)freeRam);
Print_in_window(114,51,buffer,STATS_DATA_COLOR,MC_Black); Print_in_window(114,51,buffer,STATS_DATA_COLOR,MC_Black);
#endif
// Used memory // Used memory
Print_in_window(10,59,"Used memory pages: ",STATS_TITLE_COLOR,MC_Black); Print_in_window(10,59,"Used memory pages: ",STATS_TITLE_COLOR,MC_Black);
if(Stats_pages_memory > (100LL*1024*1024*1024)) if(Stats_pages_memory > (100LL*1024*1024*1024))
@ -685,6 +738,14 @@ void Button_Stats(void)
} }
#elif defined(__HAIKU__) #elif defined(__HAIKU__)
mem_size = haiku_get_free_space(Main_current_directory); mem_size = haiku_get_free_space(Main_current_directory);
#elif defined (__MINT__)
_DISKINFO drvInfo;
mem_size=0;
Dfree(&drvInfo,0);
//number of free clusters*sectors per cluster*bytes per sector;
// reports current drive
mem_size=drvInfo.b_free*drvInfo.b_clsiz*drvInfo.b_secsiz;
#else #else
// Free disk space is only for shows. Other platforms can display 0. // Free disk space is only for shows. Other platforms can display 0.
#warning "Missing code for your platform !!! Check and correct please :)" #warning "Missing code for your platform !!! Check and correct please :)"

View File

@ -62,7 +62,11 @@ static const T_Help_table helptable_about[] =
HELP_BOLD (" \"Dragon's Layers\" Edition") HELP_BOLD (" \"Dragon's Layers\" Edition")
HELP_BOLD (" THE ULTIMATE MULTI-RESOLUTION GFX EDITOR") HELP_BOLD (" THE ULTIMATE MULTI-RESOLUTION GFX EDITOR")
HELP_TEXT (" http://grafx2.googlecode.com") HELP_TEXT (" http://grafx2.googlecode.com")
#if defined(__MINT__)
HELP_TEXT (" atari build ")
#else
HELP_TEXT ("") HELP_TEXT ("")
#endif
HELP_TEXT ("Copyright 2007-2010, the Grafx2 project team") HELP_TEXT ("Copyright 2007-2010, the Grafx2 project team")
HELP_TEXT (" Copyright 1996-2001, SUNSET DESIGN") HELP_TEXT (" Copyright 1996-2001, SUNSET DESIGN")
}; };
@ -439,6 +443,10 @@ static const T_Help_table helptable_credits[] =
HELP_TEXT ("") HELP_TEXT ("")
HELP_TEXT (" Alexander Filyanov (PheeL)") HELP_TEXT (" Alexander Filyanov (PheeL)")
HELP_TEXT ("") HELP_TEXT ("")
HELP_BOLD (" ATARI PORT")
HELP_TEXT ("")
HELP_TEXT (" Pawel Goralski (Saulot)")
HELP_TEXT ("")
HELP_TEXT ("") HELP_TEXT ("")
HELP_TEXT (" ... made it work on your favourite toaster") HELP_TEXT (" ... made it work on your favourite toaster")
HELP_TEXT ("") HELP_TEXT ("")

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2009 Franck Charlet Copyright 2009 Franck Charlet
@ -53,7 +54,9 @@
#ifndef __GP2X__ #ifndef __GP2X__
#include <SDL_syswm.h> #include <SDL_syswm.h>
#endif #endif
#if defined (__MINT__)
#include <mint/osbind.h>
#endif
#ifdef GRAFX2_CATCHES_SIGNALS #ifdef GRAFX2_CATCHES_SIGNALS
#include <signal.h> #include <signal.h>
#endif #endif
@ -653,7 +656,7 @@ T_Gui_skin * Load_graphics(const char * skin_file)
// Read the "skin" file // Read the "skin" file
strcpy(filename,Data_directory); strcpy(filename,Data_directory);
strcat(filename,"skins" PATH_SEPARATOR); strcat(filename,SKINS_SUBDIRECTORY PATH_SEPARATOR);
strcat(filename,skin_file); strcat(filename,skin_file);
gui=Load_surface(filename); gui=Load_surface(filename);
@ -732,7 +735,7 @@ byte * Load_font(const char * font_name)
} }
// Read the file containing the image // Read the file containing the image
sprintf(filename,"%sskins%s%s", Data_directory, PATH_SEPARATOR, font_name); sprintf(filename,"%s" SKINS_SUBDIRECTORY "%s%s", Data_directory, PATH_SEPARATOR, font_name);
image=Load_surface(filename); image=Load_surface(filename);
if (!image) if (!image)
@ -2203,7 +2206,7 @@ int Save_CFG(void)
T_Config_video_mode cfg_video_mode={0,0,0}; T_Config_video_mode cfg_video_mode={0,0,0};
strcpy(filename,Config_directory); strcpy(filename,Config_directory);
strcat(filename,"gfx2.cfg"); strcat(filename,CONFIG_FILENAME);
if ((Handle=fopen(filename,"wb"))==NULL) if ((Handle=fopen(filename,"wb"))==NULL)
return ERROR_SAVING_CFG; return ERROR_SAVING_CFG;
@ -2331,7 +2334,7 @@ int Save_CFG(void)
// is now loaded/saved in GIF and LBM formats. // is now loaded/saved in GIF and LBM formats.
/* /*
Chunk.Number=CHUNK_GRADIENTS; Chunk.Number=CHUNK_GRADIENTS;
Chunk.Size=241; Chunk.Size=14*16+1;
if (!Write_byte(Handle, Chunk.Number) || if (!Write_byte(Handle, Chunk.Number) ||
!Write_word_le(Handle, Chunk.Size) ) !Write_word_le(Handle, Chunk.Size) )
goto Erreur_sauvegarde_config; goto Erreur_sauvegarde_config;

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -42,6 +43,11 @@
#include <windows.h> #include <windows.h>
//#include <commdlg.h> //#include <commdlg.h>
#define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN)
#elif defined(__MINT__)
#include <mint/osbind.h>
#include <mint/sysbind.h>
#include <dirent.h>
#define isHidden(x) (0)
#else #else
#include <dirent.h> #include <dirent.h>
#define isHidden(x) ((x)->d_name[0]=='.') #define isHidden(x) ((x)->d_name[0]=='.')

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -71,6 +72,8 @@ char * Find_last_slash(const char * str);
#if defined(__WIN32__) #if defined(__WIN32__)
#define PATH_SEPARATOR "\\" #define PATH_SEPARATOR "\\"
#elif defined(__MINT__)
#define PATH_SEPARATOR "\\"
#else #else
#define PATH_SEPARATOR "/" #define PATH_SEPARATOR "/"
#endif #endif

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2010 Alexander Filyanov Copyright 2010 Alexander Filyanov
Copyright 2009 Petter Lindquist Copyright 2009 Petter Lindquist
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
@ -49,6 +50,7 @@
#include "windows.h" #include "windows.h"
#include "engine.h" #include "engine.h"
#include "brush.h" #include "brush.h"
#include "setup.h"
// -- PKM ------------------------------------------------------------------- // -- PKM -------------------------------------------------------------------
void Test_PKM(T_IO_Context *); void Test_PKM(T_IO_Context *);
@ -1084,10 +1086,12 @@ void Emergency_backup(const char *fname, byte *source, int width, int height, T_
void Image_emergency_backup() void Image_emergency_backup()
{ {
#ifndef NOLAYERS
if (Main_backups && Main_backups->Pages && Main_backups->Pages->Nb_layers == 1) if (Main_backups && Main_backups->Pages && Main_backups->Pages->Nb_layers == 1)
Emergency_backup("a999999.bkp",Main_screen, Main_image_width, Main_image_height, &Main_palette); Emergency_backup(SAFETYBACKUP_PREFIX_A "999999" BACKUP_FILE_EXTENSION,Main_screen, Main_image_width, Main_image_height, &Main_palette);
if (Spare_backups && Spare_backups->Pages && Spare_backups->Pages->Nb_layers == 1) if (Spare_backups && Spare_backups->Pages && Spare_backups->Pages->Nb_layers == 1)
Emergency_backup("b999999.bkp",Spare_visible_image.Image, Spare_image_width, Spare_image_height, &Spare_palette); Emergency_backup(SAFETYBACKUP_PREFIX_B "999999" BACKUP_FILE_EXTENSION,Spare_visible_image.Image, Spare_image_width, Spare_image_height, &Spare_palette);
#endif
} }
T_Format * Get_fileformat(byte format) T_Format * Get_fileformat(byte format)
@ -1420,8 +1424,13 @@ int Check_recovery(void)
int restored_main; int restored_main;
// First check if can write backups // First check if can write backups
if (Create_lock_file(Config_directory)) #if defined (__MINT__)
//TODO: enable file lock under Freemint only
return 0;
#else
if (Create_lock_file(Config_directory))
return -1; return -1;
#endif
Safety_backup_active=1; Safety_backup_active=1;
@ -1477,7 +1486,7 @@ void Rotate_safety_backups(void)
{ {
// Clear a previous save (rotating saves) // Clear a previous save (rotating saves)
sprintf(deleted_file, "%s%c%6.6d.bkp", sprintf(deleted_file, "%s%c%6.6d" BACKUP_FILE_EXTENSION,
Config_directory, Config_directory,
Main_safety_backup_prefix, Main_safety_backup_prefix,
(Uint32)(Main_safety_number + 1000000l - Rotation_safety_backup) % (Uint32)1000000l); (Uint32)(Main_safety_number + 1000000l - Rotation_safety_backup) % (Uint32)1000000l);
@ -1488,7 +1497,7 @@ void Rotate_safety_backups(void)
Main_time_of_safety_backup=now; Main_time_of_safety_backup=now;
// Create a new file name and save // Create a new file name and save
sprintf(file_name, "%c%6.6d.bkp", sprintf(file_name, "%c%6.6d" BACKUP_FILE_EXTENSION,
Main_safety_backup_prefix, Main_safety_backup_prefix,
(Uint32)Main_safety_number); (Uint32)Main_safety_number);
Init_context_backup_image(&context, file_name, Config_directory); Init_context_backup_image(&context, file_name, Config_directory);
@ -1530,6 +1539,10 @@ void Delete_safety_backups(void)
} }
// Release lock file // Release lock file
#if defined (__MINT__)
//TODO: release file lock under Freemint only
#else
Release_lock_file(Config_directory); Release_lock_file(Config_directory);
#endif
} }

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2009 Pasi Kallinen Copyright 2009 Pasi Kallinen
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -71,6 +72,8 @@
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
#define chdir(dir) SetCurrentDirectory(dir) #define chdir(dir) SetCurrentDirectory(dir)
#elif defined (__MINT__)
#include <mint/osbind.h>
#elif defined(__macosx__) #elif defined(__macosx__)
#import <corefoundation/corefoundation.h> #import <corefoundation/corefoundation.h>
#import <sys/param.h> #import <sys/param.h>
@ -86,6 +89,8 @@
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
#endif #endif
extern char Program_version[]; // generated in pversion.c
//--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles --- //--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles ---
void Display_syntax(void) void Display_syntax(void)
{ {
@ -401,6 +406,16 @@ int Analyze_command_line(int argc, char * argv[], char *main_filename, char *mai
return file_in_command_line; return file_in_command_line;
} }
// Compile-time assertions:
#define CT_ASSERT(e) extern char (*ct_assert(void)) [sizeof(char[1 - 2*!(e)])]
// This line will raise an error at compile time
// when sizeof(T_Components) is not 3.
CT_ASSERT(sizeof(T_Components)==3);
// This line will raise an error at compile time
// when sizeof(T_Palette) is not 768.
CT_ASSERT(sizeof(T_Palette)==768);
// ------------------------ Initialiser le programme ------------------------- // ------------------------ Initialiser le programme -------------------------
// Returns 0 on fail // Returns 0 on fail
@ -416,7 +431,12 @@ int Init_program(int argc,char * argv[])
static char spare_filename [MAX_PATH_CHARACTERS]; static char spare_filename [MAX_PATH_CHARACTERS];
static char spare_directory[MAX_PATH_CHARACTERS]; static char spare_directory[MAX_PATH_CHARACTERS];
#if defined(__MINT__)
printf("===============================\n");
printf(" /|\\ GrafX2 %.19s\n", Program_version);
printf(" compilation date: %.16s\n", __DATE__);
printf("===============================\n");
#endif
// On crée dès maintenant les descripteurs des listes de pages pour la page // On crée dès maintenant les descripteurs des listes de pages pour la page
// principale et la page de brouillon afin que leurs champs ne soient pas // principale et la page de brouillon afin que leurs champs ne soient pas
@ -433,9 +453,12 @@ int Init_program(int argc,char * argv[])
Set_data_directory(program_directory,Data_directory); Set_data_directory(program_directory,Data_directory);
// Choose directory for settings (read/write) // Choose directory for settings (read/write)
Set_config_directory(program_directory,Config_directory); Set_config_directory(program_directory,Config_directory);
#if defined(__MINT__)
// On détermine le répertoire courant: strcpy(Main_current_directory,program_directory);
#else
// On détermine le répertoire courant:
getcwd(Main_current_directory,256); getcwd(Main_current_directory,256);
#endif
// On en profite pour le mémoriser dans le répertoire principal: // On en profite pour le mémoriser dans le répertoire principal:
strcpy(Initial_directory,Main_current_directory); strcpy(Initial_directory,Main_current_directory);
@ -497,8 +520,8 @@ int Init_program(int argc,char * argv[])
Spare_magnifier_offset_Y=0; Spare_magnifier_offset_Y=0;
Keyboard_click_allowed = 1; Keyboard_click_allowed = 1;
Main_safety_backup_prefix = 'a'; Main_safety_backup_prefix = SAFETYBACKUP_PREFIX_A[0];
Spare_safety_backup_prefix = 'b'; Spare_safety_backup_prefix = SAFETYBACKUP_PREFIX_B[0];
Main_time_of_safety_backup = 0; Main_time_of_safety_backup = 0;
Spare_time_of_safety_backup = 0; Spare_time_of_safety_backup = 0;
@ -646,7 +669,7 @@ int Init_program(int argc,char * argv[])
gfx = Load_graphics(Config.Skin_file); gfx = Load_graphics(Config.Skin_file);
if (gfx == NULL) if (gfx == NULL)
{ {
gfx = Load_graphics("skin_DPaint.png"); gfx = Load_graphics(DEFAULT_SKIN_FILENAME);
if (gfx == NULL) if (gfx == NULL)
{ {
printf("%s", Gui_loading_error_message); printf("%s", Gui_loading_error_message);
@ -670,9 +693,9 @@ int Init_program(int argc,char * argv[])
// Font // Font
if (!(Menu_font=Load_font(Config.Font_file))) if (!(Menu_font=Load_font(Config.Font_file)))
if (!(Menu_font=Load_font("font_DPaint.png"))) if (!(Menu_font=Load_font(DEFAULT_FONT_FILENAME)))
{ {
printf("Unable to open the default font file: %s\n", "font_Classic.png"); printf("Unable to open the default font file: %s\n", DEFAULT_FONT_FILENAME);
Error(ERROR_GUI_MISSING); Error(ERROR_GUI_MISSING);
} }

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
@ -740,13 +741,26 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
// sysinfo not implemented // sysinfo not implemented
#elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__) #elif defined(__AROS__) || defined(__amigaos4__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/exec.h> #include <proto/exec.h>
#elif defined(__MINT__)
#include <mint/osbind.h>
#include <mint/sysbind.h>
#elif defined(__SKYOS__) #elif defined(__SKYOS__)
#include <skyos/sysinfo.h> #include <skyos/sysinfo.h>
#else #else
#include <sys/sysinfo.h> // sysinfo() for free RAM #include <sys/sysinfo.h> // sysinfo() for free RAM
#endif #endif
#if defined (__MINT__)
// atari have two kinds of memory
// standard and fast ram
void Atari_Memory_free(unsigned long *stRam,unsigned long *ttRam){
//TODO: return STRAM/TT-RAM
unsigned long mem=0;
*stRam=Mxalloc(-1L,0);
*ttRam = Mxalloc(-1L,1);
}
#else
// Indique quelle est la mémoire disponible // Indique quelle est la mémoire disponible
unsigned long Memory_free(void) unsigned long Memory_free(void)
{ {
@ -786,6 +800,8 @@ unsigned long Memory_free(void)
return info.freeram*info.mem_unit; return info.freeram*info.mem_unit;
#endif #endif
} }
#endif
// Arrondir un nombre réel à la valeur entière la plus proche // Arrondir un nombre réel à la valeur entière la plus proche

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2009 Petter Lindquist Copyright 2009 Petter Lindquist
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -733,7 +734,7 @@ void Load_CEL(T_IO_Context * context)
short y_pos; short y_pos;
byte last_byte=0; byte last_byte=0;
long file_size; long file_size;
const long int header_size = (long int)(sizeof(header1.Width)+sizeof(header1.Height)); const long int header_size = 4;
File_error=0; File_error=0;
Get_full_filename(filename, context->File_name, context->File_directory); Get_full_filename(filename, context->File_name, context->File_directory);
@ -773,7 +774,7 @@ void Load_CEL(T_IO_Context * context)
// On réessaye avec le nouveau format // On réessaye avec le nouveau format
fseek(file,0,SEEK_SET); fseek(file,0,SEEK_SET);
if (Read_bytes(file,header2.Signature,sizeof(header2.Signature)) if (Read_bytes(file,header2.Signature,4)
&& Read_byte(file,&(header2.Kind)) && Read_byte(file,&(header2.Kind))
&& Read_byte(file,&(header2.Nb_bits)) && Read_byte(file,&(header2.Nb_bits))
&& Read_word_le(file,&(header2.Filler1)) && Read_word_le(file,&(header2.Filler1))
@ -781,7 +782,7 @@ void Load_CEL(T_IO_Context * context)
&& Read_word_le(file,&(header2.Height)) && Read_word_le(file,&(header2.Height))
&& Read_word_le(file,&(header2.X_offset)) && Read_word_le(file,&(header2.X_offset))
&& Read_word_le(file,&(header2.Y_offset)) && Read_word_le(file,&(header2.Y_offset))
&& Read_bytes(file,header2.Filler2,sizeof(header2.Filler2)) && Read_bytes(file,header2.Filler2,16)
) )
{ {
// Chargement d'un fichier CEL avec signature (nouveaux fichiers) // Chargement d'un fichier CEL avec signature (nouveaux fichiers)
@ -940,7 +941,7 @@ void Save_CEL(T_IO_Context * context)
for (x_pos=0;x_pos<16;x_pos++) // Initialisation du filler 2 (?) for (x_pos=0;x_pos<16;x_pos++) // Initialisation du filler 2 (?)
header2.Filler2[x_pos]=0; header2.Filler2[x_pos]=0;
if (Write_bytes(file,header2.Signature,sizeof(header2.Signature)) if (Write_bytes(file,header2.Signature,4)
&& Write_byte(file,header2.Kind) && Write_byte(file,header2.Kind)
&& Write_byte(file,header2.Nb_bits) && Write_byte(file,header2.Nb_bits)
&& Write_word_le(file,header2.Filler1) && Write_word_le(file,header2.Filler1)
@ -948,7 +949,7 @@ void Save_CEL(T_IO_Context * context)
&& Write_word_le(file,header2.Height) && Write_word_le(file,header2.Height)
&& Write_word_le(file,header2.X_offset) && Write_word_le(file,header2.X_offset)
&& Write_word_le(file,header2.Y_offset) && Write_word_le(file,header2.Y_offset)
&& Write_bytes(file,header2.Filler2,sizeof(header2.Filler2)) && Write_bytes(file,header2.Filler2,14)
) )
{ {
// Sauvegarde de l'image // Sauvegarde de l'image
@ -1014,7 +1015,7 @@ void Test_KCF(T_IO_Context * context)
} }
else else
{ {
if (Read_bytes(file,header2.Signature,sizeof(header2.Signature)) if (Read_bytes(file,header2.Signature,4)
&& Read_byte(file,&(header2.Kind)) && Read_byte(file,&(header2.Kind))
&& Read_byte(file,&(header2.Nb_bits)) && Read_byte(file,&(header2.Nb_bits))
&& Read_word_le(file,&(header2.Filler1)) && Read_word_le(file,&(header2.Filler1))
@ -1022,7 +1023,7 @@ void Test_KCF(T_IO_Context * context)
&& Read_word_le(file,&(header2.Height)) && Read_word_le(file,&(header2.Height))
&& Read_word_le(file,&(header2.X_offset)) && Read_word_le(file,&(header2.X_offset))
&& Read_word_le(file,&(header2.Y_offset)) && Read_word_le(file,&(header2.Y_offset))
&& Read_bytes(file,header2.Filler2,sizeof(header2.Filler2)) && Read_bytes(file,header2.Filler2,14)
) )
{ {
if (memcmp(header2.Signature,"KiSS",4)==0) if (memcmp(header2.Signature,"KiSS",4)==0)
@ -1105,7 +1106,7 @@ void Load_KCF(T_IO_Context * context)
{ {
// Fichier KCF au nouveau format // Fichier KCF au nouveau format
if (Read_bytes(file,header2.Signature,sizeof(header2.Signature)) if (Read_bytes(file,header2.Signature,4)
&& Read_byte(file,&(header2.Kind)) && Read_byte(file,&(header2.Kind))
&& Read_byte(file,&(header2.Nb_bits)) && Read_byte(file,&(header2.Nb_bits))
&& Read_word_le(file,&(header2.Filler1)) && Read_word_le(file,&(header2.Filler1))
@ -1113,7 +1114,7 @@ void Load_KCF(T_IO_Context * context)
&& Read_word_le(file,&(header2.Height)) && Read_word_le(file,&(header2.Height))
&& Read_word_le(file,&(header2.X_offset)) && Read_word_le(file,&(header2.X_offset))
&& Read_word_le(file,&(header2.Y_offset)) && Read_word_le(file,&(header2.Y_offset))
&& Read_bytes(file,header2.Filler2,sizeof(header2.Filler2)) && Read_bytes(file,header2.Filler2,14)
) )
{ {
// Pre_load(context, ?); // Pas possible... pas d'image... // Pre_load(context, ?); // Pas possible... pas d'image...
@ -1227,7 +1228,7 @@ void Save_KCF(T_IO_Context * context)
for (index=0;index<16;index++) // Initialisation du filler 2 (?) for (index=0;index<16;index++) // Initialisation du filler 2 (?)
header2.Filler2[index]=0; header2.Filler2[index]=0;
if (!Write_bytes(file,header2.Signature,sizeof(header2.Signature)) if (!Write_bytes(file,header2.Signature,4)
|| !Write_byte(file,header2.Kind) || !Write_byte(file,header2.Kind)
|| !Write_byte(file,header2.Nb_bits) || !Write_byte(file,header2.Nb_bits)
|| !Write_word_le(file,header2.Filler1) || !Write_word_le(file,header2.Filler1)
@ -1235,7 +1236,7 @@ void Save_KCF(T_IO_Context * context)
|| !Write_word_le(file,header2.Height) || !Write_word_le(file,header2.Height)
|| !Write_word_le(file,header2.X_offset) || !Write_word_le(file,header2.X_offset)
|| !Write_word_le(file,header2.Y_offset) || !Write_word_le(file,header2.Y_offset)
|| !Write_bytes(file,header2.Filler2,sizeof(header2.Filler2)) || !Write_bytes(file,header2.Filler2,14)
) )
File_error=1; File_error=1;
@ -1335,12 +1336,24 @@ void PI1_decode_palette(byte * src,byte * palette)
ip=0; ip=0;
for (i=0;i<16;i++) for (i=0;i<16;i++)
{ {
w=((word)src[(i*2)+1]<<8) | src[(i*2)+0]; #if SDL_BYTEORDER == SDL_LIL_ENDIAN
w=(((word)src[(i*2)+1]<<8) | (src[(i*2)+0]));
// Traitement des couleurs rouge, verte et bleue:
palette[ip++]=(((w & 0x0007) << 1) | ((w & 0x0008) >> 3)) << 4;
palette[ip++]=(((w & 0x7000) >> 11) | ((w & 0x8000) >> 15)) << 4;
palette[ip++]=(((w & 0x0700) >> 7) | ((w & 0x0800) >> 11)) << 4;
#else
w=(((word)src[(i*2+1)])|(((word)src[(i*2)])<<8));
palette[ip++] = (((w & 0x0700)>>7) | ((w & 0x0800) >> 7))<<4 ;
palette[ip++]=(((w & 0x0070)>>3) | ((w & 0x0080) >> 3))<<4 ;
palette[ip++] = (((w & 0x0007)<<1) | ((w & 0x0008)))<<4 ;
#endif
// Traitement des couleurs rouge, verte et bleue:
palette[ip++]=(((w & 0x0007) << 1) | ((w & 0x0008) >> 3)) << 4;
palette[ip++]=(((w & 0x7000) >> 11) | ((w & 0x8000) >> 15)) << 4;
palette[ip++]=(((w & 0x0700) >> 7) | ((w & 0x0800) >> 11)) << 4;
} }
} }
@ -1354,13 +1367,15 @@ void PI1_code_palette(byte * palette,byte * dest)
// Schéma d'un word = // Schéma d'un word =
// //
// Low High // Low High
// VVVV RRRR | 0000 BBBB // VVVV RRRR | 0000 BBBB
// 0321 0321 | 0321 // 0321 0321 | 0321
ip=0; ip=0;
for (i=0;i<16;i++) for (i=0;i<16;i++)
{ {
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
// Traitement des couleurs rouge, verte et bleue: // Traitement des couleurs rouge, verte et bleue:
w =(((word)(palette[ip]>>2) & 0x38) >> 3) | (((word)(palette[ip]>>2) & 0x04) << 1); ip++; w =(((word)(palette[ip]>>2) & 0x38) >> 3) | (((word)(palette[ip]>>2) & 0x04) << 1); ip++;
w|=(((word)(palette[ip]>>2) & 0x38) << 9) | (((word)(palette[ip]>>2) & 0x04) << 13); ip++; w|=(((word)(palette[ip]>>2) & 0x38) << 9) | (((word)(palette[ip]>>2) & 0x04) << 13); ip++;
@ -1368,6 +1383,15 @@ void PI1_code_palette(byte * palette,byte * dest)
dest[(i*2)+0]=w & 0x00FF; dest[(i*2)+0]=w & 0x00FF;
dest[(i*2)+1]=(w>>8); dest[(i*2)+1]=(w>>8);
#else
w=(((word)(palette[ip]<<3))&0x0700);ip++;
w|=(((word)(palette[ip]>>1))&0x0070);ip++;
w|=(((word)(palette[ip]>>5))&0x0007);ip++;
dest[(i*2)+1]=w & 0x00FF;
dest[(i*2)+0]=(w>>8);
#endif
} }
} }

View File

@ -336,12 +336,12 @@ fstype_to_string (int t)
#define BROKEN #define BROKEN
#endif #endif
#if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2 #if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2
/* Return the device number from MOUNT_OPTIONS, if possible. /* Return the device number from MOUNT_OPTIONS, if possible.
Otherwise return (dev_t) -1. */ Otherwise return (dev_t) -1. */
static dev_t static dev_t
dev_from_mount_options (BROKEN char const *mount_options) dev_from_mount_options (BROKEN char const *mount_options)
{ {

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -39,13 +40,14 @@ extern byte * FX_feedback_screen;
/////////////////////////// BACKUP /////////////////////////////////////// /////////////////////////// BACKUP ///////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifndef NOLAYERS
/// The pixels of visible layers, flattened copy. /// The pixels of visible layers, flattened copy.
extern T_Bitmap Main_visible_image; extern T_Bitmap Main_visible_image;
/// The pixels of visible layers, flattened copy, used for no-feedback effects. /// The pixels of visible layers, flattened copy, used for no-feedback effects.
extern T_Bitmap Main_visible_image_backup; extern T_Bitmap Main_visible_image_backup;
/// The index of visible pixels from ::Visible image. Points to the right layer. /// The index of visible pixels from ::Visible image. Points to the right layer.
extern T_Bitmap Main_visible_image_depth_buffer; extern T_Bitmap Main_visible_image_depth_buffer;
#endif
/// The pixels of visible layers for the spare page, flattened copy. /// The pixels of visible layers for the spare page, flattened copy.
extern T_Bitmap Spare_visible_image; extern T_Bitmap Spare_visible_image;

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
@ -32,6 +33,7 @@
#include "global.h" #include "global.h"
#include "misc.h" #include "misc.h"
#include "readini.h" #include "readini.h"
#include "setup.h"
void Load_INI_clear_string(char * str, byte keep_comments) void Load_INI_clear_string(char * str, byte keep_comments)
{ {
@ -446,14 +448,14 @@ int Load_INI(T_Config * conf)
// On calcule le nom du fichier qu'on manipule: // On calcule le nom du fichier qu'on manipule:
strcpy(filename,Config_directory); strcpy(filename,Config_directory);
strcat(filename,"gfx2.ini"); strcat(filename,INI_FILENAME);
file=fopen(filename,"r"); file=fopen(filename,"r");
if (file==0) if (file==0)
{ {
// Si le fichier ini est absent on le relit depuis gfx2def.ini // Si le fichier ini est absent on le relit depuis gfx2def.ini
strcpy(filename,Data_directory); strcpy(filename,Data_directory);
strcat(filename,"gfx2def.ini"); strcat(filename,INIDEF_FILENAME);
file=fopen(filename,"r"); file=fopen(filename,"r");
if (file == 0) if (file == 0)
{ {

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
@ -30,6 +31,7 @@
#include "errors.h" #include "errors.h"
#include "misc.h" #include "misc.h"
#include "saveini.h" #include "saveini.h"
#include "setup.h"
int Save_INI_reach_group(FILE * old_file,FILE * new_file,char * buffer,char * group) int Save_INI_reach_group(FILE * old_file,FILE * new_file,char * buffer,char * group)
{ {
@ -409,13 +411,13 @@ int Save_INI(T_Config * conf)
// On calcule les noms des fichiers qu'on manipule: // On calcule les noms des fichiers qu'on manipule:
strcpy(filename,Config_directory); strcpy(filename,Config_directory);
strcat(filename,"gfx2.ini"); strcat(filename,INI_FILENAME);
// On vérifie si le fichier INI existe // On vérifie si le fichier INI existe
if ((ini_file_exists = File_exists(filename))) if ((ini_file_exists = File_exists(filename)))
{ {
strcpy(temp_filename,Config_directory); strcpy(temp_filename,Config_directory);
strcat(temp_filename,"gfx2.$$$"); strcat(temp_filename,INISAVE_FILENAME);
// 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(filename,temp_filename)!=0) if (rename(filename,temp_filename)!=0)
@ -425,7 +427,7 @@ int Save_INI(T_Config * conf)
} }
// On récupère un fichier INI "propre" à partir de gfx2def.ini // On récupère un fichier INI "propre" à partir de gfx2def.ini
strcpy(ref_ini_file,Data_directory); strcpy(ref_ini_file,Data_directory);
strcat(ref_ini_file,"gfx2def.ini"); strcat(ref_ini_file,INIDEF_FILENAME);
old_file=fopen(ref_ini_file,"rb"); old_file=fopen(ref_ini_file,"rb");
if (old_file==0) if (old_file==0)
{ {

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
@ -51,6 +52,8 @@
#ifndef UPDATE_METHOD #ifndef UPDATE_METHOD
#if defined(__macosx__) #if defined(__macosx__)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE #define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__MINT__)
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#else #else
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED #define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#endif #endif

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -35,6 +36,9 @@
#import <sys/param.h> #import <sys/param.h>
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#import <sys/param.h> #import <sys/param.h>
#elif defined(__MINT__)
#include <mint/osbind.h>
#include <mint/sysbind.h>
#elif defined(__linux__) #elif defined(__linux__)
#include <limits.h> #include <limits.h>
#include <unistd.h> #include <unistd.h>
@ -84,7 +88,16 @@ void Set_program_directory(ARG_UNUSED const char * argv0,char * program_dir)
// AmigaOS and alike: hard-coded volume name. // AmigaOS and alike: hard-coded volume name.
#elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) #elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
strcpy(program_dir,"PROGDIR:"); strcpy(program_dir,"PROGDIR:");
#elif defined(__MINT__)
static char path[1024]={0};
char currentDrive='A';
currentDrive=currentDrive+Dgetdrv();
Dgetpath(path,0);
sprintf(program_dir,"%c:\%s",currentDrive,path);
// Append trailing slash
strcat(program_dir,PATH_SEPARATOR);
// Linux: argv[0] unreliable // Linux: argv[0] unreliable
#elif defined(__linux__) #elif defined(__linux__)
if (argv0[0]!='/') if (argv0[0]!='/')
@ -117,6 +130,9 @@ void Set_data_directory(const char * program_dir, char * data_dir)
// On GP2X, executable is not in bin/ // On GP2X, executable is not in bin/
#elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) #elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__)
strcat(data_dir,"share/grafx2/"); strcat(data_dir,"share/grafx2/");
//on tos the same directory
#elif defined (__MINT__)
strcpy(data_dir, program_dir);
// All other targets, program is in a "bin" subdirectory // All other targets, program is in a "bin" subdirectory
#elif defined (__AROS__) #elif defined (__AROS__)
strcat(data_dir,"/share/grafx2/"); strcat(data_dir,"/share/grafx2/");
@ -146,6 +162,8 @@ void Set_config_directory(const char * program_dir, char * config_dir)
// On the GP2X, the program is installed to the sdcard, and we don't want to mess with the system tree which is // On the GP2X, the program is installed to the sdcard, and we don't want to mess with the system tree which is
// on an internal flash chip. So, keep these settings locals. // on an internal flash chip. So, keep these settings locals.
strcpy(config_dir,program_dir); strcpy(config_dir,program_dir);
#elif defined(__MINT__)
strcpy(config_dir,program_dir);
#else #else
char filename[MAX_PATH_CHARACTERS]; char filename[MAX_PATH_CHARACTERS];
@ -156,7 +174,7 @@ void Set_config_directory(const char * program_dir, char * config_dir)
strcat(config_dir, "../"); strcat(config_dir, "../");
#endif #endif
strcpy(filename, config_dir); strcpy(filename, config_dir);
strcat(filename, "gfx2.cfg"); strcat(filename, CONFIG_FILENAME);
if (!File_exists(filename)) if (!File_exists(filename))
{ {
@ -173,6 +191,10 @@ void Set_config_directory(const char * program_dir, char * config_dir)
// "~/Library/Preferences/com.googlecode.grafx2" // "~/Library/Preferences/com.googlecode.grafx2"
const char* Config_SubDir = "Library/Preferences/com.googlecode.grafx2"; const char* Config_SubDir = "Library/Preferences/com.googlecode.grafx2";
config_parent_dir = getenv("HOME"); config_parent_dir = getenv("HOME");
#elif defined(__MINT__)
const char* Config_SubDir = "";
printf("GFX2.CFG not found in %s\n",filename);
strcpy(config_parent_dir, config_dir);
#else #else
// "~/.grafx2" // "~/.grafx2"
const char* Config_SubDir = ".grafx2"; const char* Config_SubDir = ".grafx2";

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Peter Gordon Copyright 2008 Peter Gordon
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
@ -54,3 +55,101 @@ void Set_data_directory(const char * program_dir, char * data_dir);
/// OUT: Write into config_dir. Trailing / or \ is kept. /// OUT: Write into config_dir. Trailing / or \ is kept.
void Set_config_directory(const char * program_dir, char * config_dir); void Set_config_directory(const char * program_dir, char * config_dir);
/// Name of the subdirectory containing fonts, under the data directory (::Set_data_directory())
#if defined (__MINT__)
#define FONTS_SUBDIRECTORY "FONTS"
#else
#define FONTS_SUBDIRECTORY "fonts"
#endif
/// Name of the subdirectory containing fonts, under the data directory (::Set_data_directory())
#if defined (__MINT__)
#define SKINS_SUBDIRECTORY "SKINS"
#else
#define SKINS_SUBDIRECTORY "skins"
#endif
/// Name of the binary file containing some configuration settings.
#if defined (__MINT__)
#define CONFIG_FILENAME "GFX2.CFG"
#else
#define CONFIG_FILENAME "gfx2.cfg"
#endif
/// Name of the text file containing some settings in INI format.
#if defined (__MINT__)
#define INI_FILENAME "GFX2.INI"
#else
#define INI_FILENAME "gfx2.ini"
#endif
/// Name of the backup of the INI file.
#if defined (__MINT__)
#define INISAVE_FILENAME "GFX2.$$$"
#else
#define INISAVE_FILENAME "gfx2.$$$"
#endif
/// Name of the default .INI file (read-only: gives .INI format and defaults)
#if defined (__MINT__)
#define INIDEF_FILENAME "GFX2DEF.INI"
#else
#define INIDEF_FILENAME "gfx2def.ini"
#endif
/// Prefix for filenames of safety backups (main)
#if defined (__MINT__)
#define SAFETYBACKUP_PREFIX_A "A"
#else
#define SAFETYBACKUP_PREFIX_A "a"
#endif
/// Prefix for filenames of safety backups (spare)
#if defined (__MINT__)
#define SAFETYBACKUP_PREFIX_B "B"
#else
#define SAFETYBACKUP_PREFIX_B "b"
#endif
/// Name of the image file that serves as an application icon.
#if defined (__MINT__)
#define GFX2_ICON_FILENAME "GFX2.GIF"
#else
#define GFX2_ICON_FILENAME "gfx2.gif"
#endif
/// Name of the image file for the default (and fallback) GUI skin.
#if defined (__MINT__)
#define DEFAULT_SKIN_FILENAME "SDPAINT.PNG"
#else
#define DEFAULT_SKIN_FILENAME "skin_DPaint.png"
#endif
/// Name of the image file for the default (and fallback) 8x8 font.
#if defined (__MINT__)
#define DEFAULT_FONT_FILENAME "FDPAINT.PNG"
#else
#define DEFAULT_FONT_FILENAME "font_DPaint.png"
#endif
/// File extension for safety backups
#if defined (__MINT__)
#define BACKUP_FILE_EXTENSION ".BKP"
#else
#define BACKUP_FILE_EXTENSION ".bkp"
#endif
/// File prefix for fonts
#if defined (__MINT__)
#define FONT_PREFIX "F"
#else
#define FONT_PREFIX "font_"
#endif
/// File prefix for skins
#if defined (__MINT__)
#define SKIN_PREFIX "S"
#else
#define SKIN_PREFIX "skin_"
#endif

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2007 Adrien Destugues Copyright 2007 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -73,14 +74,23 @@ typedef void (* Func_draw_brush) (byte *,word,word,word,word,word,word,byte,word
typedef void (* Func_draw_list_item) (word,word,word,byte); ///< Draw an item inside a list button. This is done with a callback so it is possible to draw anything, as the list itself doesn't handle the content typedef void (* Func_draw_list_item) (word,word,word,byte); ///< Draw an item inside a list button. This is done with a callback so it is possible to draw anything, as the list itself doesn't handle the content
/// A set of RGB values. /// A set of RGB values.
#ifdef __GNUC__
typedef struct
{
byte R; ///< Red
byte G; ///< Green
byte B; ///< Blue
} __attribute__((__packed__)) T_Components, T_Palette[256] ; ///< A complete 256-entry RGB palette (768 bytes).
#else
#pragma pack(1) #pragma pack(1)
typedef struct typedef struct
{ {
byte R; ///< Red byte R; ///< Red
byte G; ///< Green byte G; ///< Green
byte B; ///< Blue byte B; ///< Blue
} T_Components, T_Palette[256]; ///< A complete 256-entry RGB palette (768 bytes). } T_Components, T_Palette[256] ; ///< A complete 256-entry RGB palette (768 bytes).
#pragma pack() #pragma pack()
#endif
/// A normal rectangular button in windows and menus. /// A normal rectangular button in windows and menus.
typedef struct T_Normal_button typedef struct T_Normal_button
@ -277,7 +287,6 @@ typedef struct
word Height;///< Videomode height in pixels. word Height;///< Videomode height in pixels.
} T_Config_video_mode; } T_Config_video_mode;
/// Header for gfx2.cfg /// Header for gfx2.cfg
typedef struct typedef struct
{ {
@ -288,7 +297,6 @@ typedef struct
byte Beta2; ///< Major beta version number (ex: 5) byte Beta2; ///< Major beta version number (ex: 5)
} T_Config_header; } T_Config_header;
/// Header for a config chunk in for gfx2.cfg /// Header for a config chunk in for gfx2.cfg
typedef struct typedef struct
{ {

View File

@ -2,6 +2,7 @@
*/ */
/* Grafx2 - The Ultimate 256-color bitmap paint program /* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2011 Pawel Góralski
Copyright 2008 Yves Rizoud Copyright 2008 Yves Rizoud
Copyright 2008 Franck Charlet Copyright 2008 Franck Charlet
Copyright 2008 Adrien Destugues Copyright 2008 Adrien Destugues
@ -57,6 +58,7 @@
#include "errors.h" #include "errors.h"
#include "windows.h" #include "windows.h"
#include "misc.h" #include "misc.h"
#include "setup.h"
typedef struct T_Font typedef struct T_Font
{ {
@ -283,7 +285,7 @@ void Init_text(void)
Nb_fonts=0; Nb_fonts=0;
// Parcours du répertoire "fonts" // Parcours du répertoire "fonts"
strcpy(directory_name, Data_directory); strcpy(directory_name, Data_directory);
strcat(directory_name, "fonts"); strcat(directory_name, FONTS_SUBDIRECTORY);
For_each_file(directory_name, Add_font); For_each_file(directory_name, Add_font);
#if defined(__WIN32__) #if defined(__WIN32__)
@ -358,6 +360,10 @@ void Init_text(void)
#ifndef NOTTF #ifndef NOTTF
For_each_file("/boot/system/fonts", Add_font); For_each_file("/boot/system/fonts", Add_font);
#endif #endif
#elif defined(__MINT__)
#ifndef NOTTF
For_each_file("C:/BTFONTS", Add_font);
#endif
#endif #endif
} }