Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

libxbmc: re-arrange Create() in preparation to move the gui setup out

  • Loading branch information...
commit 9ad6f4e67fb10de458e97e16c837afa68d883191 1 parent bc14f0c
theuni authored

Showing 1 changed file with 70 additions and 71 deletions. Show diff stats Hide diff stats

  1. +70 71 xbmc/Application.cpp
141 xbmc/Application.cpp
@@ -554,9 +554,6 @@ bool CApplication::Create()
554 554 {
555 555 g_settings.Initialize(); //Initialize default AdvancedSettings
556 556
557   - m_bSystemScreenSaverEnable = g_Windowing.IsSystemScreenSaverEnabled();
558   - g_Windowing.EnableSystemScreenSaver(false);
559   -
560 557 #ifdef _LINUX
561 558 tzset(); // Initialize timezone information variables
562 559 #endif
@@ -595,6 +592,9 @@ bool CApplication::Create()
595 592 return false;
596 593 }
597 594
  595 + // Init our DllLoaders emu env
  596 + init_emu_environ();
  597 +
598 598 g_settings.LoadProfiles(PROFILES_FILE);
599 599
600 600 CLog::Log(LOGNOTICE, "-----------------------------------------------------------------------");
@@ -642,54 +642,6 @@ bool CApplication::Create()
642 642 g_xrandr.LoadCustomModeLinesToAllOutputs();
643 643 #endif
644 644
645   - // Init our DllLoaders emu env
646   - init_emu_environ();
647   -
648   -
649   -#ifdef HAS_SDL
650   - CLog::Log(LOGNOTICE, "Setup SDL");
651   -
652   - /* Clean up on exit, exit on window close and interrupt */
653   - atexit(SDL_Quit);
654   -
655   - uint32_t sdlFlags = 0;
656   -
657   -#if defined(HAS_SDL_OPENGL) || (HAS_GLES == 2)
658   - sdlFlags |= SDL_INIT_VIDEO;
659   -#endif
660   -
661   -#if defined(HAS_SDL_JOYSTICK) && !defined(TARGET_WINDOWS)
662   - sdlFlags |= SDL_INIT_JOYSTICK;
663   -#endif
664   -
665   - //depending on how it's compiled, SDL periodically calls XResetScreenSaver when it's fullscreen
666   - //this might bring the monitor out of standby, so we have to disable it explicitly
667   - //by passing 0 for overwrite to setsenv, the user can still override this by setting the environment variable
668   -#if defined(_LINUX) && !defined(TARGET_DARWIN)
669   - setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
670   -#endif
671   -
672   -#endif // HAS_SDL
673   -
674   -#ifdef _LINUX
675   - // for nvidia cards - vsync currently ALWAYS enabled.
676   - // the reason is that after screen has been setup changing this env var will make no difference.
677   - setenv("__GL_SYNC_TO_VBLANK", "1", 0);
678   - setenv("__GL_YIELD", "USLEEP", 0);
679   -#endif
680   -
681   -#ifdef HAS_SDL
682   - if (SDL_Init(sdlFlags) != 0)
683   - {
684   - CLog::Log(LOGFATAL, "XBAppEx: Unable to initialize SDL: %s", SDL_GetError());
685   - return false;
686   - }
687   - #if defined(TARGET_DARWIN)
688   - // SDL_Init will install a handler for segfaults, restore the default handler.
689   - signal(SIGSEGV, SIG_DFL);
690   - #endif
691   -#endif
692   -
693 645 // for python scripts that check the OS
694 646 #if defined(TARGET_DARWIN)
695 647 setenv("OS","OS X",true);
@@ -699,15 +651,6 @@ bool CApplication::Create()
699 651 SetEnvironmentVariable("OS","win32");
700 652 #endif
701 653
702   - // Initialize core peripheral port support. Note: If these parameters
703   - // are 0 and NULL, respectively, then the default number and types of
704   - // controllers will be initialized.
705   - if (!g_Windowing.InitWindowSystem())
706   - {
707   - CLog::Log(LOGFATAL, "CApplication::Create: Unable to init windowing system");
708   - return false;
709   - }
710   -
711 654 g_powerManager.Initialize();
712 655
713 656 // Load the AudioEngine before settings as they need to query the engine
@@ -790,6 +733,73 @@ bool CApplication::Create()
790 733 XBMCHelper::GetInstance().Configure();
791 734 #endif
792 735
  736 + CUtil::InitRandomSeed();
  737 +
  738 +#ifdef HAS_SDL_JOYSTICK
  739 + g_Joystick.Initialize();
  740 +#endif
  741 +
  742 + g_mediaManager.Initialize();
  743 +
  744 + m_lastFrameTime = XbmcThreads::SystemClockMillis();
  745 + m_lastRenderTime = m_lastFrameTime;
  746 +#ifdef HAS_SDL
  747 + CLog::Log(LOGNOTICE, "Setup SDL");
  748 +
  749 + /* Clean up on exit, exit on window close and interrupt */
  750 + atexit(SDL_Quit);
  751 +
  752 + uint32_t sdlFlags = 0;
  753 +
  754 +#if defined(HAS_SDL_OPENGL) || (HAS_GLES == 2)
  755 + sdlFlags |= SDL_INIT_VIDEO;
  756 +#endif
  757 +
  758 +#if defined(HAS_SDL_JOYSTICK) && !defined(TARGET_WINDOWS)
  759 + sdlFlags |= SDL_INIT_JOYSTICK;
  760 +#endif
  761 +
  762 + //depending on how it's compiled, SDL periodically calls XResetScreenSaver when it's fullscreen
  763 + //this might bring the monitor out of standby, so we have to disable it explicitly
  764 + //by passing 0 for overwrite to setsenv, the user can still override this by setting the environment variable
  765 +#if defined(_LINUX) && !defined(TARGET_DARWIN)
  766 + setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
  767 +#endif
  768 +
  769 +#endif // HAS_SDL
  770 +
  771 +#ifdef _LINUX
  772 + // for nvidia cards - vsync currently ALWAYS enabled.
  773 + // the reason is that after screen has been setup changing this env var will make no difference.
  774 + setenv("__GL_SYNC_TO_VBLANK", "1", 0);
  775 + setenv("__GL_YIELD", "USLEEP", 0);
  776 +#endif
  777 +
  778 +
  779 + m_bSystemScreenSaverEnable = g_Windowing.IsSystemScreenSaverEnabled();
  780 + g_Windowing.EnableSystemScreenSaver(false);
  781 +
  782 +#ifdef HAS_SDL
  783 + if (SDL_Init(sdlFlags) != 0)
  784 + {
  785 + CLog::Log(LOGFATAL, "XBAppEx: Unable to initialize SDL: %s", SDL_GetError());
  786 + return false;
  787 + }
  788 + #if defined(TARGET_DARWIN)
  789 + // SDL_Init will install a handler for segfaults, restore the default handler.
  790 + signal(SIGSEGV, SIG_DFL);
  791 + #endif
  792 +#endif
  793 +
  794 + // Initialize core peripheral port support. Note: If these parameters
  795 + // are 0 and NULL, respectively, then the default number and types of
  796 + // controllers will be initialized.
  797 + if (!g_Windowing.InitWindowSystem())
  798 + {
  799 + CLog::Log(LOGFATAL, "CApplication::Create: Unable to init windowing system");
  800 + return false;
  801 + }
  802 +
793 803 // update the window resolution
794 804 g_Windowing.SetWindowResolution(g_guiSettings.GetInt("window.width"), g_guiSettings.GetInt("window.height"));
795 805
@@ -858,17 +868,6 @@ bool CApplication::Create()
858 868 g_settings.m_ResInfo[iResolution].strMode.c_str());
859 869 g_windowManager.Initialize();
860 870
861   - CUtil::InitRandomSeed();
862   -
863   -#ifdef HAS_SDL_JOYSTICK
864   - g_Joystick.Initialize();
865   -#endif
866   -
867   - g_mediaManager.Initialize();
868   -
869   - m_lastFrameTime = XbmcThreads::SystemClockMillis();
870   - m_lastRenderTime = m_lastFrameTime;
871   -
872 871 return Initialize();
873 872 }
874 873

0 comments on commit 9ad6f4e

Please sign in to comment.
Something went wrong with that request. Please try again.