Refactor initial ROM history save.

Add menu_rom_history_push_current().
This commit is contained in:
Themaister 2013-05-17 18:33:16 +02:00
parent 50bd5bb4ff
commit 608f88bd55
3 changed files with 17 additions and 9 deletions

View File

@ -55,15 +55,7 @@ int main(int argc, char *argv[])
// 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);
}
menu_rom_history_push_current();
for (;;)
{

View File

@ -371,6 +371,21 @@ void menu_rom_history_push(const char *path,
rom_history_push(rgui->history, path, core_path, core_name);
}
void menu_rom_history_push_current(void)
{
// g_extern.fullpath can be relative here.
// Ensure we're pushing absolute path.
char tmp[PATH_MAX];
strlcpy(tmp, g_extern.fullpath, sizeof(tmp));
if (*tmp)
path_resolve_realpath(tmp, sizeof(tmp));
menu_rom_history_push(*tmp ? tmp : NULL,
g_settings.libretro,
g_extern.system.info.library_name);
}
void load_menu_game_prepare(void)
{
if (*g_extern.fullpath || rgui->load_no_rom)

View File

@ -284,6 +284,7 @@ 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);
void menu_rom_history_push_current(void);
#ifdef __cplusplus
}