mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Added virtual Keyboard, Added joystick buttons binding
This commit is contained in:
parent
93249b29bf
commit
cd1ccf8cda
184
src/VirtualKeyboard.c
Normal file
184
src/VirtualKeyboard.c
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
|
*
|
||||||
|
* Filename: VirtualKeyboard.c
|
||||||
|
*
|
||||||
|
* Description: A virtual keyboard
|
||||||
|
*
|
||||||
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
********************************************************************/
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "z80free/Z80free.h"
|
||||||
|
#include "computer.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
|
#include "menu_sdl.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define K(name, sdl_code) \
|
||||||
|
{ name, "SDLK_"name, sdl_code, 0 ,0,0}
|
||||||
|
#define N(name, key_name, sdl_code) \
|
||||||
|
{ name, "SDLK_"key_name, sdl_code, 0,0,0 }
|
||||||
|
#define KNL() \
|
||||||
|
{ NULL, NULL, 0, 0 ,0,0}
|
||||||
|
|
||||||
|
|
||||||
|
#define KEY_COLS 10
|
||||||
|
#define KEY_ROWS 5
|
||||||
|
|
||||||
|
extern struct computer ordenador;
|
||||||
|
|
||||||
|
//TO DO Key_name and name are not necessary
|
||||||
|
static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
|
||||||
|
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),
|
||||||
|
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),
|
||||||
|
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("Enter","RETURN",13),
|
||||||
|
N("Caps","LSHIFT",304),K("Z",122),K("X",120),K("C",99), K("V",118), K("B",98), K("N",110), K("M",109), N("Sym","LCTRL",306),N("Space","SPACE",32),
|
||||||
|
N("Ext","TAB",9), KNL(), N("Fire","LALT",308),KNL(), K("None",0),KNL(),KNL(), KNL(),KNL(),KNL()};
|
||||||
|
|
||||||
|
void VirtualKeyboard_init(SDL_Surface *screen, TTF_Font *font)
|
||||||
|
{
|
||||||
|
VirtualKeyboard.screen = screen;
|
||||||
|
VirtualKeyboard.font = font;
|
||||||
|
VirtualKeyboard.sel_x = 0;
|
||||||
|
VirtualKeyboard.sel_y = 0;
|
||||||
|
|
||||||
|
memset(VirtualKeyboard.buf, 0, sizeof(VirtualKeyboard.buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
int y,x;
|
||||||
|
int screen_w = VirtualKeyboard.screen->w;
|
||||||
|
int screen_h = VirtualKeyboard.screen->h;
|
||||||
|
int key_w = 54;
|
||||||
|
int key_h = 36;
|
||||||
|
int border_x = (screen_w - (key_w * KEY_COLS)) / 2;
|
||||||
|
int border_y = (screen_h - (key_h * KEY_ROWS)) / 2;
|
||||||
|
SDL_Rect bg_rect = {border_x, border_y,
|
||||||
|
key_w * KEY_COLS, key_h * KEY_ROWS};
|
||||||
|
|
||||||
|
SDL_FillRect(VirtualKeyboard.screen, &bg_rect,
|
||||||
|
SDL_MapRGB(ordenador.screen->format, 0xff, 0xff, 0xff));
|
||||||
|
|
||||||
|
for (y = 0; y < KEY_ROWS; y++ )
|
||||||
|
{
|
||||||
|
for (x = 0; x < KEY_COLS; x++ )
|
||||||
|
{
|
||||||
|
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 == VirtualKeyboard.sel_x && y == VirtualKeyboard.sel_y))
|
||||||
|
g = 200;
|
||||||
|
|
||||||
|
menu_print_font(VirtualKeyboard.screen, r, g, b,
|
||||||
|
x * key_w + border_x, y * key_h + border_y,
|
||||||
|
what, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void select_next_kb(int dx, int dy)
|
||||||
|
{
|
||||||
|
int next_x = (VirtualKeyboard.sel_x + dx) % KEY_COLS;
|
||||||
|
int next_y = (VirtualKeyboard.sel_y + dy) % KEY_ROWS;
|
||||||
|
virtkey_t key;
|
||||||
|
|
||||||
|
if (next_x < 0)
|
||||||
|
next_x = KEY_COLS + next_x;
|
||||||
|
if (next_y < 0)
|
||||||
|
next_y = KEY_ROWS + next_y;
|
||||||
|
VirtualKeyboard.sel_x = next_x;
|
||||||
|
VirtualKeyboard.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_kb(-1, 0);
|
||||||
|
else
|
||||||
|
select_next_kb(dx, dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct virtkey *get_key_internal()
|
||||||
|
{
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
uint32_t k;
|
||||||
|
|
||||||
|
draw();
|
||||||
|
SDL_Flip(VirtualKeyboard.screen);
|
||||||
|
|
||||||
|
k = menu_wait_key_press();
|
||||||
|
|
||||||
|
if (k & KEY_UP)
|
||||||
|
select_next_kb(0, -1);
|
||||||
|
else if (k & KEY_DOWN)
|
||||||
|
select_next_kb(0, 1);
|
||||||
|
else if (k & KEY_LEFT)
|
||||||
|
select_next_kb(-1, 0);
|
||||||
|
else if (k & KEY_RIGHT)
|
||||||
|
select_next_kb(1, 0);
|
||||||
|
else if (k & KEY_ESCAPE)
|
||||||
|
return NULL;
|
||||||
|
else if (k & KEY_SELECT)
|
||||||
|
{
|
||||||
|
virtkey_t *key = &keys[ VirtualKeyboard.sel_y * KEY_COLS + VirtualKeyboard.sel_x ];
|
||||||
|
|
||||||
|
if ((key->sdl_code == 304) && !keys[3 * KEY_COLS + 8 ].is_done)
|
||||||
|
keys[3 * KEY_COLS + 0 ].is_done = !keys[3 * KEY_COLS + 0 ].is_done; //Caps Shit
|
||||||
|
else if ((key->sdl_code == 306) && !keys[3 * KEY_COLS + 0 ].is_done)
|
||||||
|
keys[3 * KEY_COLS + 8 ].is_done = !keys[3 * KEY_COLS + 8 ].is_done; //Sym Shift
|
||||||
|
else {
|
||||||
|
key->caps_on = keys[3 * KEY_COLS + 0 ].is_done;
|
||||||
|
key->sym_on = keys[3 * KEY_COLS + 8 ].is_done;
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct virtkey* get_key()
|
||||||
|
{
|
||||||
|
virtkey_t *key;
|
||||||
|
SDL_Rect rect = {32, 32, FULL_DISPLAY_X-64, FULL_DISPLAY_Y-96};
|
||||||
|
|
||||||
|
keys[3 * KEY_COLS + 0 ].is_done = 0; //Caps Shit
|
||||||
|
keys[3 * KEY_COLS + 8 ].is_done = 0; //Sym Shift
|
||||||
|
|
||||||
|
SDL_FillRect(VirtualKeyboard.screen, &rect, SDL_MapRGB(ordenador.screen->format, 0xff, 0xff, 0xff));
|
||||||
|
|
||||||
|
key = get_key_internal();
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
56
src/VirtualKeyboard.h
Normal file
56
src/VirtualKeyboard.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
|
*
|
||||||
|
* Filename: VirtualKeyboard.h
|
||||||
|
*
|
||||||
|
* Description: A virtual keyboard
|
||||||
|
*
|
||||||
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
********************************************************************/
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_ttf.h>
|
||||||
|
|
||||||
|
typedef struct virtkey
|
||||||
|
{
|
||||||
|
const char *name; //It is not necessary in FBZX Wii
|
||||||
|
const char *ev_name; //It is not necessary in FBZX Wii
|
||||||
|
int sdl_code;
|
||||||
|
int is_done;
|
||||||
|
int caps_on;
|
||||||
|
int sym_on;
|
||||||
|
} virtkey_t;
|
||||||
|
|
||||||
|
|
||||||
|
struct Virtual_Keyboard
|
||||||
|
{
|
||||||
|
SDL_Surface *screen;
|
||||||
|
TTF_Font *font;
|
||||||
|
int sel_x;
|
||||||
|
int sel_y;
|
||||||
|
char buf[255];
|
||||||
|
|
||||||
|
} VirtualKeyboard;
|
||||||
|
|
||||||
|
void VirtualKeyboard_init(SDL_Surface *screen, TTF_Font *font);
|
||||||
|
struct virtkey* get_key();
|
||||||
|
struct virtkey* get_key_internal();
|
||||||
|
void draw();
|
||||||
|
void select_next_kb(int dx, int dy);
|
||||||
|
void toggle_shift();
|
||||||
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
306
src/computer.c
306
src/computer.c
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
@ -30,6 +31,8 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include "tape.h"
|
#include "tape.h"
|
||||||
#include "microdrive.h"
|
#include "microdrive.h"
|
||||||
|
#include "Virtualkeyboard.h"
|
||||||
|
#include "gui_sdl.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
extern FILE *fdebug;
|
extern FILE *fdebug;
|
||||||
@ -128,6 +131,9 @@ void computer_init () {
|
|||||||
ordenador.tape_loop_counter = 0;
|
ordenador.tape_loop_counter = 0;
|
||||||
ordenador.kbd_buffer_pointer = 0;
|
ordenador.kbd_buffer_pointer = 0;
|
||||||
ordenador.key = SDL_GetKeyState(NULL);
|
ordenador.key = SDL_GetKeyState(NULL);
|
||||||
|
ordenador.joybuttonkey[0][0]=SDLK_LALT; //Fire button to wiimote1 button A
|
||||||
|
ordenador.joybuttonkey[1][0]=SDLK_LALT; //Fire button to wiimote1 button A
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void computer_set_palete() {
|
void computer_set_palete() {
|
||||||
@ -701,7 +707,8 @@ inline void read_keyboard () {
|
|||||||
SDL_Event evento,*pevento;
|
SDL_Event evento,*pevento;
|
||||||
enum joystate_x {JOY_CENTER_X, JOY_LEFT, JOY_RIGHT};
|
enum joystate_x {JOY_CENTER_X, JOY_LEFT, JOY_RIGHT};
|
||||||
enum joystate_y {JOY_CENTER_Y, JOY_UP, JOY_DOWN};
|
enum joystate_y {JOY_CENTER_Y, JOY_UP, JOY_DOWN};
|
||||||
int joy_axis_x[2],joy_axis_y[2], loop;
|
int joy_axis_x[2],joy_axis_y[2], joy_n, joybutton_n;
|
||||||
|
static unsigned char joybutton_matrix[2][322];
|
||||||
|
|
||||||
ordenador.k8 = ordenador.k9 = ordenador.k10 = ordenador.k11 =
|
ordenador.k8 = ordenador.k9 = ordenador.k10 = ordenador.k11 =
|
||||||
ordenador.k12 = ordenador.k13 = ordenador.k14 =
|
ordenador.k12 = ordenador.k13 = ordenador.k14 =
|
||||||
@ -716,118 +723,66 @@ inline void read_keyboard () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ordenador.kbd_buffer_pointer)
|
|
||||||
{
|
|
||||||
if (countdown)
|
|
||||||
countdown--;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (ordenador.kbd_buffer_pointer)
|
|
||||||
{
|
|
||||||
case 6: //Edit
|
|
||||||
ordenador.k8|=1;
|
|
||||||
ordenador.k11|=1;
|
|
||||||
break;
|
|
||||||
case 5: //Load
|
|
||||||
ordenador.k14|= 8;
|
|
||||||
break;
|
|
||||||
case 4: //"
|
|
||||||
ordenador.k15|= 2;
|
|
||||||
ordenador.k13|= 1;
|
|
||||||
break;
|
|
||||||
case 3: //"
|
|
||||||
ordenador.k15|= 2;
|
|
||||||
ordenador.k13|= 1;
|
|
||||||
break;
|
|
||||||
case 2: // Return
|
|
||||||
ordenador.k14|= 1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if ((ordenador.tape_fast_load == 0) || (ordenador.tape_file_type==TAP_TZX))
|
|
||||||
ordenador.pause = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ordenador.kbd_buffer_pointer--;
|
|
||||||
countdown=5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_JoystickUpdate();
|
SDL_JoystickUpdate();
|
||||||
for(loop=0;loop<ordenador.joystick_number;loop++)
|
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||||
{
|
{
|
||||||
joy_axis_x[loop] = SDL_JoystickGetAxis(ordenador.joystick_sdl[loop], 0);
|
joy_axis_x[joy_n] = SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 0);
|
||||||
joy_axis_y[loop] = SDL_JoystickGetAxis(ordenador.joystick_sdl[loop], 1);
|
joy_axis_y[joy_n] = SDL_JoystickGetAxis(ordenador.joystick_sdl[joy_n], 1);
|
||||||
ordenador.joy_fire[loop] = SDL_JoystickGetButton(ordenador.joystick_sdl[loop], 0); //Wii button A
|
//ordenador.joy_fire[joy_n] = SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 0); //Wii button "A"
|
||||||
|
|
||||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[loop], 6)) main_menu(); //Wii button Home
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 6) ||
|
||||||
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 19)) main_menu(); //Wii button "Home"
|
||||||
|
|
||||||
if (joy_axis_x[loop] > 16384) ordenador.joy_axis_x_state[loop] = JOY_RIGHT;
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 5) ||
|
||||||
else if (joy_axis_x[loop] < -16384) ordenador.joy_axis_x_state[loop] = JOY_LEFT;
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], 18)) virtual_keyboard(); //Wii button "+"
|
||||||
else ordenador.joy_axis_x_state[loop] = JOY_CENTER_X;
|
|
||||||
|
|
||||||
if (joy_axis_y[loop] > 16384) ordenador.joy_axis_y_state[loop] = JOY_DOWN;
|
if (joy_axis_x[joy_n] > 16384) ordenador.joy_axis_x_state[joy_n] = JOY_RIGHT;
|
||||||
else if (joy_axis_y[loop] < -16384) ordenador.joy_axis_y_state[loop] = JOY_UP;
|
else if (joy_axis_x[joy_n] < -16384) ordenador.joy_axis_x_state[joy_n] = JOY_LEFT;
|
||||||
else ordenador.joy_axis_y_state[loop] = JOY_CENTER_Y;
|
else ordenador.joy_axis_x_state[joy_n] = JOY_CENTER_X;
|
||||||
|
|
||||||
|
if (joy_axis_y[joy_n] > 16384) ordenador.joy_axis_y_state[joy_n] = JOY_DOWN;
|
||||||
|
else if (joy_axis_y[joy_n] < -16384) ordenador.joy_axis_y_state[joy_n] = JOY_UP;
|
||||||
|
else ordenador.joy_axis_y_state[joy_n] = JOY_CENTER_Y;
|
||||||
|
|
||||||
|
for(joybutton_n=0;joybutton_n<5;joybutton_n++)
|
||||||
|
{
|
||||||
|
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
||||||
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(joybutton_n=7;joybutton_n<18;joybutton_n++)
|
||||||
|
{
|
||||||
|
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
||||||
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Keyboard buffer
|
||||||
|
|
||||||
|
if (countdown)
|
||||||
|
{
|
||||||
|
if (countdown <5)
|
||||||
|
{
|
||||||
|
ordenador.key[(ordenador.keyboard_buffer[0][ordenador.kbd_buffer_pointer+1])]=0;
|
||||||
|
ordenador.key[(ordenador.keyboard_buffer[1][ordenador.kbd_buffer_pointer+1])]=0;
|
||||||
|
ordenador.keyboard_buffer[0][ordenador.kbd_buffer_pointer+1] = 0;
|
||||||
|
ordenador.keyboard_buffer[1][ordenador.kbd_buffer_pointer+1] = 0;
|
||||||
|
}
|
||||||
|
countdown--;
|
||||||
|
}
|
||||||
|
else if (ordenador.kbd_buffer_pointer)
|
||||||
|
{
|
||||||
|
ordenador.key[(ordenador.keyboard_buffer[0][ordenador.kbd_buffer_pointer])]=1;
|
||||||
|
ordenador.key[(ordenador.keyboard_buffer[1][ordenador.kbd_buffer_pointer])]=1;
|
||||||
|
|
||||||
|
ordenador.kbd_buffer_pointer--;
|
||||||
|
countdown=7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
temporal_io = (unsigned int) pevento->key.keysym.sym;
|
temporal_io = (unsigned int) pevento->key.keysym.sym;
|
||||||
|
|
||||||
/*
|
|
||||||
if ((pevento->type==SDL_KEYDOWN)&&(temporal_io==SDLK_TAB)) {
|
|
||||||
if (ordenador.tab_extended==0) {
|
|
||||||
ordenador.tab_extended=1;
|
|
||||||
strcpy(ordenador.osd_text,"Function Key mode on");
|
|
||||||
ordenador.osd_time=100;
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
ordenador.tab_extended=0;
|
|
||||||
ordenador.osd_time=0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((pevento->type==SDL_KEYDOWN)&&(ordenador.tab_extended==1)) {
|
|
||||||
ordenador.tab_extended=0;
|
|
||||||
ordenador.osd_time=0;
|
|
||||||
switch(temporal_io) {
|
|
||||||
case SDLK_1:
|
|
||||||
temporal_io=SDLK_F1;
|
|
||||||
break;
|
|
||||||
case SDLK_2:
|
|
||||||
temporal_io=SDLK_F2;
|
|
||||||
break;
|
|
||||||
case SDLK_3:
|
|
||||||
temporal_io=SDLK_F3;
|
|
||||||
break;
|
|
||||||
case SDLK_4:
|
|
||||||
temporal_io=SDLK_F4;
|
|
||||||
break;
|
|
||||||
case SDLK_5:
|
|
||||||
temporal_io=SDLK_F5;
|
|
||||||
break;
|
|
||||||
case SDLK_6:
|
|
||||||
temporal_io=SDLK_F6;
|
|
||||||
break;
|
|
||||||
case SDLK_7:
|
|
||||||
temporal_io=SDLK_F7;
|
|
||||||
break;
|
|
||||||
case SDLK_8:
|
|
||||||
temporal_io=SDLK_F8;
|
|
||||||
break;
|
|
||||||
case SDLK_9:
|
|
||||||
temporal_io=SDLK_F9;
|
|
||||||
break;
|
|
||||||
case SDLK_0:
|
|
||||||
temporal_io=SDLK_F10;
|
|
||||||
break;
|
|
||||||
case SDLK_o:
|
|
||||||
temporal_io=SDLK_F11;
|
|
||||||
break;
|
|
||||||
case SDLK_p:
|
|
||||||
temporal_io=SDLK_F12;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (pevento->type == SDL_KEYDOWN)
|
if (pevento->type == SDL_KEYDOWN)
|
||||||
switch (temporal_io) {
|
switch (temporal_io) {
|
||||||
case SDLK_ESCAPE: // to exit from the emulator
|
case SDLK_ESCAPE: // to exit from the emulator
|
||||||
@ -863,9 +818,20 @@ inline void read_keyboard () {
|
|||||||
|
|
||||||
case SDLK_F9:
|
case SDLK_F9:
|
||||||
//Emulate load ""
|
//Emulate load ""
|
||||||
|
ordenador.keyboard_buffer[0][6]= SDLK_1; //Edit
|
||||||
|
ordenador.keyboard_buffer[1][6]= SDLK_LSHIFT;
|
||||||
|
ordenador.keyboard_buffer[0][5]= SDLK_j; //Load
|
||||||
|
ordenador.keyboard_buffer[1][5]= 0;
|
||||||
|
ordenador.keyboard_buffer[0][4]= SDLK_p; //"
|
||||||
|
ordenador.keyboard_buffer[1][4]= SDLK_LCTRL;
|
||||||
|
ordenador.keyboard_buffer[0][3]= SDLK_p; //"
|
||||||
|
ordenador.keyboard_buffer[1][3]= SDLK_LCTRL;
|
||||||
|
ordenador.keyboard_buffer[0][2]= SDLK_RETURN; // Return
|
||||||
|
ordenador.keyboard_buffer[1][2]= 0;
|
||||||
|
ordenador.keyboard_buffer[0][1]= SDLK_F6; //F6
|
||||||
|
ordenador.keyboard_buffer[1][1]= 0;
|
||||||
ordenador.kbd_buffer_pointer=6;
|
ordenador.kbd_buffer_pointer=6;
|
||||||
countdown=5;
|
countdown=7;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_F10: // Reset emulator
|
case SDLK_F10: // Reset emulator
|
||||||
@ -909,93 +875,93 @@ inline void read_keyboard () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(loop=0;loop<ordenador.joystick_number;loop++)
|
for(joy_n=0;joy_n<ordenador.joystick_number;joy_n++)
|
||||||
{
|
{
|
||||||
switch (ordenador.joystick[loop]) {
|
switch (ordenador.joystick[joy_n]) {
|
||||||
case 0: // cursor
|
case 0: // cursor
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_UP) ordenador.k12|= 8;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_UP) ordenador.k12|= 8;
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_DOWN) ordenador.k12|= 16;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_DOWN) ordenador.k12|= 16;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_RIGHT)ordenador.k12|= 4;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)ordenador.k12|= 4;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_LEFT) ordenador.k11|= 16;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_LEFT) ordenador.k11|= 16;
|
||||||
if (ordenador.joy_fire[loop]) ordenador.k12|= 1;
|
if (joybutton_matrix[joy_n][SDLK_LALT]) ordenador.k12|= 1; //fire button
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: //Kempston
|
case 1: //Kempston
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_UP) ordenador.jk|= 8;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_UP) ordenador.jk|= 8;
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_DOWN) ordenador.jk|= 4;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_DOWN) ordenador.jk|= 4;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_RIGHT) ordenador.jk|= 1;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT) ordenador.jk|= 1;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_LEFT) ordenador.jk|= 2;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_LEFT) ordenador.jk|= 2;
|
||||||
if (ordenador.joy_fire[loop]) ordenador.jk |= 16;
|
if (joybutton_matrix[joy_n][SDLK_LALT]) ordenador.jk |= 16; //fire button
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // sinclair 1
|
case 2: // sinclair 1
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_UP) ordenador.k11|= 8;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_UP) ordenador.k11|= 8;
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_DOWN)ordenador.k11|= 4;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)ordenador.k11|= 4;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_RIGHT)ordenador.k11|= 2;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)ordenador.k11|= 2;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_LEFT) ordenador.k11|= 1;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_LEFT) ordenador.k11|= 1;
|
||||||
if (ordenador.joy_fire[loop]) ordenador.k11|= 16;
|
if (joybutton_matrix[joy_n][SDLK_LALT]) ordenador.k11|= 16; //fire button
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // sinclair 2
|
case 3: // sinclair 2
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_UP) ordenador.k12|= 2;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_UP) ordenador.k12|= 2;
|
||||||
if (ordenador.joy_axis_y_state[loop] == JOY_DOWN)ordenador.k12|= 4;
|
if (ordenador.joy_axis_y_state[joy_n] == JOY_DOWN)ordenador.k12|= 4;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_RIGHT)ordenador.k12|= 8;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_RIGHT)ordenador.k12|= 8;
|
||||||
if (ordenador.joy_axis_x_state[loop] == JOY_LEFT) ordenador.k12|= 16;
|
if (ordenador.joy_axis_x_state[joy_n] == JOY_LEFT) ordenador.k12|= 16;
|
||||||
if (ordenador.joy_fire[loop]) ordenador.k12|= 1;
|
if (joybutton_matrix[joy_n][SDLK_LALT]) ordenador.k12|= 1; //fire button
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ordenador.key[SDLK_SPACE]) ordenador.k15|=1;
|
if (ordenador.key[SDLK_SPACE]) ordenador.k15|=1;
|
||||||
if (ordenador.key[SDLK_RCTRL]||ordenador.key[SDLK_LCTRL]) ordenador.k15|=2; //Symbol shift
|
if (ordenador.key[SDLK_RCTRL]||ordenador.key[SDLK_LCTRL]) ordenador.k15|=2; //Symbol shift
|
||||||
if (ordenador.key[SDLK_m]) ordenador.k15|=4;
|
if ((ordenador.key[SDLK_m] || joybutton_matrix[0][SDLK_m] || joybutton_matrix[1][SDLK_m])) ordenador.k15|=4;
|
||||||
if (ordenador.key[SDLK_n]) ordenador.k15|=8;
|
if ((ordenador.key[SDLK_n] || joybutton_matrix[0][SDLK_n] || joybutton_matrix[1][SDLK_n])) ordenador.k15|=8;
|
||||||
if (ordenador.key[SDLK_b]) ordenador.k15|=16;
|
if ((ordenador.key[SDLK_b] || joybutton_matrix[0][SDLK_b] || joybutton_matrix[1][SDLK_b])) ordenador.k15|=16;
|
||||||
if (ordenador.key[SDLK_PERIOD]) ordenador.k15|=6;
|
if (ordenador.key[SDLK_PERIOD]) ordenador.k15|=6;
|
||||||
if (ordenador.key[SDLK_COMMA]) ordenador.k15|=10;
|
if (ordenador.key[SDLK_COMMA]) ordenador.k15|=10;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_RETURN]) ordenador.k14|=1;
|
if ((ordenador.key[SDLK_RETURN] || joybutton_matrix[0][SDLK_RETURN] || joybutton_matrix[1][SDLK_RETURN])) ordenador.k14|=1;
|
||||||
if (ordenador.key[SDLK_l]) ordenador.k14|=2;
|
if ((ordenador.key[SDLK_l] || joybutton_matrix[0][SDLK_l] || joybutton_matrix[1][SDLK_l])) ordenador.k14|=2;
|
||||||
if (ordenador.key[SDLK_k]) ordenador.k14|=4;
|
if ((ordenador.key[SDLK_k] || joybutton_matrix[0][SDLK_k] || joybutton_matrix[1][SDLK_k])) ordenador.k14|=4;
|
||||||
if (ordenador.key[SDLK_j]) ordenador.k14|=8;
|
if ((ordenador.key[SDLK_j] || joybutton_matrix[0][SDLK_j] || joybutton_matrix[1][SDLK_j])) ordenador.k14|=8;
|
||||||
if (ordenador.key[SDLK_h]) ordenador.k14|=16;
|
if ((ordenador.key[SDLK_h] || joybutton_matrix[0][SDLK_h] || joybutton_matrix[1][SDLK_h])) ordenador.k14|=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_p]) ordenador.k13|=1;
|
if ((ordenador.key[SDLK_p] || joybutton_matrix[0][SDLK_p] || joybutton_matrix[1][SDLK_p])) ordenador.k13|=1;
|
||||||
if (ordenador.key[SDLK_o]) ordenador.k13|=2;
|
if ((ordenador.key[SDLK_o] || joybutton_matrix[0][SDLK_o] || joybutton_matrix[1][SDLK_o])) ordenador.k13|=2;
|
||||||
if (ordenador.key[SDLK_i]) ordenador.k13|=4;
|
if ((ordenador.key[SDLK_i] || joybutton_matrix[0][SDLK_i] || joybutton_matrix[1][SDLK_i])) ordenador.k13|=4;
|
||||||
if (ordenador.key[SDLK_u]) ordenador.k13|=8;
|
if ((ordenador.key[SDLK_u] || joybutton_matrix[0][SDLK_u] || joybutton_matrix[1][SDLK_u])) ordenador.k13|=8;
|
||||||
if (ordenador.key[SDLK_y]) ordenador.k13|=16;
|
if ((ordenador.key[SDLK_y] || joybutton_matrix[0][SDLK_y] || joybutton_matrix[1][SDLK_y])) ordenador.k13|=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_0]) ordenador.k12|=1;
|
if ((ordenador.key[SDLK_0] || joybutton_matrix[0][SDLK_0] || joybutton_matrix[1][SDLK_0])) ordenador.k12|=1;
|
||||||
if (ordenador.key[SDLK_9]) ordenador.k12|=2;
|
if ((ordenador.key[SDLK_9] || joybutton_matrix[0][SDLK_9] || joybutton_matrix[1][SDLK_9])) ordenador.k12|=2;
|
||||||
if (ordenador.key[SDLK_8]) ordenador.k12|=4;
|
if ((ordenador.key[SDLK_8] || joybutton_matrix[0][SDLK_8] || joybutton_matrix[1][SDLK_8])) ordenador.k12|=4;
|
||||||
if (ordenador.key[SDLK_7]) ordenador.k12|=8;
|
if ((ordenador.key[SDLK_7] || joybutton_matrix[0][SDLK_7] || joybutton_matrix[1][SDLK_7])) ordenador.k12|=8;
|
||||||
if (ordenador.key[SDLK_6]) ordenador.k12|=16;
|
if ((ordenador.key[SDLK_6] || joybutton_matrix[0][SDLK_6] || joybutton_matrix[1][SDLK_6])) ordenador.k12|=16;
|
||||||
if (ordenador.key[SDLK_BACKSPACE]) {ordenador.k12|=1; ordenador.k8 |=1;}
|
if ((ordenador.key[SDLK_BACKSPACE] || joybutton_matrix[0][SDLK_BACKSPACE] || joybutton_matrix[1][SDLK_BACKSPACE])) {ordenador.k12|=1; ordenador.k8 |=1;}
|
||||||
|
|
||||||
if (ordenador.key[SDLK_1]) ordenador.k11|=1;
|
if ((ordenador.key[SDLK_1] || joybutton_matrix[0][SDLK_1] || joybutton_matrix[1][SDLK_1])) ordenador.k11|=1;
|
||||||
if (ordenador.key[SDLK_2]) ordenador.k11|=2;
|
if ((ordenador.key[SDLK_2] || joybutton_matrix[0][SDLK_2] || joybutton_matrix[1][SDLK_2])) ordenador.k11|=2;
|
||||||
if (ordenador.key[SDLK_3]) ordenador.k11|=4;
|
if ((ordenador.key[SDLK_3] || joybutton_matrix[0][SDLK_3] || joybutton_matrix[1][SDLK_3])) ordenador.k11|=4;
|
||||||
if (ordenador.key[SDLK_4]) ordenador.k11|=8;
|
if ((ordenador.key[SDLK_4] || joybutton_matrix[0][SDLK_4] || joybutton_matrix[1][SDLK_4])) ordenador.k11|=8;
|
||||||
if (ordenador.key[SDLK_5]) ordenador.k11|=16;
|
if ((ordenador.key[SDLK_5] || joybutton_matrix[0][SDLK_5] || joybutton_matrix[1][SDLK_5])) ordenador.k11|=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_q]) ordenador.k10|=1;
|
if ((ordenador.key[SDLK_q] || joybutton_matrix[0][SDLK_q] || joybutton_matrix[1][SDLK_q])) ordenador.k10|=1;
|
||||||
if (ordenador.key[SDLK_w]) ordenador.k10|=2;
|
if ((ordenador.key[SDLK_w] || joybutton_matrix[0][SDLK_w] || joybutton_matrix[1][SDLK_w])) ordenador.k10|=2;
|
||||||
if (ordenador.key[SDLK_e]) ordenador.k10|=4;
|
if ((ordenador.key[SDLK_e] || joybutton_matrix[0][SDLK_e] || joybutton_matrix[1][SDLK_e])) ordenador.k10|=4;
|
||||||
if (ordenador.key[SDLK_r]) ordenador.k10|=8;
|
if ((ordenador.key[SDLK_r] || joybutton_matrix[0][SDLK_r] || joybutton_matrix[1][SDLK_r])) ordenador.k10|=8;
|
||||||
if (ordenador.key[SDLK_t]) ordenador.k10|=16;
|
if ((ordenador.key[SDLK_t] || joybutton_matrix[0][SDLK_t] || joybutton_matrix[1][SDLK_t])) ordenador.k10|=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_a]) ordenador.k9 |=1;
|
if ((ordenador.key[SDLK_a] || joybutton_matrix[0][SDLK_a] || joybutton_matrix[1][SDLK_a])) ordenador.k9 |=1;
|
||||||
if (ordenador.key[SDLK_s]) ordenador.k9 |=2;
|
if ((ordenador.key[SDLK_s] || joybutton_matrix[0][SDLK_s] || joybutton_matrix[1][SDLK_s])) ordenador.k9 |=2;
|
||||||
if (ordenador.key[SDLK_d]) ordenador.k9 |=4;
|
if ((ordenador.key[SDLK_d] || joybutton_matrix[0][SDLK_d] || joybutton_matrix[1][SDLK_d])) ordenador.k9 |=4;
|
||||||
if (ordenador.key[SDLK_f]) ordenador.k9 |=8;
|
if ((ordenador.key[SDLK_f] || joybutton_matrix[0][SDLK_f] || joybutton_matrix[1][SDLK_f])) ordenador.k9 |=8;
|
||||||
if (ordenador.key[SDLK_g]) ordenador.k9 |=16;
|
if ((ordenador.key[SDLK_g] || joybutton_matrix[0][SDLK_g] || joybutton_matrix[1][SDLK_g])) ordenador.k9 |=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_RSHIFT]||ordenador.key[SDLK_LSHIFT]) ordenador.k8 |=1; //Caps shift
|
if ((ordenador.key[SDLK_RSHIFT]||ordenador.key[SDLK_LSHIFT])) ordenador.k8 |=1; //Caps shift
|
||||||
if (ordenador.key[SDLK_z]) ordenador.k8 |=2;
|
if ((ordenador.key[SDLK_z] || joybutton_matrix[0][SDLK_z] || joybutton_matrix[1][SDLK_z])) ordenador.k8 |=2;
|
||||||
if (ordenador.key[SDLK_x]) ordenador.k8 |=4;
|
if ((ordenador.key[SDLK_x] || joybutton_matrix[0][SDLK_x] || joybutton_matrix[1][SDLK_x])) ordenador.k8 |=4;
|
||||||
if (ordenador.key[SDLK_c]) ordenador.k8 |=8;
|
if ((ordenador.key[SDLK_c] || joybutton_matrix[0][SDLK_c] || joybutton_matrix[1][SDLK_c])) ordenador.k8 |=8;
|
||||||
if (ordenador.key[SDLK_v]) ordenador.k8 |=16;
|
if ((ordenador.key[SDLK_v] || joybutton_matrix[0][SDLK_v] || joybutton_matrix[1][SDLK_v])) ordenador.k8 |=16;
|
||||||
|
|
||||||
if (ordenador.key[SDLK_UP]) {ordenador.k12 |=8;ordenador.k8|=1;}
|
if (ordenador.key[SDLK_UP]) {ordenador.k12 |=8;ordenador.k8|=1;}
|
||||||
if (ordenador.key[SDLK_DOWN]) {ordenador.k12 |=16;ordenador.k8|=1;}
|
if (ordenador.key[SDLK_DOWN]) {ordenador.k12 |=16;ordenador.k8|=1;}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
@ -195,13 +196,15 @@ struct computer {
|
|||||||
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
|
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
|
||||||
|
|
||||||
unsigned char turbo;
|
unsigned char turbo;
|
||||||
|
unsigned int keyboard_buffer[2][10];
|
||||||
unsigned int kbd_buffer_pointer;
|
unsigned int kbd_buffer_pointer;
|
||||||
unsigned char *key;
|
unsigned char *key;
|
||||||
unsigned char joystick_number;
|
unsigned char joystick_number;
|
||||||
SDL_Joystick *joystick_sdl[2];
|
SDL_Joystick *joystick_sdl[2];
|
||||||
unsigned char joy_axis_x_state[2];
|
unsigned char joy_axis_x_state[2];
|
||||||
unsigned char joy_axis_y_state[2];
|
unsigned char joy_axis_y_state[2];
|
||||||
unsigned char joy_fire[2];
|
//unsigned char joy_fire[2];
|
||||||
|
unsigned int joybuttonkey[2][18];
|
||||||
unsigned char rumble[2];
|
unsigned char rumble[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
@ -36,6 +37,7 @@
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "tape.h"
|
#include "tape.h"
|
||||||
#include "microdrive.h"
|
#include "microdrive.h"
|
||||||
|
#include "menu_sdl.h"
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
@ -40,6 +41,7 @@ extern unsigned int jump_frames,curr_frames;
|
|||||||
void SDL_Fullscreen_Switch(void);
|
void SDL_Fullscreen_Switch(void);
|
||||||
void load_rom(char);
|
void load_rom(char);
|
||||||
void load_main_game(char *nombre);
|
void load_main_game(char *nombre);
|
||||||
|
void save_config(struct computer *object);
|
||||||
FILE *myfopen(char *filename,char *mode);
|
FILE *myfopen(char *filename,char *mode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
124
src/gui_sdl.c
124
src/gui_sdl.c
@ -1,17 +1,39 @@
|
|||||||
/*
|
/*********************************************************************
|
||||||
* UAE - The Un*x Amiga Emulator
|
|
||||||
*
|
*
|
||||||
* Interface to the Tcl/Tk GUI
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
*
|
*
|
||||||
* Copyright 1996 Bernd Schmidt
|
* Filename: menu_sdl.c
|
||||||
*/
|
* Author: Fabio Olimpieri <fabio.olimpieri@tin.it>
|
||||||
|
* Description: a SDL Gui
|
||||||
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "menu_sdl.h"
|
#include "menu_sdl.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
//#include "VirtualKeyboard.h" per ora
|
#include "VirtualKeyboard.h"
|
||||||
|
#include "tape.h"
|
||||||
|
//#include "menus.h"
|
||||||
|
#include "emulator.h"
|
||||||
|
#include "cargador.h"
|
||||||
|
|
||||||
#define ID_BUTTON_OFFSET 0
|
#define ID_BUTTON_OFFSET 0
|
||||||
#define ID_AXIS_OFFSET 32
|
#define ID_AXIS_OFFSET 32
|
||||||
@ -71,7 +93,7 @@ static const char *input_messages[] = {
|
|||||||
/*01*/ "^|Cursor|Kempston|Sinclair1|Sinclair2",
|
/*01*/ "^|Cursor|Kempston|Sinclair1|Sinclair2",
|
||||||
/*02*/ " ",
|
/*02*/ " ",
|
||||||
/*03*/ "Bind key to Wiimote",
|
/*03*/ "Bind key to Wiimote",
|
||||||
/*04*/ "^|1|2|-",
|
/*04*/ "^|A|B|1|2|-",
|
||||||
/*05*/ " ",
|
/*05*/ " ",
|
||||||
/*06*/ "Bind key to Nunchuk",
|
/*06*/ "Bind key to Nunchuk",
|
||||||
/*07*/ "^|Z|C",
|
/*07*/ "^|Z|C",
|
||||||
@ -221,7 +243,19 @@ static void manage_tape(int which)
|
|||||||
break;
|
break;
|
||||||
case 1: //Emulate load ""
|
case 1: //Emulate load ""
|
||||||
ordenador.kbd_buffer_pointer=6;
|
ordenador.kbd_buffer_pointer=6;
|
||||||
countdown=5;
|
countdown=7;
|
||||||
|
ordenador.keyboard_buffer[0][6]= SDLK_1; //Edit
|
||||||
|
ordenador.keyboard_buffer[1][6]= SDLK_LSHIFT;
|
||||||
|
ordenador.keyboard_buffer[0][5]= SDLK_j; //Load
|
||||||
|
ordenador.keyboard_buffer[1][5]= 0;
|
||||||
|
ordenador.keyboard_buffer[0][4]= SDLK_p; //"
|
||||||
|
ordenador.keyboard_buffer[1][4]= SDLK_LCTRL;
|
||||||
|
ordenador.keyboard_buffer[0][3]= SDLK_p; //"
|
||||||
|
ordenador.keyboard_buffer[1][3]= SDLK_LCTRL;
|
||||||
|
ordenador.keyboard_buffer[0][2]= SDLK_RETURN; // Return
|
||||||
|
ordenador.keyboard_buffer[1][2]= 0;
|
||||||
|
ordenador.keyboard_buffer[0][1]= SDLK_F6; //F6
|
||||||
|
ordenador.keyboard_buffer[1][1]= 0;
|
||||||
break;
|
break;
|
||||||
case 2: //Play
|
case 2: //Play
|
||||||
if ((ordenador.tape_fast_load == 0) || (ordenador.tape_file_type==TAP_TZX))
|
if ((ordenador.tape_fast_load == 0) || (ordenador.tape_file_type==TAP_TZX))
|
||||||
@ -338,29 +372,29 @@ static void emulation_settings(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_joystick(int joy, const char *key, int sdl_key)
|
static void setup_joystick(int joy, unsigned int sdl_key, int joy_key)
|
||||||
{
|
{
|
||||||
/*
|
int loop;
|
||||||
if (!strcmp(key, "None"))
|
|
||||||
{
|
//Cancel the previous assignement - it is not possible to assign a same sdl_key to 2 joybuttons
|
||||||
changed_prefs.joystick_settings[1][joy].eventid[ID_BUTTON_OFFSET + sdl_key][0] = 0;
|
for (loop=0; loop<18; loop++)
|
||||||
}
|
if (ordenador.joybuttonkey[joy][loop] == sdl_key) ordenador.joybuttonkey[joy][loop] =0;
|
||||||
else
|
|
||||||
insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key);
|
ordenador.joybuttonkey[joy][joy_key] = sdl_key;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_options(int joy)
|
static void input_options(int joy)
|
||||||
{
|
{
|
||||||
const int wiimote_to_sdl[] = {2, 3, 4, 5};
|
const unsigned int wiimote_to_sdl[] = {0, 1, 2, 3, 4};
|
||||||
const int nunchuk_to_sdl[] = {7, 8};
|
const unsigned int nunchuk_to_sdl[] = {7, 8};
|
||||||
const int classic_to_sdl[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
|
const unsigned int classic_to_sdl[] = {9, 10, 11, 12, 13, 14, 15, 16, 17};
|
||||||
int sdl_key = 1;
|
int joy_key = 1;
|
||||||
const char *key;
|
unsigned int sdl_key;
|
||||||
unsigned int submenus[5];
|
unsigned int submenus[5];
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
//struct virtkey *virtualkey;
|
struct virtkey *virtualkey;
|
||||||
|
|
||||||
memset(submenus, 0, sizeof(submenus));
|
memset(submenus, 0, sizeof(submenus));
|
||||||
|
|
||||||
@ -375,26 +409,27 @@ static void input_options(int joy)
|
|||||||
ordenador.joystick[joy] = submenus[0];
|
ordenador.joystick[joy] = submenus[0];
|
||||||
ordenador.rumble[joy] = !submenus[4];
|
ordenador.rumble[joy] = !submenus[4];
|
||||||
|
|
||||||
/*
|
if (opt == 0 || opt == 12)
|
||||||
virtualkey = virtkbd_get_key();
|
return;
|
||||||
|
|
||||||
|
virtualkey = get_key();
|
||||||
if (virtualkey == NULL)
|
if (virtualkey == NULL)
|
||||||
return;
|
return;
|
||||||
key = virtualkey->ev_name;
|
sdl_key = virtualkey->sdl_code;
|
||||||
*/
|
|
||||||
|
|
||||||
switch(opt)
|
switch(opt)
|
||||||
{
|
{
|
||||||
case 3: // wiimote
|
case 3: // wiimote
|
||||||
sdl_key = wiimote_to_sdl[submenus[1]]; break;
|
joy_key = wiimote_to_sdl[submenus[1]]; break;
|
||||||
case 6: // nunchuk
|
case 6: // nunchuk
|
||||||
sdl_key = nunchuk_to_sdl[submenus[2]]; break;
|
joy_key = nunchuk_to_sdl[submenus[2]]; break;
|
||||||
case 9: // classic
|
case 9: // classic
|
||||||
sdl_key = classic_to_sdl[submenus[3]]; break;
|
joy_key = classic_to_sdl[submenus[3]]; break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_joystick(joy, key, sdl_key);
|
setup_joystick(joy, sdl_key, joy_key);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,28 +566,27 @@ static void set_Port(int which)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void virtual_keyboard(void)
|
void virtual_keyboard(void)
|
||||||
{
|
{
|
||||||
int key_code;
|
int key_code;
|
||||||
|
|
||||||
virtkey_t *key =virtkbd_get_key();
|
virtkey_t *key =get_key();
|
||||||
if (key) {key_code = key->sdl_code;} else return;
|
if (key) {key_code = key->sdl_code;} else return;
|
||||||
|
|
||||||
SDL_Event event_key;
|
ordenador.kbd_buffer_pointer=1;
|
||||||
|
countdown=7;
|
||||||
|
ordenador.keyboard_buffer[0][1]= key_code;
|
||||||
|
if (key->caps_on) ordenador.keyboard_buffer[1][1]= SDLK_LSHIFT;
|
||||||
|
else if (key->sym_on) ordenador.keyboard_buffer[1][1]= SDLK_LCTRL;
|
||||||
|
else ordenador.keyboard_buffer[1][1]= 0;
|
||||||
|
|
||||||
event_key.type=SDL_KEYDOWN;
|
printf ("Push Event: keycode %d\n", key_code);
|
||||||
event_key.key.keysym.sym=key_code;
|
|
||||||
SDL_PushEvent(&event_key);
|
|
||||||
DEBUG_LOG ("Push Event: keycode %d %s\n", key_code, "SDL_KEYDOWN");
|
|
||||||
|
|
||||||
event_key.type=SDL_KEYUP;
|
|
||||||
SDL_PushEvent(&event_key);
|
|
||||||
DEBUG_LOG ("Push Event: keycode %d %s\n", key_code, "SDL_KEYUP");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void save_load_snapshot(int which)
|
static void save_load_snapshot(int which)
|
||||||
{
|
{
|
||||||
@ -583,7 +617,7 @@ static void save_load_snapshot(int which)
|
|||||||
{
|
{
|
||||||
if (which == 0) // Load snapshot file
|
if (which == 0) // Load snapshot file
|
||||||
{
|
{
|
||||||
retorno=load_z80(filename);
|
retorno=load_z80((char *)filename);
|
||||||
|
|
||||||
switch(retorno) {
|
switch(retorno) {
|
||||||
case 0: // all right
|
case 0: // all right
|
||||||
@ -605,7 +639,7 @@ static void save_load_snapshot(int which)
|
|||||||
case 1: // Save snapshot file
|
case 1: // Save snapshot file
|
||||||
snprintf(db, 255, "%s/%s.z80", dir, fb);
|
snprintf(db, 255, "%s/%s.z80", dir, fb);
|
||||||
retorno=save_z80(db);
|
retorno=save_z80(db);
|
||||||
msgInfo("State saved",3000,NULL);
|
msgInfo("Snapshot saved",3000,NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
29
src/gui_sdl.h
Normal file
29
src/gui_sdl.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
|
*
|
||||||
|
* Filename: menu_sdl.h
|
||||||
|
* Author: Fabio Olimpieri <fabio.olimpieri@tin.it>
|
||||||
|
* Description: a SDL Gui
|
||||||
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
void virtual_keyboard(void);
|
||||||
|
void main_menu();
|
||||||
|
|
||||||
|
|
@ -1,14 +1,28 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004,2008, Simon Kagstrom
|
* Filename: menu_sdl.c
|
||||||
*
|
*
|
||||||
* Filename: menu.c
|
|
||||||
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>
|
|
||||||
* Description: Code for menus (originally for Mophun)
|
* Description: Code for menus (originally for Mophun)
|
||||||
*
|
*
|
||||||
* $Id$
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -16,11 +30,13 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include <SDL/SDL_ttf.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "menu_sdl.h"
|
#include "menu_sdl.h"
|
||||||
#include "emulator.h" //Necessary to use ordenador.joystick_number and ordenador.joystick_sdl
|
#include "emulator.h"
|
||||||
//#include "VirtualKeyboard.h"
|
#include "VirtualKeyboard.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -966,7 +982,7 @@ void menu_init(SDL_Surface *screen)
|
|||||||
menu_font20 = read_font(FONT_PATH, 20);
|
menu_font20 = read_font(FONT_PATH, 20);
|
||||||
|
|
||||||
real_screen = screen;
|
real_screen = screen;
|
||||||
//virtkbd_init(screen, menu_font_alt16); per ora
|
VirtualKeyboard_init(screen, menu_font16); //prima c'era il font 16 alt
|
||||||
is_inited = 1;
|
is_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,24 +1,33 @@
|
|||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
* Copyright (C) 2012, Fabio Olimpieri
|
||||||
|
* Copyright (C) 2009, Simon Kagstrom
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004, 2008, Simon Kagstrom
|
* Filename: menu_sdl.h
|
||||||
*
|
*
|
||||||
* Filename: menu.h
|
* Description: Code for menus (originally for Mophun)
|
||||||
* Author: Simon Kagstrom <simon.kagstrom@gmail.com>
|
|
||||||
* Description:
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* This file is part of FBZX Wii
|
||||||
|
*
|
||||||
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#ifndef __MENU_H__
|
#ifndef __MENU_H__
|
||||||
#define __MENU_H__
|
#define __MENU_H__
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL/SDL_ttf.h>
|
#include <SDL/SDL_ttf.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KEY_UP 1
|
#define KEY_UP 1
|
||||||
#define KEY_DOWN 2
|
#define KEY_DOWN 2
|
||||||
@ -55,8 +64,5 @@ int menu_is_inited(void);
|
|||||||
|
|
||||||
int ext_matches(const char *name, const char *ext);
|
int ext_matches(const char *name, const char *ext);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !__MENU_H__ */
|
#endif /* !__MENU_H__ */
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2011 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* This file is part of FBZX
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2012 Fabio Olimpieri
|
||||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||||
* This file is part of FBZX
|
* This file is part of FBZX Wii
|
||||||
*
|
*
|
||||||
* FBZX is free software; you can redistribute it and/or modify
|
* FBZX Wii is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* FBZX is distributed in the hope that it will be useful,
|
* FBZX Wii is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
Loading…
Reference in New Issue
Block a user