summaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e172d2ff4..1bae1489f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -175,21 +175,6 @@ void GMainWindow::ShowTelemetryCallout() {
const int GMainWindow::max_recent_files_item;
-static void InitializeLogging() {
- using namespace Common;
-
- Log::Filter log_filter;
- log_filter.ParseFilterString(Settings::values.log_filter.GetValue());
- Log::SetGlobalFilter(log_filter);
-
- const auto log_dir = FS::GetYuzuPath(FS::YuzuPath::LogDir);
- void(FS::CreateDir(log_dir));
- Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir / LOG_FILE));
-#ifdef _WIN32
- Log::AddBackend(std::make_unique<Log::DebuggerBackend>());
-#endif
-}
-
static void RemoveCachedContents() {
const auto cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir);
const auto offline_fonts = cache_dir / "fonts";
@@ -207,8 +192,6 @@ GMainWindow::GMainWindow()
: input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} {
- InitializeLogging();
-
LoadTranslation();
setAcceptDrops(true);
@@ -2513,7 +2496,7 @@ void GMainWindow::ShowFullscreen() {
ui.menubar->hide();
statusBar()->hide();
- if (Settings::values.fullscreen_mode.GetValue() == 1) {
+ if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
showFullScreen();
return;
}
@@ -2528,7 +2511,7 @@ void GMainWindow::ShowFullscreen() {
} else {
UISettings::values.renderwindow_geometry = render_window->saveGeometry();
- if (Settings::values.fullscreen_mode.GetValue() == 1) {
+ if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
render_window->showFullScreen();
return;
}
@@ -2545,7 +2528,7 @@ void GMainWindow::ShowFullscreen() {
void GMainWindow::HideFullscreen() {
if (ui.action_Single_Window_Mode->isChecked()) {
- if (Settings::values.fullscreen_mode.GetValue() == 1) {
+ if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
showNormal();
restoreGeometry(UISettings::values.geometry);
} else {
@@ -2559,7 +2542,7 @@ void GMainWindow::HideFullscreen() {
statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
ui.menubar->show();
} else {
- if (Settings::values.fullscreen_mode.GetValue() == 1) {
+ if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
render_window->showNormal();
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
} else {
@@ -2814,8 +2797,6 @@ void GMainWindow::OnToggleFilterBar() {
}
void GMainWindow::OnCaptureScreenshot() {
- OnPauseGame();
-
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
const auto screenshot_path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
@@ -2827,23 +2808,22 @@ void GMainWindow::OnCaptureScreenshot() {
.arg(date);
if (!Common::FS::CreateDir(screenshot_path.toStdString())) {
- OnStartGame();
return;
}
#ifdef _WIN32
if (UISettings::values.enable_screenshot_save_as) {
+ OnPauseGame();
filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename,
tr("PNG Image (*.png)"));
+ OnStartGame();
if (filename.isEmpty()) {
- OnStartGame();
return;
}
}
#endif
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(),
filename);
- OnStartGame();
}
// TODO: Written 2020-10-01: Remove per-game config migration code when it is irrelevant
@@ -3401,6 +3381,7 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
#endif
int main(int argc, char* argv[]) {
+ Common::Log::Initialize();
Common::DetachedTasks detached_tasks;
MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT({ MicroProfileShutdown(); });
@@ -3440,6 +3421,7 @@ int main(int argc, char* argv[]) {
// generating shaders
setlocale(LC_ALL, "C");
+ Core::System::InitializeGlobalInstance();
GMainWindow main_window;
// After settings have been loaded by GMainWindow, apply the filter
main_window.show();