Auto turbo mode, graphical virtual keyboard using wii pointer, B button as escape, Fixed bug in file list management

This commit is contained in:
fabio.olimpieri 2012-12-30 17:52:21 +00:00
parent e1ebc8a118
commit 342dcfedb1
22 changed files with 173 additions and 191 deletions

View File

@ -125,9 +125,15 @@ dist: $(BUILD)
cp meta.xml $@/apps/fbzx-wii/meta.xml cp meta.xml $@/apps/fbzx-wii/meta.xml
cp icon.png $@/apps/fbzx-wii/icon.png cp icon.png $@/apps/fbzx-wii/icon.png
cp spectrum-roms/* $@/fbzx-wii/spectrum-roms cp spectrum-roms/* $@/fbzx-wii/spectrum-roms
cp keymap.bmp $@/fbzx-wii/fbzx cp images/keymap.bmp $@/fbzx-wii/fbzx
cp ZXSpectrum48k.png $@/fbzx-wii/fbzx cp images/Spectrum_keyboard.png $@/fbzx-wii/fbzx
cp FreeMono.ttf $@/fbzx-wii/fbzx cp images/symbol_shift.png $@/fbzx-wii/fbzx
cp images/caps_shift.png $@/fbzx-wii/fbzx
cp images/Spectrum_keyboard_small.png $@/fbzx-wii/fbzx
cp images/symbol_shift_small.png $@/fbzx-wii/fbzx
cp images/caps_shift_small.png $@/fbzx-wii/fbzx
cp images/ZXSpectrum48k.png $@/fbzx-wii/fbzx
cp images/FreeMono.ttf $@/fbzx-wii/fbzx
cp fbzx.net $@/fbzx-wii cp fbzx.net $@/fbzx-wii
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS VERSIONS.wii $@/apps/fbzx-wii/doc cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS VERSIONS.wii $@/apps/fbzx-wii/doc
touch $@/fbzx-wii/tapes/dummy touch $@/fbzx-wii/tapes/dummy

21
README
View File

@ -125,7 +125,8 @@ computers can run FBZX under X without problem.
The PC keyboard works exactly like the Spectrum keyboard (but only numbers and The PC keyboard works exactly like the Spectrum keyboard (but only numbers and
letters). ENTER key is Return, CAPS SHIFT is in both Shift keys, and SYMBOL letters). ENTER key is Return, CAPS SHIFT is in both Shift keys, and SYMBOL
SHIFT is in both Control keys. Delete, ',' and '.' works too. I hope to add SHIFT is in both Control keys. Delete, ',' and '.' works too. I hope to add
'extended keys' in a near future (in FBZX it is TAB button). 'extended keys' in a near future (in FBZX Wii 'extended keys' is 'TAB' button
and 'Edit' is 'INS' button).
Whit ESC you exit FBZX. Whit ESC you exit FBZX.
@ -182,13 +183,13 @@ since the emulator intercepts the call to SA-BYTES). Each new block is added at
the end of the file, but only if the SAVE operation is enabled for this file. the end of the file, but only if the SAVE operation is enabled for this file.
HOW WORKS THE FAST SPEED LOAD AND SAVE FOR TAP FILES? HOW WORKS THE INSTANT LOAD AND SAVE FOR TAP FILES?
Just type LOAD "" in the emulator (or choose the TAPE LOADER option in the 128K Just type LOAD "" in the emulator (or choose the TAPE LOADER option in the 128K
menu) and the tape will automagically load. This only works with programs that menu) and the tape will automagically load. This only works with programs that
uses the ROM to load all the blocks. If you have a TAP file with a program that uses the ROM to load all the blocks. If you have a TAP file with a program that
uses a custom routine to load the blocks, then you must use the NORMAL SPEED. uses a custom routine to load the blocks, then you must use the NORMAL LOAD.
To do this, press F3 to go to the TAP menu and choose NORMAL SPEED. Then return To do this, press F3 to go to the TAP menu and choose NORMAL LOAD. Then return
to the emulation (with ESC) and use LOAD "" (or the TAPE LOADER option). to the emulation (with ESC) and use LOAD "" (or the TAPE LOADER option).
Finally, put the tape in Play with F6. You can stop the tape with F5 and start Finally, put the tape in Play with F6. You can stop the tape with F5 and start
it again with F6 as many times you want. it again with F6 as many times you want.
@ -199,13 +200,13 @@ tape when you want with the right option in the TAP menu (F3 key).
In a near future a block manager will be added, in order to allow the user to In a near future a block manager will be added, in order to allow the user to
choose a block into the TAP file (thinking in multistage games). choose a block into the TAP file (thinking in multistage games).
Remember that the Fast Speed is available only for TAP files, not in TZX. In Remember that the INSTANT LOAD is available only for TAP files, not in TZX. In
the last case you can go to the SETTINGS menu (F4) and change the TURBO mode the last case you can go to the SETTINGS menu (F4) and enable the TURBO auto mode,
to FAST, so the tape will load faster, and then change again to NORMAL. so the tape will load faster.
The FAST SPEED applies when saving too. The SAVE operation is done ALWAYS The INSTANT LOAD applies when saving too. The SAVE operation is done ALWAYS
when SA-BYTES (in the Spectrum ROM) is called. The difference between FAST and when SA-BYTES (in the Spectrum ROM) is called. The difference between INSTANT and
normal SAVE is that FAST returns inmediately, and NORMAL calls the original normal SAVE is that INSTANT returns inmediately, and NORMAL calls the original
routine. This means that, if you abort the save command, the block will be saved routine. This means that, if you abort the save command, the block will be saved
in the TAP file anyway. in the TAP file anyway.

View File

@ -1,3 +1,12 @@
version 7:
* Added auto turbo mode
* Added graphical virtual keyboard using wii pointer
* Added B button as escape
* Fixed bug in file list management
-- Fabio Olimpieri <fabio.olimpieri@tin.it> Dec 30 2012
version 6: version 6:
* Added mdr and tape file creation menu * Added mdr and tape file creation menu
* Added poke menu * Added poke menu

View File

@ -7,7 +7,7 @@ share_name=FOLDER
smb_ip=192.168.0.1 smb_ip=192.168.0.1
# FTP configuration # FTP configuration
# set to 1 to enable FTP
ftp_enable=0 ftp_enable=0
# WOS # WOS
FTPUser=anonymous FTPUser=anonymous

View File

@ -1,7 +0,0 @@
# SMB configuration
# set to 1 to enable smb
smb_enable=0
user=USER
password=PASSWORD
share_name=FOLDER
smb_ip=192.168.0.1

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 271 KiB

BIN
images/caps_shift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

BIN
images/caps_shift_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

BIN
images/symbol_shift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name>FBZX Wii</name> <name>FBZX Wii</name>
<coder>Oibaf</coder> <coder>Oibaf</coder>
<version>6.0</version> <version>7.0</version>
<release_date>20120819</release_date> <release_date>20121230</release_date>
<short_description>ZX Spectrum Emulator</short_description> <short_description>ZX Spectrum Emulator</short_description>
<long_description>A ZX Spectrum emulator for FrameBuffer written by Sergio Costas, see http://www.rastersoft.com/fbzx.html. <long_description>A ZX Spectrum emulator for FrameBuffer written by Sergio Costas, see http://www.rastersoft.com/fbzx.html.
The port to Wii was done by Fabio Olimpieri. The port to Wii was done by Fabio Olimpieri.
@ -12,9 +12,9 @@ USAGE
------ ------
Put .z80 and .sna files in /fbzx-wii/snapshots or .tap and .tzx files in /fbzx-wii/tapes on your SD card. Put .z80 and .sna files in /fbzx-wii/snapshots or .tap and .tzx files in /fbzx-wii/tapes on your SD card.
Press the home button to access the in-game menu. Press 1 to select an item and 2 to escape. Press the home button to access the in-game menu. Press 1 or A to select an item and 2 or B to escape.
Press the "+" button to access the virtual keyboard. Press the "+" button to access the virtual keyboard which uses the IR pointer.
The in-game menu allows you to insert tapes, load them and configure the display, joysticks etc. The in-game menu allows you to insert tapes, load them and configure the display, joysticks etc.
@ -22,16 +22,15 @@ The easiest way to play a game is to load a snapshot (.z80 and .sna files).
You can also insert a tape file (.tap and .tzx) and then load the file in the tape menu (it simulates the command Load ""). You can also insert a tape file (.tap and .tzx) and then load the file in the tape menu (it simulates the command Load "").
If you have problems with a .tap file, likely the TAP file has a program which uses a custom routine to load the blocks; in this case, try to disbale the "Tap fast speed" function. If you have problems with a .tap file, likely the TAP file has a program which uses a custom routine to load the blocks; in this case, try to disable the "Tap instant load" function.
If you want to speed up the tape file loading (both for .tzx file and .tap file with "tap fast speed" disabled), try to enable "turbo mode" which speeds up the emulator by 3 or by 5. If you want to speed up the tape file loading (both for .tzx file and .tap file with "tap instant load" disabled), try to enable "auto turbo mode" which speeds up the emulator while loading.
In this case, do not forget to revert to normal speed after the loading.
It is possible to set precision emulation required by some demo graphic programs. Turbo mode is disable in this mode. It is possible to set precision emulation required by some demo graphic programs. Turbo mode is disable in this mode.
The general preferences are saved (joystick type, machine, buttons bindings, etc.) from the main in-game menu and they are loaded on start-up. The general preferences are saved (joystick type, machine, buttons bindings, etc.) from the main in-game menu and they are loaded on start-up.
You can also save the game preferences which can be automatically loaded with the tape/snapshot if the related option is set . You can also save the game preferences which can be automatically loaded with the tape/snapshot if the related option is set.
You can also load a file from a usb disk, from your PC and from Internet via FTP using a wi-fi connection. For the wi-fi you should set the parameters in fbzx.net file. You can also load a file from a usb disk, from your PC and from Internet via FTP using a wi-fi connection. For the wi-fi you should set the parameters in fbzx.net file.

View File

@ -29,6 +29,8 @@
#include "computer.h" #include "computer.h"
#include "VirtualKeyboard.h" #include "VirtualKeyboard.h"
#include "menu_sdl.h" #include "menu_sdl.h"
#include<SDL/SDL_image.h>
#include <wiiuse/wpad.h>
#define K(name, sdl_code) \ #define K(name, sdl_code) \
@ -38,7 +40,19 @@
#define KEY_COLS 10 #define KEY_COLS 10
#define KEY_ROWS 6 #define KEY_ROWS 5
#ifdef DEBUG
extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
static SDL_Surface *image_kbd, *image_sym, *image_caps,*image_kbd_small, *image_sym_small, *image_caps_small ;
static int vkb_is_init;
extern struct computer ordenador; extern struct computer ordenador;
void clean_screen(); void clean_screen();
@ -49,96 +63,70 @@ static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
K(" Q",SDLK_q), K(" W",SDLK_w), K(" E",SDLK_e), K(" R",SDLK_r), K(" T",SDLK_t), K(" Y",SDLK_y), K(" U",SDLK_u), K(" I",SDLK_i), K(" O",SDLK_o), K(" P",SDLK_p), K(" Q",SDLK_q), K(" W",SDLK_w), K(" E",SDLK_e), K(" R",SDLK_r), K(" T",SDLK_t), K(" Y",SDLK_y), K(" U",SDLK_u), K(" I",SDLK_i), K(" O",SDLK_o), K(" P",SDLK_p),
K(" A",SDLK_a), K(" S",SDLK_s), K(" D",SDLK_d), K(" F",SDLK_f), K(" G",SDLK_g), K(" H",SDLK_h), K(" J",SDLK_j), K(" K",SDLK_k), K(" L",SDLK_l),K("Enter",SDLK_RETURN), K(" A",SDLK_a), K(" S",SDLK_s), K(" D",SDLK_d), K(" F",SDLK_f), K(" G",SDLK_g), K(" H",SDLK_h), K(" J",SDLK_j), K(" K",SDLK_k), K(" L",SDLK_l),K("Enter",SDLK_RETURN),
K("Caps",SDLK_LSHIFT),K(" Z",SDLK_z),K(" X",SDLK_x),K(" C",SDLK_c), K(" V",SDLK_v), K(" B",SDLK_b), K(" N",SDLK_n), K(" M",SDLK_m), K("Sym",SDLK_LCTRL),K("Space",SDLK_SPACE), K("Caps",SDLK_LSHIFT),K(" Z",SDLK_z),K(" X",SDLK_x),K(" C",SDLK_c), K(" V",SDLK_v), K(" B",SDLK_b), K(" N",SDLK_n), K(" M",SDLK_m), K("Sym",SDLK_LCTRL),K("Space",SDLK_SPACE),
K("Ext",SDLK_TAB),K(" ,",SDLK_COMMA),K(" .",SDLK_PERIOD), K(" ;",SDLK_SEMICOLON), K(" \"",SDLK_QUOTEDBL),KNL(),K(" Up",SDLK_UP),K("Down",SDLK_DOWN), K("Left",SDLK_LEFT),K("Right",SDLK_RIGHT), K("Ext",SDLK_TAB),K("Edit",SDLK_INSERT),K("Del",SDLK_BACKSPACE),K("None",0), K("Done",1), K("Fire",SDLK_LALT) ,K(" Up",SDLK_UP),K("Down",SDLK_DOWN), K("Left",SDLK_LEFT),K("Right",SDLK_RIGHT)};
K("None",0),K("Done",1),K("Fire",SDLK_LALT),K("Del",SDLK_BACKSPACE),KNL(),KNL(),KNL(),KNL(),KNL(),KNL()};
void VirtualKeyboard_init(SDL_Surface *screen, TTF_Font *font) void VirtualKeyboard_init(SDL_Surface *screen)
{ {
VirtualKeyboard.screen = screen; VirtualKeyboard.screen = screen;
VirtualKeyboard.font = font; VirtualKeyboard.sel_x = 64;
VirtualKeyboard.sel_x = 0; VirtualKeyboard.sel_y = 100;
VirtualKeyboard.sel_y = 0; vkb_is_init = -1;
image_kbd=IMG_Load("/fbzx-wii/fbzx/Spectrum_keyboard.png");
image_sym=IMG_Load("/fbzx-wii/fbzx/symbol_shift.png");
image_caps=IMG_Load("/fbzx-wii/fbzx/caps_shift.png");
image_kbd_small=IMG_Load("/fbzx-wii/fbzx/Spectrum_keyboard_small.png");
image_sym_small=IMG_Load("/fbzx-wii/fbzx/symbol_shift_small.png");
image_caps_small=IMG_Load("/fbzx-wii/fbzx/caps_shift_small.png");
if (image_kbd == NULL) {printf("Impossible to load keyboard image\n"); return;}
if (image_sym == NULL) {printf("Impossible to load symbol shift image\n"); return;}
if (image_caps == NULL) {printf("Impossible to load caps shift image\n"); return;}
if (image_kbd_small == NULL) {printf("Impossible to load keyboard small image\n"); return;}
if (image_sym_small == NULL) {printf("Impossible to load symbol small shift image\n"); return;}
if (image_caps_small == NULL) {printf("Impossible to load caps shift small image\n"); return;}
memset(VirtualKeyboard.buf, 0, sizeof(VirtualKeyboard.buf)); memset(VirtualKeyboard.buf, 0, sizeof(VirtualKeyboard.buf));
vkb_is_init = 1;
} }
void draw() void draw()
{ {
int y,x;
int screen_w = VirtualKeyboard.screen->w;
int screen_h = VirtualKeyboard.screen->h;
int key_w = 54/RATIO;
int key_h = 36/RATIO;
int border_x = (screen_w - (key_w * KEY_COLS)) / 2;
int border_y = (screen_h - (key_h * KEY_ROWS)) / 2 + 50/RATIO;
SDL_Rect bg_rect = {border_x, border_y,
key_w * KEY_COLS, key_h * KEY_ROWS};
SDL_FillRect(VirtualKeyboard.screen, &bg_rect, SDL_Rect dst_rect = {VirtualKeyboard.sel_x/RATIO, VirtualKeyboard.sel_y/RATIO, 0, 0};
SDL_MapRGB(ordenador.screen->format, 0xff, 0xff, 0xff));
for (y = 0; y < KEY_ROWS; y++ ) if (RATIO == 1) SDL_BlitSurface(image_kbd, NULL, ordenador.screen, &dst_rect);
{ else SDL_BlitSurface(image_kbd_small, NULL, ordenador.screen, &dst_rect);
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 */ dst_rect.x = (VirtualKeyboard.sel_x+10)/RATIO;
if (key.name == NULL) dst_rect.y = (VirtualKeyboard.sel_y+200)/RATIO;
continue; if (keys[3 * KEY_COLS + 0 ].is_on)
{if (RATIO == 1) SDL_BlitSurface(image_caps, NULL, ordenador.screen, &dst_rect);
else SDL_BlitSurface(image_caps_small, NULL, ordenador.screen, &dst_rect);}
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, dst_rect.x = (VirtualKeyboard.sel_x+402)/RATIO;
x * key_w + border_x, y * key_h + border_y, dst_rect.y = (VirtualKeyboard.sel_y+200)/RATIO;
what, 16); if (keys[3 * KEY_COLS + 8 ].is_on)
} {if (RATIO == 1) SDL_BlitSurface(image_sym, NULL, ordenador.screen, &dst_rect);
} else SDL_BlitSurface(image_sym_small, NULL, ordenador.screen, &dst_rect);}
} }
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() struct virtkey *get_key_internal()
{ {
while(1) while(1)
{ {
uint32_t k; uint32_t k;
int x,y,i=0; int x,y,xm, ym, i=0;
int screen_w = VirtualKeyboard.screen->w; int key_w = 50/RATIO;
int screen_h = VirtualKeyboard.screen->h; int key_h = 64/RATIO;
int key_w = 54/RATIO; int border_x = VirtualKeyboard.sel_x/RATIO;
int key_h = 36/RATIO; int border_y = VirtualKeyboard.sel_y/RATIO;
int border_x = (screen_w - (key_w * KEY_COLS)) / 2;
int border_y = (screen_h - (key_h * KEY_ROWS)) / 2 + 50/RATIO;
draw(); draw();
SDL_Flip(VirtualKeyboard.screen); SDL_Flip(VirtualKeyboard.screen);
@ -149,35 +137,32 @@ struct virtkey *get_key_internal()
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
if (k & KEY_UP) if (k & KEY_ESCAPE) return NULL;
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) else if (k & KEY_SELECT)
{ {
if (!(k & KEY_SELECT_A)) i= VirtualKeyboard.sel_y * KEY_COLS + VirtualKeyboard.sel_x;
else SDL_GetMouseState(&xm, &ym);
{ x = (xm-border_x);
SDL_GetMouseState(&x, &y); y = (ym-border_y);
i= (y-border_y+10/RATIO)/key_h * KEY_COLS + (x-border_x+10/RATIO)/key_w; if ((x<0)||(x>= KEY_COLS*key_w)) continue;
if ((i<0)||(i>=KEY_COLS * KEY_ROWS)) i=KEY_COLS * KEY_ROWS - 1; //NULL if ((y<0)||(y>= KEY_ROWS*key_h)) continue;
}
i = y/key_h*KEY_COLS + x/key_w;
WPAD_Rumble(0, 1);
SDL_Delay(50);
WPAD_Rumble(0, 0);
virtkey_t *key = &keys[i]; virtkey_t *key = &keys[i];
if ((key->sdl_code == 304) && !keys[3 * KEY_COLS + 8 ].is_done) if ((key->sdl_code == 304) && !keys[3 * KEY_COLS + 8 ].is_on)
keys[3 * KEY_COLS + 0 ].is_done = !keys[3 * KEY_COLS + 0 ].is_done; //Caps Shit keys[3 * KEY_COLS + 0 ].is_on = !keys[3 * KEY_COLS + 0 ].is_on; //Caps Shit
else if ((key->sdl_code == 306) && !keys[3 * KEY_COLS + 0 ].is_done) else if ((key->sdl_code == 306) && !keys[3 * KEY_COLS + 0 ].is_on)
keys[3 * KEY_COLS + 8 ].is_done = !keys[3 * KEY_COLS + 8 ].is_done; //Sym Shift keys[3 * KEY_COLS + 8 ].is_on = !keys[3 * KEY_COLS + 8 ].is_on; //Sym Shift
else { else {
key->caps_on = keys[3 * KEY_COLS + 0 ].is_done; key->caps_on = keys[3 * KEY_COLS + 0 ].is_on;
key->sym_on = keys[3 * KEY_COLS + 8 ].is_done; key->sym_on = keys[3 * KEY_COLS + 8 ].is_on;
return key; return key;
} }
} }
@ -189,17 +174,14 @@ struct virtkey *get_key_internal()
struct virtkey* get_key() struct virtkey* get_key()
{ {
virtkey_t *key; virtkey_t *key;
SDL_Rect rect = {32/RATIO, (120+50)/RATIO, FULL_DISPLAY_X-64/RATIO, FULL_DISPLAY_Y-250/RATIO};
keys[3 * KEY_COLS + 0 ].is_done = 0; //Caps Shit if (vkb_is_init != 1) return NULL;
keys[3 * KEY_COLS + 8 ].is_done = 0; //Sym Shift
SDL_FillRect(VirtualKeyboard.screen, &rect, SDL_MapRGB(ordenador.screen->format, 0xff, 0xff, 0xff)); keys[3 * KEY_COLS + 0 ].is_on = 0; //Caps Shit
keys[3 * KEY_COLS + 8 ].is_on = 0; //Sym Shift
key = get_key_internal(); key = get_key_internal();
SDL_FillRect(VirtualKeyboard.screen, &rect, SDL_MapRGB(ordenador.screen->format, 0, 0, 0));
return key; return key;
} }

View File

@ -29,7 +29,7 @@ typedef struct virtkey
{ {
const char *name; const char *name;
int sdl_code; int sdl_code;
int is_done; int is_on;
int caps_on; int caps_on;
int sym_on; int sym_on;
} virtkey_t; } virtkey_t;
@ -38,14 +38,13 @@ typedef struct virtkey
struct Virtual_Keyboard struct Virtual_Keyboard
{ {
SDL_Surface *screen; SDL_Surface *screen;
TTF_Font *font;
int sel_x; int sel_x;
int sel_y; int sel_y;
char buf[255]; char buf[255];
} VirtualKeyboard; } VirtualKeyboard;
void VirtualKeyboard_init(SDL_Surface *screen, TTF_Font *font); void VirtualKeyboard_init(SDL_Surface *screen);
struct virtkey* get_key(); struct virtkey* get_key();
struct virtkey* get_key_internal(); struct virtkey* get_key_internal();
void draw(); void draw();

View File

@ -1382,10 +1382,10 @@ inline void read_keyboard () {
if (ordenador.key[SDLK_m] || joybutton_matrix[0][SDLK_m] || joybutton_matrix[1][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] || joybutton_matrix[0][SDLK_n] || joybutton_matrix[1][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] || joybutton_matrix[0][SDLK_b] || joybutton_matrix[1][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] || joybutton_matrix[0][SDLK_PERIOD] || joybutton_matrix[1][SDLK_PERIOD]) ordenador.k15|=6; if (ordenador.key[SDLK_PERIOD]) ordenador.k15|=6;
if (ordenador.key[SDLK_COMMA]|| joybutton_matrix[0][SDLK_COMMA] || joybutton_matrix[1][SDLK_COMMA]) ordenador.k15|=10; if (ordenador.key[SDLK_COMMA]) ordenador.k15|=10;
if (ordenador.key[SDLK_SEMICOLON]|| joybutton_matrix[0][SDLK_SEMICOLON] || joybutton_matrix[1][SDLK_SEMICOLON]) {ordenador.k13|=2; ordenador.k15|=2;} //if (ordenador.key[SDLK_SEMICOLON]|| joybutton_matrix[0][SDLK_SEMICOLON] || joybutton_matrix[1][SDLK_SEMICOLON]) {ordenador.k13|=2; ordenador.k15|=2;}
if (ordenador.key[SDLK_QUOTEDBL]|| joybutton_matrix[0][SDLK_QUOTEDBL] || joybutton_matrix[1][SDLK_QUOTEDBL]) {ordenador.k13|=1; ordenador.k15|=2;} //if (ordenador.key[SDLK_QUOTEDBL]|| joybutton_matrix[0][SDLK_QUOTEDBL] || joybutton_matrix[1][SDLK_QUOTEDBL]) {ordenador.k13|=1; ordenador.k15|=2;}
if (ordenador.key[SDLK_RETURN] || joybutton_matrix[0][SDLK_RETURN] || joybutton_matrix[1][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] || joybutton_matrix[0][SDLK_l] || joybutton_matrix[1][SDLK_l]) ordenador.k14|=2; if (ordenador.key[SDLK_l] || joybutton_matrix[0][SDLK_l] || joybutton_matrix[1][SDLK_l]) ordenador.k14|=2;
@ -1436,6 +1436,7 @@ inline void read_keyboard () {
if (ordenador.key[SDLK_RIGHT]) {ordenador.k12 |=4;ordenador.k8|=1;} if (ordenador.key[SDLK_RIGHT]) {ordenador.k12 |=4;ordenador.k8|=1;}
if (ordenador.key[SDLK_TAB]|| joybutton_matrix[0][SDLK_TAB] || joybutton_matrix[1][SDLK_TAB]) {ordenador.k15|=2;ordenador.k8|=1;} //Extended mode if (ordenador.key[SDLK_TAB]|| joybutton_matrix[0][SDLK_TAB] || joybutton_matrix[1][SDLK_TAB]) {ordenador.k15|=2;ordenador.k8|=1;} //Extended mode
if (ordenador.key[SDLK_INSERT]|| joybutton_matrix[0][SDLK_INSERT] || joybutton_matrix[1][SDLK_INSERT]) {ordenador.k11|=1;ordenador.k8|=1;} //Edit
ordenador.s8 = (ordenador.s8 & 0xE0) | (ordenador.k8 ^ 0x1F); ordenador.s8 = (ordenador.s8 & 0xE0) | (ordenador.k8 ^ 0x1F);
ordenador.s9 = (ordenador.s9 & 0xE0) | (ordenador.k9 ^ 0x1F); ordenador.s9 = (ordenador.s9 & 0xE0) | (ordenador.k9 ^ 0x1F);

View File

@ -147,20 +147,18 @@ static const char *microdrive_messages[] = {
}; };
static const char *tools_messages[] = { static const char *tools_messages[] = {
/*00*/ "Show keyboard", /*00*/ "Save SCR",
/*01*/ " ", /*01*/ " ",
/*02*/ "Save SCR", /*02*/ "Load SCR",
/*03*/ " ", /*03*/ " ",
/*04*/ "Load SCR", /*04*/ "Insert poke",
/*05*/ " ", /*05*/ " ",
/*06*/ "Insert poke", /*06*/ "Load poke file",
/*07*/ " ", /*07*/ " ",
/*08*/ "Load poke file", /*08*/ "Port",
/*09*/ " ", /*09*/ "^|sd|usb|smb|ftp",
/*10*/ "Port", /*10*/ " ",
/*11*/ "^|sd|usb|smb|ftp", /*11*/ "Help",
/*12*/ " ",
/*13*/ "Help",
NULL NULL
}; };
@ -665,6 +663,7 @@ static void input_options(int joy)
struct virtkey *virtualkey; struct virtkey *virtualkey;
do {
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
submenus[0] = ordenador.joystick[joy]; submenus[0] = ordenador.joystick[joy];
@ -683,6 +682,9 @@ static void input_options(int joy)
if (opt == 0 || opt == 10|| opt == 12) if (opt == 0 || opt == 10|| opt == 12)
return; return;
VirtualKeyboard.sel_x = 64;
VirtualKeyboard.sel_y = 90;
virtualkey = get_key(); virtualkey = get_key();
if (virtualkey == NULL) if (virtualkey == NULL)
return; return;
@ -708,6 +710,8 @@ static void input_options(int joy)
} }
setup_joystick(joy, sdl_key, joy_key); setup_joystick(joy, sdl_key, joy_key);
} while (opt == 2 || opt == 4 || opt == 6 || opt == 8);
} }
@ -881,29 +885,6 @@ static void microdrive()
break; break;
} }
} }
void show_keyboard_layout() {
FILE *fichero;
int bucle1,bucle2,retval;
unsigned char *buffer,valor;
buffer=screen->pixels;
fichero=myfopen("fbzx/keymap.bmp","r");
if (fichero==NULL) {
msgInfo("Keymap picture not found",3000,NULL);
return;
}
for (bucle1=0;bucle1<344;bucle1++)
for(bucle2=0;bucle2<640;bucle2++) {
retval=fscanf(fichero,"%c",&valor);
paint_one_pixel((unsigned char *)(colors+valor),buffer);
buffer+=ordenador.bpp;
}
SDL_Flip(ordenador.screen);
menu_wait_key_press();
}
static void load_scr() static void load_scr()
{ {
@ -1360,22 +1341,19 @@ static void tools()
switch(opt) switch(opt)
{ {
case 0: // Show keyboard case 0: // Save SCR
if (ordenador.zaurus_mini == 0) show_keyboard_layout(); else msgInfo("No picture available in 320X240 resolution",3000,NULL);
break;
case 2: // Save SCR
save_scr(); save_scr();
break; break;
case 4: // Load SCR case 2: // Load SCR
load_scr(); load_scr();
break; break;
case 6: // Insert poke case 4: // Insert poke
do_poke_sdl(); do_poke_sdl();
break; break;
case 8: // Load poke file case 6: // Load poke file
load_poke_file(); load_poke_file();
break; break;
case 13: case 11:
help(); help();
break; break;
default: default:
@ -1388,6 +1366,9 @@ void virtual_keyboard(void)
{ {
int key_code; int key_code;
VirtualKeyboard.sel_x = 64;
VirtualKeyboard.sel_y = 90;
virtkey_t *key =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;

View File

@ -335,10 +335,11 @@ static const char **get_file_list_zip(const char *path)
static const char **get_file_list(const char *base_dir) static const char **get_file_list(const char *base_dir)
{ {
DIR *d = opendir(base_dir); DIR *d = opendir(base_dir);
const char **file_list; const char **file_list, **realloc_file_list;
int cur = 0; int cur = 0;
struct dirent *de; struct dirent *de;
int cnt = 16; int cnt = 16;
int i;
if (!d) if (!d)
return NULL; return NULL;
@ -381,9 +382,15 @@ static const char **get_file_list(const char *base_dir)
if (cur > cnt - 2) if (cur > cnt - 2)
{ {
cnt = cnt + 32; cnt = cnt + 32;
file_list = (const char**)realloc(file_list, cnt * sizeof(char*)); realloc_file_list = (const char**)realloc(file_list, cnt * sizeof(char*));
if (!file_list) if (realloc_file_list) file_list = realloc_file_list; else
{
/* Cleanup everything - file_list is NULL-terminated */
for ( i = 0; file_list[i]; i++ )
free((void*)file_list[i]);
free(file_list);
return NULL; return NULL;
}
} }
} }
closedir(d); closedir(d);
@ -806,9 +813,8 @@ uint32_t menu_wait_key_press(void)
else if( axis1 > 15000 ) keys |= KEY_DOWN; else if( axis1 > 15000 ) keys |= KEY_DOWN;
if (!SDL_JoystickGetButton(joy, 0) && joy_bottons_last[nr][0]) /* A */ if ((!SDL_JoystickGetButton(joy, 0) && joy_bottons_last[nr][0]) || /* A */
{keys |= KEY_SELECT; keys |= KEY_SELECT_A;} (!SDL_JoystickGetButton(joy, 3) && joy_bottons_last[nr][1]) || /* 2 */
if ((!SDL_JoystickGetButton(joy, 3) && joy_bottons_last[nr][1]) || /* 2 */
(!SDL_JoystickGetButton(joy, 9) && joy_bottons_last[nr][2]) || /* CA */ (!SDL_JoystickGetButton(joy, 9) && joy_bottons_last[nr][2]) || /* CA */
(!SDL_JoystickGetButton(joy, 10) && joy_bottons_last[nr][3])) /* CB */ (!SDL_JoystickGetButton(joy, 10) && joy_bottons_last[nr][3])) /* CB */
keys |= KEY_SELECT; keys |= KEY_SELECT;
@ -1259,8 +1265,8 @@ void font_init()
void menu_init(SDL_Surface *screen) void menu_init(SDL_Surface *screen)
{ {
real_screen = screen; real_screen = screen;
if (FULL_DISPLAY_X == 640) VirtualKeyboard_init(screen, menu_font16); //prima c'era il font 16 alt
else VirtualKeyboard_init(screen, menu_font8); VirtualKeyboard_init(screen);
is_inited = 1; is_inited = 1;
} }
@ -1286,6 +1292,9 @@ int ask_value_sdl(int *final_value,int y_coord,int max_value) {
sprintf (nombre2, " %d\177 ", value); sprintf (nombre2, " %d\177 ", value);
print_string (videomem, nombre2, -1, y_coord, 15, 0, ancho); print_string (videomem, nombre2, -1, y_coord, 15, 0, ancho);
VirtualKeyboard.sel_x = 64;
VirtualKeyboard.sel_y = 155;
virtualkey = get_key(); virtualkey = get_key();
if (virtualkey == NULL) return(2); if (virtualkey == NULL) return(2);
sdl_key = virtualkey->sdl_code; sdl_key = virtualkey->sdl_code;
@ -1411,6 +1420,9 @@ int ask_filename_sdl(char *nombre_final,int y_coord,char *extension, char *path,
sprintf (nombre2, " %s.%s ", nombre,extension); sprintf (nombre2, " %s.%s ", nombre,extension);
print_string (videomem, nombre2, -1, y_coord, 15, 0, ancho); print_string (videomem, nombre2, -1, y_coord, 15, 0, ancho);
VirtualKeyboard.sel_x = 64;
VirtualKeyboard.sel_y = 155;
virtualkey = get_key(); virtualkey = get_key();
if (virtualkey == NULL) return(2); if (virtualkey == NULL) return(2);
sdl_key = virtualkey->sdl_code; sdl_key = virtualkey->sdl_code;

View File

@ -38,7 +38,6 @@
#define KEY_PAGEDOWN 64 #define KEY_PAGEDOWN 64
#define KEY_PAGEUP 128 #define KEY_PAGEUP 128
#define KEY_HELP 256 #define KEY_HELP 256
#define KEY_SELECT_A 512
int FULL_DISPLAY_X; //640 int FULL_DISPLAY_X; //640
int FULL_DISPLAY_Y; //480 int FULL_DISPLAY_Y; //480

View File

@ -601,7 +601,7 @@ void taps_menu() {
print_string(fbuffer,"rewind TAP/TZX file",62,100,15,0,ancho); print_string(fbuffer,"rewind TAP/TZX file",62,100,15,0,ancho);
print_string(fbuffer,"3:",14,140,12,0,ancho); print_string(fbuffer,"3:",14,140,12,0,ancho);
print_string(fbuffer,"fast/normal speed",62,140,15,0,ancho); print_string(fbuffer,"instant/normal load",62,140,15,0,ancho);
print_string(fbuffer,"4:",14,180,12,0,ancho); print_string(fbuffer,"4:",14,180,12,0,ancho);
print_string(fbuffer,"write protection",62,180,15,0,ancho); print_string(fbuffer,"write protection",62,180,15,0,ancho);