Merge pull request #1085 from waddlesplash/refactoring

Migrate global init stuff into UICommon.
This commit is contained in:
Lioncash
2014-10-05 21:25:44 -04:00
12 changed files with 170 additions and 60 deletions

View File

@ -3,6 +3,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
set(LIBS core
uicommon
${LZO}
${GTK2_LIBRARIES})

View File

@ -188,6 +188,9 @@
</ProjectReference>
<ProjectReference Include="$(CoreDir)InputCommon\InputCommon.vcxproj">
<Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)UICommon\UICommon.vcxproj">
<Project>{604C8368-F34A-4D55-82C8-CC92A0C13254}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\D3D\D3D.vcxproj">
<Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project>

View File

@ -52,6 +52,8 @@
#include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Debugger/JitWindow.h"
#include "UICommon/UICommon.h"
#include "VideoCommon/VideoBackendBase.h"
#if defined HAVE_X11 && HAVE_X11
@ -83,15 +85,6 @@
class wxFrame;
// Nvidia drivers >= v302 will check if the application exports a global
// variable named NvOptimusEnablement to know if it should run the app in high
// performance graphics mode or using the IGP.
#ifdef WIN32
extern "C" {
__declspec(dllexport) DWORD NvOptimusEnablement = 1;
}
#endif
// ------------
// Main window
@ -263,32 +256,8 @@ bool DolphinApp::OnInit()
}
#endif
// Copy initial Wii NAND data from Sys to User.
File::CopyDir(File::GetSysDirectory() + WII_USER_DIR DIR_SEP,
File::GetUserPath(D_WIIUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_USER_IDX));
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
File::CreateFullPath(File::GetUserPath(D_GAMESETTINGS_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
File::CreateFullPath(File::GetUserPath(D_MAPS_IDX));
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX));
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
File::CreateFullPath(File::GetUserPath(D_THEMES_IDX));
LogManager::Init();
SConfig::Init();
VideoBackend::PopulateList();
WiimoteReal::LoadSettings();
UICommon::CreateDirectories();
UICommon::Init();
if (selectVideoBackend && videoBackendName != wxEmptyString)
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend =
@ -307,8 +276,6 @@ bool DolphinApp::OnInit()
// Enable the PNG image handler for screenshots
wxImage::AddHandler(new wxPNGHandler);
SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
int x = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX;
int y = SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY;
int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth;
@ -451,10 +418,7 @@ void DolphinApp::OnEndSession(wxCloseEvent& event)
int DolphinApp::OnExit()
{
Core::Shutdown();
WiimoteReal::Shutdown();
VideoBackend::ClearList();
SConfig::Shutdown();
LogManager::Shutdown();
UICommon::Shutdown();
delete m_locale;

View File

@ -43,6 +43,8 @@
#include "DiscIO/Filesystem.h"
#include "DiscIO/VolumeCreator.h"
#include "UICommon/UICommon.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoBackendBase.h"
@ -360,21 +362,14 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
OSD::AddCallback(OSD::OSD_INIT, ButtonManager::Init);
OSD::AddCallback(OSD::OSD_SHUTDOWN, ButtonManager::Shutdown);
LogManager::Init();
SConfig::Init();
VideoBackend::PopulateList();
VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend);
WiimoteReal::LoadSettings();
UICommon::Init();
// No use running the loop when booting fails
if ( BootManager::BootCore( g_filename.c_str() ) )
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();
WiimoteReal::Shutdown();
VideoBackend::ClearList();
SConfig::Shutdown();
LogManager::Shutdown();
UICommon::Shutdown();
ANativeWindow_release(surf);
}

View File

@ -22,6 +22,8 @@
#include "Core/HW/Wiimote.h"
#include "Core/PowerPC/PowerPC.h"
#include "UICommon/UICommon.h"
#include "VideoCommon/VideoBackendBase.h"
static bool rendererHasFocus = true;
@ -347,12 +349,7 @@ int main(int argc, char* argv[])
return 1;
}
LogManager::Init();
SConfig::Init();
VideoBackend::PopulateList();
VideoBackend::ActivateBackend(SConfig::GetInstance().
m_LocalCoreStartupParameter.m_strVideoBackend);
WiimoteReal::LoadSettings();
UICommon::Init();
platform->Init();
@ -372,10 +369,7 @@ int main(int argc, char* argv[])
platform->Shutdown();
Core::Shutdown();
WiimoteReal::Shutdown();
VideoBackend::ClearList();
SConfig::Shutdown();
LogManager::Shutdown();
UICommon::Shutdown();
delete platform;