Esempio n. 1
0
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
   char path[MAX_PATH_LENGTH];

   if(hObjPressed == m_romlist)
   {
      int index = m_romlist.GetCurSel();
      if(browser.cur[index].d_type != FILE_ATTRIBUTE_DIRECTORY)
      {
         struct retro_system_info info;
	 retro_get_system_info(&info);
	 bool block_zip_extract  = info.block_extract;
         memset(strbuffer, 0, sizeof(strbuffer));
	 wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer));
	 if((strstr(strbuffer, ".zip") || strstr(strbuffer, ".ZIP")) && !block_zip_extract)
	 {
            char path_tmp[1024];
	    sprintf(path_tmp, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
	    rarch_extract_zipfile(path_tmp);
	 }
	 else
	 {
            memset(g_console.rom_path, 0, sizeof(g_console.rom_path));
	    sprintf(g_console.rom_path, "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
	    return_to_game();
	    g_console.initialize_rarch_enable = 1;
	 }
      }
      else if(browser.cur[index].d_type == FILE_ATTRIBUTE_DIRECTORY)
      {
         memset(strbuffer, 0, sizeof(strbuffer));
	 wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer));
	 snprintf(path, sizeof(path), "%s\\%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), strbuffer);
	 filebrowser_fetch_directory_entries(path, &browser, &m_romlist, &m_rompathtitle);
      }
   }
   else if (hObjPressed == m_dir_game)
   {
      filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());
      filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);
   }
   else if (hObjPressed == m_dir_cache)
   {
      filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext());
      filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle);
   }
   else if(hObjPressed == m_back)
      NavigateBack(app.hMainScene);

   bHandled = TRUE;

   return S_OK;
}
Esempio n. 2
0
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
   char path[PATH_MAX];

   if(hObjPressed == m_romlist)
   {
      int index = m_romlist.GetCurSel();
      if(path_file_exists(browser.current_dir.list->elems[index].data))
      {
         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));

         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);
         }
      }
      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);
      }
   }
   else if (hObjPressed == m_dir_game)
   {
      filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());
      filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);
   }
   else if (hObjPressed == m_dir_cache)
   {
      filebrowser_new(&browser, "cache:", rarch_console_get_rom_ext());
      filebrowser_fetch_directory_entries("cache:", &browser, &m_romlist, &m_rompathtitle);
      if (g_console.info_msg_enable)
         rarch_settings_msg(S_MSG_CACHE_PARTITION, S_DELAY_180);
   }

   bHandled = TRUE;

   return 0;
}
Esempio n. 3
0
HRESULT CRetroArchFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
{
   char path[PATH_MAX];

   if(hObjPressed == m_romlist)
   {
      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))
      {
         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)
      {
         snprintf(path, sizeof(path), "%s\\%s", filebrowser_get_current_dir(&browser), str_buffer);
         uint64_t action = (1ULL << 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);
      }
   }
   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 = (1ULL << 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 = (1ULL << 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

   bHandled = TRUE;

   return 0;
}
Esempio n. 4
0
HRESULT CRetroArchFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
   GetChildById(L"XuiRomList", &m_romlist);
   GetChildById(L"XuiBackButton1", &m_back);
   GetChildById(L"XuiTxtRomPath", &m_rompathtitle);
   GetChildById(L"XuiBtnGameDir", &m_dir_game);
   GetChildById(L"XuiBtnCacheDir", &m_dir_cache);

   filebrowser_set_root(&browser, g_console.default_rom_startup_dir);
   strlcpy(tmp_browser.extensions, rarch_console_get_rom_ext(), sizeof(tmp_browser.extensions));
   filebrowser_fetch_directory_entries(g_console.default_rom_startup_dir, &browser, &m_romlist, &m_rompathtitle);

   return 0;
}
Esempio n. 5
0
HRESULT CRetroArchFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
{
   GetChildById(L"XuiRomList", &m_romlist);
   GetChildById(L"XuiBackButton1", &m_back);
   GetChildById(L"XuiTxtRomPath", &m_rompathtitle);
   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);

   uint64_t action = (1ULL << RMENU_DEVICE_NAV_B);
   filebrowser_fetch_directory_entries(&browser, action, &m_romlist, &m_rompathtitle);

   return 0;
}
Esempio n. 6
0
int menu_init (void)
{
   HRESULT hr;

   xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;

   bool hdmenus_allowed = g_console.menus_hd_enable;

   hr = app.InitShared(vid->d3d_render_device, &vid->d3dpp, XuiPNGTextureLoader);

   if (hr < 0)
   {
      RARCH_ERR("Failed initializing XUI application.\n");
      return 1;
   }

   /* Register font */
   hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/rarch.ttf" );
   if (hr < 0)
   {
      RARCH_ERR("Failed to register default typeface.\n");
      return 1;
   }

   hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur");
   if (hr < 0)
   {
      RARCH_ERR("Failed to load skin.\n");
      return 1;
   }

   hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene);
   if (hr < 0)
   {
      RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n");
      return 1;
   }

   hCur = app.hMainScene;
   XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS);

   filebrowser_new(&browser, g_console.default_rom_startup_dir, rarch_console_get_rom_ext());

   return 0;
}
Esempio n. 7
0
void menu_init (void)
{
   HRESULT hr;

   xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;

   bool hdmenus_allowed = g_extern.console.rmenu.state.rmenu_hd.enable;

   D3DPRESENT_PARAMETERS d3dpp;
   video_info_t video_info = {0};

   video_info.vsync = g_settings.video.vsync;
   video_info.force_aspect = false;
   video_info.smooth = g_settings.video.smooth;
   video_info.input_scale = 2;
   video_info.fullscreen = true;
   video_info.rgb32 = false;

   xdk_d3d_generate_pp(&d3dpp, &video_info);

   hr = app.InitShared(device_ptr->d3d_render_device, &d3dpp, XuiPNGTextureLoader);

   if (hr < 0)
   {
      RARCH_ERR("Failed initializing XUI application.\n");
      return;
   }

   /* Register font */
   hr = app.RegisterDefaultTypeface(L"Arial Unicode MS", L"file://game:/media/rarch.ttf" );
   if (hr < 0)
   {
      RARCH_ERR("Failed to register default typeface.\n");
      return;
   }

   hr = app.LoadSkin( L"file://game:/media/rarch_scene_skin.xur");
   if (hr < 0)
   {
      RARCH_ERR("Failed to load skin.\n");
      return;
   }

   hr = XuiSceneCreate(hdmenus_allowed ? L"file://game:/media/hd/" : L"file://game:/media/sd/", L"rarch_main.xur", NULL, &app.hMainScene);
   if (hr < 0)
   {
      RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n");
      return;
   }

   hCur = app.hMainScene;
   XuiSceneNavigateFirst(app.GetRootObj(), app.hMainScene, XUSER_INDEX_FOCUS);

   filebrowser_new(&browser, g_extern.console.main_wrap.paths.default_rom_startup_dir, rarch_console_get_rom_ext());
}
Esempio n. 8
0
static bool folder_cb(const char *directory, rgui_file_enum_cb_t file_cb,
      void *userdata, void *ctx)
{
   bool core_chooser = (userdata) ? *(rgui_file_type_t *)userdata == RGUI_SETTINGS_CORE : false;

   if (!*directory)
   {
#ifdef HW_RVL
      file_cb(ctx, "sd:", RGUI_FILE_DEVICE, 0);
      file_cb(ctx, "usb:", RGUI_FILE_DEVICE, 0);
#endif
      file_cb(ctx, "carda:", RGUI_FILE_DEVICE, 0);
      file_cb(ctx, "cardb:", RGUI_FILE_DEVICE, 0);
      return true;
   }

#ifdef HW_RVL
   LWP_MutexLock(gx_device_mutex);
   int dev = gx_get_device_from_path(directory);

   if (dev != -1 && !gx_devices[dev].mounted && gx_devices[dev].interface->isInserted())
      fatMountSimple(gx_devices[dev].name, gx_devices[dev].interface);

   LWP_MutexUnlock(gx_device_mutex);
#endif

   char exts[256];
   if (core_chooser)
      strlcpy(exts, "dol|DOL", sizeof(exts));
   else
      strlcpy(exts, rarch_console_get_rom_ext(), sizeof(exts));
   struct string_list *ext_list = string_split(exts, "|");

   char _dir[PATH_MAX];
   snprintf(_dir, sizeof(_dir), "%s/", directory);
   DIR *dir = opendir(_dir);
   if (!dir)
      return false;

   struct dirent *entry;
   while ((entry = readdir(dir)))
   {
      char stat_path[PATH_MAX];
      const char *file_ext = path_get_extension(entry->d_name);
      snprintf(stat_path, sizeof(stat_path), "%s/%s", directory, entry->d_name);
      bool is_dir;

#ifdef _DIRENT_HAVE_D_TYPE
      is_dir = (entry->d_type == DT_DIR);
      if (entry->d_type != DT_REG && !is_dir)
         continue;
#else
      struct stat st;
      if (stat(stat_path, &st) < 0)
         continue;

      is_dir = S_ISDIR(st.st_mode);
      if (!S_ISREG(st.st_mode) && !is_dir)
         continue;
#endif

      if (core_chooser && (is_dir || strcasecmp(entry->d_name, default_paths.salamander_file) == 0))
         continue;

      if (!is_dir && ext_list && !string_list_find_elem_prefix(ext_list, ".", file_ext))
         continue;

      file_cb(ctx,
            entry->d_name,
            is_dir ? RGUI_FILE_DIRECTORY : RGUI_FILE_PLAIN, 0);
   }

   closedir(dir);
   string_list_free(ext_list);
   return true;
}