libretro / RetroArch

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

[Emscripten] failded to load content no cores available. #4246

Closed r-type closed 7 years ago

r-type commented 7 years ago

Since commit 4eaf011f244a8034c97ea14ef68217f64e74a1f0 , I can't load content on Emscripten core,it stuck with no core available.

capture du 2016-12-15 11-51-31

it's was working fine with the previous commit 6fd6329b4120788692d593d149aed519f4ea4787

capture du 2016-12-15 12-26-05

inactive123 commented 7 years ago

I can reproduce this yes. It must affect other statically linked RetroArch versions too.

It's as a result of the load_content branch that has been recently merged. Guess we need to figure out how to fix this again. It sucks how much of a pain in the ass statically linked RA remains to this day.

r-type commented 7 years ago

i don't understand very well RA code , but with statically emscripten Retroarch it seem to beak here in menu_displaylist.c
in case DISPLAYLIST_CORES_COLLECTION_SUPPORTED:

is there anyway to detect in code if it's a statically linked Retroach version ? to do something like

#if __STATICALLY_LINKED__

                     const char *core_name            = NULL;
                     struct retro_system_info *system = NULL;

                     menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
                           &system);

                     if (system)
                        core_name = system->library_name;
                  menu_entries_append_enum(info->list,
                        core_name,
                        core_name,
            MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE,
                        FILE_TYPE_DIRECT_LOAD,
                        0,
                        0);
string_list_free(cores_names);
break;
#endif
r-type commented 7 years ago

it's the patch used to fix Emscripten no cores available , i thinks it should work also on other statically linked RetroArch versions too.

@twinaphex take a look at , not sure it's the best way but at least it works for me.

diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c
index 21e7e47..3dbab4c 100644
--- a/menu/menu_displaylist.c
+++ b/menu/menu_displaylist.c
@@ -5724,12 +5724,34 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
                }
                else
                {
-                  menu_entries_append_enum(info->list,
-                        msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE),
-                        msg_hash_to_str(MENU_ENUM_LABEL_NO_CORES_AVAILABLE),
-                        MENU_ENUM_LABEL_NO_CORES_AVAILABLE,
-                        0, 0, 0);
-                  info->download_core = true;
+                  const char *core_name            = NULL;
+                  struct retro_system_info *system = NULL;
+
+         menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,&system);
+
+         if (system){
+
+                   core_name = system->library_name;
+
+               menu_entries_append_enum(info->list,
+                   core_name,
+                        core_name,
+           MENU_ENUM_LABEL_DETECT_CORE_LIST_OK_CURRENT_CORE,
+                        FILE_TYPE_DIRECT_LOAD,
+                        0,
+                        0);
+
+             }
+         else
+         {
+                   menu_entries_append_enum(info->list,
+                           msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE),
+                           msg_hash_to_str(MENU_ENUM_LABEL_NO_CORES_AVAILABLE),
+                           MENU_ENUM_LABEL_NO_CORES_AVAILABLE,
+                           0, 0, 0);
+                   info->download_core = true;
+         }
+
                }
             }
inactive123 commented 7 years ago

Hi, I'll test this out @r-type. Thanks very much for sharing it.

The way we detect statically linked RA is if HAVE_DYNAMIC is not defined. So we could maybe use that as an ifdef.

inactive123 commented 7 years ago

@r-type This fixed the issue for me on statically linked Linux -

https://github.com/libretro/RetroArch/commit/78c251f66b89329c1ee04c10b32b7ce26e4c4c85

Can you confirm if this works for you too on Emscripten?

r-type commented 7 years ago

it doesn't work for ermscripten , i thinks !path_is_empty(RARCH_PATH_CORE) is never meet on emscripten as RARCH_PATH_CORE is empty

inactive123 commented 7 years ago

OK, I'll add the code you suggested then.

inactive123 commented 7 years ago

Pushed this code - let me know if this works -

https://github.com/libretro/RetroArch/commit/e0166a5d6810315c9ad29721e27ccb6982262b47

r-type commented 7 years ago

yes it works with that! nice

BTW is there anyway the content load directly like before, as now when you have selected a content to load, you will have the core name print and you have to push input to load the content.

1pp

capture du 2016-12-16 12-17-00

2pp

r-type commented 7 years ago

fixed by e0166a5

inactive123 commented 7 years ago

@r-type Are you certain it's fixed? I'm trying to load it here -

https://buildbot.libretro.com/web/

And after I load a ROM I am just greeted with a black screen. I tried cleaning up the cache by pressing the 'Remove' button on the site, to no avail.

I'm trying this with the snes9x 2010 core.

r-type commented 7 years ago

i had test with buildbot gambatte core and your link, they works fine for me at least with mario.

edit: tested with snes2010 and same behaviour as you , but i didn't test this core before so not sure if it works normally. also tested mame0.179 and hatari , both works fine with emscripten and last patch

r-type commented 7 years ago

I've tested snes2010 with an old emscripten core (date 3 dec) and it's the same behavior , black screen. so the core is not working in emscripten at least from 3 dec , then not related to the last changes of content menu.