Files
RetroArch/ai
libretroadmin 9fa38c20b8 ai/game_ai: fail gracefully when game_ai library is unavailable
game_ai_init() loaded the optional Game AI module with
dlopen("./libgame_ai.so") (or LoadLibrary on Windows) and then
retro_assert()'d the handle and every resolved symbol. retro_assert
aborts the process on failure, so on any build compiled with
--enable-game_ai where libgame_ai.so is not present next to the
binary, RetroArch aborts at startup with:

  Assertion failed at ai/game_ai.c:106.

This is what #18126 reports on the arm64 PPA build: the package was
built with Game AI enabled, the library is not shipped/located, and
the frontend aborts before the menu ever appears.

A missing optional, runtime-loaded module must never be fatal. Replace
the asserts with graceful failure: if the library or any required
symbol cannot be loaded, log a warning, release the handle, leave the
function pointers NULL and return. The Game AI globals all start NULL
and game_ai_input() already guards on a NULL state, so the feature
simply stays disabled.

Also fixes the Windows branch, which tested/asserted the undefined
'hinstLib' while actually assigning to 'g_lib_handle', and drops the
unused full_module_path/GetModuleFileNameA call.

Note: this does not change why the library is loaded on a given build
(that is the PPA's --enable-game_ai packaging decision); it only
ensures a missing library degrades gracefully instead of aborting.
2026-06-26 06:52:49 +02:00
..
2025-02-09 20:33:04 +01:00