Some work on a port for the gp2x. Runs up to the splashscreen, but as there is no mouse i have to make the program usable with a joystick.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@462 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
c130a327d1
commit
132eabcde5
29
Makefile
29
Makefile
@ -139,6 +139,7 @@ else
|
|||||||
MKDIR = mkdir -p
|
MKDIR = mkdir -p
|
||||||
RMDIR = rmdir
|
RMDIR = rmdir
|
||||||
CP = cp
|
CP = cp
|
||||||
|
|
||||||
ifdef WIN32CROSS
|
ifdef WIN32CROSS
|
||||||
#cross compile a Win32 executable
|
#cross compile a Win32 executable
|
||||||
CC = i586-mingw32msvc-gcc
|
CC = i586-mingw32msvc-gcc
|
||||||
@ -148,13 +149,27 @@ else
|
|||||||
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
|
||||||
else
|
else
|
||||||
BIN = grafx2
|
|
||||||
CFGBIN = gfxcfg
|
ifdef GP2XCROSS
|
||||||
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
|
#cross compile an exec for the gp2x
|
||||||
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT)
|
CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
|
||||||
CC = gcc
|
BIN = grafx2.gpe
|
||||||
OBJDIR = obj/unix
|
CFGBIN = gfxcfg.gpe
|
||||||
X11LOPT = -lX11
|
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)
|
||||||
|
OBJDIR = obj/gp2x
|
||||||
|
NOTTF = 1
|
||||||
|
else
|
||||||
|
|
||||||
|
# Compiles a regular linux exectutable for the native platform
|
||||||
|
BIN = grafx2
|
||||||
|
CFGBIN = gfxcfg
|
||||||
|
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
|
||||||
|
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT)
|
||||||
|
CC = gcc
|
||||||
|
OBJDIR = obj/unix
|
||||||
|
X11LOPT = -lX11
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
4
SFont.c
4
SFont.c
@ -24,8 +24,8 @@
|
|||||||
GERMANY
|
GERMANY
|
||||||
karlb@gmx.net
|
karlb@gmx.net
|
||||||
*/
|
*/
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL/SDL_video.h>
|
#include <SDL_video.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
2
SFont.h
2
SFont.h
@ -36,7 +36,7 @@
|
|||||||
#ifndef _SFONT_H_
|
#ifndef _SFONT_H_
|
||||||
#define _SFONT_H_
|
#define _SFONT_H_
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
|
|||||||
3
divers.c
3
divers.c
@ -20,8 +20,9 @@
|
|||||||
write to the Free Software Foundation, Inc.,
|
write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
|
|||||||
1
files.c
1
files.c
@ -285,7 +285,6 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max )
|
|||||||
// -- Lecture d'une liste de lecteurs / volumes -----------------------------
|
// -- Lecture d'une liste de lecteurs / volumes -----------------------------
|
||||||
void Lire_liste_des_lecteurs(void)
|
void Lire_liste_des_lecteurs(void)
|
||||||
{
|
{
|
||||||
// Fixes a warning on os4
|
|
||||||
#ifndef __amigaos4__
|
#ifndef __amigaos4__
|
||||||
int Indice;
|
int Indice;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
6
gfxcfg.c
6
gfxcfg.c
@ -29,9 +29,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
//SDL
|
//SDL
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL/SDL_image.h>
|
#include <SDL_image.h>
|
||||||
#include <SDL/SDL_events.h>
|
#include <SDL_events.h>
|
||||||
//#include <SDL_gfxPrimitives.h>
|
//#include <SDL_gfxPrimitives.h>
|
||||||
|
|
||||||
//mine
|
//mine
|
||||||
|
|||||||
2
global.h
2
global.h
@ -39,7 +39,7 @@
|
|||||||
#ifndef _GLOBAL_H_
|
#ifndef _GLOBAL_H_
|
||||||
#define _GLOBAL_H_
|
#define _GLOBAL_H_
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
|
|
||||||
GFX2_GLOBAL struct S_Config
|
GFX2_GLOBAL struct S_Config
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
/*** Types definitions and structs ***/
|
/*** Types definitions and structs ***/
|
||||||
|
|
||||||
|
|||||||
2
init.c
2
init.c
@ -31,7 +31,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <SDL/SDL_byteorder.h>
|
#include <SDL_byteorder.h>
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
#include <windows.h> // GetLogicalDrives(), GetDriveType(), DRIVE_*
|
#include <windows.h> // GetLogicalDrives(), GetDriveType(), DRIVE_*
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
488
io.c
488
io.c
@ -1,245 +1,245 @@
|
|||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
Grafx2 is free software; you can redistribute it and/or
|
Grafx2 is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; version 2
|
as published by the Free Software Foundation; version 2
|
||||||
of the License.
|
of the License.
|
||||||
|
|
||||||
Grafx2 is distributed in the hope that it will be useful,
|
Grafx2 is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
|
along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
|
||||||
write to the Free Software Foundation, Inc.,
|
write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Fonctions de lecture/ecriture fichier, gèrent les systèmes big-endian et
|
// Fonctions de lecture/ecriture fichier, gèrent les systèmes big-endian et
|
||||||
// little-endian.
|
// little-endian.
|
||||||
|
|
||||||
#include <SDL/SDL_endian.h>
|
#include <SDL_endian.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#if defined(__amigaos4__)
|
#if defined(__amigaos4__)
|
||||||
#include <proto/dos.h>
|
#include <proto/dos.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
word endian_magic16(word x)
|
word endian_magic16(word x)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
return x;
|
return x;
|
||||||
#else
|
#else
|
||||||
return SDL_Swap16(x);
|
return SDL_Swap16(x);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
dword endian_magic32(dword x)
|
dword endian_magic32(dword x)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
return x;
|
return x;
|
||||||
#else
|
#else
|
||||||
return SDL_Swap32(x);
|
return SDL_Swap32(x);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lit un octet
|
// Lit un octet
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_byte(FILE *Fichier, byte *Dest)
|
int read_byte(FILE *Fichier, byte *Dest)
|
||||||
{
|
{
|
||||||
return fread(Dest, 1, 1, Fichier) == 1;
|
return fread(Dest, 1, 1, Fichier) == 1;
|
||||||
}
|
}
|
||||||
// Ecrit un octet
|
// Ecrit un octet
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_byte(FILE *Fichier, byte Byte)
|
int write_byte(FILE *Fichier, byte Byte)
|
||||||
{
|
{
|
||||||
return fwrite(&Byte, 1, 1, Fichier) == 1;
|
return fwrite(&Byte, 1, 1, Fichier) == 1;
|
||||||
}
|
}
|
||||||
// Lit des octets
|
// Lit des octets
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_bytes(FILE *Fichier, void *Dest, size_t Taille)
|
int read_bytes(FILE *Fichier, void *Dest, size_t Taille)
|
||||||
{
|
{
|
||||||
return fread(Dest, 1, Taille, Fichier) == Taille;
|
return fread(Dest, 1, Taille, Fichier) == Taille;
|
||||||
}
|
}
|
||||||
// Ecrit des octets
|
// Ecrit des octets
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_bytes(FILE *Fichier, void *Src, size_t Taille)
|
int write_bytes(FILE *Fichier, void *Src, size_t Taille)
|
||||||
{
|
{
|
||||||
return fwrite(Src, 1, Taille, Fichier) == Taille;
|
return fwrite(Src, 1, Taille, Fichier) == Taille;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lit un word (little-endian)
|
// Lit un word (little-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_word_le(FILE *Fichier, word *Dest)
|
int read_word_le(FILE *Fichier, word *Dest)
|
||||||
{
|
{
|
||||||
if (fread(Dest, 1, sizeof(word), Fichier) != sizeof(word))
|
if (fread(Dest, 1, sizeof(word), Fichier) != sizeof(word))
|
||||||
return 0;
|
return 0;
|
||||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||||
*Dest = SDL_Swap16(*Dest);
|
*Dest = SDL_Swap16(*Dest);
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Ecrit un word (little-endian)
|
// Ecrit un word (little-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_word_le(FILE *Fichier, word Mot)
|
int write_word_le(FILE *Fichier, word Mot)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||||
Mot = SDL_Swap16(Mot);
|
Mot = SDL_Swap16(Mot);
|
||||||
#endif
|
#endif
|
||||||
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
|
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
|
||||||
}
|
}
|
||||||
// Lit un word (big-endian)
|
// Lit un word (big-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_word_be(FILE *Fichier, word *Dest)
|
int read_word_be(FILE *Fichier, word *Dest)
|
||||||
{
|
{
|
||||||
if (fread(Dest, 1, sizeof(word), Fichier) != sizeof(word))
|
if (fread(Dest, 1, sizeof(word), Fichier) != sizeof(word))
|
||||||
return 0;
|
return 0;
|
||||||
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
||||||
*Dest = SDL_Swap16(*Dest);
|
*Dest = SDL_Swap16(*Dest);
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Ecrit un word (big-endian)
|
// Ecrit un word (big-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_word_be(FILE *Fichier, word Mot)
|
int write_word_be(FILE *Fichier, word Mot)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
||||||
Mot = SDL_Swap16(Mot);
|
Mot = SDL_Swap16(Mot);
|
||||||
#endif
|
#endif
|
||||||
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
|
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
|
||||||
}
|
}
|
||||||
// Lit un dword (little-endian)
|
// Lit un dword (little-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_dword_le(FILE *Fichier, dword *Dest)
|
int read_dword_le(FILE *Fichier, dword *Dest)
|
||||||
{
|
{
|
||||||
if (fread(Dest, 1, sizeof(dword), Fichier) != sizeof(dword))
|
if (fread(Dest, 1, sizeof(dword), Fichier) != sizeof(dword))
|
||||||
return 0;
|
return 0;
|
||||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||||
*Dest = SDL_Swap32(*Dest);
|
*Dest = SDL_Swap32(*Dest);
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Ecrit un dword (little-endian)
|
// Ecrit un dword (little-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_dword_le(FILE *Fichier, dword Mot)
|
int write_dword_le(FILE *Fichier, dword Mot)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||||
Mot = SDL_Swap32(Mot);
|
Mot = SDL_Swap32(Mot);
|
||||||
#endif
|
#endif
|
||||||
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
|
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lit un dword (big-endian)
|
// Lit un dword (big-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int read_dword_be(FILE *Fichier, dword *Dest)
|
int read_dword_be(FILE *Fichier, dword *Dest)
|
||||||
{
|
{
|
||||||
if (fread(Dest, 1, sizeof(dword), Fichier) != sizeof(dword))
|
if (fread(Dest, 1, sizeof(dword), Fichier) != sizeof(dword))
|
||||||
return 0;
|
return 0;
|
||||||
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
||||||
*Dest = SDL_Swap32(*Dest);
|
*Dest = SDL_Swap32(*Dest);
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Ecrit un dword (big-endian)
|
// Ecrit un dword (big-endian)
|
||||||
// Renvoie -1 si OK, 0 en cas d'erreur
|
// Renvoie -1 si OK, 0 en cas d'erreur
|
||||||
int write_dword_be(FILE *Fichier, dword Mot)
|
int write_dword_be(FILE *Fichier, dword Mot)
|
||||||
{
|
{
|
||||||
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
|
||||||
Mot = SDL_Swap32(Mot);
|
Mot = SDL_Swap32(Mot);
|
||||||
#endif
|
#endif
|
||||||
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
|
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Détermine la position du dernier '/' ou '\\' dans une chaine,
|
// Détermine la position du dernier '/' ou '\\' dans une chaine,
|
||||||
// typiquement pour séparer le nom de fichier d'un chemin.
|
// typiquement pour séparer le nom de fichier d'un chemin.
|
||||||
// Attention, sous Windows, il faut s'attendre aux deux car
|
// Attention, sous Windows, il faut s'attendre aux deux car
|
||||||
// par exemple un programme lancé sous GDB aura comme argv[0]:
|
// par exemple un programme lancé sous GDB aura comme argv[0]:
|
||||||
// d:\Data\C\GFX2\grafx2/grafx2.exe
|
// d:\Data\C\GFX2\grafx2/grafx2.exe
|
||||||
char * Position_dernier_slash(const char * Chaine)
|
char * Position_dernier_slash(const char * Chaine)
|
||||||
{
|
{
|
||||||
const char * Position = NULL;
|
const char * Position = NULL;
|
||||||
for (; *Chaine != '\0'; Chaine++)
|
for (; *Chaine != '\0'; Chaine++)
|
||||||
if (*Chaine == SEPARATEUR_CHEMIN[0]
|
if (*Chaine == SEPARATEUR_CHEMIN[0]
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|| *Chaine == '/'
|
|| *Chaine == '/'
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
Position = Chaine;
|
Position = Chaine;
|
||||||
return (char *)Position;
|
return (char *)Position;
|
||||||
}
|
}
|
||||||
// Récupère la partie "nom de fichier seul" d'un chemin
|
// Récupère la partie "nom de fichier seul" d'un chemin
|
||||||
void Extraire_nom_fichier(char *Destination, const char *Source)
|
void Extraire_nom_fichier(char *Destination, const char *Source)
|
||||||
{
|
{
|
||||||
const char * Position = Position_dernier_slash(Source);
|
const char * Position = Position_dernier_slash(Source);
|
||||||
|
|
||||||
if (Position)
|
if (Position)
|
||||||
strcpy(Destination,Position+1);
|
strcpy(Destination,Position+1);
|
||||||
else
|
else
|
||||||
strcpy(Destination,Source);
|
strcpy(Destination,Source);
|
||||||
}
|
}
|
||||||
// Récupère la partie "répertoire+/" d'un chemin.
|
// Récupère la partie "répertoire+/" d'un chemin.
|
||||||
void Extraire_chemin(char *Destination, const char *Source)
|
void Extraire_chemin(char *Destination, const char *Source)
|
||||||
{
|
{
|
||||||
char * Position;
|
char * Position;
|
||||||
|
|
||||||
strcpy(Destination,Source);
|
strcpy(Destination,Source);
|
||||||
Position = Position_dernier_slash(Destination);
|
Position = Position_dernier_slash(Destination);
|
||||||
if (Position)
|
if (Position)
|
||||||
*(Position+1) = '\0';
|
*(Position+1) = '\0';
|
||||||
else
|
else
|
||||||
strcat(Destination, SEPARATEUR_CHEMIN);
|
strcat(Destination, SEPARATEUR_CHEMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Fichier_existe(char * Fichier)
|
int Fichier_existe(char * Fichier)
|
||||||
// Détermine si un fichier passé en paramètre existe ou non dans le
|
// Détermine si un fichier passé en paramètre existe ou non dans le
|
||||||
// répertoire courant.
|
// répertoire courant.
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
int Resultat;
|
int Resultat;
|
||||||
|
|
||||||
Resultat=stat(Fichier,&buf);
|
Resultat=stat(Fichier,&buf);
|
||||||
if (Resultat!=0)
|
if (Resultat!=0)
|
||||||
return(errno!=ENOENT);
|
return(errno!=ENOENT);
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
int Repertoire_existe(char * Repertoire)
|
int Repertoire_existe(char * Repertoire)
|
||||||
// Détermine si un répertoire passé en paramètre existe ou non dans le
|
// Détermine si un répertoire passé en paramètre existe ou non dans le
|
||||||
// répertoire courant.
|
// répertoire courant.
|
||||||
{
|
{
|
||||||
DIR* Enreg; // Structure de lecture des éléments
|
DIR* Enreg; // Structure de lecture des éléments
|
||||||
|
|
||||||
if (strcmp(Repertoire,"..")==0)
|
if (strcmp(Repertoire,"..")==0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// On va chercher si le répertoire existe à l'aide d'un Opendir. S'il
|
// On va chercher si le répertoire existe à l'aide d'un Opendir. S'il
|
||||||
// renvoie NULL c'est que le répertoire n'est pas accessible...
|
// renvoie NULL c'est que le répertoire n'est pas accessible...
|
||||||
|
|
||||||
Enreg=opendir(Repertoire);
|
Enreg=opendir(Repertoire);
|
||||||
if (Enreg==NULL)
|
if (Enreg==NULL)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
closedir(Enreg);
|
closedir(Enreg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
main.c
6
main.c
@ -35,8 +35,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL/SDL_image.h>
|
#include <SDL_image.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "pages.h"
|
#include "pages.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
@ -58,7 +58,7 @@
|
|||||||
#elif defined(__macosx__)
|
#elif defined(__macosx__)
|
||||||
#import <corefoundation/corefoundation.h>
|
#import <corefoundation/corefoundation.h>
|
||||||
#import <sys/param.h>
|
#import <sys/param.h>
|
||||||
#elif defined(__AROS__) || defined(__BEOS__) || defined(__MORPHOS__)
|
#elif defined(__AROS__) || defined(__BEOS__) || defined(__MORPHOS__) || defined(__GP2X__)
|
||||||
#include "realpath.h"
|
#include "realpath.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
#include "brush.h"
|
#include "brush.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#if defined(__WATCOMC__) || defined(__GP2X__)
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
#include "divers.h"
|
#include "divers.h"
|
||||||
|
|||||||
2
pxtall.c
2
pxtall.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
#include "divers.h"
|
#include "divers.h"
|
||||||
|
|||||||
2
pxwide.c
2
pxwide.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
#include "divers.h"
|
#include "divers.h"
|
||||||
|
|||||||
@ -9,6 +9,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#if defined(__GP2X__)
|
||||||
|
// This is a random default value ...
|
||||||
|
#define PATH_MAX 32768
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *sep(char *path)
|
static char *sep(char *path)
|
||||||
{
|
{
|
||||||
char *tmp, c;
|
char *tmp, c;
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "sdlscreen.h"
|
#include "sdlscreen.h"
|
||||||
#include "erreurs.h"
|
#include "erreurs.h"
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
#ifndef SDLSCREEN_H_INCLUDED
|
#ifndef SDLSCREEN_H_INCLUDED
|
||||||
#define SDLSCREEN_H_INCLUDED
|
#define SDLSCREEN_H_INCLUDED
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL.h>
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
|
|
||||||
void Set_Mode_SDL(int *,int *,int);
|
void Set_Mode_SDL(int *,int *,int);
|
||||||
|
|||||||
7
texte.c
7
texte.c
@ -33,7 +33,7 @@
|
|||||||
#ifdef __macosx__
|
#ifdef __macosx__
|
||||||
#include <SDL_ttf/SDL_ttf.h>
|
#include <SDL_ttf/SDL_ttf.h>
|
||||||
#else
|
#else
|
||||||
#include <SDL/SDL_ttf.h>
|
#include <SDL_ttf.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@ -46,7 +46,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <SDL/SDL_image.h>
|
|
||||||
|
#include <SDL_image.h>
|
||||||
// SFont
|
// SFont
|
||||||
#include "SFont.h"
|
#include "SFont.h"
|
||||||
|
|
||||||
@ -319,6 +320,7 @@ void Initialisation_Texte(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
|
#ifndef NOTTF
|
||||||
#define USE_XLIB
|
#define USE_XLIB
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
#ifdef USE_XLIB
|
||||||
@ -333,6 +335,7 @@ void Initialisation_Texte(void)
|
|||||||
XFreeFontPath(font_path_list);
|
XFreeFontPath(font_path_list);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#elif defined(__amigaos4__)
|
#elif defined(__amigaos4__)
|
||||||
#ifndef NOTTF
|
#ifndef NOTTF
|
||||||
for_each_file( "FONTS:_TrueType", Ajout_fonte );
|
for_each_file( "FONTS:_TrueType", Ajout_fonte );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user