Add a port to the GCW Zero, contributed by David Knight.

Untested since I don't have the hardware.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2080 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2015-02-10 20:13:57 +00:00
parent 5e26436c48
commit 61c8dca353
10 changed files with 142 additions and 16 deletions

View File

@ -313,7 +313,20 @@ endif
PLATFORM = gp2x PLATFORM = gp2x
STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip
JOYCOPT = -DUSE_JOYSTICK JOYCOPT = -DUSE_JOYSTICK
else
ifdef GCWZERO
#cross compile an exec for the gcw0
CC = mipsel-linux-gcc
BIN = ../bin/grafx2
LUACOPT =
LUALOPT = -lluajit-5.1
COPT = -DGCWZERO -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -g -O$(OPTIM) -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL `/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config --cflags` $(TTFCOPT) $(TTFCOPT) $(JOYCOPT) $(LUACOPT)
LOPT = -L/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib -lSDL_image `/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config --libs` -ljpeg -lpng -lz -lm $(TTFLOPT) $(LUALOPT)
OBJDIR = ../obj/gp2x
NOTTF = 1
PLATFORM = gp2x
STRIP = mipsel-linux-strip
JOYCOPT = -DUSE_JOYSTICK
else else
ifdef AROS32CROSS ifdef AROS32CROSS
#cross compile an AROS 32 bit executable #cross compile an AROS 32 bit executable
@ -354,6 +367,7 @@ endif
endif endif
endif endif
endif endif
endif
endif endif
endif endif

View File

