aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/citra
diff options
context:
space:
mode:
authorGravatar darkf <lw9k123@gmail.com>2014-12-29 19:47:41 -0800
committerGravatar darkf <lw9k123@gmail.com>2014-12-29 19:47:41 -0800
commit8ba9ac0f74abb0408a26207a76a0c1808bad8de0 (patch)
treef1c7c3393fa726435b5b90bf335567c93e528ef1 /src/citra
parenta19354acedbfeafd28219c48a1ec32f76dd17a54 (diff)
parent3d14eb285382740b144e5b047cb2ad072f6129ea (diff)
Fix merge conflicts
Diffstat (limited to 'src/citra')
-rw-r--r--src/citra/CMakeLists.txt14
-rw-r--r--src/citra/citra.cpp25
-rw-r--r--src/citra/config.cpp30
-rw-r--r--src/citra/config.h7
-rw-r--r--src/citra/default_ini.h7
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp26
-rw-r--r--src/citra/emu_window/emu_window_glfw.h2
7 files changed, 58 insertions, 53 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index c4cbf9fe..0e03212d 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -12,25 +12,23 @@ set(HEADERS
create_directory_groups(${SRCS} ${HEADERS})
-# NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable)
-if (NOT X11_xf86vmode_LIB)
- set(X11_xv86vmode_LIB Xxf86vm)
-endif()
-
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core common video_core)
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
+if (UNIX)
+ target_link_libraries(citra -pthread)
+endif()
+
if (APPLE)
- target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY})
+ target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
elseif (WIN32)
target_link_libraries(citra winmm)
if (MINGW)
target_link_libraries(citra iconv)
endif()
else() # Unix
- target_link_libraries(citra pthread rt)
- target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})
+ target_link_libraries(citra rt)
endif()
#install(TARGETS citra RUNTIME DESTINATION ${bindir})
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index f2aeb510..f6a52758 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -1,9 +1,14 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <thread>
+
#include "common/common.h"
-#include "common/log_manager.h"
+#include "common/logging/text_formatter.h"
+#include "common/logging/backend.h"
+#include "common/logging/filter.h"
+#include "common/scope_exit.h"
#include "core/settings.h"
#include "core/system.h"
@@ -15,17 +20,21 @@
/// Application entry point
int __cdecl main(int argc, char **argv) {
- LogManager::Init();
+ std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
+ Log::Filter log_filter(Log::Level::Debug);
+ std::thread logging_thread(Log::TextLoggingLoop, logger, &log_filter);
+ SCOPE_EXIT({
+ logger->Close();
+ logging_thread.join();
+ });
if (argc < 2) {
- ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified");
+ LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1;
}
Config config;
-
- if (!Settings::values.enable_log)
- LogManager::Shutdown();
+ log_filter.ParseFilterString(Settings::values.log_filter);
std::string boot_filename = argv[1];
EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
@@ -34,7 +43,7 @@ int __cdecl main(int argc, char **argv) {
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
if (Loader::ResultStatus::Success != load_result) {
- ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result);
+ LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
return -1;
}
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index f45d09fc..2bf0dff3 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -1,5 +1,5 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <GLFW/glfw3.h>
@@ -22,21 +22,22 @@ Config::Config() {
bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) {
if (config->ParseError() < 0) {
if (retry) {
- ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location);
+ LOG_WARNING(Config, "Failed to load %s. Creating file from defaults...", location);
FileUtil::CreateFullPath(location);
FileUtil::WriteStringToFile(true, default_contents, location);
*config = INIReader(location); // Reopen file
return LoadINI(config, location, default_contents, false);
}
- ERROR_LOG(CONFIG, "Failed.");
+ LOG_ERROR(Config, "Failed.");
return false;
}
- INFO_LOG(CONFIG, "Successfully loaded %s", location);
+ LOG_INFO(Config, "Successfully loaded %s", location);
return true;
}
-void Config::ReadControls() {
+void Config::ReadValues() {
+ // Controls
Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A);
Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S);
Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z);
@@ -54,27 +55,22 @@ void Config::ReadControls() {
Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
-}
-void Config::ReadCore() {
+ // Core
Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter);
- Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60);
-}
+ Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30);
+ Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0);
-void Config::ReadData() {
+ // Data Storage
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
-}
-void Config::ReadMiscellaneous() {
- Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true);
+ // Miscellaneous
+ Settings::values.log_filter = glfw_config->Get("Miscellaneous", "log_filter", "*:Info");
}
void Config::Reload() {
LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
- ReadControls();
- ReadCore();
- ReadData();
- ReadMiscellaneous();
+ ReadValues();
}
Config::~Config() {
diff --git a/src/citra/config.h b/src/citra/config.h
index 19bb8370..0eb176c7 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -1,5 +1,5 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
@@ -15,10 +15,7 @@ class Config {
std::string glfw_config_loc;
bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
- void ReadControls();
- void ReadCore();
- void ReadData();
- void ReadMiscellaneous();
+ void ReadValues();
public:
Config();
~Config();
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index f1f626ee..f41020f7 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -1,5 +1,5 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
@@ -28,13 +28,14 @@ pad_sright =
[Core]
cpu_core = ## 0: Interpreter (default), 1: FastInterpreter (experimental)
-gpu_refresh_rate = ## 60 (default)
+gpu_refresh_rate = ## 30 (default)
+frame_skip = ## 0: No frameskip (default), 1 : 2x frameskip, 2 : 4x frameskip, etc.
[Data Storage]
use_virtual_sd =
[Miscellaneous]
-enable_log =
+log_filter = *:Info ## Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
)";
}
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 8efb39e2..a6282809 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -1,5 +1,5 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <GLFW/glfw3.h>
@@ -36,15 +36,15 @@ const bool EmuWindow_GLFW::IsOpen() {
}
void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) {
- _dbg_assert_(GUI, width > 0);
- _dbg_assert_(GUI, height > 0);
+ _dbg_assert_(Frontend, width > 0);
+ _dbg_assert_(Frontend, height > 0);
GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height));
}
void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) {
- _dbg_assert_(GUI, width > 0);
- _dbg_assert_(GUI, height > 0);
+ _dbg_assert_(Frontend, width > 0);
+ _dbg_assert_(Frontend, height > 0);
// NOTE: GLFW provides no proper way to set a minimal window size.
// Hence, we just ignore the corresponding EmuWindow hint.
@@ -58,9 +58,13 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
ReloadSetKeymaps();
+ glfwSetErrorCallback([](int error, const char *desc){
+ LOG_ERROR(Frontend, "GLFW 0x%08x: %s", error, desc);
+ });
+
// Initialize the window
if(glfwInit() != GL_TRUE) {
- printf("Failed to initialize GLFW! Exiting...");
+ LOG_CRITICAL(Frontend, "Failed to initialize GLFW! Exiting...");
exit(1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -72,10 +76,10 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth,
(VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight),
- window_title.c_str(), NULL, NULL);
+ window_title.c_str(), nullptr, nullptr);
- if (m_render_window == NULL) {
- printf("Failed to create GLFW window! Exiting...");
+ if (m_render_window == nullptr) {
+ LOG_CRITICAL(Frontend, "Failed to create GLFW window! Exiting...");
exit(1);
}
@@ -119,7 +123,7 @@ void EmuWindow_GLFW::MakeCurrent() {
/// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
void EmuWindow_GLFW::DoneCurrent() {
- glfwMakeContextCurrent(NULL);
+ glfwMakeContextCurrent(nullptr);
}
void EmuWindow_GLFW::ReloadSetKeymaps() {
@@ -145,7 +149,7 @@ void EmuWindow_GLFW::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,u
std::pair<int,int> current_size;
glfwGetWindowSize(m_render_window, &current_size.first, &current_size.second);
- _dbg_assert_(GUI, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
+ _dbg_assert_(Frontend, (int)minimal_size.first > 0 && (int)minimal_size.second > 0);
int new_width = std::max(current_size.first, (int)minimal_size.first);
int new_height = std::max(current_size.second, (int)minimal_size.second);
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.h
index 5b04e87b..5252fccc 100644
--- a/src/citra/emu_window/emu_window_glfw.h
+++ b/src/citra/emu_window/emu_window_glfw.h
@@ -1,5 +1,5 @@
// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
+// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once