libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.26k stars 1.83k forks source link

In game GUI freezes on control info screen #1807

Closed joolswills closed 9 years ago

joolswills commented 9 years ago

Problem: Pressing the GUI hotkey on joypad brings up the in-game retroarch gui showing the control information but no inputs are accepted after that and it appears to be crashed/frozen. Cannot return to game etc.

Running version d2cd6a33cb9a7e46d38dbd13f70d1f471da9b7b6 on a rpi1.

compile options

./configure --disable-x11 --disable-oss --disable-pulse --enable-floathard

I've been bisecting this. I see a lot of changes have been ongoing in regards to the menu, so sorry if this is a known issue. Please let me know what further information I can provide to debug this further if needed.

There isn't a single commit where the menu breaks, but the behaviour changes in recent development.

4ba272202020eff6b496d50ed798fbf60f8c871c - Working - can navigate menu / exit and bring it back up again later

f23962ff3bd4f12f06b3cf4e3c7cb6dbe918a1bf - Works the first time - second time the INFO SCREEN is shown for the selected menu item, and navigation is frozen.

10e2949ad835dd3d218683457d1e0abb5f9a2327 - displays one time only - on second hotkey press, game freezes but no menu is displayed on the screen. but can return to game with hotkey press.

Somewhere between 10e2949ad835dd3d218683457d1e0abb5f9a2327 and d2cd6a33cb9a7e46d38dbd13f70d1f471da9b7b6 this changes again so that the menu stops working completely and freezes on the control information window.

This was reported by others users of retropie also.

joolswills commented 9 years ago

I bisected further between 10e2949 and d2cd6a3

