From 98e669cf00f5e8ddb8d61a35b1c15170be6cccf3 Mon Sep 17 00:00:00 2001 From: Daniel Lim Wee Soong Date: Fri, 16 Mar 2018 12:17:14 +0800 Subject: [PATCH] Remove all edits not in the scope of this PR --- src/citra_qt/CMakeLists.txt | 10 ----- src/citra_qt/configuration/config.cpp | 2 - .../configuration/configure_debug.cpp | 23 ----------- src/citra_qt/configuration/configure_debug.ui | 41 ------------------- src/citra_qt/debugger/console.cpp | 34 --------------- src/citra_qt/debugger/console.h | 14 ------- src/citra_qt/ui_settings.h | 2 - src/common/common_paths.h | 4 -- src/common/file_util.cpp | 17 +++----- src/common/file_util.h | 9 +--- src/common/string_util.cpp | 1 + src/common/threadsafe_queue.h | 32 +-------------- src/core/settings.cpp | 3 +- src/core/settings.h | 3 +- 14 files changed, 13 insertions(+), 182 deletions(-) delete mode 100644 src/citra_qt/debugger/console.cpp delete mode 100644 src/citra_qt/debugger/console.h diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index a70476998..b0fc1acca 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -28,8 +28,6 @@ add_executable(citra-qt configuration/configure_system.h configuration/configure_web.cpp configuration/configure_web.h - debugger/console.h - debugger/console.cpp debugger/graphics/graphics.cpp debugger/graphics/graphics.h debugger/graphics/graphics_breakpoint_observer.cpp @@ -140,14 +138,6 @@ if (APPLE) target_sources(citra-qt PRIVATE ${MACOSX_ICON}) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) -elseif(WIN32) - # compile as a win32 gui application instead of a console application - target_link_libraries(citra-qt PRIVATE Qt5::WinMain) - if(MSVC) - set_target_properties(citra-qt PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") - elseif(MINGW) - set_target_properties(citra-qt PROPERTIES LINK_FLAGS_RELEASE "-mwindows") - endif() endif() create_target_directory_groups(citra-qt) diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index c18422e3f..a0dc0cd84 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -224,7 +224,6 @@ void Config::ReadValues() { UISettings::values.confirm_before_closing = qt_config->value("confirmClose", true).toBool(); UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); UISettings::values.callout_flags = qt_config->value("calloutFlags", 0).toUInt(); - UISettings::values.show_console = qt_config->value("showConsole", false).toBool(); qt_config->endGroup(); } @@ -366,7 +365,6 @@ void Config::SaveValues() { qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); qt_config->setValue("firstStart", UISettings::values.first_start); qt_config->setValue("calloutFlags", UISettings::values.callout_flags); - qt_config->setValue("showConsole", UISettings::values.show_console); qt_config->endGroup(); } diff --git a/src/citra_qt/configuration/configure_debug.cpp b/src/citra_qt/configuration/configure_debug.cpp index b9eb0e3d1..48f57739e 100644 --- a/src/citra_qt/configuration/configure_debug.cpp +++ b/src/citra_qt/configuration/configure_debug.cpp @@ -2,27 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include -#include - #include "citra_qt/configuration/configure_debug.h" -#include "citra_qt/debugger/console.h" -#include "citra_qt/ui_settings.h" -#include "common/file_util.h" -#include "common/logging/backend.h" -#include "common/logging/filter.h" -#include "common/logging/log.h" -#include "core/core.h" #include "core/settings.h" #include "ui_configure_debug.h" ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { ui->setupUi(this); this->setConfiguration(); - connect(ui->open_log_button, &QPushButton::pressed, []() { - QString path = QString::fromStdString(FileUtil::GetUserPath(D_LOGS_IDX)); - QDesktopServices::openUrl(QUrl::fromLocalFile(path)); - }); } ConfigureDebug::~ConfigureDebug() {} @@ -31,20 +17,11 @@ void ConfigureDebug::setConfiguration() { ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); - ui->toggle_console->setEnabled(!Core::System::GetInstance().IsPoweredOn()); - ui->toggle_console->setChecked(UISettings::values.show_console); - ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter)); } void ConfigureDebug::applyConfiguration() { Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked(); Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); - UISettings::values.show_console = ui->toggle_console->isChecked(); - Settings::values.log_filter = ui->log_filter_edit->text().toStdString(); - Debugger::ToggleConsole(); - Log::Filter filter; - filter.ParseFilterString(Settings::values.log_filter); - Log::SetFilter(&filter); Settings::Apply(); } diff --git a/src/citra_qt/configuration/configure_debug.ui b/src/citra_qt/configuration/configure_debug.ui index 118e91cf1..a10bea2f4 100644 --- a/src/citra_qt/configuration/configure_debug.ui +++ b/src/citra_qt/configuration/configure_debug.ui @@ -72,47 +72,6 @@ - - - - Logging - - - - - - - - Global Log Filter - - - - - - - - - - - - - - Show Log Console (Windows Only) - - - - - - - Open Log Location - - - - - - - - diff --git a/src/citra_qt/debugger/console.cpp b/src/citra_qt/debugger/console.cpp deleted file mode 100644 index 9d80d108e..000000000 --- a/src/citra_qt/debugger/console.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#ifdef _WIN32 -#include - -#include -#endif - -#include "citra_qt/debugger/console.h" -#include "citra_qt/ui_settings.h" - -namespace Debugger { -void ToggleConsole() { -#ifdef _WIN32 - if (UISettings::values.show_console) { - if (AllocConsole()) { - freopen_s((FILE**)stdin, "CONIN$", "r", stdin); - freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); - freopen_s((FILE**)stderr, "CONOUT$", "w", stderr); - } - } else { - if (FreeConsole()) { - // In order to close the console, we have to also detach the streams on it. - // Just redirect them to NUL if there is no console window - freopen_s((FILE**)stdin, "NUL", "r", stdin); - freopen_s((FILE**)stdout, "NUL", "w", stdout); - freopen_s((FILE**)stderr, "NUL", "w", stderr); - } - } -#endif -} -} // namespace Debugger diff --git a/src/citra_qt/debugger/console.h b/src/citra_qt/debugger/console.h deleted file mode 100644 index 3baf0fdd4..000000000 --- a/src/citra_qt/debugger/console.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -namespace Debugger { - -/** - * Uses the WINAPI to hide or show the stderr console. This function is a placeholder until we can - * get a real qt logging window which would work for all platforms. - */ -void ToggleConsole(); -} // namespace Debugger \ No newline at end of file diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h index d994cd5c5..caf6aea6a 100644 --- a/src/citra_qt/ui_settings.h +++ b/src/citra_qt/ui_settings.h @@ -56,8 +56,6 @@ struct Values { std::vector shortcuts; uint32_t callout_flags; - - bool show_console; }; extern Values values; diff --git a/src/common/common_paths.h b/src/common/common_paths.h index f6d9ea303..d5b510cdb 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -36,12 +36,8 @@ #define SDMC_DIR "sdmc" #define NAND_DIR "nand" #define SYSDATA_DIR "sysdata" -#define LOG_DIR "log" // Filenames -// Files in the directory returned by GetUserPath(D_LOGS_IDX) -#define LOG_FILE "citra_log.txt" - // Files in the directory returned by GetUserPath(D_CONFIG_IDX) #define EMU_CONFIG "emu.ini" #define DEBUGGER_CONFIG "debugger.ini" diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 7b256fede..4e1d702f7 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -715,8 +715,6 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string& new paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; - // TODO: Put the logs in a better location for each OS - paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOG_DIR DIR_SEP; } if (!newPath.empty()) { @@ -803,8 +801,8 @@ void SplitFilename83(const std::string& filename, std::array& short_nam IOFile::IOFile() {} -IOFile::IOFile(const std::string& filename, const char openmode[], int flags) { - Open(filename, openmode, flags); +IOFile::IOFile(const std::string& filename, const char openmode[]) { + Open(filename, openmode); } IOFile::~IOFile() { @@ -825,16 +823,11 @@ void IOFile::Swap(IOFile& other) { std::swap(m_good, other.m_good); } -bool IOFile::Open(const std::string& filename, const char openmode[], int flags) { +bool IOFile::Open(const std::string& filename, const char openmode[]) { Close(); #ifdef _WIN32 - if (flags != 0) { - m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), - Common::UTF8ToUTF16W(openmode).c_str(), flags); - } else { - _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), - Common::UTF8ToUTF16W(openmode).c_str()); - } + _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), + Common::UTF8ToUTF16W(openmode).c_str()); #else m_file = fopen(filename.c_str(), openmode); #endif diff --git a/src/common/file_util.h b/src/common/file_util.h index 8674ac224..630232a25 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -156,8 +156,7 @@ void SplitFilename83(const std::string& filename, std::array& short_nam class IOFile : public NonCopyable { public: IOFile(); - /// Opens the file. flags is for windows shared file settings and are ignored on other oses - IOFile(const std::string& filename, const char openmode[], int flags = 0); + IOFile(const std::string& filename, const char openmode[]); ~IOFile(); @@ -166,7 +165,7 @@ public: void Swap(IOFile& other); - bool Open(const std::string& filename, const char openmode[], int flags = 0); + bool Open(const std::string& filename, const char openmode[]); bool Close(); template @@ -225,10 +224,6 @@ public: return WriteArray(&object, 1); } - size_t WriteString(const std::string& str) { - return WriteArray(str.c_str(), str.length()); - } - bool IsOpen() const { return nullptr != m_file; } diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 0b120e407..124a8937f 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -484,4 +484,5 @@ const char* TrimSourcePath(const char* path, const char* root) { } return path; } + } // namespace Common diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index 1c676d202..a0c731e8c 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h @@ -9,7 +9,6 @@ #include #include -#include #include #include #include "common/common_types.h" @@ -37,10 +36,6 @@ public: T& Front() const { return read_ptr->current; } - - /** - * Push data to the queue. If NeedSize=True then Push will notify the waiting consumer thread - */ template void Push(Arg&& t) { // create the element, add it to the queue @@ -50,11 +45,8 @@ public: ElementPtr* new_ptr = new ElementPtr(); write_ptr->next.store(new_ptr, std::memory_order_release); write_ptr = new_ptr; - if (NeedSize) { - std::lock_guard lock(size_lock); + if (NeedSize) size++; - size_cv.notify_one(); - } } void Pop() { @@ -83,25 +75,6 @@ public: return true; } - /** - * Waits up to timeout for data to be Pushed to the queue. Push uses a condition variable to - * signal the waiting thread, but only if NeedSize = true. Returns false if the timeout is - * triggered. If the condition variable is signalled, returns the value from Pop - * @param T In parameter to store the value if this method returns true - * @param timeout Time in milliseconds to wait for a signal from a Push - */ - bool PopWait(T& t, u64 timeout = 500) { - if (NeedSize) { - std::unique_lock lock(size_lock); - if (size_cv.wait_for(lock, std::chrono::milliseconds(timeout), - [& size = size] { return size > 0; })) { - return Pop(t); - } - return false; - } - return Pop(t); - } - // not thread-safe void Clear() { size.store(0); @@ -129,9 +102,6 @@ private: ElementPtr* write_ptr; ElementPtr* read_ptr; std::atomic size; - - std::mutex size_lock; - std::condition_variable size_cv; }; // a simple thread-safe, diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 770b7fda7..f457c3d9c 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -4,13 +4,14 @@ #include "audio_core/dsp_interface.h" #include "core/core.h" -#include "core/frontend/emu_window.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/service/hid/hid.h" #include "core/hle/service/ir/ir.h" #include "core/settings.h" #include "video_core/video_core.h" +#include "core/frontend/emu_window.h" + namespace Settings { Values values = {}; diff --git a/src/core/settings.h b/src/core/settings.h index d574a1578..15751720a 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -129,6 +129,8 @@ struct Values { float bg_green; float bg_blue; + std::string log_filter; + // Audio std::string sink_id; bool enable_audio_stretching; @@ -141,7 +143,6 @@ struct Values { // Debugging bool use_gdbstub; u16 gdbstub_port; - std::string log_filter; // Movie std::string movie_play;