From 8f164a16ce9c7b2def438bf998e631c035679f2a Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Sat, 28 Mar 2020 17:08:27 +0000 Subject: [PATCH] Review changes --- CMakeLists.txt | 1 + externals/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/citra_qt/main.cpp | 2 +- src/core/core.cpp | 7 +------ src/core/file_sys/archive_ncch.h | 2 +- src/core/file_sys/archive_other_savedata.h | 2 -- src/core/file_sys/archive_savedata.h | 1 - src/core/file_sys/archive_selfncch.h | 4 ++-- src/core/hle/kernel/config_mem.h | 4 ++-- src/core/hle/kernel/hle_ipc.h | 2 +- src/core/hle/service/err_f.cpp | 3 ++- 12 files changed, 13 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faa41ea54b..315bc237d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # CMake 3.8 required for 17 to be a valid value for CXX_STANDARD cmake_minimum_required(VERSION 3.8) if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15) + # Don't override the warning flags in MSVC: cmake_policy(SET CMP0092 NEW) endif () list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 49cca86a1e..7d687a4dc5 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -1,7 +1,7 @@ # Definitions for all external bundled libraries # Suppress warnings from external libraries -if (CMAKE_C_COMPILER_ID MATCHES "MSVC") +if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") add_compile_options(/W0) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d466415701..38cd0be79f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ if (MSVC) /Zc:externConstexpr /Zc:inline ) - if (CMAKE_C_COMPILER_ID MATCHES "MSVC") + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") add_compile_options( /MP /Zc:throwingNew diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 6ceaea57d3..a583e903a9 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1438,7 +1438,7 @@ void GMainWindow::OnCIAInstallFinished() { void GMainWindow::OnMenuRecentFile() { QAction* action = qobject_cast(sender()); - assert(action); + ASSERT(action); const QString filename = action->data().toString(); if (QFileInfo::exists(filename)) { diff --git a/src/core/core.cpp b/src/core/core.cpp index ff6da91e75..5897443676 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -33,6 +33,7 @@ #include "core/hle/kernel/thread.h" #include "core/hle/service/fs/archive.h" #include "core/hle/service/gsp/gsp.h" +#include "core/hle/service/pm/pm_app.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" #include "core/hw/gpu.h" @@ -45,8 +46,6 @@ #include "network/network.h" #include "video_core/video_core.h" -#include "core/hle/service/pm/pm_app.h" - namespace Core { /*static*/ System System::s_instance; @@ -183,15 +182,11 @@ System::ResultStatus System::RunLoop(bool tight_loop) { case Signal::Load: { LOG_INFO(Core, "Begin load"); System::LoadState(param); - // auto stream = std::ifstream("save0.citrasave", std::fstream::binary); - // System::Load(stream, FileUtil::GetSize("save0.citrasave")); LOG_INFO(Core, "Load completed"); } break; case Signal::Save: { LOG_INFO(Core, "Begin save"); System::SaveState(param); - // auto stream = std::ofstream("save0.citrasave", std::fstream::binary); - // System::Save(stream); LOG_INFO(Core, "Save completed"); } break; default: diff --git a/src/core/file_sys/archive_ncch.h b/src/core/file_sys/archive_ncch.h index 76b8d46554..95fe889ea5 100644 --- a/src/core/file_sys/archive_ncch.h +++ b/src/core/file_sys/archive_ncch.h @@ -102,7 +102,7 @@ private: template void serialize(Archive& ar, const unsigned int) { ar& boost::serialization::base_object(*this); - ar& file_buffer; // TODO: See about a more efficient way to do this + ar& file_buffer; } friend class boost::serialization::access; }; diff --git a/src/core/file_sys/archive_other_savedata.h b/src/core/file_sys/archive_other_savedata.h index c5bf98a683..cc0cfe404d 100644 --- a/src/core/file_sys/archive_other_savedata.h +++ b/src/core/file_sys/archive_other_savedata.h @@ -29,7 +29,6 @@ public: ResultVal GetFormatInfo(const Path& path, u64 program_id) const override; private: - std::string mount_point; // TODO: Remove, unused? std::shared_ptr sd_savedata_source; ArchiveFactory_OtherSaveDataPermitted() = default; @@ -57,7 +56,6 @@ public: ResultVal GetFormatInfo(const Path& path, u64 program_id) const override; private: - std::string mount_point; // TODO: Remove, unused? std::shared_ptr sd_savedata_source; ArchiveFactory_OtherSaveDataGeneral() = default; diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h index 6bb22f7a80..3f73adba31 100644 --- a/src/core/file_sys/archive_savedata.h +++ b/src/core/file_sys/archive_savedata.h @@ -28,7 +28,6 @@ public: ResultVal GetFormatInfo(const Path& path, u64 program_id) const override; private: - std::string mount_point; // TODO: Remove this? seems unused std::shared_ptr sd_savedata_source; ArchiveFactory_SaveData() = default; diff --git a/src/core/file_sys/archive_selfncch.h b/src/core/file_sys/archive_selfncch.h index d7b1cf301d..68b48074f4 100644 --- a/src/core/file_sys/archive_selfncch.h +++ b/src/core/file_sys/archive_selfncch.h @@ -58,12 +58,12 @@ public: private: /// Mapping of ProgramId -> NCCHData - std::unordered_map - ncch_data; // TODO: Remove this, or actually set the values here + std::unordered_map ncch_data; template void serialize(Archive& ar, const unsigned int) { ar& boost::serialization::base_object(*this); + // NOTE: ncch_data is never written to, so we don't serialize it here } friend class boost::serialization::access; }; diff --git a/src/core/hle/kernel/config_mem.h b/src/core/hle/kernel/config_mem.h index 74d934345f..c466345ece 100644 --- a/src/core/hle/kernel/config_mem.h +++ b/src/core/hle/kernel/config_mem.h @@ -57,11 +57,11 @@ public: Handler(); ConfigMemDef& GetConfigMem(); - virtual u8* GetPtr() { + u8* GetPtr() override { return static_cast(static_cast(&config_mem)); } - virtual u32 GetSize() const { + u32 GetSize() const override { return sizeof(config_mem); } diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 046a31e2eb..0004868259 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -99,12 +99,12 @@ protected: struct SessionInfo { SessionInfo(std::shared_ptr session, std::unique_ptr data); - SessionInfo() = default; std::shared_ptr session; std::unique_ptr data; private: + SessionInfo() = default; template void serialize(Archive& ar, const unsigned int file_version) { ar& session; diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index f88ffef192..85759f9d20 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -15,7 +15,8 @@ #include "core/hle/ipc_helpers.h" #include "core/hle/result.h" #include "core/hle/service/err_f.h" -#undef exception_info +#undef exception_info // We use 'exception_info' as a plain identifier, but MSVC defines this in one + // of its many headers. SERIALIZE_EXPORT_IMPL(Service::ERR::ERR_F)