(RARCH_CONSOLE) rarch_console_load_game created

This commit is contained in:
Twinaphex 2012-07-08 17:49:58 +02:00
parent 23904c4740
commit 2d237784b3
5 changed files with 14 additions and 15 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}