Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115)
This commit is contained in:
parent
90b418fd1a
commit
cbd5d1c15c
67 changed files with 6837 additions and 7475 deletions
|
@ -471,7 +471,8 @@ endif()
|
|||
create_target_directory_groups(core)
|
||||
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives Boost::serialization)
|
||||
target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt::fmt open_source_archives Boost::serialization)
|
||||
set_target_properties(core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
|
|
|
@ -326,7 +326,7 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
|
|||
m_filepath = filepath;
|
||||
|
||||
// Reset counters and set time origin to current frame
|
||||
GetAndResetPerfStats();
|
||||
[[maybe_unused]] const PerfStats::Results result = GetAndResetPerfStats();
|
||||
perf_stats->BeginSystemFrame();
|
||||
return status;
|
||||
}
|
||||
|
@ -571,8 +571,9 @@ void System::Reset() {
|
|||
}
|
||||
|
||||
Shutdown();
|
||||
|
||||
// Reload the system with the same setting
|
||||
Load(*m_emu_window, m_filepath);
|
||||
[[maybe_unused]] const System::ResultStatus result = Load(*m_emu_window, m_filepath);
|
||||
|
||||
// Restore the deliver arg.
|
||||
if (auto apt = Service::APT::GetModule(*this)) {
|
||||
|
@ -597,7 +598,8 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
|
|||
// Re-initialize everything like it was before
|
||||
auto system_mode = this->app_loader->LoadKernelSystemMode();
|
||||
auto n3ds_mode = this->app_loader->LoadKernelN3dsMode();
|
||||
Init(*m_emu_window, *system_mode.first, *n3ds_mode.first, num_cores);
|
||||
[[maybe_unused]] const System::ResultStatus result =
|
||||
Init(*m_emu_window, *system_mode.first, *n3ds_mode.first, num_cores);
|
||||
}
|
||||
|
||||
// flush on save, don't flush on load
|
||||
|
|
|
@ -199,7 +199,7 @@ void Timing::Timer::Advance() {
|
|||
std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
|
||||
event_queue.pop_back();
|
||||
if (evt.type->callback != nullptr) {
|
||||
evt.type->callback(evt.userdata, executed_ticks - evt.time);
|
||||
evt.type->callback(evt.userdata, static_cast<int>(executed_ticks - evt.time));
|
||||
} else {
|
||||
LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ struct ArchiveFormatInfo {
|
|||
u32_le number_files; ///< The pre-defined number of files in the archive.
|
||||
u8 duplicate_data; ///< Whether the archive should duplicate the data.
|
||||
};
|
||||
static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
|
||||
static_assert(std::is_trivial_v<ArchiveFormatInfo>, "ArchiveFormatInfo is not POD");
|
||||
|
||||
class ArchiveBackend : NonCopyable {
|
||||
public:
|
||||
|
|
|
@ -58,8 +58,7 @@ bool DiskFile::Close() const {
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DiskDirectory::DiskDirectory(const std::string& path) {
|
||||
unsigned size = FileUtil::ScanDirectoryTree(path, directory);
|
||||
directory.size = size;
|
||||
directory.size = FileUtil::ScanDirectoryTree(path, directory);
|
||||
directory.isDirectory = true;
|
||||
children_iterator = directory.children.begin();
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ Loader::ResultStatus NCCHContainer::Load() {
|
|||
exheader_header.arm11_system_local_caps.resource_limit_category;
|
||||
|
||||
LOG_DEBUG(Service_FS, "Name: {}",
|
||||
exheader_header.codeset_info.name);
|
||||
reinterpret_cast<const char*>(exheader_header.codeset_info.name));
|
||||
LOG_DEBUG(Service_FS, "Program ID: {:016X}", ncch_header.program_id);
|
||||
LOG_DEBUG(Service_FS, "Code compressed: {}", is_compressed ? "yes" : "no");
|
||||
LOG_DEBUG(Service_FS, "Entry point: 0x{:08X}", entry_point);
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
template <typename ValueType>
|
||||
std::optional<ValueType> Read() {
|
||||
static_assert(std::is_pod_v<ValueType>);
|
||||
static_assert(std::is_trivial_v<ValueType>);
|
||||
ValueType val{};
|
||||
if (!Read(&val, sizeof(val)))
|
||||
return std::nullopt;
|
||||
|
|
|
@ -534,9 +534,8 @@ static void SendReply(const char* reply) {
|
|||
|
||||
/// Handle query command from gdb client.
|
||||
static void HandleQuery() {
|
||||
LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", command_buffer + 1);
|
||||
|
||||
const char* query = reinterpret_cast<const char*>(command_buffer + 1);
|
||||
LOG_DEBUG(Debug_GDBStub, "gdb: query '{}'\n", query);
|
||||
|
||||
if (strcmp(query, "TStatus") == 0) {
|
||||
SendReply("T0");
|
||||
|
@ -685,7 +684,8 @@ static void ReadCommand() {
|
|||
LOG_ERROR(
|
||||
Debug_GDBStub,
|
||||
"gdb: invalid checksum: calculated {:02x} and read {:02x} for ${}# (length: {})\n",
|
||||
checksum_calculated, checksum_received, command_buffer, command_length);
|
||||
checksum_calculated, checksum_received, reinterpret_cast<const char*>(command_buffer),
|
||||
command_length);
|
||||
|
||||
command_length = 0;
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ void HandlePacket() {
|
|||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer);
|
||||
LOG_DEBUG(Debug_GDBStub, "Packet: {}", command_buffer[0]);
|
||||
|
||||
switch (command_buffer[0]) {
|
||||
case 'q':
|
||||
|
|
|
@ -94,7 +94,7 @@ u64 Handler::GetSystemTime() const {
|
|||
epoch_tm.tm_mon = 0;
|
||||
epoch_tm.tm_year = 100;
|
||||
epoch_tm.tm_isdst = 0;
|
||||
u64 epoch = std::mktime(&epoch_tm) * 1000;
|
||||
s64 epoch = std::mktime(&epoch_tm) * 1000;
|
||||
|
||||
// 3DS console time uses Jan 1 1900 as internal epoch,
|
||||
// so we use the milliseconds between 1900 and 2000 as base console time
|
||||
|
|
|
@ -262,8 +262,8 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
|||
// kernel version and an applet with new kernel version run at the same time, and they both use
|
||||
// shared font, different linear heap region would have required shared font to relocate
|
||||
// according to two different addresses at the same time, which is impossible.
|
||||
VAddr target_address =
|
||||
apt->shared_font_mem->GetLinearHeapPhysicalOffset() + Memory::LINEAR_HEAP_VADDR;
|
||||
VAddr target_address = static_cast<VAddr>(apt->shared_font_mem->GetLinearHeapPhysicalOffset()) +
|
||||
Memory::LINEAR_HEAP_VADDR;
|
||||
if (!apt->shared_font_relocated) {
|
||||
BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address);
|
||||
apt->shared_font_relocated = true;
|
||||
|
|
|
@ -150,15 +150,15 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(u32* cmd_buf, const Funct
|
|||
int num_params = header.normal_params_size + header.translate_params_size;
|
||||
std::string function_name = info == nullptr ? fmt::format("{:#08x}", cmd_buf[0]) : info->name;
|
||||
|
||||
fmt::memory_buffer buf;
|
||||
fmt::format_to(buf, "function '{}': port='{}' cmd_buf={{[0]={:#x}", function_name, service_name,
|
||||
cmd_buf[0]);
|
||||
std::string result = fmt::format("function '{}': port='{}' cmd_buf={{[0]={:#x}", function_name,
|
||||
service_name, cmd_buf[0]);
|
||||
for (int i = 1; i <= num_params; ++i) {
|
||||
fmt::format_to(buf, ", [{}]={:#x}", i, cmd_buf[i]);
|
||||
result += fmt::format(", [{}]={:#x}", i, cmd_buf[i]);
|
||||
}
|
||||
buf.push_back('}');
|
||||
|
||||
LOG_ERROR(Service, "unknown / unimplemented {}", fmt::to_string(buf));
|
||||
result.push_back('}');
|
||||
|
||||
LOG_ERROR(Service, "unknown / unimplemented {}", result);
|
||||
// TODO(bunnei): Hack - ignore error
|
||||
header.normal_params_size.Assign(1);
|
||||
header.translate_params_size.Assign(0);
|
||||
|
|
|
@ -223,10 +223,10 @@ Movie::PlayMode Movie::GetPlayMode() const {
|
|||
}
|
||||
|
||||
u64 Movie::GetCurrentInputIndex() const {
|
||||
return nearbyint(current_input / 234.0 * GPU::SCREEN_REFRESH_RATE);
|
||||
return static_cast<u64>(std::nearbyint(current_input / 234.0 * GPU::SCREEN_REFRESH_RATE));
|
||||
}
|
||||
u64 Movie::GetTotalInputCount() const {
|
||||
return nearbyint(total_input / 234.0 * GPU::SCREEN_REFRESH_RATE);
|
||||
return static_cast<u64>(std::nearbyint(total_input / 234.0 * GPU::SCREEN_REFRESH_RATE));
|
||||
}
|
||||
|
||||
void Movie::CheckInputEnd() {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <iterator>
|
||||
#include <mutex>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <fmt/chrono.h>
|
||||
#include <fmt/format.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue