(360) Put filebrowser on stack again - fixes crash at startup

in Gambatte
This commit is contained in:
twinaphex 2012-11-10 15:39:39 +01:00
parent e87477a75f
commit 6f2c6fcaa1

View File

@ -35,8 +35,8 @@
CRetroArch app;
HXUIOBJ hCur;
filebrowser_t *browser;
filebrowser_t *tmp_browser;
filebrowser_t browser;
filebrowser_t tmp_browser;
uint32_t set_shader = 0;
static const rmenu_context_t *context;
@ -160,10 +160,10 @@ HRESULT CRetroArchFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled
GetChildById(L"XuiBtnGameDir", &m_dir_game);
GetChildById(L"XuiBtnCacheDir", &m_dir_cache);
filebrowser_set_root_and_ext(browser, rarch_console_get_rom_ext(), g_extern.console.main_wrap.paths.default_rom_startup_dir);
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), g_extern.console.main_wrap.paths.default_rom_startup_dir);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(browser, action, &m_romlist, &m_rompathtitle);
filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle);
return 0;
}
@ -176,33 +176,33 @@ HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
{
int index = m_romlist.GetCurSel();
convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer));
if(path_file_exists(browser->current_dir.list->elems[index].data))
if(path_file_exists(browser.current_dir.list->elems[index].data))
{
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(browser), str_buffer);
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), str_buffer);
rarch_console_load_game_wrap(path, g_extern.file_state.zip_extract_mode, S_DELAY_45);
}
else if(browser->current_dir.list->elems[index].attr.b)
else if(browser.current_dir.list->elems[index].attr.b)
{
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(browser), str_buffer);
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), str_buffer);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_set_root_and_ext(browser, rarch_console_get_rom_ext(), path);
filebrowser_fetch_directory_entries(browser, action, &m_romlist, &m_rompathtitle);
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), path);
filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle);
}
}
else if (hObjPressed == m_dir_game)
{
filebrowser_set_root_and_ext(browser, rarch_console_get_rom_ext(), g_extern.console.main_wrap.paths.default_rom_startup_dir);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(browser, action, &m_romlist, &m_rompathtitle);
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), g_extern.console.main_wrap.paths.default_rom_startup_dir);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle);
}
#ifdef HAVE_HDD_CACHE_PARTITION
else if (hObjPressed == m_dir_cache)
{
filebrowser_set_root_and_ext(browser, rarch_console_get_rom_ext(), "cache:");
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(browser, action, &m_romlist, &m_rompathtitle);
if (g_extern.console.rmenu.state.msg_info.enable)
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), "cache:");
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle);
if (g_extern.console.rmenu.state.msg_info.enable)
rarch_settings_msg(S_MSG_CACHE_PARTITION, S_DELAY_180);
}
#endif
@ -844,9 +844,9 @@ HRESULT CRetroArchShaderBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandl
GetChildById(L"XuiBackButton1", &m_back);
GetChildById(L"XuiTxtRomPath", &m_shaderpathtitle);
filebrowser_set_root_and_ext(tmp_browser, "cg|CG", "game:\\media\\shaders");
filebrowser_set_root_and_ext(&tmp_browser, "cg|CG", "game:\\media\\shaders");
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(tmp_browser, action, &m_shaderlist, &m_shaderpathtitle);
filebrowser_fetch_directory_entries(&tmp_browser, action, &m_shaderlist, &m_shaderpathtitle);
return 0;
}
@ -858,31 +858,31 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
if(hObjPressed == m_shaderlist)
{
int index = m_shaderlist.GetCurSel();
if(path_file_exists(tmp_browser->current_dir.list->elems[index].data))
if(path_file_exists(tmp_browser.current_dir.list->elems[index].data))
{
convert_wchar_to_char(str_buffer, (const wchar_t *)m_shaderlist.GetText(index), sizeof(str_buffer));
switch(set_shader)
{
case 1:
snprintf(g_settings.video.cg_shader_path, sizeof(g_settings.video.cg_shader_path), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
snprintf(g_settings.video.cg_shader_path, sizeof(g_settings.video.cg_shader_path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
rarch_load_shader(set_shader, g_settings.video.cg_shader_path);
break;
case 2:
snprintf (g_settings.video.second_pass_shader, sizeof(g_settings.video.second_pass_shader), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
snprintf (g_settings.video.second_pass_shader, sizeof(g_settings.video.second_pass_shader), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
rarch_load_shader(set_shader, g_settings.video.second_pass_shader);
break;
default:
break;
}
}
else if(tmp_browser->current_dir.list->elems[index].attr.b)
else if(tmp_browser.current_dir.list->elems[index].attr.b)
{
convert_wchar_to_char(str_buffer, (const wchar_t *)m_shaderlist.GetText(index), sizeof(str_buffer));
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
filebrowser_set_root_and_ext(tmp_browser, "cg|CG", path);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(tmp_browser, action, &m_shaderlist, &m_shaderpathtitle);
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
filebrowser_set_root_and_ext(&tmp_browser, "cg|CG", path);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(&tmp_browser, action, &m_shaderlist, &m_shaderpathtitle);
}
}
@ -897,9 +897,9 @@ HRESULT CRetroArchCoreBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled
GetChildById(L"XuiBackButton1", &m_back);
GetChildById(L"XuiTxtRomPath", &m_rompathtitle);
filebrowser_set_root_and_ext(tmp_browser, "xex|XEX", "game:");
filebrowser_set_root_and_ext(&tmp_browser, "xex|XEX", "game:");
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(tmp_browser, action, &m_romlist, &m_rompathtitle);
filebrowser_fetch_directory_entries(&tmp_browser, action, &m_romlist, &m_rompathtitle);
return 0;
}
@ -912,17 +912,17 @@ HRESULT CRetroArchCoreBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandle
{
int index = m_romlist.GetCurSel();
convert_wchar_to_char(str_buffer, (const wchar_t *)m_romlist.GetText(index), sizeof(str_buffer));
if(path_file_exists(tmp_browser->current_dir.list->elems[index].data))
if(path_file_exists(tmp_browser.current_dir.list->elems[index].data))
{
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
snprintf(g_extern.console.external_launch.launch_app, sizeof(g_extern.console.external_launch.launch_app), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
rarch_settings_change(S_RETURN_TO_LAUNCHER);
}
else if(tmp_browser->current_dir.list->elems[index].attr.b)
else if(tmp_browser.current_dir.list->elems[index].attr.b)
{
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(tmp_browser), str_buffer);
filebrowser_set_root_and_ext(tmp_browser, "xex|XEX", path);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(tmp_browser, action, &m_romlist, &m_rompathtitle);
snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), str_buffer);
filebrowser_set_root_and_ext(&tmp_browser, "xex|XEX", path);
uint64_t action = (1 << RMENU_DEVICE_NAV_B);
filebrowser_fetch_directory_entries(&tmp_browser, action, &m_romlist, &m_rompathtitle);
}
}
@ -1081,17 +1081,13 @@ void menu_init (void)
hCur = app.hMainScene;
XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS);
browser = (filebrowser_t*)malloc(1 * sizeof(filebrowser_t));
tmp_browser = (filebrowser_t*)malloc(1 * sizeof(filebrowser_t));
filebrowser_new(browser, g_extern.console.main_wrap.paths.default_rom_startup_dir, rarch_console_get_rom_ext());
filebrowser_new(&browser, g_extern.console.main_wrap.paths.default_rom_startup_dir, rarch_console_get_rom_ext());
}
void menu_free (void)
{
filebrowser_free(browser);
filebrowser_free(tmp_browser);
free(browser);
free(tmp_browser);
filebrowser_free(&browser);
filebrowser_free(&tmp_browser);
app.Uninit();
}