(360) Works now too with refactored filebrowser code

This commit is contained in:
TwinAphex51224 2012-06-18 06:12:37 +02:00
parent 805ca7e027
commit 21a344e61b
2 changed files with 12 additions and 9 deletions

View File

@ -73,7 +73,9 @@ static void filebrowser_fetch_directory_entries(const char *path, filebrowser_t
romlist->InsertItems(0, browser->current_dir.size);
for(unsigned i = 0; i < browser->current_dir.size; i++)
{
rarch_convert_char_to_wchar(strw_buffer, browser->current_dir.files[i].d_name, sizeof(strw_buffer));
char fname_tmp[256];
fill_pathname_base(fname_tmp, browser->current_dir.elems[i], sizeof(fname_tmp));
rarch_convert_char_to_wchar(strw_buffer, fname_tmp, sizeof(strw_buffer));
romlist->SetText(i, strw_buffer);
}
}
@ -524,13 +526,12 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
if(hObjPressed == m_romlist)
{
int index = m_romlist.GetCurSel();
if(browser.current_dir.files[index].d_type != FILE_ATTRIBUTE_DIRECTORY)
if(path_file_exists(browser.current_dir.elems[index]))
{
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));
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t*)m_romlist.GetText(index));
if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract)
{
@ -545,7 +546,7 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
rarch_settings_change(S_START_RARCH);
}
}
else if(browser.current_dir.files[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
else if(path_is_directory(browser.current_dir.elems[index]))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
@ -578,7 +579,7 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
if(hObjPressed == m_shaderlist)
{
int index = m_shaderlist.GetCurSel();
if(tmp_browser.current_dir.files[index].d_type != FILE_ATTRIBUTE_DIRECTORY)
if(path_file_exists(tmp_browser.current_dir.elems[index]))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_shaderlist.GetText(index));
@ -599,7 +600,7 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
if (g_console.info_msg_enable)
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
}
else if(tmp_browser.current_dir.files[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
else if(path_is_directory(tmp_browser.current_dir.elems[index]))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_shaderlist.GetText(index));
snprintf(path, sizeof(path), "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmp_browser), strbuffer);
@ -619,13 +620,13 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
if(hObjPressed == m_romlist)
{
int index = m_romlist.GetCurSel();
if(tmp_browser.current_dir.files[index].d_type != FILE_ATTRIBUTE_DIRECTORY)
if(path_file_exists(tmp_browser.current_dir.elems[index]))
{
const char * strbuffer = rarch_convert_wchar_to_const_char((const wchar_t *)m_romlist.GetText(index));
snprintf(g_console.launch_app_on_exit, sizeof(g_console.launch_app_on_exit), "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(tmp_browser), strbuffer);
rarch_settings_change(S_RETURN_TO_LAUNCHER);
}
else if(tmp_browser.current_dir.files[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
else if(path_is_directory(tmp_browser.current_dir.elems[index]))
{
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_DIRECTORY_NAME(tmp_browser), strbuffer);

View File

@ -214,8 +214,10 @@ char **dir_list_new(const char *dir, const char *ext, bool include_dirs)
if (!include_dirs && path_is_directory(name))
continue;
#ifndef _XBOX
if (!path_is_directory(name) && !string_list_find_elem(ext_list, file_ext))
continue;
#endif
char file_path[PATH_MAX];
snprintf(file_path, sizeof(file_path), "%s\\%s", dir, name);