Ejemplo n.º 1
0
/**
 * Driver ownership - set this to true if the platform in question needs to 'own' 
 * the respective handle and therefore skip regular RetroArch 
 * driver teardown/reiniting procedure.
 *
 * If  to true, the 'free' function will get skipped. It is 
 * then up to the driver implementation to properly handle 
 * 'reiniting' inside the 'init' function and make sure it 
 * returns the existing handle instead of allocating and 
 * returning a pointer to a new handle.
 *
 * Typically, if a driver intends to make use of this, it should 
 * set this to true at the end of its 'init' function.
 **/
static void uninit_drivers(int flags)
{
#ifdef HAVE_MENU
   if (flags & DRIVER_MENU)
      menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
#endif

   if ((flags & DRIVER_LOCATION) && !location_driver_ctl(RARCH_LOCATION_CTL_OWNS_DRIVER, NULL))
      location_driver_ctl(RARCH_LOCATION_CTL_DEINIT, NULL);

   if ((flags & DRIVER_CAMERA) && !camera_driver_ctl(RARCH_CAMERA_CTL_OWNS_DRIVER, NULL))
      camera_driver_ctl(RARCH_CAMERA_CTL_DEINIT, NULL);

   if (flags & DRIVER_AUDIO)
      audio_driver_deinit();

   if (flags & DRIVERS_VIDEO_INPUT)
      video_driver_deinit();

   if ((flags & DRIVER_VIDEO) && !video_driver_owns_driver())
      video_driver_destroy_data();

   if ((flags & DRIVER_INPUT) && !input_driver_owns_driver())
      input_driver_destroy_data();

   if ((flags & DRIVER_AUDIO) && !audio_driver_owns_driver())
      audio_driver_destroy_data();
}
Ejemplo n.º 2
0
/**
 * Driver ownership - set this to true if the platform in question needs to 'own'
 * the respective handle and therefore skip regular RetroArch
 * driver teardown/reiniting procedure.
 *
 * If  to true, the 'free' function will get skipped. It is
 * then up to the driver implementation to properly handle
 * 'reiniting' inside the 'init' function and make sure it
 * returns the existing handle instead of allocating and
 * returning a pointer to a new handle.
 *
 * Typically, if a driver intends to make use of this, it should
 * set this to true at the end of its 'init' function.
 **/
void driver_uninit(int flags)
{
   core_info_deinit_list();
   core_info_free_current_core();

#ifdef HAVE_MENU
   if (flags & DRIVER_MENU_MASK)
      menu_driver_ctl(RARCH_MENU_CTL_DEINIT, NULL);
#endif

   if ((flags & DRIVER_LOCATION_MASK) && !location_driver_ctl(RARCH_LOCATION_CTL_OWNS_DRIVER, NULL))
      location_driver_ctl(RARCH_LOCATION_CTL_DEINIT, NULL);

   if ((flags & DRIVER_CAMERA_MASK) && !camera_driver_ctl(RARCH_CAMERA_CTL_OWNS_DRIVER, NULL))
      camera_driver_ctl(RARCH_CAMERA_CTL_DEINIT, NULL);

   if ((flags & DRIVER_WIFI_MASK) && !wifi_driver_ctl(RARCH_WIFI_CTL_OWNS_DRIVER, NULL))
      wifi_driver_ctl(RARCH_WIFI_CTL_DEINIT, NULL);

   if (flags & DRIVER_LED)
      led_driver_free();
   
   if (flags & DRIVERS_VIDEO_INPUT)
      video_driver_free();

   if (flags & DRIVER_AUDIO_MASK)
      audio_driver_deinit();

   if ((flags & DRIVER_VIDEO_MASK) && !video_driver_owns_driver())
      video_driver_destroy_data();

   if ((flags & DRIVER_INPUT_MASK) && !input_driver_owns_driver())
      input_driver_destroy_data();
   
   if ((flags & DRIVER_AUDIO_MASK) && !audio_driver_owns_driver())
      audio_driver_destroy_data();

   if (flags & DRIVER_MIDI_MASK)
      midi_driver_free();
}