diff --git a/360/frontend-xdk/menu.cpp b/360/frontend-xdk/menu.cpp index 260e35f098..81e766a560 100644 --- a/360/frontend-xdk/menu.cpp +++ b/360/frontend-xdk/menu.cpp @@ -543,30 +543,22 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle if(hObjPressed == m_romlist) { int index = m_romlist.GetCurSel(); + const char *strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index)); if(path_file_exists(browser.current_dir.list->elems[index].data)) { + char path_tmp[1024]; struct retro_system_info info; retro_get_system_info(&info); bool block_zip_extract = info.block_extract; - const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t*)m_romlist.GetText(index)); + snprintf(path_tmp, sizeof(path_tmp), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract) - { - char path_tmp[1024]; - snprintf(path_tmp, sizeof(path_tmp), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); rarch_extract_zipfile(path_tmp); - } else - { - memset(g_console.rom_path, 0, sizeof(g_console.rom_path)); - snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); - rarch_settings_change(S_START_RARCH); - } + rarch_console_load_game(path_tmp); } else if(browser.current_dir.list->elems[index].attr.b) { - - const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index)); snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), strbuffer); filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle); } diff --git a/console/retroarch_console.c b/console/retroarch_console.c index 6f81f276c9..66d6d5a752 100644 --- a/console/retroarch_console.c +++ b/console/retroarch_console.c @@ -47,6 +47,12 @@ ROM EXTENSIONS ============================================================ */ +void rarch_console_load_game(const char *path) +{ + snprintf(g_console.rom_path, sizeof(g_console.rom_path), path); + rarch_settings_change(S_START_RARCH); +} + const char *rarch_console_get_rom_ext(void) { const char *retval = NULL; diff --git a/console/retroarch_console.h b/console/retroarch_console.h index 46d4f47fc3..5a0e161131 100644 --- a/console/retroarch_console.h +++ b/console/retroarch_console.h @@ -135,6 +135,8 @@ enum ROM EXTENSIONS ============================================================ */ +void rarch_console_load_game(const char *path); + // Get rom extensions for current library. // Returns NULL if library doesn't have any preferences in particular. const char *rarch_console_get_rom_ext(void); diff --git a/ps3/frontend/menu.c b/ps3/frontend/menu.c index c11839565a..218980bc95 100644 --- a/ps3/frontend/menu.c +++ b/ps3/frontend/menu.c @@ -1634,9 +1634,8 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac rarch_extract_zipfile(rom_path_temp); else { - snprintf(g_console.rom_path, sizeof(g_console.rom_path), filebrowser_get_current_path(filebrowser)); + rarch_console_load_game(filebrowser_get_current_path(filebrowser)); rarch_settings_msg(S_MSG_LOADING_ROM, S_DELAY_45); - rarch_settings_change(S_START_RARCH); } } break; diff --git a/wii/frontend/rgui.c b/wii/frontend/rgui.c index ebdec6ce65..be446ff4cf 100644 --- a/wii/frontend/rgui.c +++ b/wii/frontend/rgui.c @@ -328,7 +328,7 @@ const char *rgui_iterate(rgui_handle_t *rgui, rgui_action_t action) else { snprintf(rgui->path_buf, sizeof(rgui->path_buf), "%s/%s", dir, path); - strlcpy(g_console.rom_path, rgui->path_buf, sizeof(g_console.rom_path)); + rarch_console_load_game(rgui->path_buf); rarch_settings_msg(S_MSG_LOADING_ROM, S_DELAY_1); found = true; }