diff --git a/frontend/frontend.c b/frontend/frontend.c index c3d04b158c..c6bc35299e 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -52,6 +52,19 @@ int main(int argc, char *argv[]) menu_init(); g_extern.lifecycle_mode_state |= 1ULL << MODE_GAME; + // If we started a ROM directly from command line, + // push it to ROM history. + if (!g_extern.libretro_dummy) + { + // g_extern.fullpath can be relative here. + if (*g_extern.fullpath) + path_resolve_realpath(g_extern.fullpath, sizeof(g_extern.fullpath)); + + menu_rom_history_push(*g_extern.fullpath ? g_extern.fullpath : NULL, + g_settings.libretro, + g_extern.system.info.library_name); + } + for (;;) { if (g_extern.system.shutdown) diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 6fa61f49df..84ca48a36b 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -363,6 +363,14 @@ void rgui_list_get_last(const rgui_list_t *list, #endif +void menu_rom_history_push(const char *path, + const char *core_path, + const char *core_name) +{ + if (rgui->history) + rom_history_push(rgui->history, path, core_path, core_name); +} + void load_menu_game_prepare(void) { if (*g_extern.fullpath || rgui->load_no_rom) @@ -378,13 +386,9 @@ void load_menu_game_prepare(void) msg_queue_push(g_extern.msg_queue, str, 1, 1); } - if (rgui->history) - { - rom_history_push(rgui->history, - *g_extern.fullpath ? g_extern.fullpath : NULL, - g_settings.libretro, - rgui->info.library_name); - } + menu_rom_history_push(*g_extern.fullpath ? g_extern.fullpath : NULL, + g_settings.libretro, + rgui->info.library_name); } #ifdef HAVE_RGUI diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index 4256fd0865..123329874d 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -282,6 +282,8 @@ void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, boo void load_menu_game_prepare(void); bool load_menu_game(void); void load_menu_game_history(unsigned game_index); +void menu_rom_history_push(const char *path, const char *core_path, + const char *core_name); #ifdef __cplusplus }