@ -61,13 +61,18 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
false, false,
SDLK_RIGHT, // DROITE SDLK_RIGHT, // DROITE
0}, 0},
#ifdef GCWZERO
#define FAST_MOD MOD_CTRL
#else
#define FAST_MOD MOD_SHIFT
#endif
{4, {4,
"Faster scroll up", "Faster scroll up",
"Used to scroll upwards in the", "Used to scroll upwards in the",
"picture fast, either in magnify and", "picture fast, either in magnify and",
"normal mode.", "normal mode.",
true, true,
SDLK_UP|MOD_SHIFT, // Shift + Haut SDLK_UP|FAST_MOD, // Shift + Up
0}, 0},
{5, {5,
"Faster scroll down", "Faster scroll down",
@ -75,7 +80,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"picture fast, either in magnify and", "picture fast, either in magnify and",
"normal mode.", "normal mode.",
true, true,
SDLK_DOWN|MOD_SHIFT, // Shift + Bas SDLK_DOWN|FAST_MOD, // Shift + Down
0}, 0},
{6, {6,
"Faster scroll left", "Faster scroll left",
@ -83,7 +88,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"picture fast, either in magnify and", "picture fast, either in magnify and",
"normal mode.", "normal mode.",
true, true,
SDLK_LEFT|MOD_SHIFT, // Shift + Gauche SDLK_LEFT|FAST_MOD, // Shift + Left
0}, 0},
{7, {7,
"Faster scroll right", "Faster scroll right",
@ -91,8 +96,9 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"picture fast, either in magnify and", "picture fast, either in magnify and",
"normal mode.", "normal mode.",
true, true,
SDLK_RIGHT|MOD_SHIFT, // Shift + Droite SDLK_RIGHT|FAST_MOD, // Shift + Right
0}, 0},
#undef FAST_MOD
{8, {8,
"Slower scroll up", "Slower scroll up",
"Used to scroll upwards in the", "Used to scroll upwards in the",
@ -131,7 +137,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"deplacement up.It's very useful", "deplacement up.It's very useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN,
#else
SDLK_UP|MOD_CTRL, // Ctrl + Haut SDLK_UP|MOD_CTRL, // Ctrl + Haut
#endif
0}, 0},
{13, {13,
"Move mouse cursor 1 pixel down", "Move mouse cursor 1 pixel down",
@ -139,7 +149,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"deplacement down.It's very useful", "deplacement down.It's very useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN,
#else
SDLK_DOWN|MOD_CTRL, // Ctrl + Bas SDLK_DOWN|MOD_CTRL, // Ctrl + Bas
#endif
0}, 0},
{14, {14,
"Move mouse cursor 1 pixel left", "Move mouse cursor 1 pixel left",
@ -147,7 +161,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"deplacement left.It's very useful", "deplacement left.It's very useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN,
#else
SDLK_LEFT|MOD_CTRL, // Ctrl + Gauche SDLK_LEFT|MOD_CTRL, // Ctrl + Gauche
#endif
0}, 0},
{15, {15,
"Move mouse cursor 1 pixel right", "Move mouse cursor 1 pixel right",
@ -155,7 +173,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"deplacement right.It's very useful", "deplacement right.It's very useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN,
#else
SDLK_RIGHT|MOD_CTRL, // Ctrl + Droite SDLK_RIGHT|MOD_CTRL, // Ctrl + Droite
#endif
0}, 0},
{16, {16,
"Simulate left mouse click", "Simulate left mouse click",
@ -163,7 +185,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"left mouse button. It's useful", "left mouse button. It's useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_SPACE, // Space
#else
SDLK_SPACE|MOD_CTRL, // Ctrl + Space SDLK_SPACE|MOD_CTRL, // Ctrl + Space
#endif
0}, 0},
{17, {17,
"Simulate right mouse click", "Simulate right mouse click",
@ -171,7 +197,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"right mouse button.. It's useful", "right mouse button.. It's useful",
"when you want ultra-high precision.", "when you want ultra-high precision.",
true, true,
#ifdef GCWZERO
SDLK_BACKSPACE, // R-shoulderpad
#else
SDLK_SPACE|MOD_SHIFT, // Shift + Space SDLK_SPACE|MOD_SHIFT, // Shift + Space
#endif
0}, 0},
{18, {18,
"Show/hide menu toolbars", "Show/hide menu toolbars",
@ -816,7 +846,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"information about the program,", "information about the program,",
"or contextual help.", "or contextual help.",
true, true,
#ifdef GCWZERO
SDLK_TAB, // L-Shoulderpad
#else
SDLK_F1, // F1 SDLK_F1, // F1
#endif
0}, 0},
{92, {92,
"Statistics", "Statistics",
@ -832,7 +866,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"", "",
"", "",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN,
#else
SDLK_TAB, // Tab SDLK_TAB, // Tab
#endif
0}, 0},
{94, {94,
"Copy current page to spare page", "Copy current page to spare page",
@ -963,7 +1001,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"or the transparent color if it's", "or the transparent color if it's",
"a layered image.", "a layered image.",
true, true,
#ifdef GCWZERO
SDLK_UNKNOWN, // BackSpace
#else
SDLK_BACKSPACE, // BackSpace SDLK_BACKSPACE, // BackSpace
#endif
0}, 0},
{105, {105,
"Clear page with backcolor", "Clear page with backcolor",
@ -1095,7 +1137,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"in the palette.", "in the palette.",
"", "",
true, true,
#ifdef GCWZERO
SDLK_RIGHT|MOD_SHIFT,
#else
SDLK_RIGHTBRACKET, // ] (0x en AZERTY) SDLK_RIGHTBRACKET, // ] (0x en AZERTY)
#endif
0}, 0},
{118, {118,
"Previous foreground color", "Previous foreground color",
@ -1103,7 +1149,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"previous in the palette.", "previous in the palette.",
"", "",
true, true,
#ifdef GCWZERO
SDLK_LEFT|MOD_SHIFT,
#else
SDLK_LEFTBRACKET, // [ (^ en AZERTY) SDLK_LEFTBRACKET, // [ (^ en AZERTY)
#endif
0}, 0},
{119, {119,
"Next background color", "Next background color",
@ -1111,7 +1161,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"in the palette.", "in the palette.",
"", "",
true, true,
#ifdef GCWZERO
SDLK_DOWN|MOD_SHIFT,
#else
SDLK_RIGHTBRACKET|MOD_SHIFT, // Shift + ] SDLK_RIGHTBRACKET|MOD_SHIFT, // Shift + ]
#endif
0}, 0},
{120, {120,
"Previous background color", "Previous background color",
@ -1119,7 +1173,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"previous in the palette.", "previous in the palette.",
"", "",
true, true,
#ifdef GCWZERO
SDLK_UP|MOD_SHIFT,
#else
SDLK_LEFTBRACKET|MOD_SHIFT, // Shift + [ SDLK_LEFTBRACKET|MOD_SHIFT, // Shift + [
#endif
0}, 0},
{126, {126,
"Next user-defined forecolor", "Next user-defined forecolor",
@ -1751,7 +1809,11 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
"click and drag the mouse to", "click and drag the mouse to",
"pan the view.", "pan the view.",
true, true,
#ifdef GCWZERO
SDLK_F1, // Space
#else
SDLK_SPACE, // Space SDLK_SPACE, // Space
#endif
0}, 0},
}; };

View File

@ -1888,7 +1888,7 @@ void Set_all_video_modes(void)
// The first mode will have index number 0. // The first mode will have index number 0.
// It will be the default mode if an unsupported one // It will be the default mode if an unsupported one
// is requested in gfx2.ini // is requested in gfx2.ini
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
// Native GP2X resolution // Native GP2X resolution
Set_video_mode( 320,240,0, 1); Set_video_mode( 320,240,0, 1);
#else #else
@ -1898,7 +1898,7 @@ void Set_all_video_modes(void)
Set_video_mode( 320,200,0, 1); Set_video_mode( 320,200,0, 1);
Set_video_mode( 320,224,0, 1); Set_video_mode( 320,224,0, 1);
#if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) #if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) && !defined(GCWZERO)
// For the GP2X, this one is already declared above. // For the GP2X, this one is already declared above.
Set_video_mode( 320,240,0, 1); Set_video_mode( 320,240,0, 1);
#endif #endif
@ -1967,7 +1967,7 @@ void Set_all_video_modes(void)
for (index=0; Modes[index]; index++) for (index=0; Modes[index]; index++)
{ {
int index2; int index2;
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
// On the GP2X the first mode is not windowed, so include it in the search. // On the GP2X the first mode is not windowed, so include it in the search.
index2=0; index2=0;
#else #else

View File

@ -460,7 +460,11 @@ byte Create_lock_file(const char *file_directory)
#else #else
char lock_filename[MAX_PATH_CHARACTERS]; char lock_filename[MAX_PATH_CHARACTERS];
#ifdef GCWZERO
strcpy(lock_filename,"/media/home/.grafx2/");
#else
strcpy(lock_filename,file_directory); strcpy(lock_filename,file_directory);
#endif
strcat(lock_filename,"gfx2.lck"); strcat(lock_filename,"gfx2.lck");
#ifdef __WIN32__ #ifdef __WIN32__

View File

@ -381,12 +381,21 @@ const char * Key_name(word key)
} T_key_label; } T_key_label;
T_key_label key_labels[] = T_key_label key_labels[] =
{ {
#ifdef GCWZERO
{ SDLK_BACKSPACE , "Right-SP" },
{ SDLK_TAB , "Left-SP" },
{ SDLK_CLEAR , "Clear" },
{ SDLK_RETURN , "START" },
{ SDLK_PAUSE , "Power-Down" },
{ SDLK_ESCAPE , "SELECT" },
#else
{ SDLK_BACKSPACE , "Backspace" }, { SDLK_BACKSPACE , "Backspace" },
{ SDLK_TAB , "Tab" }, { SDLK_TAB , "Tab" },
{ SDLK_CLEAR , "Clear" }, { SDLK_CLEAR , "Clear" },
{ SDLK_RETURN , "Return" }, { SDLK_RETURN , "Return" },
{ SDLK_PAUSE , "Pause" }, { SDLK_PAUSE , "Pause" },
{ SDLK_ESCAPE , "Esc" }, { SDLK_ESCAPE , "Esc" },
#endif
{ SDLK_DELETE , "Del" }, { SDLK_DELETE , "Del" },
{ SDLK_KP0 , "KP 0" }, { SDLK_KP0 , "KP 0" },
{ SDLK_KP1 , "KP 1" }, { SDLK_KP1 , "KP 1" },
@ -433,11 +442,19 @@ const char * Key_name(word key)
{ SDLK_CAPSLOCK , "CapsLck" }, { SDLK_CAPSLOCK , "CapsLck" },
{ SDLK_SCROLLOCK , "ScrlLock" }, { SDLK_SCROLLOCK , "ScrlLock" },
{ SDLK_RSHIFT , "RShift" }, { SDLK_RSHIFT , "RShift" },
#ifdef GCWZERO
{ SDLK_LSHIFT , "X" },
{ SDLK_RCTRL , "RCtrl" },
{ SDLK_LCTRL , "A" },
{ SDLK_RALT , "RAlt" },
{ SDLK_LALT , "B" },
#else
{ SDLK_LSHIFT , "LShift" }, { SDLK_LSHIFT , "LShift" },
{ SDLK_RCTRL , "RCtrl" }, { SDLK_RCTRL , "RCtrl" },
{ SDLK_LCTRL , "LCtrl" }, { SDLK_LCTRL , "LCtrl" },
{ SDLK_RALT , "RAlt" }, { SDLK_RALT , "RAlt" },
{ SDLK_LALT , "LAlt" }, { SDLK_LALT , "LAlt" },
#endif
{ SDLK_RMETA , "RMeta" }, { SDLK_RMETA , "RMeta" },
{ SDLK_LMETA , "LMeta" }, { SDLK_LMETA , "LMeta" },
{ SDLK_LSUPER , "LWin" }, { SDLK_LSUPER , "LWin" },
@ -463,13 +480,22 @@ const char * Key_name(word key)
if (key == SDLK_UNKNOWN) if (key == SDLK_UNKNOWN)
return "None"; return "None";
#ifdef GCWZERO
if (key & MOD_CTRL) if (key & MOD_CTRL)
strcat(buffer, "Ctrl+"); strcat(buffer, "A+");
if (key & MOD_ALT)
strcat(buffer, "B+");
if (key & MOD_SHIFT)
strcat(buffer, "X+");
#else
if (key & MOD_CTRL)
strcat(buffer, "Ctl+");
if (key & MOD_ALT) if (key & MOD_ALT)
strcat(buffer, "Alt+"); strcat(buffer, "Alt+");
if (key & MOD_SHIFT) if (key & MOD_SHIFT)
strcat(buffer, "Shift+"); strcat(buffer, "Shift+");
#endif
if (key & MOD_META) if (key & MOD_META)
strcat(buffer, META_KEY_PREFIX); strcat(buffer, META_KEY_PREFIX);

View File

@ -41,7 +41,7 @@
// There is no WM on the GP2X... // There is no WM on the GP2X...
#if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) #if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) && !defined(GCWZERO)
#include <SDL_syswm.h> #include <SDL_syswm.h>
#endif #endif

View File

@ -59,8 +59,7 @@ void Load_INI_clear_string(char * str, byte keep_comments)
// Suppression d'un espace ou d'un tab: // Suppression d'un espace ou d'un tab:
memmove(str+index,str+index+1,strlen(str+index)); memmove(str+index,str+index+1,strlen(str+index));
} }
else else if (!keep_comments && ((str[index]==';') || (str[index]=='#')))
if (!keep_comments && ((str[index]==';') || (str[index]=='#')))
{ {
// Comment // Comment
str[index]='\0'; str[index]='\0';
@ -75,8 +74,9 @@ void Load_INI_clear_string(char * str, byte keep_comments)
if (!equal_found) if (!equal_found)
{ {
// Passage en majuscule d'un caractère: // Passage en majuscule d'un caractère:
#ifndef GCWZERO //this causes gcw to crash
str[index]=toupper((int)str[index]); str[index]=toupper((int)str[index]);
#endif
} }
index++; index++;
} }

