removed gfx2cfg, we don't need it anymore.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@678 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									c60c1e7353
								
							
						
					
					
						commit
						cb1cac1b6f
					
				
							
								
								
									
										39
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								Makefile
									
									
									
									
									
								
							@ -40,7 +40,6 @@ ifdef COMSPEC
 | 
				
			|||||||
  RMDIR = rmdir
 | 
					  RMDIR = rmdir
 | 
				
			||||||
  CP = cp
 | 
					  CP = cp
 | 
				
			||||||
  BIN = grafx2.exe
 | 
					  BIN = grafx2.exe
 | 
				
			||||||
  CFGBIN = gfxcfg.exe
 | 
					 | 
				
			||||||
  COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT)
 | 
					  COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT)
 | 
				
			||||||
  LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng
 | 
					  LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng
 | 
				
			||||||
  CC = gcc
 | 
					  CC = gcc
 | 
				
			||||||
@ -64,7 +63,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -D__USE_INLINE__ $(TTFCOPT)
 | 
					    COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -D__USE_INLINE__ $(TTFCOPT)
 | 
				
			||||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2
 | 
					    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -79,7 +77,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -Wall -g `sdl-config --cflags` $(TTFCOPT)
 | 
					    COPT = -Wall -g `sdl-config --cflags` $(TTFCOPT)
 | 
				
			||||||
    LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared
 | 
					    LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -94,7 +91,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -Wall -gstabs -c `sdl-config --cflags` $(TTFCOPT)
 | 
					    COPT = -Wall -gstabs -c `sdl-config --cflags` $(TTFCOPT)
 | 
				
			||||||
    LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT)
 | 
					    LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT)
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -109,7 +105,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/home/config/include
 | 
					    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/home/config/include
 | 
				
			||||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
					    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -123,7 +118,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/common/include
 | 
					    COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/common/include
 | 
				
			||||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
					    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -137,7 +131,6 @@ else
 | 
				
			|||||||
    RMDIR = rmdir
 | 
					    RMDIR = rmdir
 | 
				
			||||||
    CP = cp
 | 
					    CP = cp
 | 
				
			||||||
    BIN = grafx2
 | 
					    BIN = grafx2
 | 
				
			||||||
    CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
    COPT = -W -Wall -Wdeclaration-after-statement -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
					    COPT = -W -Wall -Wdeclaration-after-statement -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
				
			||||||
    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
					    LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
 | 
				
			||||||
    CC = gcc
 | 
					    CC = gcc
 | 
				
			||||||
@ -161,7 +154,6 @@ else
 | 
				
			|||||||
      ZIP = zip
 | 
					      ZIP = zip
 | 
				
			||||||
      PLATFORMFILS = gfx2.png
 | 
					      PLATFORMFILS = gfx2.png
 | 
				
			||||||
      BIN = grafx2
 | 
					      BIN = grafx2
 | 
				
			||||||
      CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
      COPT = -c99
 | 
					      COPT = -c99
 | 
				
			||||||
      LOPT =
 | 
					      LOPT =
 | 
				
			||||||
      CC = Logiciels:vbcc/bin/vc
 | 
					      CC = Logiciels:vbcc/bin/vc
 | 
				
			||||||
@ -184,7 +176,6 @@ else
 | 
				
			|||||||
        #cross compile a Win32 executable
 | 
					        #cross compile a Win32 executable
 | 
				
			||||||
        CC = i586-mingw32msvc-gcc
 | 
					        CC = i586-mingw32msvc-gcc
 | 
				
			||||||
        BIN = grafx2.exe
 | 
					        BIN = grafx2.exe
 | 
				
			||||||
        CFGBIN = gfxcfg.exe
 | 
					 | 
				
			||||||
        COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT)
 | 
					        COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT)
 | 
				
			||||||
        LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` -lSDL_image $(TTFLOPT)
 | 
					        LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` -lSDL_image $(TTFLOPT)
 | 
				
			||||||
        OBJDIR = obj/win32
 | 
					        OBJDIR = obj/win32
 | 
				
			||||||
@ -194,7 +185,6 @@ else
 | 
				
			|||||||
        #cross compile an exec for the gp2x
 | 
					        #cross compile an exec for the gp2x
 | 
				
			||||||
        CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
 | 
					        CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
 | 
				
			||||||
        BIN = grafx2.gpe
 | 
					        BIN = grafx2.gpe
 | 
				
			||||||
        CFGBIN = gfxcfg.gpe
 | 
					 | 
				
			||||||
        COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -c -g -O3 `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__
 | 
					        COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -c -g -O3 `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__
 | 
				
			||||||
        LOPT = -static -lSDL_image `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --static-libs` -ljpeg -lpng -lz -lm $(TTFLOPT)
 | 
					        LOPT = -static -lSDL_image `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --static-libs` -ljpeg -lpng -lz -lm $(TTFLOPT)
 | 
				
			||||||
        OBJDIR = obj/gp2x
 | 
					        OBJDIR = obj/gp2x
 | 
				
			||||||
@ -205,7 +195,6 @@ else
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        # Compiles a regular linux exectutable for the native platform
 | 
					        # Compiles a regular linux exectutable for the native platform
 | 
				
			||||||
        BIN = grafx2
 | 
					        BIN = grafx2
 | 
				
			||||||
        CFGBIN = gfxcfg
 | 
					 | 
				
			||||||
        COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
					        COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
 | 
				
			||||||
        LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT)
 | 
					        LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT)
 | 
				
			||||||
        CC = gcc
 | 
					        CC = gcc
 | 
				
			||||||
@ -246,30 +235,25 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
					# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
 | 
				
			||||||
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o
 | 
					OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o  $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o
 | 
				
			||||||
CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/setup.o  $(OBJDIR)/hotkeys.o
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
all : $(BIN) $(CFGBIN)
 | 
					all : $(BIN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
debug : $(BIN)
 | 
					debug : $(BIN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Make release will strip the executable to make it smaller but non-debugable
 | 
					# Make release will strip the executable to make it smaller but non-debugable
 | 
				
			||||||
release : $(BIN) $(CFGBIN)
 | 
					release : $(BIN)
 | 
				
			||||||
	$(STRIP) $(BIN)
 | 
						$(STRIP) $(BIN)
 | 
				
			||||||
	$(STRIP) $(CFGBIN)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a zip archive ready for upload to the website, including binaries and sourcecode
 | 
					# Create a zip archive ready for upload to the website, including binaries and sourcecode
 | 
				
			||||||
ziprelease: version $(BIN) $(BINCFG) release
 | 
					ziprelease: version $(BIN) release
 | 
				
			||||||
	tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico
 | 
						tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico
 | 
				
			||||||
	$(ZIP) $(ZIPOPT) grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).$(ZIP) $(BIN) $(CFGBIN) gfx2def.ini gfx2gui.gif gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES)
 | 
						$(ZIP) $(ZIPOPT) grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).$(ZIP) $(BIN) gfx2def.ini gfx2gui.gif gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES)
 | 
				
			||||||
	$(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz
 | 
						$(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz
 | 
				
			||||||
	tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz *.c *.h Makefile Makefile.dep gfx2def.ini gfx2gui.gif gfx2.ico gfx2cfg.ico gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png fonts/Tuffy.ttf
 | 
						tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz *.c *.h Makefile Makefile.dep gfx2def.ini gfx2gui.gif gfx2.ico gfx2cfg.ico gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png fonts/Tuffy.ttf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(BIN) : $(OBJ) $(OBJRES)
 | 
					$(BIN) : $(OBJ) $(OBJRES)
 | 
				
			||||||
	$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
 | 
						$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(CFGBIN) : $(CFGOBJ) $(CFGOBJRES)
 | 
					 | 
				
			||||||
	$(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# SVN revision number
 | 
					# SVN revision number
 | 
				
			||||||
version.c :
 | 
					version.c :
 | 
				
			||||||
	echo "char SVN_revision[]=\"`svnversion`\";" > version.c
 | 
						echo "char SVN_revision[]=\"`svnversion`\";" > version.c
 | 
				
			||||||
@ -290,24 +274,17 @@ depend :
 | 
				
			|||||||
$(OBJDIR)/winres.o : gfx2.ico
 | 
					$(OBJDIR)/winres.o : gfx2.ico
 | 
				
			||||||
	echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o
 | 
						echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(OBJDIR)/wincfgres.o : gfx2cfg.ico
 | 
					 | 
				
			||||||
	echo "1 ICON \"gfx2cfg.ico\"" | $(WINDRES) -o $(OBJDIR)/wincfgres.o
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
clean :
 | 
					clean :
 | 
				
			||||||
	$(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES)
 | 
						$(DELCOMMAND) $(OBJ) $(OBJDIR)/version.o $(OBJRES)
 | 
				
			||||||
	$(DELCOMMAND) $(BIN) $(CFGBIN)
 | 
						$(DELCOMMAND) $(BIN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Linux installation of the program
 | 
					# Linux installation of the program
 | 
				
			||||||
install : $(BIN) $(CFGBIN)
 | 
					install : $(BIN)
 | 
				
			||||||
	echo "#!/bin/sh" > $(bindir)/grafx2
 | 
						echo "#!/bin/sh" > $(bindir)/grafx2
 | 
				
			||||||
	echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
 | 
						echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
 | 
				
			||||||
	chmod 755 $(bindir)/grafx2
 | 
						chmod 755 $(bindir)/grafx2
 | 
				
			||||||
	echo "#!/bin/sh" > $(bindir)/gfxcfg
 | 
					 | 
				
			||||||
	echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg
 | 
					 | 
				
			||||||
	chmod 755 $(bindir)/gfxcfg
 | 
					 | 
				
			||||||
	$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
 | 
						$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
 | 
				
			||||||
	$(CP) $(BIN) $(datadir)/grafx2/
 | 
						$(CP) $(BIN) $(datadir)/grafx2/
 | 
				
			||||||
	$(CP) $(CFGBIN) $(datadir)/grafx2/
 | 
					 | 
				
			||||||
	$(CP) gfx2def.ini $(datadir)/grafx2/
 | 
						$(CP) gfx2def.ini $(datadir)/grafx2/
 | 
				
			||||||
	$(CP) gfx2gui.gif $(datadir)/grafx2/
 | 
						$(CP) gfx2gui.gif $(datadir)/grafx2/
 | 
				
			||||||
	$(CP) gfx2.gif $(datadir)/grafx2/
 | 
						$(CP) gfx2.gif $(datadir)/grafx2/
 | 
				
			||||||
@ -319,9 +296,7 @@ install : $(BIN) $(CFGBIN)
 | 
				
			|||||||
# Linux uninstallation of the program
 | 
					# Linux uninstallation of the program
 | 
				
			||||||
uninstall :
 | 
					uninstall :
 | 
				
			||||||
	$(DELCOMMAND) $(bindir)/grafx2
 | 
						$(DELCOMMAND) $(bindir)/grafx2
 | 
				
			||||||
	$(DELCOMMAND) $(bindir)/gfxcfg
 | 
					 | 
				
			||||||
	$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
 | 
						$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
 | 
				
			||||||
	$(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN)
 | 
					 | 
				
			||||||
	$(DELCOMMAND) $(datadir)/grafx2/gfx2def.ini
 | 
						$(DELCOMMAND) $(datadir)/grafx2/gfx2def.ini
 | 
				
			||||||
	$(DELCOMMAND) $(datadir)/grafx2/gfx2gui.gif
 | 
						$(DELCOMMAND) $(datadir)/grafx2/gfx2gui.gif
 | 
				
			||||||
	$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
 | 
						$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								Makefile.dep
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Makefile.dep
									
									
									
									
									
								
							@ -1,4 +1,3 @@
 | 
				
			|||||||
$(OBJDIR)/SFont.o: SFont.c SFont.h
 | 
					 | 
				
			||||||
$(OBJDIR)/aide.o: aide.c const.h struct.h global.h divers.h moteur.h tables_aide.h \
 | 
					$(OBJDIR)/aide.o: aide.c const.h struct.h global.h divers.h moteur.h tables_aide.h \
 | 
				
			||||||
  aide.h sdlscreen.h texte.h clavier.h windows.h input.h hotkeys.h \
 | 
					  aide.h sdlscreen.h texte.h clavier.h windows.h input.h hotkeys.h \
 | 
				
			||||||
  erreurs.h
 | 
					  erreurs.h
 | 
				
			||||||
@ -12,9 +11,7 @@ $(OBJDIR)/clavier.o: clavier.c global.h struct.h const.h
 | 
				
			|||||||
$(OBJDIR)/divers.o: divers.c struct.h const.h sdlscreen.h global.h erreurs.h \
 | 
					$(OBJDIR)/divers.o: divers.c struct.h const.h sdlscreen.h global.h erreurs.h \
 | 
				
			||||||
  boutons.h moteur.h divers.h clavier.h windows.h palette.h input.h
 | 
					  boutons.h moteur.h divers.h clavier.h windows.h palette.h input.h
 | 
				
			||||||
$(OBJDIR)/files.o: files.c const.h struct.h global.h divers.h erreurs.h io.h \
 | 
					$(OBJDIR)/files.o: files.c const.h struct.h global.h divers.h erreurs.h io.h \
 | 
				
			||||||
  windows.h loadsave.h
 | 
					  windows.h loadsave.h mountlist.h moteur.h
 | 
				
			||||||
$(OBJDIR)/gfxcfg.o: gfxcfg.c SFont.h struct.h const.h clavier.h io.h hotkeys.h \
 | 
					 | 
				
			||||||
  setup.h
 | 
					 | 
				
			||||||
$(OBJDIR)/graph.o: graph.c global.h struct.h const.h moteur.h boutons.h pages.h \
 | 
					$(OBJDIR)/graph.o: graph.c global.h struct.h const.h moteur.h boutons.h pages.h \
 | 
				
			||||||
  erreurs.h sdlscreen.h graph.h divers.h pxsimple.h pxtall.h pxwide.h \
 | 
					  erreurs.h sdlscreen.h graph.h divers.h pxsimple.h pxtall.h pxwide.h \
 | 
				
			||||||
  pxdouble.h windows.h
 | 
					  pxdouble.h windows.h
 | 
				
			||||||
@ -32,8 +29,8 @@ $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h divers.h init.h \
 | 
				
			|||||||
  readini.h saveini.h io.h texte.h setup.h windows.h brush.h palette.h
 | 
					  readini.h saveini.h io.h texte.h setup.h windows.h brush.h palette.h
 | 
				
			||||||
$(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h graph.h divers.h special.h \
 | 
					$(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h graph.h divers.h special.h \
 | 
				
			||||||
  boutons.h operatio.h shade.h erreurs.h sdlscreen.h windows.h brush.h \
 | 
					  boutons.h operatio.h shade.h erreurs.h sdlscreen.h windows.h brush.h \
 | 
				
			||||||
  input.h
 | 
					  input.h moteur.h
 | 
				
			||||||
$(OBJDIR)/mountlist.o: mountlist.c
 | 
					$(OBJDIR)/mountlist.o: mountlist.c mountlist.h
 | 
				
			||||||
$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h
 | 
					$(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h
 | 
				
			||||||
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h divers.h moteur.h \
 | 
					$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h divers.h moteur.h \
 | 
				
			||||||
  graph.h operatio.h boutons.h pages.h erreurs.h sdlscreen.h brush.h \
 | 
					  graph.h operatio.h boutons.h pages.h erreurs.h sdlscreen.h brush.h \
 | 
				
			||||||
@ -43,7 +40,8 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h erreurs.h divers.h
 | 
				
			|||||||
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h divers.h moteur.h \
 | 
					$(OBJDIR)/palette.o: palette.c const.h struct.h global.h divers.h moteur.h \
 | 
				
			||||||
  readline.h boutons.h pages.h aide.h sdlscreen.h erreurs.h op_c.h \
 | 
					  readline.h boutons.h pages.h aide.h sdlscreen.h erreurs.h op_c.h \
 | 
				
			||||||
  windows.h input.h
 | 
					  windows.h input.h
 | 
				
			||||||
$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h divers.h
 | 
					$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h divers.h \
 | 
				
			||||||
 | 
					  pxwide.h
 | 
				
			||||||
$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h divers.h
 | 
					$(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h divers.h
 | 
				
			||||||
$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h divers.h \
 | 
					$(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h divers.h \
 | 
				
			||||||
  pxsimple.h
 | 
					  pxsimple.h
 | 
				
			||||||
@ -57,6 +55,7 @@ $(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h erreurs.
 | 
				
			|||||||
$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h erreurs.h \
 | 
					$(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h erreurs.h \
 | 
				
			||||||
  divers.h
 | 
					  divers.h
 | 
				
			||||||
$(OBJDIR)/setup.o: setup.c struct.h const.h io.h files.h
 | 
					$(OBJDIR)/setup.o: setup.c struct.h const.h io.h files.h
 | 
				
			||||||
 | 
					$(OBJDIR)/SFont.o: SFont.c SFont.h
 | 
				
			||||||
$(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h moteur.h divers.h \
 | 
					$(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h moteur.h divers.h \
 | 
				
			||||||
  readline.h aide.h sdlscreen.h windows.h input.h
 | 
					  readline.h aide.h sdlscreen.h windows.h input.h
 | 
				
			||||||
$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h moteur.h windows.h
 | 
					$(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h moteur.h windows.h
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								gfx2cfg.gif
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gfx2cfg.gif
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								gfx2cfg.ico
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gfx2cfg.ico
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 2.2 KiB  | 
							
								
								
									
										746
									
								
								gfxcfg.c
									
									
									
									
									
								
							
							
						
						
									
										746
									
								
								gfxcfg.c
									
									
									
									
									
								
							@ -1,746 +0,0 @@
 | 
				
			|||||||
/*  Grafx2 - The Ultimate 256-color bitmap paint program
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Copyright 2008 Peter Gordon
 | 
					 | 
				
			||||||
    Copyright 2008 Yves Rizoud
 | 
					 | 
				
			||||||
    Copyright 2008 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.
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
//C
 | 
					 | 
				
			||||||
#include <stdbool.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//POSIX
 | 
					 | 
				
			||||||
#include <unistd.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//SDL
 | 
					 | 
				
			||||||
#include <SDL.h>
 | 
					 | 
				
			||||||
#include <SDL_image.h>
 | 
					 | 
				
			||||||
#include <SDL_events.h>
 | 
					 | 
				
			||||||
//#include <SDL_gfxPrimitives.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//mine
 | 
					 | 
				
			||||||
#include "SFont.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Modificateurs pour Touche
 | 
					 | 
				
			||||||
#define MOD_SHIFT 0x1000
 | 
					 | 
				
			||||||
#define MOD_CTRL  0x2000
 | 
					 | 
				
			||||||
#define MOD_ALT   0x4000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define TOUCHE_MOUSEMIDDLE     (SDLK_LAST+1)
 | 
					 | 
				
			||||||
#define TOUCHE_MOUSEWHEELUP    (SDLK_LAST+2)
 | 
					 | 
				
			||||||
#define TOUCHE_MOUSEWHEELDOWN  (SDLK_LAST+3)
 | 
					 | 
				
			||||||
#define TOUCHE_BUTTON          (SDLK_LAST+4)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef __gp2x__
 | 
					 | 
				
			||||||
  #define TOUCHE_ESC (TOUCHE_BUTTON+GP2X_BUTTON_X)
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
  #define TOUCHE_ESC SDLK_ESCAPE
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "struct.h"
 | 
					 | 
				
			||||||
#include "clavier.h"
 | 
					 | 
				
			||||||
#include "const.h"
 | 
					 | 
				
			||||||
#include "io.h"
 | 
					 | 
				
			||||||
#include "hotkeys.h"
 | 
					 | 
				
			||||||
#include "setup.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Constants ***/
 | 
					 | 
				
			||||||
#define NB_MAX_TOUCHES 134
 | 
					 | 
				
			||||||
#define HAUTEUR_DEBUT_SETUP 7
 | 
					 | 
				
			||||||
#define HAUTEUR_FIN_SETUP 44
 | 
					 | 
				
			||||||
#define Header_size sizeof(Config_Header)
 | 
					 | 
				
			||||||
#define Chunk_size sizeof(Config_Chunk)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Colors */
 | 
					 | 
				
			||||||
#define COULEUR_SETUP 1
 | 
					 | 
				
			||||||
#define COULEUR_SELECT 8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Global variables ***/
 | 
					 | 
				
			||||||
SFont_Font* MyFont;
 | 
					 | 
				
			||||||
SDL_Surface* Ecran;
 | 
					 | 
				
			||||||
char Repertoire_config[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
char Repertoire_donnees[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool Erreur[NB_MAX_TOUCHES];
 | 
					 | 
				
			||||||
uint8_t Choix_enreg;
 | 
					 | 
				
			||||||
uint16_t Decalage_curseur=0;
 | 
					 | 
				
			||||||
uint16_t Position_curseur=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
byte * FichierConfig = NULL;
 | 
					 | 
				
			||||||
byte * ChunkData[CHUNK_MAX];
 | 
					 | 
				
			||||||
Config_Chunk Chunk[CHUNK_MAX];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* Choix, uint8_t Choix_debut,
 | 
					 | 
				
			||||||
        uint8_t Couleur,uint8_t Couleur_choix);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Fonctions de gestion des évènements SDL ***/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Attend qu'une touche soit pressée. Retourne le code touche. */
 | 
					 | 
				
			||||||
word Lire_Touche(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    SDL_Event Event;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    do{
 | 
					 | 
				
			||||||
        SDL_WaitEvent(&Event);
 | 
					 | 
				
			||||||
        if(Event.type==SDL_KEYDOWN)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          word Touche = Conversion_Touche(Event.key.keysym);
 | 
					 | 
				
			||||||
          if (Touche != 0)
 | 
					 | 
				
			||||||
            return Touche;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }while(1);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Drawing functions ***/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Draws a filled rectanble */
 | 
					 | 
				
			||||||
void Cadre(int x,int y,int w,int h,uint8_t color)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    SDL_Rect rct;
 | 
					 | 
				
			||||||
    rct.x=x;
 | 
					 | 
				
			||||||
    rct.y=y;
 | 
					 | 
				
			||||||
    rct.w=w;
 | 
					 | 
				
			||||||
    rct.h=h;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SDL_FillRect(Ecran, &rct, color);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Draws the main screen and welcome message */
 | 
					 | 
				
			||||||
void Dessiner_ecran_principal()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    Cadre(3,3,630,40,2);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran, MyFont, 8,6,"Setup program for Grafx2 (c) 1996-98 Sunset Design and 2008 PulkoMandy");
 | 
					 | 
				
			||||||
    SFont_Write(Ecran, MyFont, 8,18,"Use Up/Down arrows & Page-Up/Page-Down to scroll, Enter to modify,");
 | 
					 | 
				
			||||||
    SFont_Write(Ecran, MyFont, 8,30,"Delete to remove a hot-key and Escape to validate or cancel.");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Cadre(3,47,630,10,86);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8   ,48,"Option");
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8*40,48,"Hot-Key");
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8*75,48,"Err");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SDL_UpdateRect(Ecran,0,0,640,480);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Displays informations about an option */
 | 
					 | 
				
			||||||
void Ecrire(uint8_t Ligne, uint16_t Num_option, uint8_t Couleur)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    Cadre(3,Ligne*9,630,9,Couleur);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8,Ligne*9,ConfigTouche[Num_option].Libelle);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,40*8,Ligne*9,Nom_touche(ConfigTouche[Num_option].Touche));
 | 
					 | 
				
			||||||
    if(Erreur[Num_option])
 | 
					 | 
				
			||||||
        SFont_Write(Ecran,MyFont,77*8,Ligne*9,"X");
 | 
					 | 
				
			||||||
    Cadre(39*8,Ligne*9,1,9,255);
 | 
					 | 
				
			||||||
    Cadre(74*8,Ligne*9,1,9,255);
 | 
					 | 
				
			||||||
    SDL_UpdateRect(Ecran,3,Ligne*9,630,9);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Displays comment about an option */
 | 
					 | 
				
			||||||
void Ecrire_commentaire(uint16_t Num_option)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    Cadre(8,50*9,630,18,0);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8,50*9,ConfigTouche[Num_option].Explic1);
 | 
					 | 
				
			||||||
    SFont_Write(Ecran,MyFont,8,51*9,ConfigTouche[Num_option].Explic2);
 | 
					 | 
				
			||||||
    SDL_UpdateRect(Ecran,8,50*9,631,19);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Display the options list */
 | 
					 | 
				
			||||||
void Tout_ecrire()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint8_t i = HAUTEUR_DEBUT_SETUP;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Cadre(3,64,630,340,COULEUR_SETUP);
 | 
					 | 
				
			||||||
    while(i<=HAUTEUR_FIN_SETUP && i < NB_MAX_TOUCHES + HAUTEUR_DEBUT_SETUP)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Ecrire(i,Decalage_curseur+i-HAUTEUR_DEBUT_SETUP,
 | 
					 | 
				
			||||||
                (i==HAUTEUR_DEBUT_SETUP+Position_curseur)?COULEUR_SELECT:COULEUR_SETUP);
 | 
					 | 
				
			||||||
        i++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Cadre(39*8,46,1,360,255);
 | 
					 | 
				
			||||||
    Cadre(74*8,46,1,360,255);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SDL_UpdateRect(Ecran,0,0,640,480);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Ecrire_commentaire(Decalage_curseur+Position_curseur);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Configuration handling functions ***/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Reads the config file */
 | 
					 | 
				
			||||||
/* returns an error message, or NULL if everything OK */
 | 
					 | 
				
			||||||
char * Interpretation_du_fichier_config()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  char Nom_Fichier[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
  FILE* Fichier;
 | 
					 | 
				
			||||||
  long int Taille_fichier;
 | 
					 | 
				
			||||||
  byte Numero_chunk;
 | 
					 | 
				
			||||||
  word Taille_chunk;
 | 
					 | 
				
			||||||
  byte * Ptr;
 | 
					 | 
				
			||||||
  int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  strcpy(Nom_Fichier, Repertoire_config);
 | 
					 | 
				
			||||||
  strcat(Nom_Fichier, "gfx2.cfg");
 | 
					 | 
				
			||||||
  Fichier = fopen(Nom_Fichier,"rb");
 | 
					 | 
				
			||||||
  if (!Fichier)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    return "gfx2.cfg is missing! Please run the\nmain program to generate it.";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  fseek(Fichier,0,SEEK_END); // Positionnement à la fin
 | 
					 | 
				
			||||||
  Taille_fichier = ftell(Fichier);
 | 
					 | 
				
			||||||
  if (!Taille_fichier)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    fclose(Fichier);
 | 
					 | 
				
			||||||
    return "gfx2.cfg is empty. Please run the main\nprogram to generate it.";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  FichierConfig = malloc(Taille_fichier);
 | 
					 | 
				
			||||||
  if (!Fichier)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    fclose(Fichier);
 | 
					 | 
				
			||||||
    return "Out of memory when reading gfx2.cfg.";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  fseek(Fichier,0,SEEK_SET); // Positionnement au début
 | 
					 | 
				
			||||||
  if (! read_bytes(Fichier, FichierConfig, Taille_fichier))
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    fclose(Fichier);
 | 
					 | 
				
			||||||
    return "Error while reading gfx2.cfg.";
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  fclose(Fichier);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  // Initialisation des "index"
 | 
					 | 
				
			||||||
  for (i=0; i<CHUNK_MAX; i++)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    Chunk[i].Taille=0;
 | 
					 | 
				
			||||||
    Chunk[i].Numero=i;
 | 
					 | 
				
			||||||
    ChunkData[i]=NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  // Pour faire simple, on saute l'en-tete
 | 
					 | 
				
			||||||
  Ptr = FichierConfig + Header_size;
 | 
					 | 
				
			||||||
  while (Ptr < FichierConfig + Taille_fichier)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    // Lecture chunk
 | 
					 | 
				
			||||||
    Numero_chunk = *Ptr;
 | 
					 | 
				
			||||||
    Ptr++;
 | 
					 | 
				
			||||||
    Taille_chunk = endian_magic16(*((word *)Ptr)); 
 | 
					 | 
				
			||||||
    Ptr+=2;
 | 
					 | 
				
			||||||
    if (Numero_chunk>= CHUNK_MAX)
 | 
					 | 
				
			||||||
      return "File gfx2.cfg invalid.";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ChunkData[Numero_chunk] = Ptr;
 | 
					 | 
				
			||||||
    Chunk[Numero_chunk].Taille = Taille_chunk;
 | 
					 | 
				
			||||||
//    printf("%d %6X %d\n", Numero_chunk, Ptr - FichierConfig, Taille_chunk);
 | 
					 | 
				
			||||||
    Ptr+=Taille_chunk;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  // Si la config contenait des touches, on les initialise:
 | 
					 | 
				
			||||||
  if (Chunk[CHUNK_TOUCHES].Taille)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    unsigned int Indice_config;
 | 
					 | 
				
			||||||
    Ptr = ChunkData[CHUNK_TOUCHES];
 | 
					 | 
				
			||||||
    for (Indice_config=0; Indice_config<Chunk[CHUNK_TOUCHES].Taille / sizeof(Config_Infos_touche) ; Indice_config++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      word Numero;
 | 
					 | 
				
			||||||
      word Touche;
 | 
					 | 
				
			||||||
      word Touche2;
 | 
					 | 
				
			||||||
      int Indice_touche;
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      Numero = endian_magic16(*((word *)Ptr));
 | 
					 | 
				
			||||||
      Ptr+=2;
 | 
					 | 
				
			||||||
      Touche = endian_magic16(*((word *)Ptr));
 | 
					 | 
				
			||||||
      Ptr+=2;
 | 
					 | 
				
			||||||
      Touche2 = endian_magic16(*((word *)Ptr));
 | 
					 | 
				
			||||||
      Ptr+=2;
 | 
					 | 
				
			||||||
      //printf("%4d %4X %4X\t", Numero, Touche, Touche2);
 | 
					 | 
				
			||||||
      // Recherche de la touche qui porte ce numéro
 | 
					 | 
				
			||||||
      for (Indice_touche=0; Indice_touche < NB_MAX_TOUCHES; Indice_touche ++)
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        if (ConfigTouche[Indice_touche].Numero == Numero)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          ConfigTouche[Indice_touche].Touche = Touche;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Utilisé pour afficher la liste complète des raccourcis dans le format du wiki...
 | 
					 | 
				
			||||||
/*          printf("||%s||%s||%s %s||\n", ConfigTouche[Indice_touche].Libelle, 
 | 
					 | 
				
			||||||
                            Nom_touche(Touche),
 | 
					 | 
				
			||||||
                            ConfigTouche[Indice_touche].Explic1, 
 | 
					 | 
				
			||||||
                            ConfigTouche[Indice_touche].Explic2); */
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } 
 | 
					 | 
				
			||||||
  return NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Initialize configuration */
 | 
					 | 
				
			||||||
bool Initialiser_config()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    char * MessageErreur = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    MessageErreur = Interpretation_du_fichier_config();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (MessageErreur)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      Fenetre_choix(30,10,MessageErreur,"Ok",0,0x2A,0x6F);
 | 
					 | 
				
			||||||
      return 1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* Choix, uint8_t Choix_debut,
 | 
					 | 
				
			||||||
        uint8_t Couleur,uint8_t Couleur_choix)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    char Temp[70];
 | 
					 | 
				
			||||||
    uint8_t i,j,Num_titre,Num_choix;
 | 
					 | 
				
			||||||
    uint16_t x1,y1;
 | 
					 | 
				
			||||||
    uint8_t Option_choisie;
 | 
					 | 
				
			||||||
    word Touche;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Hauteur *= 8;
 | 
					 | 
				
			||||||
    Largeur *= 8;
 | 
					 | 
				
			||||||
    x1=(640 - Largeur)/2;
 | 
					 | 
				
			||||||
    y1=(480 - Hauteur)/2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Cadre(x1+5,y1+5,Largeur,Hauteur,0);
 | 
					 | 
				
			||||||
    Cadre(x1,y1,Largeur,Hauteur,Couleur);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Num_choix =  0;
 | 
					 | 
				
			||||||
    Num_titre=1;
 | 
					 | 
				
			||||||
    j=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // SFont ne gère pas les \n donc on le fait nous même
 | 
					 | 
				
			||||||
    for(i=0;i<=strlen(Titre);i++)
 | 
					 | 
				
			||||||
    {   
 | 
					 | 
				
			||||||
        if (Titre[i]=='\n' || Titre[i]==0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            memcpy(Temp,Titre+j,i-j);
 | 
					 | 
				
			||||||
            Temp[i-j]=0;
 | 
					 | 
				
			||||||
            j=i+1;
 | 
					 | 
				
			||||||
            SFont_Write(Ecran,MyFont,x1+3,y1+Num_titre*9,Temp);
 | 
					 | 
				
			||||||
            Num_titre++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Maintenant on fait pareil pour les divers choix proposés
 | 
					 | 
				
			||||||
    j=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // SFont ne gère pas les \n donc on le fait nous même
 | 
					 | 
				
			||||||
    for(i=0;i<=strlen(Choix);i++)
 | 
					 | 
				
			||||||
    {   
 | 
					 | 
				
			||||||
        if (Choix[i]=='\n' || Choix[i]==0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            memcpy(Temp,Choix+j,i-j);
 | 
					 | 
				
			||||||
            Temp[i-j]=0;
 | 
					 | 
				
			||||||
            j=i+1;
 | 
					 | 
				
			||||||
            SFont_Write(Ecran,MyFont,x1+3+50*Num_choix,y1+(Num_titre+2)*9,Temp);
 | 
					 | 
				
			||||||
            Num_choix++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Option_choisie = Choix_debut;
 | 
					 | 
				
			||||||
    Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
 | 
					 | 
				
			||||||
    SDL_UpdateRect(Ecran,x1,y1,Largeur+5,Hauteur+5);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    do
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Touche = Lire_Touche();
 | 
					 | 
				
			||||||
        switch(Touche)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            case SDLK_LEFT:
 | 
					 | 
				
			||||||
                Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
 | 
					 | 
				
			||||||
                if(Option_choisie==0) Option_choisie = Num_choix - 1;
 | 
					 | 
				
			||||||
                else Option_choisie --;
 | 
					 | 
				
			||||||
                Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_RIGHT:
 | 
					 | 
				
			||||||
                Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
 | 
					 | 
				
			||||||
                if(Option_choisie==Num_choix-1) Option_choisie = 0;
 | 
					 | 
				
			||||||
                else Option_choisie ++;
 | 
					 | 
				
			||||||
                Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
 | 
					 | 
				
			||||||
            default:
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        SDL_UpdateRect(Ecran,x1+3,y1+(Num_titre+3)*9,50*Num_choix,2);
 | 
					 | 
				
			||||||
    }while(Touche!=SDLK_RETURN);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Tout_ecrire(); // Efface la boite de dialogue
 | 
					 | 
				
			||||||
    return Option_choisie+1;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Checks if some key is used twice */
 | 
					 | 
				
			||||||
void Test_duplic()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint16_t i,j;
 | 
					 | 
				
			||||||
    bool Pas_encore_erreur;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for(i=0;i<NB_MAX_TOUCHES;i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if(ConfigTouche[i].Touche!=0xFF) // FIXME
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            j=0;
 | 
					 | 
				
			||||||
            Pas_encore_erreur=true;
 | 
					 | 
				
			||||||
            while(j<NB_MAX_TOUCHES && Pas_encore_erreur)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                if(i!=j && ConfigTouche[i].Touche==ConfigTouche[j].Touche)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    Pas_encore_erreur = false;
 | 
					 | 
				
			||||||
                    Erreur[i] = true;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                j++;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (Pas_encore_erreur) Erreur[i] = false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Checks if everything is OK */
 | 
					 | 
				
			||||||
bool Validation()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bool Y_a_des_erreurs = false;
 | 
					 | 
				
			||||||
    uint16_t i = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while(i<NB_MAX_TOUCHES && !Y_a_des_erreurs)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Y_a_des_erreurs = Erreur[i];
 | 
					 | 
				
			||||||
        i++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (Y_a_des_erreurs)
 | 
					 | 
				
			||||||
        Choix_enreg = 4 - Fenetre_choix(30,12,
 | 
					 | 
				
			||||||
                "There are errors in the\nhot-keys configuration.\nCheck out the \"Err\" column\nin order to correct them.","OK\nQuit anyway",1,0x4C,0x3F);
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        Choix_enreg = Fenetre_choix(30,10,"Save configuration?","Yes\nNo\nCancel",1,0x2A,0x6F);
 | 
					 | 
				
			||||||
    if (Choix_enreg!=3) return true; else return false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Move one line up */
 | 
					 | 
				
			||||||
void Scroll_haut()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if(Position_curseur + Decalage_curseur > 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SETUP);
 | 
					 | 
				
			||||||
            (Position_curseur) -- ;
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SELECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if(Decalage_curseur>0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            (Decalage_curseur) -- ;
 | 
					 | 
				
			||||||
            Tout_ecrire();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Ecrire_commentaire(Position_curseur + Decalage_curseur);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Moves one line down */
 | 
					 | 
				
			||||||
void Scroll_bas()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  if(Position_curseur + Decalage_curseur < (NB_MAX_TOUCHES-1))
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
        if(Position_curseur < HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SETUP);
 | 
					 | 
				
			||||||
            (Position_curseur) ++ ;
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SELECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if(Decalage_curseur < (NB_MAX_TOUCHES-1))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            (Decalage_curseur) ++ ;
 | 
					 | 
				
			||||||
            Tout_ecrire();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Ecrire_commentaire(Position_curseur + Decalage_curseur );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Moves one screen up */
 | 
					 | 
				
			||||||
void Page_up()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if(Position_curseur+Decalage_curseur>0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if(Position_curseur>0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SETUP);
 | 
					 | 
				
			||||||
            Position_curseur = 0 ;
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SELECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if(Decalage_curseur>0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
 | 
					 | 
				
			||||||
                Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
 | 
					 | 
				
			||||||
            else Decalage_curseur=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            Tout_ecrire();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Ecrire_commentaire(Position_curseur+Decalage_curseur);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Moves one screen down */
 | 
					 | 
				
			||||||
void Page_down()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  if(Position_curseur+Decalage_curseur<(NB_MAX_TOUCHES-1))
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
        if(Position_curseur<HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
 | 
					 | 
				
			||||||
        { 
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SETUP);
 | 
					 | 
				
			||||||
            Position_curseur = HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP ;
 | 
					 | 
				
			||||||
            Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SELECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if(Decalage_curseur<(NB_MAX_TOUCHES-1))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if(Decalage_curseur + Position_curseur + HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP < (NB_MAX_TOUCHES-1))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                  Decalage_curseur+=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          else
 | 
					 | 
				
			||||||
            Decalage_curseur=NB_MAX_TOUCHES-1-HAUTEUR_FIN_SETUP+HAUTEUR_DEBUT_SETUP;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          Tout_ecrire();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Ecrire_commentaire(Position_curseur+Decalage_curseur);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Select()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  word Touche;
 | 
					 | 
				
			||||||
  Cadre(36*8+1,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,38*8-2,9,COULEUR_SETUP);
 | 
					 | 
				
			||||||
  SFont_Write(Ecran,MyFont,40*8,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,
 | 
					 | 
				
			||||||
    "-- Press a key --");
 | 
					 | 
				
			||||||
  SDL_UpdateRect(Ecran,3,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,630,9);
 | 
					 | 
				
			||||||
  while (1)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
        Touche = Lire_Touche();
 | 
					 | 
				
			||||||
    if (Touche == SDLK_ESCAPE)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
 | 
					 | 
				
			||||||
                    COULEUR_SETUP);
 | 
					 | 
				
			||||||
                  return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (Touche != 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      ConfigTouche[Position_curseur+Decalage_curseur].Touche = Touche;
 | 
					 | 
				
			||||||
      Test_duplic();
 | 
					 | 
				
			||||||
      // Des X ont pu être ajoutés ou enlevés sur n'importe quelle ligne..
 | 
					 | 
				
			||||||
      // pour faire simple, on rafraîchit toute la page. 
 | 
					 | 
				
			||||||
            Tout_ecrire();
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Let the user do things */
 | 
					 | 
				
			||||||
void Setup()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bool Sortie_OK = false;
 | 
					 | 
				
			||||||
    word Touche;
 | 
					 | 
				
			||||||
    Test_duplic();
 | 
					 | 
				
			||||||
    Tout_ecrire();
 | 
					 | 
				
			||||||
    do{
 | 
					 | 
				
			||||||
        Touche = Lire_Touche();
 | 
					 | 
				
			||||||
        switch(Touche)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            case SDLK_UP:
 | 
					 | 
				
			||||||
                Scroll_haut();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_DOWN:
 | 
					 | 
				
			||||||
                Scroll_bas();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_PAGEUP:
 | 
					 | 
				
			||||||
                Page_up();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_PAGEDOWN:
 | 
					 | 
				
			||||||
                Page_down();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_RETURN:
 | 
					 | 
				
			||||||
                Select();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_DELETE:
 | 
					 | 
				
			||||||
                //Unselect();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case SDLK_ESCAPE:
 | 
					 | 
				
			||||||
                Sortie_OK=Validation();
 | 
					 | 
				
			||||||
                break; 
 | 
					 | 
				
			||||||
            default:
 | 
					 | 
				
			||||||
                break; // On ne fait rien pour les autres touches
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } while(!Sortie_OK);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** File management functions ***/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Checks if we can write the config file */
 | 
					 | 
				
			||||||
bool Verifier_ecriture_possible()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  #ifdef __amigaos4__
 | 
					 | 
				
			||||||
    // TODO: Make it work :)
 | 
					 | 
				
			||||||
    #warning "There is some code missing here for your platform ! please check and correct :)"
 | 
					 | 
				
			||||||
    return 1;
 | 
					 | 
				
			||||||
  #else
 | 
					 | 
				
			||||||
    // Doesn't work on OS4.
 | 
					 | 
				
			||||||
    return access(Repertoire_config,W_OK) == 0;
 | 
					 | 
				
			||||||
  #endif
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Save the config file */
 | 
					 | 
				
			||||||
void Enregistrer_config()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    FILE* Fichier;
 | 
					 | 
				
			||||||
    Config_Header Header;
 | 
					 | 
				
			||||||
    int Indice_chunk;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if(Choix_enreg==true) // Save keys if wanted
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      char Nom_Fichier[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
      strcpy(Nom_Fichier, Repertoire_config);
 | 
					 | 
				
			||||||
      strcat(Nom_Fichier, "gfx2.cfg");
 | 
					 | 
				
			||||||
      Fichier = fopen(Nom_Fichier,"wb");
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      // En-tete
 | 
					 | 
				
			||||||
      sprintf(Header.Signature,"CFG");
 | 
					 | 
				
			||||||
      Header.Version1 = VERSION1;
 | 
					 | 
				
			||||||
      Header.Version2 = VERSION2;
 | 
					 | 
				
			||||||
      Header.Beta1 = BETA1;
 | 
					 | 
				
			||||||
      Header.Beta2 = BETA2;
 | 
					 | 
				
			||||||
      write_bytes(Fichier, &Header, sizeof(Header));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Chunk[CHUNK_TOUCHES].Taille=sizeof(Config_Infos_touche)*(NB_MAX_TOUCHES);
 | 
					 | 
				
			||||||
      Chunk[CHUNK_TOUCHES].Numero=CHUNK_TOUCHES;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      for (Indice_chunk=0; Indice_chunk<CHUNK_MAX; Indice_chunk++)
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        // Ecriture en-tete chunk
 | 
					 | 
				
			||||||
        write_bytes(Fichier, &(Chunk[Indice_chunk].Numero), 1);
 | 
					 | 
				
			||||||
        write_word_le(Fichier, Chunk[Indice_chunk].Taille);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (Indice_chunk == CHUNK_TOUCHES)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          int Indice_touche;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          for(Indice_touche=0; Indice_touche<NB_MAX_TOUCHES;Indice_touche++)
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            write_word_le(Fichier,ConfigTouche[Indice_touche].Numero);
 | 
					 | 
				
			||||||
            write_word_le(Fichier,ConfigTouche[Indice_touche].Touche);
 | 
					 | 
				
			||||||
            write_word_le(Fichier,ConfigTouche[Indice_touche].Touche2);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          write_bytes(Fichier, ChunkData[Indice_chunk], Chunk[Indice_chunk].Taille);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
       fclose(Fichier);         
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*** Main program ***/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
 | 
					 | 
				
			||||||
{       
 | 
					 | 
				
			||||||
  char Repertoire_programme[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
  char Nom_fichier[TAILLE_CHEMIN_FICHIER];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Set_Program_Directory(argv[0],Repertoire_programme);
 | 
					 | 
				
			||||||
  Set_Config_Directory(Repertoire_programme,Repertoire_config);
 | 
					 | 
				
			||||||
  Set_Data_Directory(Repertoire_programme,Repertoire_donnees);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (Verifier_ecriture_possible())
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
        /* On initialise SDL */
 | 
					 | 
				
			||||||
        SDL_Init(SDL_INIT_VIDEO);
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      // Routine pour définir l'icone.
 | 
					 | 
				
			||||||
      SDL_Surface * Icone;
 | 
					 | 
				
			||||||
      byte *Masque_icone;
 | 
					 | 
				
			||||||
      strcpy(Nom_fichier, Repertoire_donnees);
 | 
					 | 
				
			||||||
      strcat(Nom_fichier, "gfx2cfg.gif");
 | 
					 | 
				
			||||||
      Icone = IMG_Load(Nom_fichier);
 | 
					 | 
				
			||||||
      if (Icone)
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        int x,y;
 | 
					 | 
				
			||||||
        Masque_icone=malloc(128);
 | 
					 | 
				
			||||||
        memset(Masque_icone,0,128);
 | 
					 | 
				
			||||||
        for (y=0;y<32;y++)
 | 
					 | 
				
			||||||
          for (x=0;x<32;x++)
 | 
					 | 
				
			||||||
            if (((byte *)(Icone->pixels))[(y*32+x)] != 255)
 | 
					 | 
				
			||||||
              Masque_icone[(y*32+x)/8] |=0x80>>(x&7);
 | 
					 | 
				
			||||||
        SDL_WM_SetIcon(Icone,Masque_icone);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    Ecran = SDL_SetVideoMode(640,480,8,0);
 | 
					 | 
				
			||||||
    SDL_WM_SetCaption ("Grafx2 configuration tool","Gfx2Cfg");
 | 
					 | 
				
			||||||
    SDL_EnableKeyRepeat(250, 32);
 | 
					 | 
				
			||||||
    SDL_EnableUNICODE(SDL_ENABLE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* On initialise SFont */
 | 
					 | 
				
			||||||
    strcpy(Nom_fichier, Repertoire_donnees);
 | 
					 | 
				
			||||||
    strcat(Nom_fichier, "fonts/8pxfont.png");
 | 
					 | 
				
			||||||
    MyFont = SFont_InitFont(IMG_Load(Nom_fichier));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(MyFont==NULL)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            SDL_Quit();
 | 
					 | 
				
			||||||
            exit(0);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Dessiner_ecran_principal();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(!Initialiser_config())
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            Setup();
 | 
					 | 
				
			||||||
            Enregistrer_config();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            /* On fait un peu de nettoyage avant de s'en aller */
 | 
					 | 
				
			||||||
            SFont_FreeFont(MyFont);
 | 
					 | 
				
			||||||
            SDL_Quit();
 | 
					 | 
				
			||||||
            exit(0);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            SFont_FreeFont(MyFont);
 | 
					 | 
				
			||||||
            SDL_Quit();
 | 
					 | 
				
			||||||
            exit(1);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
        puts("Error: you mustn't run this setup program from a read-only drive!\n");
 | 
					 | 
				
			||||||
        puts("The most probable cause of this error is that you are running this program");
 | 
					 | 
				
			||||||
        puts("from a CD-Rom or a protected floppy disk.");
 | 
					 | 
				
			||||||
        puts("You should try to copy all the files of Grafx2 on a hard drive or to");
 | 
					 | 
				
			||||||
        puts("unprotect your floppy disk if you really want to run it from this outdated medium.");
 | 
					 | 
				
			||||||
        exit(1);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user