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
STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip
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
ifdef AROS32CROSS
#cross compile an AROS 32 bit executable
@ -354,6 +367,7 @@ endif
endif
endif
endif
endif
endif
endif

View File

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

View File

@ -1888,7 +1888,7 @@ void Set_all_video_modes(void)
// The first mode will have index number 0.
// It will be the default mode if an unsupported one
// is requested in gfx2.ini
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
// Native GP2X resolution
Set_video_mode( 320,240,0, 1);
#else
@ -1898,7 +1898,7 @@ void Set_all_video_modes(void)
Set_video_mode( 320,200,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.
Set_video_mode( 320,240,0, 1);
#endif
@ -1967,7 +1967,7 @@ void Set_all_video_modes(void)
for (index=0; Modes[index]; index++)
{
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.
index2=0;
#else

View File

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

View File

@ -381,12 +381,21 @@ const char * Key_name(word key)
} T_key_label;
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_TAB , "Tab" },
{ SDLK_CLEAR , "Clear" },
{ SDLK_RETURN , "Return" },
{ SDLK_PAUSE , "Pause" },
{ SDLK_ESCAPE , "Esc" },
#endif
{ SDLK_DELETE , "Del" },
{ SDLK_KP0 , "KP 0" },
{ SDLK_KP1 , "KP 1" },
@ -433,11 +442,19 @@ const char * Key_name(word key)
{ SDLK_CAPSLOCK , "CapsLck" },
{ SDLK_SCROLLOCK , "ScrlLock" },
{ 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_RCTRL , "RCtrl" },
{ SDLK_LCTRL , "LCtrl" },
{ SDLK_RALT , "RAlt" },
{ SDLK_LALT , "LAlt" },
#endif
{ SDLK_RMETA , "RMeta" },
{ SDLK_LMETA , "LMeta" },
{ SDLK_LSUPER , "LWin" },
@ -464,12 +481,21 @@ const char * Key_name(word key)
if (key == SDLK_UNKNOWN)
return "None";
#ifdef GCWZERO
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)
strcat(buffer, "Alt+");
if (key & MOD_SHIFT)
strcat(buffer, "Shift+");
#endif
if (key & MOD_META)
strcat(buffer, META_KEY_PREFIX);

View File

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

View File

@ -56,7 +56,7 @@
#endif
// 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
#else
#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();
}
}
#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;
#endif
Hide_cursor();
// Effacement de la chaîne

View File

@ -55,6 +55,8 @@
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__MINT__)
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
#elif defined(GCWZERO)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#elif defined(__ANDROID__)
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
#else
@ -70,7 +72,11 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
static SDL_Cursor* cur = NULL;
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);
#endif
if(Screen_SDL != NULL)
{
// 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
if (update_is_required)
{
#ifdef GCWZERO
SDL_Flip(Screen_SDL);
#else
SDL_UpdateRect(Screen_SDL, 0, 0, 0, 0);
#endif
update_is_required=0;
}
#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
#elif defined (__AROS__)
strcat(data_dir,"share/grafx2/");
#elif defined (GCWZERO)
strcat(data_dir,"share/grafx2/");
#else
strcat(data_dir,"../share/grafx2/");
#endif
@ -162,11 +164,15 @@ void Set_config_directory(const char * program_dir, char * config_dir)
strcpy(config_dir,program_dir);
#elif defined(__MINT__)
strcpy(config_dir,program_dir);
#else
char filename[MAX_PATH_CHARACTERS];
#ifdef GCWZERO
strcpy(config_dir, "/media/home/.grafx2/");
#else
// In priority: check root directory
strcpy(config_dir, program_dir);
#endif
// On all the remaining targets except OSX, the executable is in ./bin
#if !defined(__macosx__)
strcat(config_dir, "../");