diff --git a/Makefile.wii b/Makefile.wii index 368fc7b..54e0ec5 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -203,6 +203,7 @@ dist:uae.dol cp FreeMono.ttf $@/apps/uae/ cp README.Cloanto-Amiga_Forever $@/apps/uae/docs/ cp images/kb_amiga.png $@/apps/uae/images/ + cp images/kb_amiga_small.png $@/apps/uae/images/ cp uaerc.wii $@/uae/uaerc cp uaerc.smb $@/uae/ cp docs/configuration.txt $@/apps/uae/docs/ diff --git a/images/kb_amiga_small.png b/images/kb_amiga_small.png new file mode 100644 index 0000000..55074ca Binary files /dev/null and b/images/kb_amiga_small.png differ diff --git a/src/gfx-sdl/sdlgfx.c b/src/gfx-sdl/sdlgfx.c index bb8c5d5..826b176 100644 --- a/src/gfx-sdl/sdlgfx.c +++ b/src/gfx-sdl/sdlgfx.c @@ -46,10 +46,8 @@ #include "inputdevice.h" #include "hotkeys.h" #include "sdlgfx.h" - -#ifdef USE_SDL #include "guidep/menu.h" -#endif + /* Uncomment for debugging output */ //#define DEBUG @@ -945,9 +943,9 @@ static int graphics_subinit (void) gui_message ("Unable to set video mode: %s\n", SDL_GetError ()); return 0; } else { -#ifdef USE_SDL + menu_init(screen); //GEKKO -#endif + /* Just in case we didn't get exactly what we asked for . . . */ fullscreen = ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN); is_hwsurface = ((screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE); @@ -1112,6 +1110,9 @@ static void graphics_subshutdown (void) if (display != screen) SDL_FreeSurface (screen); } + + menu_deinit(); //GEKKO + display = screen = 0; mousehack = 0; @@ -1144,9 +1145,6 @@ void graphics_leave (void) graphics_subshutdown (); SDL_QuitSubSystem(SDL_INIT_VIDEO); dumpcustom (); -#ifdef USE_SDL - menu_deinit(); //GEKKO -#endif } void graphics_notify_state (int state) diff --git a/src/gui-sdl/VirtualKeyboard.c b/src/gui-sdl/VirtualKeyboard.c index 210a124..38216e9 100644 --- a/src/gui-sdl/VirtualKeyboard.c +++ b/src/gui-sdl/VirtualKeyboard.c @@ -24,6 +24,14 @@ #include "target.h" #include "gensound.h" +/* Uncomment for debugging output */ +//#define DEBUG_VK +#ifdef DEBUG_VK +#define DEBUG_LOG write_log +#else +#define DEBUG_LOG(...) do {} while(0) +#endif + static SDL_Surface *image_kbd, *tmp_surface ; static int vkb_is_init; //static int key_code; @@ -68,14 +76,15 @@ static int buttons_margins[KEY_ROWS][KEY_COLS+1] = { {28,63,95,329,361,396,515,567,593,620}, {14,80,146,212,278,344,411,476,543}}; - +extern int RATIO; void VirtualKeyboard_init(SDL_Surface *screen) { + if (vkb_is_init) return; + VirtualKeyboard.screen = screen; - VirtualKeyboard.x = 3; //Where to print the keyboard - VirtualKeyboard.y = 100; - vkb_is_init = -1; + VirtualKeyboard.x = 2/RATIO; //Where to print the keyboard + VirtualKeyboard.y = 100/RATIO; char kbd_image[255]; @@ -91,7 +100,7 @@ void VirtualKeyboard_init(SDL_Surface *screen) } #endif - strcat (kbd_image, KBDIMAGE); + if (RATIO == 1) strcat (kbd_image, KBDIMAGE); else strcat (kbd_image, KBDIMAGE_SMALL); tmp_surface=IMG_Load(kbd_image); @@ -102,19 +111,23 @@ void VirtualKeyboard_init(SDL_Surface *screen) memset(VirtualKeyboard.buf, 0, sizeof(VirtualKeyboard.buf)); vkb_is_init = 1; kbd_is_active=0; + DEBUG_LOG("Virtual keyboard is inited\n"); } void VirtualKeyboard_fini(void) { + if (!vkb_is_init) return; + SDL_FreeSurface (image_kbd); - vkb_is_init = -1; + vkb_is_init = 0; kbd_is_active = 0; + DEBUG_LOG("Virtual keyboard is finished\n"); } void draw_vk() { SDL_Rect dst_rect = {VirtualKeyboard.x, VirtualKeyboard.y, 0, 0}; - SDL_BlitSurface(image_kbd, NULL, VirtualKeyboard.screen, &dst_rect); + SDL_BlitSurface(image_kbd, NULL, VirtualKeyboard.screen, &dst_rect); } inline void flip_VKB() @@ -181,7 +194,7 @@ struct virtkey *get_key_internal() x = (xm-border_x); y = (ym-border_y); - i = get_index(x,y); + i = get_index(x*RATIO,y*RATIO); if (i==-1) continue; @@ -205,9 +218,7 @@ struct virtkey* virtkbd_get_key() { virtkey_t *key; - if (FULL_DISPLAY_X != 640) {msgInfo("Virtual Keyboard only with 640X480 res",4000,NULL);return NULL;} - - if (vkb_is_init != 1) return NULL; + if (!vkb_is_init) return NULL; pause_sound(); diff --git a/src/gui-sdl/menu.c b/src/gui-sdl/menu.c index e7b3fd8..30637e0 100644 --- a/src/gui-sdl/menu.c +++ b/src/gui-sdl/menu.c @@ -26,7 +26,13 @@ #include "options.h" #include "filesys.h" - +/* Uncomment for debugging output */ +//#define DEBUG_MENU +#ifdef DEBUG_MENU +#define DEBUG_LOG write_log +#else +#define DEBUG_LOG(...) do {} while(0) +#endif struct joyinfo { SDL_Joystick *joy; @@ -1159,10 +1165,13 @@ void menu_init(SDL_Surface *screen) real_screen = screen; VirtualKeyboard_init(screen); is_inited = 1; + DEBUG_LOG("Menu is inited\n"); } void menu_deinit(void) { + if (!is_inited) return; + is_inited = 0; VirtualKeyboard_fini(); @@ -1172,6 +1181,7 @@ void menu_deinit(void) TTF_CloseFont(menu_font10); TTF_Quit(); + DEBUG_LOG("Menu is finished\n"); } diff --git a/src/targets/t-wii.h b/src/targets/t-wii.h index b4b85dc..1ac42c6 100644 --- a/src/targets/t-wii.h +++ b/src/targets/t-wii.h @@ -24,6 +24,7 @@ #define USERFILENAME "/uae/uaerc.user" #define SAVEDFILENAME "/uae/uaerc.saved" #define KBDIMAGE "/apps/uae/images/kb_amiga.png" +#define KBDIMAGE_SMALL "/apps/uae/images/kb_amiga_small.png" #define DEFPRTNAME "lpr" #define DEFSERNAME "/dev/ttyS1"