mirror of
https://github.com/Oibaf66/uae-wii.git
synced 2024-11-14 23:05:08 +01:00
Added graphic virtual keyboard
This commit is contained in:
parent
807f70fe2e
commit
0aaba1033f
11
Makefile.wii
11
Makefile.wii
@ -144,11 +144,13 @@ CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
|
|||||||
#unused defines; -DCAPS (to enable ipf file) -DFDI2RAW (to enable DFI file)
|
#unused defines; -DCAPS (to enable ipf file) -DFDI2RAW (to enable DFI file)
|
||||||
|
|
||||||
# Test link flags.
|
# Test link flags.
|
||||||
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(PORTLIBS)/lib -L$(DEVKITPRO)/libogc/lib -L$(DEVKITPRO)/libogc/lib/wii -lz -lSDL_ttf -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard -ltinysmb
|
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(PORTLIBS)/lib -L$(DEVKITPRO)/libogc/lib -L$(DEVKITPRO)/libogc/lib/wii -lz -lSDL_ttf -lSDL -lSDL_image -lpng -ljpeg -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard -ltinysmb
|
||||||
|
|
||||||
|
|
||||||
dist:uae.dol
|
dist:uae.dol
|
||||||
install -d $@/apps/uae
|
install -d $@/apps/uae
|
||||||
|
install -d $@/apps/uae/docs
|
||||||
|
install -d $@/apps/uae/images/
|
||||||
install -d $@/uae
|
install -d $@/uae
|
||||||
install -d $@/uae/roms
|
install -d $@/uae/roms
|
||||||
install -d $@/uae/floppies
|
install -d $@/uae/floppies
|
||||||
@ -166,11 +168,12 @@ dist:uae.dol
|
|||||||
cp icon.png $@/apps/uae/
|
cp icon.png $@/apps/uae/
|
||||||
cp FreeMono.ttf $@/apps/uae/
|
cp FreeMono.ttf $@/apps/uae/
|
||||||
cp Smaller.ttf $@/apps/uae/
|
cp Smaller.ttf $@/apps/uae/
|
||||||
cp README.Cloanto-Amiga_Forever $@/apps/uae/
|
cp README.Cloanto-Amiga_Forever $@/apps/uae/docs/
|
||||||
|
cp images/kb_amiga.png $@/apps/uae/images/
|
||||||
cp uaerc.wii $@/uae/uaerc
|
cp uaerc.wii $@/uae/uaerc
|
||||||
cp uaerc.smb $@/uae/
|
cp uaerc.smb $@/uae/
|
||||||
cp docs/configuration.txt $@/apps/uae/
|
cp docs/configuration.txt $@/apps/uae/docs/
|
||||||
cp docs/Joystick_mapping.txt $@/apps/uae/
|
cp docs/Joystick_mapping.txt $@/apps/uae/docs/
|
||||||
cp src/resource/*.wav $@/uae/wave
|
cp src/resource/*.wav $@/uae/wave
|
||||||
cd $@ && tar -czf ../uae-wii-vx-bin.tar.gz *
|
cd $@ && tar -czf ../uae-wii-vx-bin.tar.gz *
|
||||||
|
|
||||||
|
BIN
images/kb_amiga.png
Normal file
BIN
images/kb_amiga.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@ -1,31 +1,36 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, Simon Kagstrom
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
|
* Copyright (C) 2014, Fabio Olimpieri
|
||||||
*
|
*
|
||||||
* Filename: VirtualKeyboard.c
|
* Filename: VirtualKeyboard.c
|
||||||
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>
|
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>, Fabio Olimpieri
|
||||||
* Description: A virtual keyboard
|
* Description: A virtual keyboard
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_ttf.h>
|
#include<SDL/SDL_image.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "VirtualKeyboard.h"
|
#include "VirtualKeyboard.h"
|
||||||
|
#include "writelog.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "gensound.h"
|
||||||
|
|
||||||
|
static SDL_Surface *image_kbd, *tmp_surface ;
|
||||||
|
static int vkb_is_init;
|
||||||
|
//static int key_code;
|
||||||
|
|
||||||
static struct virtkey* get_key_internal();
|
static VirtualKeyboard_struct VirtualKeyboard;
|
||||||
static void draw();
|
|
||||||
static void select_next(int dx, int dy);
|
|
||||||
|
|
||||||
static SDL_Surface *screen;
|
int kbd_is_active;
|
||||||
static TTF_Font *font;
|
|
||||||
static int sel_x;
|
|
||||||
static int sel_y;
|
|
||||||
|
|
||||||
static char buf[255];
|
|
||||||
|
|
||||||
|
|
||||||
#define K(name, sdl_code) \
|
#define K(name, sdl_code) \
|
||||||
@ -39,112 +44,148 @@ static char buf[255];
|
|||||||
#define NJ(name, joy_name) \
|
#define NJ(name, joy_name) \
|
||||||
{ name, joy_name, 0, 0 }
|
{ name, joy_name, 0, 0 }
|
||||||
|
|
||||||
#define KEY_COLS 14
|
#define KEY_COLS 21
|
||||||
#define KEY_ROWS 8
|
#define KEY_ROWS 7
|
||||||
|
|
||||||
static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
|
static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
|
||||||
N("Esc","ESC",27), KNL(), K("F1",282),K("F2",283),K("F3",284),K("F4",285),K("F5",286),K("F6",287),K("F7",288),K("F8",289),K("F9",290),K("F10",291), N("BS","BACKSPACE",8),N("Help", "HELP",277),
|
N("Esc","ESC",27), K("F1",282),K("F2",283),K("F3",284),K("F4",285),K("F5",286),K("F6",287),K("F7",288),K("F8",289),K("F9",290),K("F10",291), KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),
|
||||||
N("~`","BACKQUOTE",96),KNL(),K("1",49),K("2",50), K("3",51), K("4",52), K("5",53), K("6",54), K("7",55), K("8",56), K("9",57), K("0",48), N("-","SUB",45),N("=","EQUALS",61),
|
N("~`","BACKQUOTE",96),K("1",49),K("2",50), K("3",51), K("4",52), K("5",53), K("6",54), K("7",55), K("8",56), K("9",57), K("0",48), N("-","SUB",45),N("=","EQUALS",61), N("\\","KEY_BACKSLASH",92),N("BS","BACKSPACE",8),N("Del", "DELETE",127),N("Help", "HELP",277),K("LEFTPAREN",278), K("RIGHTPAREN",279),K("KP_DIVIDE",267),K("KP_MULTIPLY",268),
|
||||||
N("Tab", "TAB", 9), KNL(), K("Q",113), K("W",119), K("E",101), K("R",114), K("T",116), K("Y",121), K("U",117), K("I",105), K("O",111), K("P",112),N("[","LEFTBRACKET",91),N("]","RIGHTBRACKET",93),
|
N("Tab", "TAB", 9), K("Q",113), K("W",119), K("E",101), K("R",114), K("T",116), K("Y",121), K("U",117), K("I",105), K("O",111), K("P",112),N("[","LEFTBRACKET",91),N("]","RIGHTBRACKET",93),N("Ret","RETURN",13),KNL(), K("KP7",263), K("KP8",264), K("KP9",265), K("KP_MINUS",269),KNL(),KNL(),
|
||||||
N("Ctrl","CTRL",306),KNL(), K("A",97), K("S",115), K("D",100), K("F",102), K("G",103), K("H",104), K("J",106), K("K",107), K("L",108),N(":;","SEMICOLON",59),N("'","SINGLEQUOTE",96),N("Ret","RETURN",13),
|
N("Ctrl","CTRL",306),N("Capslock","CAPSLOCK",301), K("A",97), K("S",115), K("D",100), K("F",102), K("G",103), K("H",104), K("J",106), K("K",107), K("L",108),N(";","SEMICOLON",59),N("'","SINGLEQUOTE",96),N("Ret","RETURN",13),KNL(),N("Up","CURSOR_UP",273),KNL(),K("KP4",260), K("KP5",261), K("KP6",262),K("KP_PLUS",270),
|
||||||
N("Sft","SHIFT_LEFT",304),KNL(),K("Z",122),K("X",120),K("C",99), K("V",118), K("B",98), K("N",110), K("M",109),N("<,","COMMA",44),N(">.","PERIOD",46), N("/","SLASH",47),N("\\","KEY_BACKSLASH",92), N("Sft","SHIFT_RIGHT",303),
|
N("Sft","SHIFT_LEFT",304),K("Z",122),K("X",120),K("C",99), K("V",118), K("B",98), K("N",110), K("M",109),N(",","COMMA",44),N(".","PERIOD",46), N("/","SLASH",47), N("Sft","SHIFT_RIGHT",303), N("Lft","CURSOR_LEFT",276), N("Dwn","CURSOR_DOWN",274), N("Rgt", "CURSOR_RIGHT",275),K("KP1",257),K("KP2",258), K("KP3",259), N("Enter","KP_ENTERENTER",271),KNL(),KNL(),
|
||||||
N("Alt","ALT_LEFT",308),KNL(), N("Amg","AMIGA_LEFT",310),KNL(),N("space", "SPACE",32),KNL(),KNL(),KNL(),N("Up","CURSOR_UP",273),KNL(),KNL(),N("Amg","AMIGA_RIGHT",309),KNL(),N("Alt","ALT_RIGHT",307),
|
N("Alt","ALT_LEFT",308), N("Amg","AMIGA_LEFT",310),N("space", "SPACE",32),N("Amg","AMIGA_RIGHT",309),N("Alt","ALT_RIGHT",307),KNL(),K("KP0",256),N(".","KP_PERIOD",266),N("Enter","KP_ENTER",271),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),
|
||||||
D("None"), KNL(), KNL(), KNL(), KNL(), KNL(), N("Lft","CURSOR_LEFT",276),KNL(), N("Dwn","CURSOR_DOWN",274), KNL(), N("Rgt", "CURSOR_RIGHT",275),KNL(), N("Enter","ENTER",271),KNL(),
|
|
||||||
NJ("Fire","JOY_FIRE_BUTTON"),KNL(),KNL(),NJ("Joy 2nd button","JOY_2ND_BUTTON"),KNL(),KNL(),KNL(),KNL(),KNL(),NJ("Joy 3rd button","JOY_3RD_BUTTON"),KNL(),KNL(),KNL(),KNL()
|
NJ("Fire","JOY_FIRE_BUTTON"),NJ("Joy 2nd button","JOY_2ND_BUTTON"),NJ("Joy 3rd button","JOY_3RD_BUTTON"), NJ("Joy left","JOY_LEFT"),NJ("Joy right","JOY_RIGHT"),NJ("Joy up","JOY_UP"),NJ("Joy down","JOY_DOWN"),D("None"),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(),KNL(), KNL()};
|
||||||
};
|
|
||||||
|
static int rows_margins[KEY_ROWS+1] = {26, 49, 74, 98, 122, 145, 172, 198};
|
||||||
|
|
||||||
|
static int buttons_margins[KEY_ROWS][KEY_COLS+1] = {
|
||||||
|
{14,44,79,110,143,175,216,257,289,321,353,386},
|
||||||
|
{14,47,73,99,125,151,177,203,229,255,281,307,333,359,385,417,462,509,541,567,593,620},
|
||||||
|
{14,62,88,114,140,166,192,218,244,270,296,322,348,374,412,515,541,567,593,620},
|
||||||
|
{14,42,67,93,119,145,171,197,223,249,275,301,327,353,412,449,476,515,541,567,593,620},
|
||||||
|
{14,80,106,132,158,184,210,236,262,288,314,340,417,449,476,515,541,567,593,620 },
|
||||||
|
{28,63,95,329,361,396,515,567,593,620},
|
||||||
|
{14,80,146,212,278,344,411,476,543}};
|
||||||
|
|
||||||
|
|
||||||
void draw()
|
|
||||||
|
void VirtualKeyboard_init(SDL_Surface *screen)
|
||||||
{
|
{
|
||||||
int screen_w = screen->w;
|
VirtualKeyboard.screen = screen;
|
||||||
int screen_h = screen->h;
|
VirtualKeyboard.x = 3; //Where to print the keyboard
|
||||||
int key_w = 36;
|
VirtualKeyboard.y = 100;
|
||||||
int key_h = 36;
|
vkb_is_init = -1;
|
||||||
int border_x = (screen_w - (key_w * KEY_COLS)) / 2;
|
|
||||||
int border_y = (screen_h - (key_h * KEY_ROWS)) / 2;
|
|
||||||
int y;
|
|
||||||
int x;
|
|
||||||
|
|
||||||
SDL_Rect bg_rect = {border_x, border_y,
|
char kbd_image[255];
|
||||||
key_w * KEY_COLS, key_h * KEY_ROWS};
|
|
||||||
|
|
||||||
SDL_FillRect(screen, &bg_rect,
|
strcpy (kbd_image, "");
|
||||||
SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
|
|
||||||
|
|
||||||
for (y = 0; y < KEY_ROWS; y++ )
|
#ifdef OPTIONS_IN_HOME
|
||||||
|
char *home;
|
||||||
|
home = getenv ("HOME");
|
||||||
|
if (home != NULL && strlen (home) < 240)
|
||||||
{
|
{
|
||||||
for (x = 0; x < KEY_COLS; x++ )
|
strcpy (kbd_image, home);
|
||||||
{
|
strcat (kbd_image, "/");
|
||||||
int which = y * KEY_COLS + x;
|
|
||||||
virtkey_t key = keys[which];
|
|
||||||
int r = 64, g = 64, b = 64;
|
|
||||||
const char *what = key.name;
|
|
||||||
|
|
||||||
/* Skip empty positions */
|
|
||||||
if (key.name == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( key.is_done )
|
|
||||||
r = 255;
|
|
||||||
if ( (x == sel_x && y == sel_y))
|
|
||||||
g = 200;
|
|
||||||
|
|
||||||
menu_print_font(screen, r, g, b,
|
|
||||||
x * key_w + border_x, y * key_h + border_y,
|
|
||||||
what, 20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
strcat (kbd_image, KBDIMAGE);
|
||||||
|
|
||||||
|
tmp_surface=IMG_Load(kbd_image);
|
||||||
|
|
||||||
|
if (tmp_surface == NULL) {write_log("Impossible to load keyboard image\n"); return;}
|
||||||
|
image_kbd=SDL_DisplayFormat(tmp_surface);
|
||||||
|
SDL_FreeSurface (tmp_surface);
|
||||||
|
|
||||||
|
memset(VirtualKeyboard.buf, 0, sizeof(VirtualKeyboard.buf));
|
||||||
|
vkb_is_init = 1;
|
||||||
|
kbd_is_active=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void select_next(int dx, int dy)
|
|
||||||
|
void draw_vk()
|
||||||
{
|
{
|
||||||
int next_x = (sel_x + dx) % KEY_COLS;
|
SDL_Rect dst_rect = {VirtualKeyboard.x, VirtualKeyboard.y, 0, 0};
|
||||||
int next_y = (sel_y + dy) % KEY_ROWS;
|
SDL_BlitSurface(image_kbd, NULL, VirtualKeyboard.screen, &dst_rect);
|
||||||
virtkey_t key;
|
|
||||||
|
|
||||||
if (next_x < 0)
|
|
||||||
next_x = KEY_COLS + next_x;
|
|
||||||
if (next_y < 0)
|
|
||||||
next_y = KEY_ROWS + next_y;
|
|
||||||
sel_x = next_x;
|
|
||||||
sel_y = next_y;
|
|
||||||
|
|
||||||
key = keys[ next_y * KEY_COLS + next_x ];
|
|
||||||
|
|
||||||
/* Skip the empty spots */
|
|
||||||
if (key.name == NULL)
|
|
||||||
{
|
|
||||||
if (dy != 0) /* Look left */
|
|
||||||
select_next(-1, 0);
|
|
||||||
else
|
|
||||||
select_next(dx, dy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void flip_VKB()
|
||||||
|
{
|
||||||
|
SDL_Flip(VirtualKeyboard.screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_index(int x, int y)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
int row, col;
|
||||||
|
|
||||||
|
row=col=0;
|
||||||
|
|
||||||
|
if ((x<0)||(x> 620)) return -1;
|
||||||
|
if ((y<0)||(y> 198)) return -1;
|
||||||
|
|
||||||
|
for (row=0; (rows_margins[row]<y)&&(row<KEY_ROWS+1); row++);
|
||||||
|
|
||||||
|
if (row==0) return -1; //not valid
|
||||||
|
if (rows_margins[row]<y) return -1; //not valid
|
||||||
|
|
||||||
|
row--;
|
||||||
|
|
||||||
|
for (col=0; (buttons_margins[row][col]<x)&&(row<KEY_COLS+1); col++);
|
||||||
|
|
||||||
|
if (col==0) return -1; //not valid
|
||||||
|
if (buttons_margins[row][col]<x) return -1; //not valid
|
||||||
|
|
||||||
|
col--;
|
||||||
|
|
||||||
|
return ((col) + (row) *KEY_COLS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct virtkey *get_key_internal()
|
struct virtkey *get_key_internal()
|
||||||
{
|
{
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
uint32_t k;
|
uint32_t k;
|
||||||
|
int x,y,xm, ym, i=0;
|
||||||
|
int border_x = VirtualKeyboard.x;
|
||||||
|
int border_y = VirtualKeyboard.y;
|
||||||
|
|
||||||
draw();
|
draw_vk();
|
||||||
SDL_Flip(screen);
|
|
||||||
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
|
||||||
|
flip_VKB();
|
||||||
|
|
||||||
k = menu_wait_key_press();
|
k = menu_wait_key_press();
|
||||||
|
|
||||||
if (k & KEY_UP)
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
select_next(0, -1);
|
|
||||||
else if (k & KEY_DOWN)
|
if (k & KEY_ESCAPE) return NULL;
|
||||||
select_next(0, 1);
|
|
||||||
else if (k & KEY_LEFT)
|
|
||||||
select_next(-1, 0);
|
|
||||||
else if (k & KEY_RIGHT)
|
|
||||||
select_next(1, 0);
|
|
||||||
else if (k & KEY_ESCAPE)
|
|
||||||
return NULL;
|
|
||||||
else if (k & KEY_SELECT)
|
else if (k & KEY_SELECT)
|
||||||
{
|
{
|
||||||
virtkey_t *key = &keys[ sel_y * KEY_COLS + sel_x ];
|
|
||||||
|
SDL_GetMouseState(&xm, &ym);
|
||||||
|
x = (xm-border_x);
|
||||||
|
y = (ym-border_y);
|
||||||
|
|
||||||
|
i = get_index(x,y);
|
||||||
|
|
||||||
|
if (i==-1) continue;
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
WPAD_Rumble(0, 1);
|
||||||
|
SDL_Delay(90);
|
||||||
|
WPAD_Rumble(0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
virtkey_t *key = &keys[i];
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@ -153,25 +194,24 @@ struct virtkey *get_key_internal()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct virtkey* virtkbd_get_key(void)
|
|
||||||
|
struct virtkey* virtkbd_get_key()
|
||||||
{
|
{
|
||||||
virtkey_t *key;
|
virtkey_t *key;
|
||||||
SDL_Rect rect = {56, 80, FULL_DISPLAY_X-104, FULL_DISPLAY_Y-176};
|
|
||||||
|
|
||||||
SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
|
if (vkb_is_init != 1) return NULL;
|
||||||
|
|
||||||
|
pause_sound();
|
||||||
|
|
||||||
|
kbd_is_active=1;
|
||||||
|
|
||||||
key = get_key_internal();
|
key = get_key_internal();
|
||||||
|
|
||||||
|
kbd_is_active=0;
|
||||||
|
|
||||||
|
resume_sound();
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void virtkbd_init(SDL_Surface *surf, TTF_Font *fnt)
|
|
||||||
{
|
|
||||||
sel_x = 0;
|
|
||||||
sel_y = 0;
|
|
||||||
screen = surf;
|
|
||||||
font = fnt;
|
|
||||||
memset(buf, 0, sizeof(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, Simon Kagstrom
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
|
* Copyright (C) 2014, Fabio Olimpieri
|
||||||
*
|
*
|
||||||
* Filename: VirtualKeyboard.c
|
* Filename: VirtualKeyboard.c
|
||||||
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>
|
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>, Fabio Olimpieri
|
||||||
* Description: A virtual keyboard
|
* Description: A virtual keyboard
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@ -20,5 +21,16 @@ typedef struct virtkey
|
|||||||
int is_done;
|
int is_done;
|
||||||
} virtkey_t;
|
} virtkey_t;
|
||||||
|
|
||||||
extern void virtkbd_init(SDL_Surface *surf, TTF_Font *fnt);
|
typedef struct Virtual_Keyboard
|
||||||
|
{
|
||||||
|
SDL_Surface *screen;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
char buf[255];
|
||||||
|
|
||||||
|
} VirtualKeyboard_struct;
|
||||||
|
|
||||||
|
extern void VirtualKeyboard_init(SDL_Surface *surf);
|
||||||
extern struct virtkey *virtkbd_get_key(void);
|
extern struct virtkey *virtkbd_get_key(void);
|
||||||
|
extern void flip_VKB();
|
||||||
|
extern int kbd_is_active;
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* UAE - The Un*x Amiga Emulator
|
* UAE - The Un*x Amiga Emulator
|
||||||
*
|
*
|
||||||
* Interface to the Tcl/Tk GUI
|
* WII Interface
|
||||||
*
|
*
|
||||||
* Copyright 1996 Bernd Schmidt
|
* Copyright 2014 Fabio Olimpieri
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -865,7 +865,6 @@ msgInfo("File deleted",3000,NULL);
|
|||||||
static int get_dfxclick(void)
|
static int get_dfxclick(void)
|
||||||
{
|
{
|
||||||
int sounddf_on = 0;
|
int sounddf_on = 0;
|
||||||
int i;
|
|
||||||
|
|
||||||
sounddf_on = (changed_prefs.dfxclick[0]!=0)||(changed_prefs.dfxclick[1]!=0)||
|
sounddf_on = (changed_prefs.dfxclick[0]!=0)||(changed_prefs.dfxclick[1]!=0)||
|
||||||
(changed_prefs.dfxclick[2]!=0)||(changed_prefs.dfxclick[3]!=0);
|
(changed_prefs.dfxclick[2]!=0)||(changed_prefs.dfxclick[3]!=0);
|
||||||
@ -1096,7 +1095,6 @@ static void input_options(int joy)
|
|||||||
const char *key;
|
const char *key;
|
||||||
int submenus[5];
|
int submenus[5];
|
||||||
int opt;
|
int opt;
|
||||||
int i;
|
|
||||||
struct virtkey *virtualkey;
|
struct virtkey *virtualkey;
|
||||||
|
|
||||||
memset(submenus, 0, sizeof(submenus));
|
memset(submenus, 0, sizeof(submenus));
|
||||||
@ -1160,6 +1158,19 @@ static void input_options(int joy)
|
|||||||
if (!strcmp(key,"JOY_3RD_BUTTON"))
|
if (!strcmp(key,"JOY_3RD_BUTTON"))
|
||||||
key= joy ? "JOY1_3RD_BUTTON": "JOY2_3RD_BUTTON";
|
key= joy ? "JOY1_3RD_BUTTON": "JOY2_3RD_BUTTON";
|
||||||
|
|
||||||
|
if (!strcmp(key,"JOY_LEFT"))
|
||||||
|
key= joy ? "JOY1_LEFT": "JOY2_LEFT";
|
||||||
|
|
||||||
|
if (!strcmp(key,"JOY_RIGHT"))
|
||||||
|
key= joy ? "JOY1_RIGHT": "JOY2_RIGHT";
|
||||||
|
|
||||||
|
if (!strcmp(key,"JOY_UP"))
|
||||||
|
key= joy ? "JOY1_UP": "JOY2_UP";
|
||||||
|
|
||||||
|
if (!strcmp(key,"JOY_DOWN"))
|
||||||
|
key= joy ? "JOY1_DOWN": "JOY2_DOWN";
|
||||||
|
|
||||||
|
|
||||||
setup_joystick(joy, key, sdl_key);
|
setup_joystick(joy, key, sdl_key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ int fh, fw;
|
|||||||
int msgInfo(char *text, int duration, SDL_Rect *irc)
|
int msgInfo(char *text, int duration, SDL_Rect *irc)
|
||||||
{
|
{
|
||||||
int len = strlen(text);
|
int len = strlen(text);
|
||||||
int X, Y, wX, wY;
|
int X, Y;
|
||||||
SDL_Rect src;
|
SDL_Rect src;
|
||||||
SDL_Rect rc;
|
SDL_Rect rc;
|
||||||
SDL_Rect brc;
|
SDL_Rect brc;
|
||||||
@ -137,7 +137,7 @@ void msgKill(SDL_Rect *rc)
|
|||||||
int msgYesNo(char *text, int default_opt, int x, int y)
|
int msgYesNo(char *text, int default_opt, int x, int y)
|
||||||
{
|
{
|
||||||
int len = strlen(text);
|
int len = strlen(text);
|
||||||
int X, Y, wX, wY;
|
int X, Y;
|
||||||
SDL_Rect src;
|
SDL_Rect src;
|
||||||
SDL_Rect rc;
|
SDL_Rect rc;
|
||||||
SDL_Rect brc;
|
SDL_Rect brc;
|
||||||
@ -426,7 +426,6 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_siz
|
|||||||
int entries_visible = (p_menu->y2 - p_menu->y1) / line_height - 1;
|
int entries_visible = (p_menu->y2 - p_menu->y1) / line_height - 1;
|
||||||
|
|
||||||
int i, y;
|
int i, y;
|
||||||
char pTemp[256];
|
|
||||||
|
|
||||||
if ( p_menu->n_entries * line_height > p_menu->y2 )
|
if ( p_menu->n_entries * line_height > p_menu->y2 )
|
||||||
y_start = p_menu->y1 + line_height;
|
y_start = p_menu->y1 + line_height;
|
||||||
@ -565,7 +564,6 @@ static int get_next_seq_y(menu_t *p_menu, int v, int dy, int cicle)
|
|||||||
static void select_next(menu_t *p_menu, int dx, int dy, int cicle)
|
static void select_next(menu_t *p_menu, int dx, int dy, int cicle)
|
||||||
{
|
{
|
||||||
int next;
|
int next;
|
||||||
char buffer[256];
|
|
||||||
|
|
||||||
p_menu->cur_sel = get_next_seq_y(p_menu, p_menu->cur_sel, dy, cicle);
|
p_menu->cur_sel = get_next_seq_y(p_menu, p_menu->cur_sel, dy, cicle);
|
||||||
next = get_next_seq_y(p_menu, p_menu->cur_sel, dy + 1, cicle);
|
next = get_next_seq_y(p_menu, p_menu->cur_sel, dy + 1, cicle);
|
||||||
@ -612,7 +610,6 @@ static void menu_init_internal(menu_t *p_menu, const char *title,
|
|||||||
int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
int16_t x1, int16_t y1, int16_t x2, int16_t y2)
|
||||||
{
|
{
|
||||||
int submenu;
|
int submenu;
|
||||||
int i;
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
memset(p_menu, 0, sizeof(menu_t));
|
memset(p_menu, 0, sizeof(menu_t));
|
||||||
@ -704,7 +701,6 @@ uint32_t menu_wait_key_press(void)
|
|||||||
hats = SDL_JoystickNumHats (joy);
|
hats = SDL_JoystickNumHats (joy);
|
||||||
for (i = 0; i < hats; i++) {
|
for (i = 0; i < hats; i++) {
|
||||||
Uint8 v = SDL_JoystickGetHat (joy, i);
|
Uint8 v = SDL_JoystickGetHat (joy, i);
|
||||||
int x = 0, y = 0;
|
|
||||||
|
|
||||||
if (v & SDL_HAT_UP)
|
if (v & SDL_HAT_UP)
|
||||||
keys |= KEY_UP;
|
keys |= KEY_UP;
|
||||||
@ -796,7 +792,7 @@ uint32_t menu_wait_key_press(void)
|
|||||||
|
|
||||||
if (keys != 0)
|
if (keys != 0)
|
||||||
break;
|
break;
|
||||||
SDL_Delay(100);
|
SDL_Delay(20);
|
||||||
}
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
@ -1050,7 +1046,7 @@ void menu_init(SDL_Surface *screen)
|
|||||||
menu_font_alt16 = read_font(FONT_ALT_PATH,16);
|
menu_font_alt16 = read_font(FONT_ALT_PATH,16);
|
||||||
|
|
||||||
real_screen = screen;
|
real_screen = screen;
|
||||||
virtkbd_init(screen, menu_font_alt16);
|
VirtualKeyboard_init(screen);
|
||||||
is_inited = 1;
|
is_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#define SMBFILENAME "/uae/uaerc.smb"
|
#define SMBFILENAME "/uae/uaerc.smb"
|
||||||
#define USERFILENAME "/uae/uaerc.user"
|
#define USERFILENAME "/uae/uaerc.user"
|
||||||
#define SAVEDFILENAME "/uae/uaerc.saved"
|
#define SAVEDFILENAME "/uae/uaerc.saved"
|
||||||
|
#define KBDIMAGE "/apps/uae/images/kb_amiga.png"
|
||||||
|
|
||||||
#define DEFPRTNAME "lpr"
|
#define DEFPRTNAME "lpr"
|
||||||
#define DEFSERNAME "/dev/ttyS1"
|
#define DEFSERNAME "/dev/ttyS1"
|
||||||
|
Loading…
Reference in New Issue
Block a user