The commit which changes the menu from working the first time, to not working at all (and freezing with just the Control Info dialog displayed (no main menu is displayed behind) is

commit 02b29e08addf1fa47ef94d2b9fa92a0b3da086f0 Author: twinaphex libretro@gmail.com Date: Sat May 16 17:27:16 2015 +0200

Move menu_do_refresh to rarch_main_data_iterate
inactive123 commented 9 years ago

@joolswills kivutar could maybe take a look since he has to test Lakka routinely on Rasperry Pi.

Can you come up with some kind of stack trace so that it is easier to narrow down what is going wrong?

heuripedes commented 9 years ago

@joolswills A verbose log file may help too.

joolswills commented 9 years ago

I will post a log - the problem is not so much a crash as some loop/stuck code. so no crash to log but i'll post. If having a pi would help I can fund that or post you one. Be easier to buy you a rpi2 if you would be willing to test/debug on it ?

I'll also try to trace through and find where it gets stuck.

in regards to getting you a rpi2 - please email me buzz [at] exotica.org.uk and I'll get it sorted. (If you are interested of course)

joolswills commented 9 years ago

here is a log

http://pastebin.com/S0YS43rZ

joolswills commented 9 years ago

If I launch retroarch with --menu it works, so it seems specifically when activating RGUI during emulation.

heuripedes commented 9 years ago

See if setting threaded_data_runloop_enable = "false" in your configuration helps it.

joolswills commented 9 years ago

Doesn't help I'm afraid.

heuripedes commented 9 years ago
joolswills commented 9 years ago

same behaviour with glui and xmb menus. xmb menu shows the main menu with the "Welcome to Retroach" dialog over it, but doesn't respond to any button / keyboard presses etc

Same with threaded video enabled and disabled.

Same using sdl audio instead of alsa.

retroarch.cfg

http://pastebin.com/m2fqPru9

Was playing "Sonic the hedgehog" on picodrive core. Will test loading the game from the GUI.

joypad config:

input_device = "USB,2-axis 8-button gamepad  "
input_driver = "udev"
input_up_axis = "-1"
input_right_axis = "+0"
input_state_slot_increase_axis = "+0"
input_down_axis = "+1"
input_left_axis = "-0"
input_state_slot_decrease_axis = "-0"
input_a_btn = "0"
input_b_btn = "1"
input_reset_btn = "1"
input_x_btn = "2"
input_menu_toggle_btn = "2"
input_y_btn = "3"
input_l_btn = "4"
input_load_state_btn = "4"
input_r_btn = "5"
input_save_state_btn = "5"
input_start_btn = "7"
input_exit_emulator_btn = "7"
input_select_btn = "6"
input_enable_hotkey_btn = "6"
joolswills commented 9 years ago

I did a ctrl+c from gdb while the gui was shown - had to try a few times to get a backtrace that wasn't in an external library - not sure if there is anything useful here though. Any help on debugging this further with gdb is welcome.

(gdb) backtrace full
#0  0x00059030 in rgui_render_messagebox () at menu/drivers/rgui.c:100
        bitmap_bin = '\000' <repeats 231 times>"\200, \020B\b \000\000J)\000\000\000\000\000\000\250\257\324W\000\000\200\370\342\350#\000\000\000\210\252\250\212\000\000\300\244dRt\000\000\204\020\000\000\000\000\000\210\b!\204 \b\000\202 \204\020\"\002\000\000\220\352*\001\000\000\000\020\362\t\001\000\000\000\000\000\000 \002\000\000\000\360\001\000\000\000\000\000\000\000 \000\000\020\"D\210\020\001\000\300\305Xct\000\000\200\030B\bq\000\000\300E\310D\370\000\000\300E\310`t\000\000\000\061\225>B\000\000\340\207\360`t\000\000\200\211\360bt\000\000\340C\204\b\021\000\000\300\305\350bt\000\000\300\305\350!2\000\000\000\000\002\000\001\000\000\000\000\002\000\021\000\000\000@6\030\004\000\000\000\200\017>\000\000\000\000\004\203M\000\000\000\300E\210\b \000\000\300\207\326z\360\000\000\200\020\245\\\214\000\000\340\305\370b|\000\000\300\305\020Bt\000\000\340\244\030c:\000\000\340\207\360B\370\000\000\340"...
        menu_ctx_rgui = {set_texture = 0x58954 <rgui_set_texture>, render_messagebox = 0x58dc8 <rgui_render_messagebox>, 
          render = 0x597ac <rgui_render>, frame = 0, init = 0x58990 <rgui_init>, free = 0x58904 <rgui_free>, 
          context_reset = 0, context_destroy = 0, populate_entries = 0x58c50 <rgui_populate_entries>, toggle = 0, 
          navigation_clear = 0x588e0 <rgui_navigation_clear>, navigation_decrement = 0, navigation_increment = 0, 
          navigation_set = 0x58824 <rgui_navigation_set>, navigation_set_last = 0x58b94 <rgui_navigation_set_last>, 
          navigation_descend_alphabet = 0x58ad8 <rgui_navigation_descend_alphabet>, 
          navigation_ascend_alphabet = 0x58d0c <rgui_navigation_ascend_alphabet>, list_insert = 0, list_free = 0, 
          list_clear = 0, list_cache = 0, list_get_selection = 0, list_get_size = 0, list_get_entry = 0, 
          list_set_selection = 0, bind_init = 0, load_image = 0, ident = 0xcb7b4 "rgui", perform_action = 0}
#1  0x00085e84 in action_iterate_main ()
No symbol table info available.
#2  0x00065fd8 in menu_entry_iterate ()
No symbol table info available.
#3  0x000233f0 in rarch_main_data_iterate () at runloop_data.c:275
        runloop = 0x16bbc0
        settings = 0xb6778008
#4  0x000144c4 in rarch_main (argc=6, argv=0xbefff774, data=0x0) at frontend/frontend.c:336
        args = 0x0
        ret = 1
        settings = 0xb6778008
        driver = 0x14b008
        __FUNCTION__ = "rarch_main"
#5  0x00014538 in main (argc=6, argv=0xbefff774) at frontend/frontend.c:348
No locals.
joolswills commented 9 years ago

If I apply the following change - a manual revert of 02b29e0, the gui works the first time. I am able to navigate it etc. It doesn't however work a second time (nothing is displayed, but the hotkey freezes the game) - as mentioned in the initial report.

diff --git a/menu/menu.c b/menu/menu.c
index 0fa2d44..19e3ba0 100644
--- a/menu/menu.c
+++ b/menu/menu.c
@@ -311,6 +311,9 @@ int menu_iterate(retro_input_t input,

    action = menu_input->joypad.state;

+   if (menu_entries_refresh(MENU_ACTION_REFRESH) == 0)
+      return 0;
+
    ret = menu_entry_iterate(action);

    if (menu_driver_alive() && !runloop->is_idle)
diff --git a/runloop_data.c b/runloop_data.c
index fe4a528..81ebc63 100644
--- a/runloop_data.c
+++ b/runloop_data.c
@@ -271,10 +271,6 @@ void rarch_main_data_iterate(void)
       data_runloop_msg[0] = '\0';
    }

-#ifdef HAVE_MENU
-   menu_entries_refresh(MENU_ACTION_REFRESH);
-#endif
-
 #ifdef HAVE_THREADS
    if (settings->menu.threaded_data_runloop_enable && runloop->alive)
       return;
`
joolswills commented 9 years ago

regarding running retroarch as standalone then loading the core / content, as soon as the game has started and RGUI is re-entered it will freeze. the GUI was fine before starting the content.

joolswills commented 9 years ago

I noticed that when it froze after re-entering RGUI when starting core/content from the GUI, the search dialog was shown. This used to cause a problem in the past - https://github.com/libretro/RetroArch/issues/1432 / https://github.com/libretro/RetroArch/issues/1428 - I made the following change and the GUI seems to be working as expected -

diff --git a/menu/menu_entry.c b/menu/menu_entry.c
index 66bb3ea..e6505b0 100644
--- a/menu/menu_entry.c
+++ b/menu/menu_entry.c
@@ -498,7 +498,7 @@ int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
          break;

       case MENU_ACTION_SEARCH:
-         menu_input_search_start();
+         //menu_input_search_start();
          break;

       case MENU_ACTION_SCAN:

so it looks as though the freeze could be due to this menu action being triggered when entering RGUI ? (Why the search action doesn't work I haven't looked into but it shouldnt be triggered just from pressing the RGUI hotkey right ?

joolswills commented 9 years ago

(so select + x is RGUI hotkey, and x brings up the search - seems it may be due to this combination that causes the problem - and the search dialog is triggered - although when activating RGUI from within a game there is no search dialog to be seen, but removing the menu_input_search_start does seem to solve it)

inactive123 commented 9 years ago

You should be able to close that search dialog now with the press of the B button on the gamepad now though.

joolswills commented 9 years ago

The search requester can now be closed with b. However there is still an issue with the search dialog being triggered when entering the gui if hotkey includes the X button. Currently when entering retroarch with select+x the info screen displays, no search dialog can be seen, but button B (1) is needed to be pressed first to back out of the invisible "search" dialog that has been triggered before button 0 can be used to close the dialog.

joolswills commented 9 years ago

There is still an issue with the search window being triggered as written above (unless it has been fixed in the last 9 days) - Do you want that in another ticket ?

andres-asm commented 9 years ago

I haven't seen this, you should check if it's still happening

joolswills commented 9 years ago

I can confirm it is still an issue. ill open a new ticket.