summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/Main.cpp
blob: 12963caf592a684a0c58703bcd6f01857b287060 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include <QAbstractEventDispatcher>
#include <QApplication>

#include "Core/BootManager.h"
#include "Core/Core.h"
#include "DolphinQt2/Host.h"
#include "DolphinQt2/MainWindow.h"
#include "DolphinQt2/Resources.h"
#include "UICommon/UICommon.h"

int main(int argc, char* argv[])
{
	QApplication app(argc, argv);

	UICommon::SetUserDirectory("");
	UICommon::CreateDirectories();
	UICommon::Init();
	Resources::Init();

	// Whenever the event loop is about to go to sleep, dispatch the jobs
	// queued in the Core first.
	QObject::connect(QAbstractEventDispatcher::instance(),
	                 &QAbstractEventDispatcher::aboutToBlock,
	                 &app, &Core::HostDispatchJobs);

	MainWindow win;
	win.show();
	int retval = app.exec();

	BootManager::Stop();
	Core::Shutdown();
	UICommon::Shutdown();
	Host::GetInstance()->deleteLater();

	return retval;
}