From 7a3ae5824a545a46ff764123dc369376a3b86c47 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 5 Nov 2010 01:03:11 +0000 Subject: [PATCH] Merged the specifics of Caanoo 1.2 port by Pheel + Enabled TTF text on Caanoo git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1645 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/buttons.c | 2 +- src/factory.c | 1 + src/filesel.c | 2 +- src/global.h | 5 ++++- src/helpfile.h | 2 +- src/init.c | 12 ++++++------ src/input.h | 1 - src/keyboard.c | 2 +- src/loadsave.c | 2 +- src/main.c | 7 ++++++- src/op_c.c | 2 +- src/text.c | 10 ++++++---- 12 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index ba8eccda..e9e449f5 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1464,7 +1464,7 @@ void Button_Skins(void) Menu_font = new_font; fname = Get_item_by_index(&Font_files_list,selected_font)->Full_name; free(Config.Font_file); - Config.Font_file = strdup(fname); + Config.Font_file = (char *)strdup(fname); } // Confirm the change of cursor shape Config.Cursor = selected_cursor; diff --git a/src/factory.c b/src/factory.c index 05621862..241a18a2 100644 --- a/src/factory.c +++ b/src/factory.c @@ -53,6 +53,7 @@ char * Bound_script[10]; #include #include // for DBL_MAX #include // chdir() +#include //for INT_MIN /// /// Number of characters for name in fileselector. diff --git a/src/filesel.c b/src/filesel.c index a78a5164..92aa97c0 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -1423,7 +1423,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) case 6 : // Scroller des formats // On met à jour le format de browsing du fileselect: if (Main_format != Window_attribute2) { - char* savename = strdup(Selector_filename); + char* savename = (char *)strdup(Selector_filename); int nameLength = strlen(savename); DEBUG(Selector_filename, 42); Main_format = Window_attribute2; diff --git a/src/global.h b/src/global.h index c9fcaacb..bf2ed001 100644 --- a/src/global.h +++ b/src/global.h @@ -997,7 +997,10 @@ GFX2_GLOBAL SDL_Joystick* Joystick; #define JOY_BUTTON_VOLDOWN (17) #define KEY_ESC (KEY_JOYBUTTON+JOY_BUTTON_X) -#elif __CAANOO__ +#elif defined (__CAANOO__) + + #define JOYSTICK_THRESHOLD (4096) + /// Button definitions for the Caanoo #define JOY_BUTTON_A (0) #define JOY_BUTTON_X (1) diff --git a/src/helpfile.h b/src/helpfile.h index 2dc0f85b..4e372014 100644 --- a/src/helpfile.h +++ b/src/helpfile.h @@ -443,7 +443,7 @@ static const T_Help_table helptable_credits[] = HELP_TEXT ("") HELP_BOLD (" WIZ & CAANOO PORT") HELP_TEXT ("") - HELP_TEXT (" PheeL") + HELP_TEXT (" Alexander Filyanov (PheeL)") HELP_TEXT ("") HELP_TEXT ("") HELP_TEXT (" ... made it work on your favourite toaster") diff --git a/src/init.c b/src/init.c index e089d32e..c92a594c 100644 --- a/src/init.c +++ b/src/init.c @@ -1698,7 +1698,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__) + #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) // Native GP2X resolution Set_video_mode( 320,240,0, 1); #else @@ -1708,7 +1708,7 @@ void Set_all_video_modes(void) Set_video_mode( 320,200,0, 1); Set_video_mode( 320,224,0, 1); - #if !defined(__GP2X__) + #if !defined(__GP2X__) && !defined(__WIZ__) && !defined(__CAANOO__) // For the GP2X, this one is already declared above. Set_video_mode( 320,240,0, 1); #endif @@ -1777,7 +1777,7 @@ void Set_all_video_modes(void) for (index=0; Modes[index]; index++) { int index2; -#if defined(__GP2X__) +#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) // On the GP2X the first mode is not windowed, so include it in the search. index2=0; #else @@ -1925,7 +1925,7 @@ int Load_CFG(int reload_all) !Read_word_le(Handle, &cfg_video_mode.Height) ) goto Erreur_lecture_config; -#if defined(__GP2X__) +#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) index2=0; #else index2=1; @@ -2254,7 +2254,7 @@ int Save_CFG(void) // D'abord compter les modes pour lesquels l'utilisateur a mis une préférence modes_to_save=0; -#if defined(__GP2X__) +#if defined(__GP2X__) || defined (__WIZ__) || defined (__CAANOO__) index = 0; #else index = 1; @@ -2270,7 +2270,7 @@ int Save_CFG(void) if (!Write_byte(Handle, Chunk.Number) || !Write_word_le(Handle, Chunk.Size) ) goto Erreur_sauvegarde_config; -#if defined(__GP2X__) +#if defined(__GP2X__) || defined (__WIZ__) || defined (__CAANOO__) index = 0; #else index = 1; diff --git a/src/input.h b/src/input.h index 8ab7440a..9ee0d7e7 100644 --- a/src/input.h +++ b/src/input.h @@ -64,4 +64,3 @@ extern int Snap_axis_origin_Y; /// This malloced string is set when a drag-and-drop event /// brings a file to Grafx2's window. extern char * Drop_file_name; - \ No newline at end of file diff --git a/src/keyboard.c b/src/keyboard.c index d3d22f5a..b459b83c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2,7 +2,7 @@ */ /* Grafx2 - The Ultimate 256-color bitmap paint program - Copyright 2010 A Filyanov + Copyright 2010 Alexander Filyanov Copyright 2009 Franck Charlet Copyright 2008 Yves Rizoud Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) diff --git a/src/loadsave.c b/src/loadsave.c index 65973377..9268ddec 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -2,7 +2,7 @@ */ /* Grafx2 - The Ultimate 256-color bitmap paint program - Copyright 2010 A Filyanov + Copyright 2010 Alexander Filyanov Copyright 2009 Petter Lindquist Copyright 2008 Yves Rizoud Copyright 2008 Franck Charlet diff --git a/src/main.c b/src/main.c index 3f87aa51..af2dad04 100644 --- a/src/main.c +++ b/src/main.c @@ -610,6 +610,11 @@ int Init_program(int argc,char * argv[]) Paintbrush_offset_Y=0; Paintbrush_shape=PAINTBRUSH_SHAPE_ROUND; + #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) + // Prefer cycling active by default + Cycling_mode=1; + #endif + // Charger la configuration des touches Set_config_defaults(); @@ -888,7 +893,7 @@ void Program_shutdown(void) SDL_Quit(); - #if defined(__GP2X__) || defined(__gp2x__) || defined(__WIZ__) || defined(__CAANOO__) + #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) chdir("/usr/gp2x"); execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); #endif diff --git a/src/op_c.c b/src/op_c.c index eaeac5ee..1838d5d7 100644 --- a/src/op_c.c +++ b/src/op_c.c @@ -2,7 +2,7 @@ */ /* Grafx2 - The Ultimate 256-color bitmap paint program - Copyright 2010 A Filyanov + Copyright 2010 Alexander Filyanov Copyright 2007 Adrien Destugues Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud) diff --git a/src/text.c b/src/text.c index 1a7edd50..4ffca741 100644 --- a/src/text.c +++ b/src/text.c @@ -36,16 +36,16 @@ #include #endif -#if defined(__linux__) -#if defined(__macosx__) +#if defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) +// No X11 +#elif defined(__macosx__) #include #import #import -#else +#elif defined(__linux__) #include #endif #endif -#endif #include #include "SFont.h" @@ -321,6 +321,8 @@ void Init_text(void) CFRelease(url); #endif + #elif defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) + // No X11 : Only use fonts from Grafx2 #elif defined(__linux__) #ifndef NOTTF #define USE_XLIB