summaryrefslogtreecommitdiff
path: root/src/citra
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra')
-rw-r--r--src/citra/citra.cpp23
-rw-r--r--src/citra/config.cpp8
-rw-r--r--src/citra/default_ini.h2
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp16
4 files changed, 29 insertions, 20 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index f2aeb510e..d6e8a4ec7 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -2,8 +2,13 @@
2// Licensed under GPLv2 2// Licensed under GPLv2
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <thread>
6
5#include "common/common.h" 7#include "common/common.h"
6#include "common/log_manager.h" 8#include "common/logging/text_formatter.h"
9#include "common/logging/backend.h"
10#include "common/logging/filter.h"
11#include "common/scope_exit.h"
7 12
8#include "core/settings.h" 13#include "core/settings.h"
9#include "core/system.h" 14#include "core/system.h"
@@ -15,17 +20,21 @@
15 20
16/// Application entry point 21/// Application entry point
17int __cdecl main(int argc, char **argv) { 22int __cdecl main(int argc, char **argv) {
18 LogManager::Init(); 23 std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
24 Log::Filter log_filter(Log::Level::Debug);
25 std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter);
26 SCOPE_EXIT({
27 logger->Close();
28 logging_thread.join();
29 });
19 30
20 if (argc < 2) { 31 if (argc < 2) {
21 ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified"); 32 LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
22 return -1; 33 return -1;
23 } 34 }
24 35
25 Config config; 36 Config config;
26 37 log_filter.ParseFilterString(Settings::values.log_filter);
27 if (!Settings::values.enable_log)
28 LogManager::Shutdown();
29 38
30 std::string boot_filename = argv[1]; 39 std::string boot_filename = argv[1];
31 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; 40 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
@@ -34,7 +43,7 @@ int __cdecl main(int argc, char **argv) {
34 43
35 Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); 44 Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
36 if (Loader::ResultStatus::Success != load_result) { 45 if (Loader::ResultStatus::Success != load_result) {
37 ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result); 46 LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
38 return -1; 47 return -1;
39 } 48 }
40 49
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 1f8f5922b..92764809e 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -22,17 +22,17 @@ Config::Config() {
22bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) { 22bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) {
23 if (config->ParseError() < 0) { 23 if (config->ParseError() < 0) {
24 if (retry) { 24 if (retry) {
25 ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location); 25 LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location);
26 FileUtil::CreateFullPath(location); 26 FileUtil::CreateFullPath(location);
27 FileUtil::WriteStringToFile(true, default_contents, location); 27 FileUtil::WriteStringToFile(true, default_contents, location);
28 *config = INIReader(location); // Reopen file 28 *config = INIReader(location); // Reopen file
29 29
30 return LoadINI(config, location, default_contents, false); 30 return LoadINI(config, location, default_contents, false);
31 } 31 }
32 ERROR_LOG(CONFIG, "Failed."); 32 LOG_ERROR(Config, "Failed.");
33 return false; 33 return false;
34 } 34 }
35 INFO_LOG(CONFIG, "Successfully loaded %s", location); 35 LOG_INFO(Config, "Successfully loaded %s", location);
36 return true; 36 return true;
37} 37}
38 38
@@ -64,7 +64,7 @@ void Config::ReadValues() {
64 Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); 64 Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
65 65
66 // Miscellaneous 66 // Miscellaneous
67 Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true); 67 Settings::values.log_filter = glfw_config->Get("Miscellaneous", "log_filter", "*:Info");
68} 68}
69 69
70void Config::Reload() { 70void Config::Reload() {
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index f1f626eed..7cf543e07 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -34,7 +34,7 @@ gpu_refresh_rate = ## 60 (default)
34use_virtual_sd = 34use_virtual_sd =
35 35
36[Miscellaneous] 36[Miscellaneous]
37enable_log = 37log_filter = *:Info ## Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
38)"; 38)";
39 39
40} 40}
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 982619126..929e09f43 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -36,15 +36,15 @@ const bool EmuWindow_GLFW::IsOpen() {
36} 36}
37 37
38void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) { 38void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) {
39 _dbg_assert_(GUI, width > 0); 39 _dbg_assert_(Frontend, width > 0);
40 _dbg_assert_(GUI, height > 0); 40 _dbg_assert_(Frontend, height > 0);
41 41
42 GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height)); 42 GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height));
43} 43}
44 44
45void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) { 45void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) {
46 _dbg_assert_(GUI, width > 0); 46 _dbg_assert_(Frontend, width > 0);
47 _dbg_assert_(GUI, height > 0); 47 _dbg_assert_(Frontend, height > 0);
48 48
49 // NOTE: GLFW provides no proper way to set a minimal window size. 49 // NOTE: GLFW provides no proper way to set a minimal window size.
50 // Hence, we just ignore the corresponding EmuWindow hint. 50 // Hence, we just ignore the corresponding EmuWindow hint.
@@ -59,12 +59,12 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
59 ReloadSetKeymaps(); 59 ReloadSetKeymaps();
60 60
61 glfwSetErrorCallback([](int error, const char *desc){ 61 glfwSetErrorCallback([](int error, const char *desc){
62 ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc); 62 LOG_ERROR(Frontend, "GLFW 0x%08x: %s", error, desc);
63 }); 63 });
64 64
65 // Initialize the window 65 // Initialize the window
66 if(glfwInit() != GL_TRUE) { 66 if(glfwInit() != GL_TRUE) {
67 ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting..."); 67 LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting...");
68 exit(1); 68 exit(1);
69 } 69 }
70 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 70 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -79,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
79 window_title.c_str(), nullptr, nullptr); 79 window_title.c_str(), nullptr, nullptr);
80 80
81 if (m_render_window == nullptr) { 81 if (m_render_window == nullptr) {
82 ERROR_LOG(GUI, "Failed to create GLFW window! Exiting..."); 82 LOG_CRITICAL(Frontend, "Failed to create GLFW window! Exiting...");
83 exit(1); 83 exit(1);
84 } 84 }
85 85
@@ -149,7 +149,7 @@ void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,u
149 std::pair<int,int> current_size; 149 std::pair<int,int> current_size;
150 glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second); 150 glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second);
151 151
152 _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0); 152 _dbg_assert_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
153 int new_width = std::max(current_size.first, (int)minimal_size.first); 153 int new_width = std::max(current_size.first, (int)minimal_size.first);
154 int new_height = std::max(current_size.second, (int)minimal_size.second); 154 int new_height = std::max(current_size.second, (int)minimal_size.second);
155 155