View File

@ -56,7 +56,7 @@
#endif #endif
// Virtual keyboard is ON by default on these platforms: // Virtual keyboard is ON by default on these platforms:
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
#define VIRT_KEY_DEFAULT_ON 1 #define VIRT_KEY_DEFAULT_ON 1
#else #else
#define VIRT_KEY_DEFAULT_ON 0 #define VIRT_KEY_DEFAULT_ON 0
@ -515,7 +515,11 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
Display_cursor(); Display_cursor();
} }
} }
#ifdef GCWZERO //we cannot enter text into a field without using the virtual mouse otherwise so no saving etc
Keyboard_click_allowed = 1;
#else
Keyboard_click_allowed = 0; Keyboard_click_allowed = 0;
#endif
Hide_cursor(); Hide_cursor();
// Effacement de la chaîne // Effacement de la chaîne

View File

@ -55,6 +55,8 @@
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE #define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__MINT__) #elif defined(__MINT__)
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED #define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#elif defined(GCWZERO)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE #define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#else #else
@ -70,7 +72,11 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
static SDL_Cursor* cur = NULL; static SDL_Cursor* cur = NULL;
static byte cursorData = 0; static byte cursorData = 0;
#ifdef GCWZERO
Screen_SDL=SDL_SetVideoMode(*width,*height,8,SDL_HWSURFACE|SDL_TRIPLEBUF|(fullscreen?SDL_FULLSCREEN:0)|SDL_RESIZABLE);
#else
Screen_SDL=SDL_SetVideoMode(*width,*height,8,(fullscreen?SDL_FULLSCREEN:0)|SDL_RESIZABLE); Screen_SDL=SDL_SetVideoMode(*width,*height,8,(fullscreen?SDL_FULLSCREEN:0)|SDL_RESIZABLE);
#endif
if(Screen_SDL != NULL) if(Screen_SDL != NULL)
{ {
// Check the mode we got, in case it was different from the one we requested. // Check the mode we got, in case it was different from the one we requested.
@ -116,7 +122,11 @@ void Flush_update(void)
// Do a full screen update // Do a full screen update
if (update_is_required) if (update_is_required)
{ {
#ifdef GCWZERO
SDL_Flip(Screen_SDL);
#else
SDL_UpdateRect(Screen_SDL, 0, 0, 0, 0); SDL_UpdateRect(Screen_SDL, 0, 0, 0, 0);
#endif
update_is_required=0; update_is_required=0;
} }
#endif #endif

View File

@ -134,6 +134,8 @@ void Set_data_directory(const char * program_dir, char * data_dir)
// All other targets, program is in a "bin" subdirectory // All other targets, program is in a "bin" subdirectory
#elif defined (__AROS__) #elif defined (__AROS__)
strcat(data_dir,"share/grafx2/"); strcat(data_dir,"share/grafx2/");
#elif defined (GCWZERO)
strcat(data_dir,"share/grafx2/");
#else #else
strcat(data_dir,"../share/grafx2/"); strcat(data_dir,"../share/grafx2/");
#endif #endif
@ -162,11 +164,15 @@ void Set_config_directory(const char * program_dir, char * config_dir)
strcpy(config_dir,program_dir); strcpy(config_dir,program_dir);
#elif defined(__MINT__) #elif defined(__MINT__)
strcpy(config_dir,program_dir); strcpy(config_dir,program_dir);
#else #else
char filename[MAX_PATH_CHARACTERS]; char filename[MAX_PATH_CHARACTERS];
#ifdef GCWZERO
strcpy(config_dir, "/media/home/.grafx2/");
#else
// In priority: check root directory // In priority: check root directory
strcpy(config_dir, program_dir); strcpy(config_dir, program_dir);
#endif
// On all the remaining targets except OSX, the executable is in ./bin // On all the remaining targets except OSX, the executable is in ./bin
#if !defined(__macosx__) #if !defined(__macosx__)
strcat(config_dir, "../"); strcat(config_dir, "../");