mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
"-" on wiimote and canc on keyboard pause the emulation, rzx browser improvements
This commit is contained in:
parent
9a02a2cf2f
commit
2dbfec8e0e
@ -1177,6 +1177,66 @@ inline void paint_one_pixel(unsigned char *colour,unsigned char *address ) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline void pause() {
|
||||||
|
unsigned int temporal_io;
|
||||||
|
SDL_Event evento,*pevento;
|
||||||
|
unsigned char minus_pressed=2;
|
||||||
|
|
||||||
|
pevento=&evento;
|
||||||
|
printf("Pause\n");
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
SDL_JoystickUpdate();
|
||||||
|
|
||||||
|
#ifdef HW_DOL //Gamecube button "Z"
|
||||||
|
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==2 ) minus_pressed = 1; //Released
|
||||||
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==1) minus_pressed = 0; //Pressed
|
||||||
|
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4 ) && minus_pressed==0 ) return; //Released
|
||||||
|
#else //HW_RVL - WIN // Wii button "-"
|
||||||
|
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) &&
|
||||||
|
!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17) && minus_pressed==2 ) minus_pressed=1; //Released
|
||||||
|
if ((SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) ||
|
||||||
|
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17)) && minus_pressed==1) minus_pressed = 0; //Pressed
|
||||||
|
if (!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) &&
|
||||||
|
!SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17) && minus_pressed==0 ) return; //Released
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memset(&evento,0, sizeof(SDL_Event));
|
||||||
|
SDL_PollEvent (&evento);
|
||||||
|
|
||||||
|
if (pevento->type==SDL_QUIT) {
|
||||||
|
printf("SDL_QUIT event\n");
|
||||||
|
salir = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temporal_io = (unsigned int) pevento->key.keysym.sym;
|
||||||
|
|
||||||
|
if (pevento->type == SDL_KEYDOWN)
|
||||||
|
switch (temporal_io) {
|
||||||
|
case SDLK_ESCAPE: // to exit from the emulator
|
||||||
|
if (ordenador.esc_again==0) {
|
||||||
|
ordenador.esc_again=1;
|
||||||
|
strcpy(ordenador.osd_text,"ESC again to exit");
|
||||||
|
ordenador.osd_time=100;
|
||||||
|
} else
|
||||||
|
salir = 0;
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDLK_F10: // Reset emulator
|
||||||
|
ResetComputer ();
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDLK_DELETE: //unpause RZX playing
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SDL_Delay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read the keyboard and stores the flags
|
// Read the keyboard and stores the flags
|
||||||
|
|
||||||
@ -1215,10 +1275,15 @@ inline void read_keyboard () {
|
|||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 7)) //Gamecube button "Start"
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 7)) //Gamecube button "Start"
|
||||||
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
||||||
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) //Gamecube button "Z"
|
||||||
|
pause();
|
||||||
#else //HW_RVL - WIN
|
#else //HW_RVL - WIN
|
||||||
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home"
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 6) ||//Wii button "Home"
|
||||||
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 19))
|
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 19))
|
||||||
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
{if (ordenador.vk_is_active) virtkey_ir_deactivate();main_menu(); }
|
||||||
|
if (SDL_JoystickGetButton(ordenador.joystick_sdl[0], 4) ||//Wii button "-"
|
||||||
|
SDL_JoystickGetButton(ordenador.joystick_sdl[0], 17))
|
||||||
|
pause();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
@ -1244,14 +1309,14 @@ inline void read_keyboard () {
|
|||||||
else ordenador.joy_axis_y_state[joy_n] = JOY_CENTER_Y;
|
else ordenador.joy_axis_y_state[joy_n] = JOY_CENTER_Y;
|
||||||
|
|
||||||
if (!ordenador.vk_is_active) {
|
if (!ordenador.vk_is_active) {
|
||||||
for(joybutton_n=0;joybutton_n<5;joybutton_n++)
|
for(joybutton_n=0;joybutton_n<4;joybutton_n++)
|
||||||
{
|
{
|
||||||
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
||||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
for(joybutton_n=7;joybutton_n<18;joybutton_n++)
|
for(joybutton_n=7;joybutton_n<17;joybutton_n++)
|
||||||
{
|
{
|
||||||
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
joybutton_matrix[joy_n][(ordenador.joybuttonkey[joy_n][joybutton_n])] =
|
||||||
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
SDL_JoystickGetButton(ordenador.joystick_sdl[joy_n], joybutton_n);
|
||||||
@ -1432,6 +1497,9 @@ inline void read_keyboard () {
|
|||||||
if (!ordenador.vk_auto)
|
if (!ordenador.vk_auto)
|
||||||
{if (!ordenador.vk_is_active) virtkey_ir_activate(); else virtkey_ir_deactivate();}
|
{if (!ordenador.vk_is_active) virtkey_ir_activate(); else virtkey_ir_deactivate();}
|
||||||
break;
|
break;
|
||||||
|
case SDLK_DELETE: // Pause emulator
|
||||||
|
pause();
|
||||||
|
break;
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
case SDLK_RALT: //Full_screen
|
case SDLK_RALT: //Full_screen
|
||||||
SDL_Fullscreen_Switch();
|
SDL_Fullscreen_Switch();
|
||||||
|
@ -168,14 +168,14 @@ static const char *input_messages[] = {
|
|||||||
/*01*/ "^|Curs|Kemps|Sincl1|Sincl2|Fuller|QAOP",
|
/*01*/ "^|Curs|Kemps|Sincl1|Sincl2|Fuller|QAOP",
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
/*02*/ "Bind key to Wiimote",
|
/*02*/ "Bind key to Wiimote",
|
||||||
/*03*/ "^|A|B|1|2|-|+",
|
/*03*/ "^|A|B|1|2|+",
|
||||||
/*04*/ "Bind key to Nunchuk",
|
/*04*/ "Bind key to Nunchuk",
|
||||||
/*05*/ "^|Z|C",
|
/*05*/ "^|Z|C",
|
||||||
/*06*/ "Bind key to Classic",
|
/*06*/ "Bind key to Classic",
|
||||||
/*07*/ "^|a|b|x|y|L|R|Zl|Zr|-|+",
|
/*07*/ "^|a|b|x|y|L|R|Zl|Zr|+",
|
||||||
#else //HW_DOL - WIN
|
#else //HW_DOL - WIN
|
||||||
/*02*/ "Bind key to Controller",
|
/*02*/ "Bind key to Controller",
|
||||||
/*03*/ "^|A|B|X|Y|Z",
|
/*03*/ "^|A|B|X|Y",
|
||||||
/*04*/ "Unused",
|
/*04*/ "Unused",
|
||||||
/*05*/ "^|----",
|
/*05*/ "^|----",
|
||||||
/*06*/ "Unused",
|
/*06*/ "Unused",
|
||||||
@ -883,9 +883,9 @@ static void setup_joystick(int joy, unsigned int sdl_key, int joy_key)
|
|||||||
|
|
||||||
static void input_options(int joy)
|
static void input_options(int joy)
|
||||||
{
|
{
|
||||||
const unsigned int wiimote_to_sdl[] = {0, 1, 2, 3, 4,5};
|
const unsigned int wiimote_to_sdl[] = {0, 1, 2, 3, 5};
|
||||||
const unsigned int nunchuk_to_sdl[] = {7, 8};
|
const unsigned int nunchuk_to_sdl[] = {7, 8};
|
||||||
const unsigned 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, 18};
|
||||||
const unsigned int pad_to_sdl[] = {19, 20, 21, 22};
|
const unsigned int pad_to_sdl[] = {19, 20, 21, 22};
|
||||||
int joy_key = 1;
|
int joy_key = 1;
|
||||||
unsigned int sdl_key;
|
unsigned int sdl_key;
|
||||||
@ -1913,6 +1913,7 @@ static int load_rzx(int edit)
|
|||||||
|
|
||||||
if (!(ext_matches(filename, ".rzx")|ext_matches(filename, ".RZX"))) {free((void *)filename); return -1;}
|
if (!(ext_matches(filename, ".rzx")|ext_matches(filename, ".RZX"))) {free((void *)filename); return -1;}
|
||||||
|
|
||||||
|
printf("Loading %s\n", filename);
|
||||||
|
|
||||||
if (edit) retorno=rzx_edit(filename);
|
if (edit) retorno=rzx_edit(filename);
|
||||||
else retorno=rzx_playback(filename);
|
else retorno=rzx_playback(filename);
|
||||||
@ -1984,7 +1985,11 @@ static void rzx_browser()
|
|||||||
|
|
||||||
ordenador.frames_count_rzx=rzx_browser_list[block_n_int].frames_count;
|
ordenador.frames_count_rzx=rzx_browser_list[block_n_int].frames_count;
|
||||||
|
|
||||||
if (ordenador.playing_rzx) rzx_set_file_position(rzx_position);
|
if (ordenador.playing_rzx)
|
||||||
|
{
|
||||||
|
rzx_set_file_position(rzx_position);
|
||||||
|
ordenador.maxicount = 0; //Force rzx_update and interrupt
|
||||||
|
}
|
||||||
|
|
||||||
if (ordenador.recording_rzx)
|
if (ordenador.recording_rzx)
|
||||||
{
|
{
|
||||||
@ -2010,6 +2015,7 @@ static void rzx_browser()
|
|||||||
rzx_snapshot_counter = block_n_int+1;
|
rzx_snapshot_counter = block_n_int+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ordenador.icount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_rzx(int which)
|
static int do_rzx(int which)
|
||||||
@ -2066,11 +2072,8 @@ static int do_rzx(int which)
|
|||||||
break;
|
break;
|
||||||
case 4: //browser
|
case 4: //browser
|
||||||
if (!ordenador.playing_rzx&&!ordenador.recording_rzx) break;
|
if (!ordenador.playing_rzx&&!ordenador.recording_rzx) break;
|
||||||
if (ordenador.recording_rzx) rzx_update(&ordenador.icount); //Discard the records
|
if (ordenador.recording_rzx) rzx_update(0); //Force rzx_close_irb
|
||||||
ordenador.icount = 0;
|
|
||||||
rzx_reset(); //Reset internal library variables
|
|
||||||
rzx_browser();
|
rzx_browser();
|
||||||
if (ordenador.playing_rzx) ordenador.maxicount = 0; //Force rzx_update and interrupt
|
|
||||||
retorno = -2;
|
retorno = -2;
|
||||||
break;
|
break;
|
||||||
case 5: //edit
|
case 5: //edit
|
||||||
|
@ -560,6 +560,8 @@ int extract_screen(char* screen_memory, const char* name)
|
|||||||
char char_id[10];
|
char char_id[10];
|
||||||
int retorno;
|
int retorno;
|
||||||
|
|
||||||
|
printf("Extracting screen of %s\n", name);
|
||||||
|
|
||||||
if ((ext_matches(name, ".tap")||ext_matches(name, ".TAP")))
|
if ((ext_matches(name, ".tap")||ext_matches(name, ".TAP")))
|
||||||
{
|
{
|
||||||
sprintf(filename,"%s/%s",load_path_taps, name);
|
sprintf(filename,"%s/%s",load_path_taps, name);
|
||||||
|
@ -304,6 +304,7 @@ void rzx_set_file_position(unsigned int rzx_position)
|
|||||||
#endif
|
#endif
|
||||||
fseek(rzxfile,rzx_position,SEEK_SET);
|
fseek(rzxfile,rzx_position,SEEK_SET);
|
||||||
INcount=0;
|
INcount=0;
|
||||||
|
INmax=0;
|
||||||
INold=0xFFFF;
|
INold=0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,7 +926,7 @@ void rzx_store_input(rzx_u8 value)
|
|||||||
|
|
||||||
int rzx_get_input(rzx_u8 *input)
|
int rzx_get_input(rzx_u8 *input)
|
||||||
{
|
{
|
||||||
if(INcount>=INmax) {printf("Too many inputs read\n"); *input=0; return RZX_SYNCLOST;};
|
if(INcount>=INmax) {printf("Too many inputs read, expected %d\n", INmax); *input=0; return RZX_SYNCLOST;};
|
||||||
*input = inputbuffer[INcount++];
|
*input = inputbuffer[INcount++];
|
||||||
return RZX_OK;
|
return RZX_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user