mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-12-01 04:24:16 +01:00
Rewritten the event processing, added arrow keys emulation, file name in save snapshot menu
This commit is contained in:
parent
c8973f8493
commit
449ed4a2da
3052
src/computer.c
3052
src/computer.c
File diff suppressed because it is too large
Load Diff
437
src/computer.h
437
src/computer.h
@ -1,217 +1,220 @@
|
||||
/*
|
||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||
* This file is part of FBZX
|
||||
*
|
||||
* FBZX 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 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 computer_h
|
||||
#define computer_h
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_thread.h>
|
||||
|
||||
// #define MUT
|
||||
|
||||
extern char salir;
|
||||
|
||||
enum tapmodes {TAP_GUIDE, TAP_DATA, TAP_PAUSE, TAP_TRASH, TAP_STOP, TAP_PAUSE2, TZX_PURE_TONE,
|
||||
TZX_SEQ_PULSES, TAP_FINAL_BIT, TAP_PAUSE3};
|
||||
enum taptypes {TAP_TAP, TAP_TZX};
|
||||
|
||||
struct computer {
|
||||
|
||||
unsigned int temporal_io;
|
||||
|
||||
// screen private global variables
|
||||
SDL_Surface *screen;
|
||||
unsigned char *screenbuffer;
|
||||
unsigned int screen_width;
|
||||
unsigned int translate[6144],translate2[6144];
|
||||
unsigned char zaurus_mini;
|
||||
unsigned char text_mini;
|
||||
unsigned char dblscan;
|
||||
unsigned char bw;
|
||||
|
||||
int contador_flash;
|
||||
|
||||
unsigned int *p_translt,*p_translt2;
|
||||
unsigned char *pixel; // current address
|
||||
char border,flash;
|
||||
int currline,currpix;
|
||||
|
||||
int tstados_counter; // counts tstates leaved to the next call
|
||||
int resx,resy,bpp; // screen resolutions
|
||||
int init_line; // cuantity to add to the base address to start to paint
|
||||
int next_line; // cuantity to add when we reach the end of line to go to next line
|
||||
int next_scanline; // cuantity to add to pass to the next scanline
|
||||
int first_line; // first line to start to paint
|
||||
int last_line; // last line to paint
|
||||
int first_pixel; // first pixel of a line to paint
|
||||
int last_pixel; // last pixel of a line to paint
|
||||
int next_pixel; // next pixel
|
||||
int pixancho,pixalto; // maximum pixel value for width and height
|
||||
int jump_pixel;
|
||||
unsigned char screen_snow; // 0-> no emulate snow; 1-> emulate snow
|
||||
unsigned char contended_zone; // 0-> no contention; 1-> contention possible
|
||||
int cicles_counter; // counts how many pixel clock cicles passed since las interrupt
|
||||
|
||||
char ulaplus; // 0 = inactive; 1 = active
|
||||
unsigned char ulaplus_reg; // contains the last selected register in the ULAPlus
|
||||
unsigned char ulaplus_palete[64]; // contains the current palete
|
||||
|
||||
// keyboard private global variables
|
||||
|
||||
unsigned char s8,s9,s10,s11,s12,s13,s14,s15;
|
||||
unsigned char k8,k9,k10,k11,k12,k13,k14,k15;
|
||||
unsigned char readed;
|
||||
unsigned char tab_extended;
|
||||
unsigned char esc_again;
|
||||
|
||||
// kempston joystick private global variables
|
||||
|
||||
unsigned char js,jk;
|
||||
|
||||
// Linux joystick private global variables
|
||||
|
||||
unsigned char use_js;
|
||||
unsigned char updown,leftright;
|
||||
|
||||
// sound global variables
|
||||
|
||||
int tst_sample; // number of tstates per sample
|
||||
int freq; // frequency for reproduction
|
||||
int format; // 0: 8 bits, 1: 16 bits LSB, 2: 16 bits MSB
|
||||
signed char sign; // 0: unsigned; 1: signed
|
||||
int channels; // number of channels
|
||||
int buffer_len; // sound buffer length (in samples)
|
||||
int increment; // cuantity to add to jump to the next sample
|
||||
unsigned char volume; // volume
|
||||
unsigned char sample1[4]; // buffer with precalculated sample 1 (for buzzer)
|
||||
unsigned char sample1b[4]; // buffer with prec. sample 1 (for AY-3-8912)
|
||||
unsigned char sample0[4]; // buffer with precalculated sample 0
|
||||
unsigned char sound_bit;
|
||||
unsigned int tstados_counter_sound;
|
||||
unsigned char *current_buffer;
|
||||
unsigned char num_buff;
|
||||
unsigned int sound_cuantity; // counter for the buffer
|
||||
unsigned char ay_registers[16]; // registers for the AY emulation
|
||||
unsigned int aych_a,aych_b,aych_c,aych_n,aych_envel; // counters for AY emulation
|
||||
unsigned char ayval_a,ayval_b,ayval_c,ayval_n;
|
||||
unsigned char ay_emul; // 0: no AY emulation; 1: AY emulation
|
||||
unsigned char vol_a,vol_b,vol_c;
|
||||
unsigned int tst_ay;
|
||||
unsigned int tst_ay2;
|
||||
unsigned int ay_latch;
|
||||
signed char ay_envel_value;
|
||||
unsigned char ay_envel_way;
|
||||
unsigned char sound_current_value;
|
||||
|
||||
// bus global variables
|
||||
|
||||
unsigned char bus_counter;
|
||||
unsigned char bus_value;
|
||||
unsigned char issue; // 2= 48K issue 2, 3= 48K issue 3
|
||||
unsigned char mode128k; // 0=48K, 1=128K, 2=+2, 3=+3
|
||||
unsigned char joystick; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2
|
||||
unsigned char port254;
|
||||
|
||||
|
||||
// tape global variables
|
||||
|
||||
enum tapmodes tape_current_mode;
|
||||
unsigned char pause; // 1=tape stop
|
||||
enum taptypes tape_file_type;
|
||||
unsigned int tape_counter0;
|
||||
unsigned int tape_counter1;
|
||||
unsigned int tape_counter_rep;
|
||||
unsigned char tape_byte;
|
||||
unsigned char tape_bit;
|
||||
unsigned char tape_readed;
|
||||
unsigned int tape_byte_counter;
|
||||
unsigned int tape_pause_at_end;
|
||||
FILE *tap_file;
|
||||
unsigned char tape_fast_load; // 0 normal load; 1 fast load
|
||||
unsigned char current_tap[2049];
|
||||
|
||||
unsigned char tape_current_bit;
|
||||
unsigned int tape_block_level;
|
||||
unsigned int tape_sync_level0;
|
||||
unsigned int tape_sync_level1;
|
||||
unsigned int tape_bit0_level;
|
||||
unsigned int tape_bit1_level;
|
||||
unsigned char tape_bits_at_end;
|
||||
unsigned int tape_loop_counter;
|
||||
long tape_loop_pos;
|
||||
|
||||
unsigned char tape_write; // 0 can't write; 1 can write
|
||||
|
||||
// Microdrive global variables
|
||||
FILE *mdr_file; // Current microdrive file
|
||||
unsigned char mdr_current_mdr[2049]; // current path and name for microdrive file
|
||||
unsigned char mdr_active; // 0: not installed; 1: installed
|
||||
unsigned char mdr_paged; // 0: not pagined; 1: pagined
|
||||
unsigned int mdr_tapehead; // current position in the tape
|
||||
unsigned int mdr_bytes; // number of bytes read or written in this transfer
|
||||
unsigned int mdr_maxbytes; // maximum number of bytes to read or write in this transfer
|
||||
unsigned int mdr_gap; // TSTATEs remaining for GAP end
|
||||
unsigned int mdr_nogap; // TSTATEs remaining for next GAP
|
||||
unsigned char mdr_cartridge[137923]; // current cartridge
|
||||
unsigned char mdr_drive; // current drive
|
||||
byte mdr_old_STATUS; // to detect an edge in COM CLK
|
||||
unsigned char mdr_modified; // if a sector is stored, this change to know that it must be stored in the file
|
||||
|
||||
// OSD global variables
|
||||
|
||||
unsigned char osd_text[200];
|
||||
unsigned int osd_time;
|
||||
|
||||
// pagination global variables
|
||||
|
||||
unsigned char mport1,mport2; // ports for memory management (128K and +3)
|
||||
unsigned int video_offset; // 0 for page 5, and 32768 for page 7
|
||||
unsigned char *block0,*block1,*block2,*block3; // pointers for memory access (one for each 16K block).
|
||||
|
||||
// public
|
||||
|
||||
unsigned char memoria[196608]; // memory (12 pages of 16K each one). 4 for ROM, and 8 for RAM
|
||||
unsigned char shadowrom[8192]; // space for Interface I's ROMs
|
||||
unsigned char interr;
|
||||
unsigned char mustlock;
|
||||
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
|
||||
|
||||
unsigned char turbo;
|
||||
SDL_Event keyboard_buffer[10];
|
||||
unsigned int kbd_buffer_pointer;
|
||||
};
|
||||
|
||||
void computer_init();
|
||||
void register_screen(SDL_Surface *);
|
||||
inline void show_screen(int);
|
||||
inline void paint_pixels(unsigned char, unsigned char, unsigned char);
|
||||
inline void read_keyboard();
|
||||
void fill_audio(void *udata,Uint8 *,int);
|
||||
void set_volume(unsigned char);
|
||||
inline void play_sound(unsigned int);
|
||||
inline void emulate(int);
|
||||
void ResetComputer();
|
||||
inline byte bus_empty();
|
||||
void set_memory_pointers();
|
||||
inline void play_ay();
|
||||
inline void paint_one_pixel(unsigned char *colour,unsigned char *address);
|
||||
void computer_set_palete();
|
||||
void set_palete_entry(unsigned char entry, byte Value);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright 2003-2009 (C) Raster Software Vigo (Sergio Costas)
|
||||
* This file is part of FBZX
|
||||
*
|
||||
* FBZX 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 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 computer_h
|
||||
#define computer_h
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_thread.h>
|
||||
|
||||
// #define MUT
|
||||
|
||||
extern char salir;
|
||||
|
||||
enum tapmodes {TAP_GUIDE, TAP_DATA, TAP_PAUSE, TAP_TRASH, TAP_STOP, TAP_PAUSE2, TZX_PURE_TONE,
|
||||
TZX_SEQ_PULSES, TAP_FINAL_BIT, TAP_PAUSE3};
|
||||
enum taptypes {TAP_TAP, TAP_TZX};
|
||||
|
||||
struct computer {
|
||||
|
||||
unsigned int temporal_io;
|
||||
|
||||
// screen private global variables
|
||||
SDL_Surface *screen;
|
||||
unsigned char *screenbuffer;
|
||||
unsigned int screen_width;
|
||||
unsigned int translate[6144],translate2[6144];
|
||||
unsigned char zaurus_mini;
|
||||
unsigned char text_mini;
|
||||
unsigned char dblscan;
|
||||
unsigned char bw;
|
||||
|
||||
int contador_flash;
|
||||
|
||||
unsigned int *p_translt,*p_translt2;
|
||||
unsigned char *pixel; // current address
|
||||
char border,flash;
|
||||
int currline,currpix;
|
||||
|
||||
int tstados_counter; // counts tstates leaved to the next call
|
||||
int resx,resy,bpp; // screen resolutions
|
||||
int init_line; // cuantity to add to the base address to start to paint
|
||||
int next_line; // cuantity to add when we reach the end of line to go to next line
|
||||
int next_scanline; // cuantity to add to pass to the next scanline
|
||||
int first_line; // first line to start to paint
|
||||
int last_line; // last line to paint
|
||||
int first_pixel; // first pixel of a line to paint
|
||||
int last_pixel; // last pixel of a line to paint
|
||||
int next_pixel; // next pixel
|
||||
int pixancho,pixalto; // maximum pixel value for width and height
|
||||
int jump_pixel;
|
||||
unsigned char screen_snow; // 0-> no emulate snow; 1-> emulate snow
|
||||
unsigned char contended_zone; // 0-> no contention; 1-> contention possible
|
||||
int cicles_counter; // counts how many pixel clock cicles passed since las interrupt
|
||||
|
||||
char ulaplus; // 0 = inactive; 1 = active
|
||||
unsigned char ulaplus_reg; // contains the last selected register in the ULAPlus
|
||||
unsigned char ulaplus_palete[64]; // contains the current palete
|
||||
|
||||
// keyboard private global variables
|
||||
|
||||
unsigned char s8,s9,s10,s11,s12,s13,s14,s15;
|
||||
unsigned char k8,k9,k10,k11,k12,k13,k14,k15;
|
||||
unsigned char readed;
|
||||
unsigned char tab_extended;
|
||||
unsigned char esc_again;
|
||||
|
||||
// kempston joystick private global variables
|
||||
|
||||
unsigned char js,jk;
|
||||
|
||||
// Linux joystick private global variables
|
||||
|
||||
unsigned char use_js;
|
||||
unsigned char updown,leftright;
|
||||
|
||||
// sound global variables
|
||||
|
||||
int tst_sample; // number of tstates per sample
|
||||
int freq; // frequency for reproduction
|
||||
int format; // 0: 8 bits, 1: 16 bits LSB, 2: 16 bits MSB
|
||||
signed char sign; // 0: unsigned; 1: signed
|
||||
int channels; // number of channels
|
||||
int buffer_len; // sound buffer length (in samples)
|
||||
int increment; // cuantity to add to jump to the next sample
|
||||
unsigned char volume; // volume
|
||||
unsigned char sample1[4]; // buffer with precalculated sample 1 (for buzzer)
|
||||
unsigned char sample1b[4]; // buffer with prec. sample 1 (for AY-3-8912)
|
||||
unsigned char sample0[4]; // buffer with precalculated sample 0
|
||||
unsigned char sound_bit;
|
||||
unsigned int tstados_counter_sound;
|
||||
unsigned char *current_buffer;
|
||||
unsigned char num_buff;
|
||||
unsigned int sound_cuantity; // counter for the buffer
|
||||
unsigned char ay_registers[16]; // registers for the AY emulation
|
||||
unsigned int aych_a,aych_b,aych_c,aych_n,aych_envel; // counters for AY emulation
|
||||
unsigned char ayval_a,ayval_b,ayval_c,ayval_n;
|
||||
unsigned char ay_emul; // 0: no AY emulation; 1: AY emulation
|
||||
unsigned char vol_a,vol_b,vol_c;
|
||||
unsigned int tst_ay;
|
||||
unsigned int tst_ay2;
|
||||
unsigned int ay_latch;
|
||||
signed char ay_envel_value;
|
||||
unsigned char ay_envel_way;
|
||||
unsigned char sound_current_value;
|
||||
|
||||
// bus global variables
|
||||
|
||||
unsigned char bus_counter;
|
||||
unsigned char bus_value;
|
||||
unsigned char issue; // 2= 48K issue 2, 3= 48K issue 3
|
||||
unsigned char mode128k; // 0=48K, 1=128K, 2=+2, 3=+3
|
||||
unsigned char joystick; // 0=cursor, 1=kempston, 2=sinclair1, 3=sinclair2
|
||||
unsigned char port254;
|
||||
|
||||
|
||||
// tape global variables
|
||||
|
||||
enum tapmodes tape_current_mode;
|
||||
unsigned char pause; // 1=tape stop
|
||||
enum taptypes tape_file_type;
|
||||
unsigned int tape_counter0;
|
||||
unsigned int tape_counter1;
|
||||
unsigned int tape_counter_rep;
|
||||
unsigned char tape_byte;
|
||||
unsigned char tape_bit;
|
||||
unsigned char tape_readed;
|
||||
unsigned int tape_byte_counter;
|
||||
unsigned int tape_pause_at_end;
|
||||
FILE *tap_file;
|
||||
unsigned char tape_fast_load; // 0 normal load; 1 fast load
|
||||
unsigned char current_tap[2049];
|
||||
|
||||
unsigned char tape_current_bit;
|
||||
unsigned int tape_block_level;
|
||||
unsigned int tape_sync_level0;
|
||||
unsigned int tape_sync_level1;
|
||||
unsigned int tape_bit0_level;
|
||||
unsigned int tape_bit1_level;
|
||||
unsigned char tape_bits_at_end;
|
||||
unsigned int tape_loop_counter;
|
||||
long tape_loop_pos;
|
||||
|
||||
unsigned char tape_write; // 0 can't write; 1 can write
|
||||
|
||||
// Microdrive global variables
|
||||
FILE *mdr_file; // Current microdrive file
|
||||
unsigned char mdr_current_mdr[2049]; // current path and name for microdrive file
|
||||
unsigned char mdr_active; // 0: not installed; 1: installed
|
||||
unsigned char mdr_paged; // 0: not pagined; 1: pagined
|
||||
unsigned int mdr_tapehead; // current position in the tape
|
||||
unsigned int mdr_bytes; // number of bytes read or written in this transfer
|
||||
unsigned int mdr_maxbytes; // maximum number of bytes to read or write in this transfer
|
||||
unsigned int mdr_gap; // TSTATEs remaining for GAP end
|
||||
unsigned int mdr_nogap; // TSTATEs remaining for next GAP
|
||||
unsigned char mdr_cartridge[137923]; // current cartridge
|
||||
unsigned char mdr_drive; // current drive
|
||||
byte mdr_old_STATUS; // to detect an edge in COM CLK
|
||||
unsigned char mdr_modified; // if a sector is stored, this change to know that it must be stored in the file
|
||||
|
||||
// OSD global variables
|
||||
|
||||
unsigned char osd_text[200];
|
||||
unsigned int osd_time;
|
||||
|
||||
// pagination global variables
|
||||
|
||||
unsigned char mport1,mport2; // ports for memory management (128K and +3)
|
||||
unsigned int video_offset; // 0 for page 5, and 32768 for page 7
|
||||
unsigned char *block0,*block1,*block2,*block3; // pointers for memory access (one for each 16K block).
|
||||
|
||||
// public
|
||||
|
||||
unsigned char memoria[196608]; // memory (12 pages of 16K each one). 4 for ROM, and 8 for RAM
|
||||
unsigned char shadowrom[8192]; // space for Interface I's ROMs
|
||||
unsigned char interr;
|
||||
unsigned char mustlock;
|
||||
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
|
||||
|
||||
unsigned char turbo;
|
||||
unsigned int kbd_buffer_pointer;
|
||||
unsigned char *key;
|
||||
SDL_Joystick *joystick_sdl[2];
|
||||
int joy_axis_x_state[2];
|
||||
int joy_axis_y_state[2];
|
||||
};
|
||||
|
||||
void computer_init();
|
||||
void register_screen(SDL_Surface *);
|
||||
inline void show_screen(int);
|
||||
inline void paint_pixels(unsigned char, unsigned char, unsigned char);
|
||||
inline void read_keyboard();
|
||||
void fill_audio(void *udata,Uint8 *,int);
|
||||
void set_volume(unsigned char);
|
||||
inline void play_sound(unsigned int);
|
||||
inline void emulate(int);
|
||||
void ResetComputer();
|
||||
inline byte bus_empty();
|
||||
void set_memory_pointers();
|
||||
inline void play_ay();
|
||||
inline void paint_one_pixel(unsigned char *colour,unsigned char *address);
|
||||
void computer_set_palete();
|
||||
void set_palete_entry(unsigned char entry, byte Value);
|
||||
|
||||
#endif
|
||||
|
@ -219,7 +219,7 @@ void load_rom(char type) {
|
||||
|
||||
void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hwsurface) {
|
||||
|
||||
int retorno,bucle,bucle2,valores,ret2;
|
||||
int retorno,bucle,bucle2,valores,ret2,joystick_number;
|
||||
unsigned char value;
|
||||
|
||||
//if (sound_type!=3)
|
||||
@ -239,8 +239,11 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
|
||||
ordenador.use_js=1;
|
||||
if(SDL_NumJoysticks()>0){
|
||||
// Open joystick
|
||||
for (bucle=0;bucle<SDL_NumJoysticks();bucle++) {
|
||||
if (NULL==SDL_JoystickOpen(bucle)) {
|
||||
joystick_number = SDL_NumJoysticks();
|
||||
if (joystick_number>2) joystick_number = 2; //Open max 2 joysticks
|
||||
for (bucle=0;bucle<joystick_number;bucle++) {
|
||||
ordenador.joystick_sdl [bucle] = SDL_JoystickOpen(bucle);
|
||||
if (NULL==ordenador.joystick_sdl [bucle]) {
|
||||
printf("Can't open joystick %d\n",bucle);
|
||||
}
|
||||
}
|
||||
@ -704,11 +707,11 @@ int main(int argc,char *argv[]) {
|
||||
SDL_EventState(SDL_MOUSEMOTION,SDL_IGNORE);
|
||||
SDL_EventState(SDL_MOUSEBUTTONDOWN,SDL_IGNORE);
|
||||
SDL_EventState(SDL_MOUSEBUTTONUP,SDL_IGNORE);
|
||||
SDL_EventState(SDL_JOYAXISMOTION,SDL_ENABLE);
|
||||
SDL_EventState(SDL_JOYBALLMOTION,SDL_ENABLE);
|
||||
SDL_EventState(SDL_JOYHATMOTION,SDL_ENABLE);
|
||||
SDL_EventState(SDL_JOYBUTTONDOWN,SDL_ENABLE);
|
||||
SDL_EventState(SDL_JOYBUTTONUP,SDL_ENABLE);
|
||||
SDL_EventState(SDL_JOYAXISMOTION,SDL_IGNORE);
|
||||
SDL_EventState(SDL_JOYBALLMOTION,SDL_IGNORE);
|
||||
SDL_EventState(SDL_JOYHATMOTION,SDL_IGNORE);
|
||||
SDL_EventState(SDL_JOYBUTTONDOWN,SDL_IGNORE);
|
||||
SDL_EventState(SDL_JOYBUTTONUP,SDL_IGNORE);
|
||||
SDL_EventState(SDL_QUIT,SDL_ENABLE);
|
||||
SDL_EventState(SDL_SYSWMEVENT,SDL_IGNORE);
|
||||
SDL_EventState(SDL_VIDEORESIZE,SDL_IGNORE);
|
||||
@ -798,7 +801,7 @@ int main(int argc,char *argv[]) {
|
||||
ordenador.mdr_paged = 2;
|
||||
|
||||
if(ordenador.interr==1) {
|
||||
read_keyboard (NULL); // read the physical keyboard
|
||||
read_keyboard (); // read the physical keyboard
|
||||
Z80free_INT(&procesador,bus_empty());
|
||||
ordenador.interr=0;
|
||||
}
|
||||
|
71
src/menus.c
71
src/menus.c
@ -286,7 +286,7 @@ void settings_menu() {
|
||||
ordenador.turbo = 0;
|
||||
jump_frames=0;
|
||||
} else {
|
||||
ordenador.tst_sample=12000000/ordenador.freq; //5,0 MHz max emulation speed for wii
|
||||
ordenador.tst_sample=12000000/ordenador.freq; //5,0 MHz max emulation speed for wii at full frames
|
||||
ordenador.turbo = 1;
|
||||
jump_frames=3;
|
||||
}
|
||||
@ -308,7 +308,7 @@ void help_menu() {
|
||||
|
||||
clean_screen();
|
||||
|
||||
print_string(fbuffer,"FBZX (2.7.0)",-1,20,15,0,ancho);
|
||||
print_string(fbuffer,"FBZX Wii (1.0)",-1,20,15,0,ancho);
|
||||
print_string(fbuffer,"Available keys",-1,50,14,0,ancho);
|
||||
print_string(fbuffer,"Shift:Caps Shift Ctrl:Symbol Shift",-1,95,11,0,ancho);
|
||||
|
||||
@ -351,7 +351,7 @@ void help_menu() {
|
||||
print_string(fbuffer,"ESC:",184,400,12,0,ancho);
|
||||
print_string(fbuffer,"exit emulator",248,400,15,0,ancho);
|
||||
|
||||
print_copy(fbuffer,ancho);
|
||||
//print_copy(fbuffer,ancho);
|
||||
|
||||
fin=1;
|
||||
do {
|
||||
@ -484,7 +484,7 @@ void tools_menu() {
|
||||
print_string(fbuffer,"ESC:",14,250,12,0,ancho);
|
||||
print_string(fbuffer,"return emulator",78,250,15,0,ancho);
|
||||
|
||||
print_copy(fbuffer,ancho);
|
||||
//print_copy(fbuffer,ancho);
|
||||
|
||||
switch(wait_key()) {
|
||||
case SDLK_ESCAPE: // to exit the help
|
||||
@ -539,7 +539,7 @@ void snapshots_menu() {
|
||||
|
||||
print_string(fbuffer,"ESC: \001\017return to emulator",-1,400,12,0,ancho);
|
||||
|
||||
print_copy(fbuffer,ancho);
|
||||
//print_copy(fbuffer,ancho);
|
||||
|
||||
fin=1;
|
||||
do {
|
||||
@ -609,7 +609,7 @@ void taps_menu() {
|
||||
print_string(fbuffer,"Current TAP/TZX file is:",-1,310,12,0,ancho);
|
||||
print_string(fbuffer,ordenador.current_tap,-1,330,12,0,ancho);
|
||||
|
||||
print_copy(fbuffer,ancho);
|
||||
//print_copy(fbuffer,ancho);
|
||||
|
||||
if(ordenador.tape_fast_load)
|
||||
print_string(fbuffer,"Fast load enabled ",10,420,14,0,ancho);
|
||||
@ -748,7 +748,7 @@ void create_tapfile() {
|
||||
print_string(videomem,path_taps,0,152,12,0,ancho);
|
||||
|
||||
|
||||
retorno=ask_filename(nombre2,84,"tap",path_taps);
|
||||
retorno=ask_filename(nombre2,84,"tap",path_taps,NULL);
|
||||
|
||||
clean_screen();
|
||||
|
||||
@ -821,7 +821,7 @@ void microdrive_menu() {
|
||||
print_string(fbuffer,"Current MDR file is:",-1,300,12,0,ancho);
|
||||
print_string(fbuffer,ordenador.mdr_current_mdr,-1,320,12,0,ancho);
|
||||
|
||||
print_copy(fbuffer,ancho);
|
||||
//print_copy(fbuffer,ancho);
|
||||
|
||||
if(!ordenador.mdr_cartridge[137922])
|
||||
print_string(fbuffer,"Write enabled",-1,420,14,0,ancho);
|
||||
@ -931,7 +931,7 @@ void create_mdrfile() {
|
||||
print_string(videomem,"MDR file will be saved in:",-1,132,12,0,ancho);
|
||||
print_string(videomem,path_mdrs,0,152,12,0,ancho);
|
||||
|
||||
retorno=ask_filename(nombre2,84,"mdr",path_mdrs);
|
||||
retorno=ask_filename(nombre2,84,"mdr",path_mdrs, NULL);
|
||||
|
||||
clean_screen();
|
||||
|
||||
@ -984,6 +984,7 @@ void create_scrfile() {
|
||||
int ancho,retorno,retval;
|
||||
unsigned char nombre2[1024];
|
||||
FILE *fichero;
|
||||
char *name;
|
||||
|
||||
videomem=screen->pixels;
|
||||
ancho=screen->w;
|
||||
@ -996,7 +997,15 @@ void create_scrfile() {
|
||||
print_string(videomem,"SCR file will be saved in:",-1,132,12,0,ancho);
|
||||
print_string(videomem,path_snaps,0,152,12,0,ancho);
|
||||
|
||||
retorno=ask_filename(nombre2,84,"scr",path_snaps);
|
||||
if (strlen(ordenador.current_tap))
|
||||
{
|
||||
name=strrchr(ordenador.current_tap,'/');
|
||||
if (name) name++; else name = ordenador.current_tap;
|
||||
}
|
||||
else
|
||||
name=NULL;
|
||||
|
||||
retorno=ask_filename(nombre2,84,"scr",path_snaps, name);
|
||||
|
||||
clean_screen();
|
||||
|
||||
@ -1041,10 +1050,11 @@ void create_scrfile() {
|
||||
}
|
||||
|
||||
|
||||
int ask_filename(char *nombre_final,int y_coord,char *extension, char *path) {
|
||||
int ask_filename(char *nombre_final,int y_coord,char *extension, char *path, char *name) {
|
||||
|
||||
int longitud,retorno;
|
||||
unsigned char nombre[37],nombre2[38];
|
||||
char *ptr;
|
||||
|
||||
unsigned char *videomem;
|
||||
int ancho;
|
||||
@ -1052,10 +1062,29 @@ int ask_filename(char *nombre_final,int y_coord,char *extension, char *path) {
|
||||
videomem=screen->pixels;
|
||||
ancho=screen->w;
|
||||
|
||||
nombre[0]=127;
|
||||
nombre[1]=0;
|
||||
longitud=0;
|
||||
retorno=0;
|
||||
|
||||
if (!name||(strlen(name)>36))
|
||||
{
|
||||
nombre[0]=127;
|
||||
nombre[1]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(nombre,name);
|
||||
ptr = strrchr (nombre, '.');
|
||||
if (ptr) //remove the extension
|
||||
{
|
||||
*ptr = 127;
|
||||
*(ptr+1) = 0;
|
||||
}
|
||||
else
|
||||
nombre[strlen(nombre)-1]=127;
|
||||
nombre[strlen(nombre)]=0;
|
||||
}
|
||||
|
||||
longitud=strlen(nombre)-1;
|
||||
|
||||
|
||||
do {
|
||||
sprintf (nombre2, " %s.%s ", nombre,extension);
|
||||
@ -1452,6 +1481,7 @@ void save_z80file() {
|
||||
unsigned char *videomem;
|
||||
int ancho,retorno;
|
||||
unsigned char nombre2[1024];
|
||||
char *name;
|
||||
|
||||
videomem=screen->pixels;
|
||||
ancho=screen->w;
|
||||
@ -1464,8 +1494,15 @@ void save_z80file() {
|
||||
print_string(videomem,"Snapshot will be saved in:",-1,132,12,0,ancho);
|
||||
print_string(videomem,path_snaps,0,152,12,0,ancho);
|
||||
|
||||
|
||||
retorno=ask_filename(nombre2,84,"z80", path_snaps);
|
||||
if (strlen(ordenador.current_tap))
|
||||
{
|
||||
name=strrchr(ordenador.current_tap,'/');
|
||||
if (name) name++; else name = ordenador.current_tap;
|
||||
}
|
||||
else
|
||||
name=NULL;
|
||||
|
||||
retorno=ask_filename(nombre2,84,"z80", path_snaps, name);
|
||||
|
||||
clean_screen();
|
||||
|
||||
@ -1845,7 +1882,7 @@ void keyboard_menu() {
|
||||
buffer=buffer2-ordenador.bpp;
|
||||
}
|
||||
}
|
||||
print_copy(screen->pixels,screen->w);
|
||||
//print_copy(screen->pixels,screen->w);
|
||||
wait_key();
|
||||
clean_screen();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void create_mdrfile();
|
||||
void microdrive_menu();
|
||||
void keyboard_menu();
|
||||
void load_scrfile();
|
||||
int ask_filename(char *nombre,int y_coord,char *extension, char *path);
|
||||
int ask_filename(char *nombre,int y_coord,char *extension, char *path, char *name);
|
||||
void create_scrfile();
|
||||
void do_poke();
|
||||
int ask_value(int *final_value,int y_coord,int max_value);
|
||||
|
Loading…
Reference in New Issue
Block a user