void rarch_console_load_game_wrap(const char *path, unsigned extract_zip_mode, unsigned delay)
{
   const char *game_to_load;
   char first_file_inzip[PATH_MAX];
   char rom_path_temp[PATH_MAX];
   char dir_path_temp[PATH_MAX];
   struct retro_system_info info;
   bool block_zip_extract = false;
   bool extract_zip_cond = false;
   bool extract_zip_and_load_game_cond = false;
   bool load_game = !extract_zip_cond;

   retro_get_system_info(&info);
   block_zip_extract = info.block_extract;

   snprintf(rom_path_temp, sizeof(rom_path_temp), path);

#ifdef HAVE_ZLIB
   extract_zip_cond = (strstr(rom_path_temp, ".zip") || strstr(rom_path_temp, ".ZIP"))
   && !block_zip_extract;

   if(extract_zip_cond)
   {
      fill_pathname_basedir(dir_path_temp, rom_path_temp, sizeof(dir_path_temp));
      rarch_extract_zipfile(rom_path_temp, dir_path_temp, first_file_inzip, sizeof(first_file_inzip), extract_zip_mode);

      if(g_extern.console.rmenu.state.msg_info.enable)
         rarch_settings_msg(S_MSG_EXTRACTED_ZIPFILE, S_DELAY_180);
   }

   extract_zip_and_load_game_cond = (extract_zip_cond && 
   g_extern.file_state.zip_extract_mode == ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE);
   load_game = (extract_zip_and_load_game_cond) || (!extract_zip_cond);

   if(extract_zip_and_load_game_cond)
      game_to_load = first_file_inzip;
   else
#endif
      game_to_load = path;

   if(load_game)
   {
      rarch_console_load_game(game_to_load);

      if(g_extern.console.rmenu.state.msg_info.enable)
         rarch_settings_msg(S_MSG_LOADING_ROM, delay);
   }
}
Beispiel #2
0
void CMenuMain::ProcessInput()
{
   uint16_t input_state = 0;
   input_xinput.poll(NULL);

   static const struct retro_keybind *binds[MAX_PLAYERS] = {
      g_settings.input.binds[0],
      g_settings.input.binds[1],
      g_settings.input.binds[2],
      g_settings.input.binds[3],
      g_settings.input.binds[4],
      g_settings.input.binds[5],
      g_settings.input.binds[6],
      g_settings.input.binds[7],
   };

   for (unsigned i = 0; i < RARCH_FIRST_META_KEY; i++)
   {
      input_state |= input_xinput.input_state(NULL, binds, false,
         RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0;
   }

   uint16_t trigger_state = input_state & ~old_input_state;

   if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
   {
      if(m_romListSelectedRom < g_romList.GetRomListSize())
      {
         if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
	 {
            m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
	    m_romListSelectedRom++;
	    RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
	 }

         if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
	 {
            m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
	    m_romListSelectedRom++;
	    if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
               m_romListSelectedRom = g_romList.GetRomListSize() - 1;

	    RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);

	    if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1)
            {
               m_romListOffset++;
	       RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
	    }
	 }
      }
   }

   if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
   {
      if(m_romListSelectedRom > -1)
      {
         if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
	 {
            m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
	    m_romListSelectedRom--;
	    RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
	 }

         if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
	 {
            m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
	    m_romListSelectedRom--;
	    if(m_romListSelectedRom < 0)
               m_romListSelectedRom = 0;

	    RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);

	    if(m_romListSelectedRom > 0 && m_romListOffset > 0)
            {
               m_romListOffset--;
	       RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
	    }
	 }
      }
   }

   // Press A to launch, selected rom filename is saved into T:\\tmp.retro
   if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B) || trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
      rarch_console_load_game(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());

   if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
   {
      LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
      XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
   }
}
Beispiel #3
0
static void menu_loop(void)
{
    rarch_console_load_game("D:\\ssf2x.gba");
}