libretro / libretro-cap32

caprice32 4.2.0 libretro
21 stars 36 forks source link

Virtual keyboard in Retropie (cap32 4.5) #61

Closed RetroandMusic closed 5 years ago

RetroandMusic commented 5 years ago

Since I upgraded the new version in retropie (cap32 4.5) it´s impossible to show the virtual keyboard with the pad, It´s a known issue or it´s only me?

DSkywalk commented 5 years ago

Thanks for your report, @RetroandMusic :+1:

RetroandMusic commented 5 years ago

I think the main problem is the hotkey in retropie, if you change that for anything different than "select" button, you can show the virtual keyboard pressing select + start. If you use select key for hotkey, obviously you exit from emulator when press both of them.

helppe commented 5 years ago

hello just 2 things

1 - how to do "change that for anything different than "select""? in my user 1 binds menu the select button is associated to rshift, i dont see any way to associate select to none.

2 - is there an updated documentation because here https://docs.libretro.com/library/caprice32/ it is written either the "y" button for vkeyboard or "select+down" but not select+start. so its hard to know that in fact it is the select+start combination.

thanks

crcerror commented 5 years ago

Same here caprice32-4.2 worked just fine with Y-button in 4.5 no chance...

A workaround is to change RETRO_DEVICE_ID_JOYPAD_SELECT toRETRO_DEVICE_ID_JOYPAD_R2 in sourcode retro_events.c


   if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT)) {
      ev_events_joy();
   } else {
      ev_process_joy(ID_PLAYER1);
   }

   ev_process_joy(ID_PLAYER2);
}

/**
 * ev_joy_vkeyboard:
 * joystick logic in GUI_MENU / GUI_VIRTUAL_KEYBOARD
 * WIP: VERY preliminar code - just remove GUI_VIRTUAL_KEYBOARD atm
 **/
void ev_joy_vkeyboard(){
   uint32_t pressed = 0;
   if ( (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
        && (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START)) ) {
      BIT_SET(pressed, 3);
      if(pressed != combo_last_event) {
         showkeyb=-showkeyb;
         combo_last_event = pressed;
      }
   } else {
      combo_last_event = 0;
   }
}

Then you can hold R2 and press START to bring VK_to screen

DSkywalk commented 5 years ago

I start my holidays tomorrow and this is the first problem I want to solve.

thanks @crcerror

crcerror commented 5 years ago

This is a bad solution! Best would be the old style by just pressing Y. I tried the SELECT and R2 button for example and this did not work anymore. I don't know why. I think you have to release the buttons somewhere.

I hope you'll find a solid solution. Enjoy your spare time

crcerror commented 5 years ago

@DSkywalk This one is better http://pasted.co/dd7ba0b2

--- retro_events.c.org  2019-07-15 19:23:25.324040442 +0000
+++ retro_events.c  2019-07-15 19:46:52.000000000 +0000
@@ -123,13 +123,13 @@ const retro_combo_event_t events_combo[M
 {
    { RETRO_DEVICE_ID_JOYPAD_B,
       { EVENT_WRITE, "CAT\n", NULL } },
-   { RETRO_DEVICE_ID_JOYPAD_Y,
-      { EVENT_WRITE, "|CPM\n", NULL } },
    { RETRO_DEVICE_ID_JOYPAD_A,
-      { EVENT_WRITE, "RUN\"DISK\nRUN\"DISC\n", NULL } },
+      { EVENT_WRITE, "RUN\"", NULL } },
    { RETRO_DEVICE_ID_JOYPAD_X,
-      { EVENT_WRITE, "|TAPE\nRUN\"\n^" } },
-   { RETRO_DEVICE_ID_JOYPAD_START,
+      { EVENT_WRITE, "|CPM\n", NULL } },
+   { RETRO_DEVICE_ID_JOYPAD_Y,
+      { EVENT_VKEYB, "VKEYB\n", NULL } },
+   { RETRO_DEVICE_ID_JOYPAD_SELECT,
       { EVENT_VKEYB, "VKEYB\n", NULL } },
    { RETRO_DEVICE_ID_JOYPAD_UP,
       { EVENT_WRITE, "1\nY\n", "PRESSED => 1/Y" } },
@@ -297,7 +297,7 @@ void ev_joysticks() {
       retro_computer_cfg.padcfg[ID_PLAYER1] != PADCFG_JOYSTICK)
          return;

-   if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT)) {
+   if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START)) {
       ev_events_joy();
    } else {
       ev_process_joy(ID_PLAYER1);
@@ -313,8 +313,8 @@ void ev_joysticks() {
  **/
 void ev_joy_vkeyboard(){
    uint32_t pressed = 0;
-   if ( (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
-        && (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START)) ) {
+   if ( (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT) && input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
+      || (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y)) ) {
       BIT_SET(pressed, 3);
       if(pressed != combo_last_event) {
          showkeyb=-showkeyb;

Hold Y and press START, VKB will show up it works with hold SELECT and press START (like old version)

Commands like |cpm .... works now with START button and don't interfere with retroarch now. Is this a solution so far you would accept?

Or you may turn back to old input?? like in 4.2???

DSkywalk commented 5 years ago

added new configurable combo key. I hope this helps while i finished the new gui :)

imagen

crcerror commented 5 years ago

@DSkywalk This works Thanks