diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index e055332fe..c1c4ac753 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -292,7 +292,11 @@ public: if (GetWindowSystemType() == Frontend::WindowSystemType::Wayland) { setAttribute(Qt::WA_DontCreateNativeAncestors); } +#ifdef __APPLE__ + windowHandle()->setSurfaceType(QWindow::MetalSurface); +#else windowHandle()->setSurfaceType(QWindow::VulkanSurface); +#endif } QPaintEngine* paintEngine() const override { diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp index 3a223398f..781e1a284 100644 --- a/src/citra_qt/configuration/configure_general.cpp +++ b/src/citra_qt/configuration/configure_general.cpp @@ -31,7 +31,8 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) // Set a minimum width for the label to prevent the slider from changing size. // This scales across DPIs, and is acceptable for uncapitalized strings. - ui->emulation_speed_display_label->setMinimumWidth(tr("unthrottled").size() * 6); + const auto width = static_cast(tr("unthrottled").size() * 6); + ui->emulation_speed_display_label->setMinimumWidth(width); ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->updateBox->setVisible(UISettings::values.updater_found); diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index e63f5399e..f0ae442d6 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp @@ -285,12 +285,12 @@ void ConfigureSystem::SetConfiguration() { date_time.setSecsSinceEpoch(Settings::values.init_time.GetValue()); ui->edit_init_time->setDateTime(date_time); - long long init_time_offset = Settings::values.init_time_offset.GetValue(); - long long days_offset = init_time_offset / 86400; + s64 init_time_offset = Settings::values.init_time_offset.GetValue(); + int days_offset = static_cast(init_time_offset / 86400); ui->edit_init_time_offset_days->setValue(days_offset); - unsigned long long time_offset = std::abs(init_time_offset) - std::abs(days_offset * 86400); - QTime time = QTime::fromMSecsSinceStartOfDay(time_offset * 1000); + u64 time_offset = std::abs(init_time_offset) - std::abs(days_offset * 86400); + QTime time = QTime::fromMSecsSinceStartOfDay(static_cast(time_offset * 1000)); ui->edit_init_time_offset_time->setTime(time); if (!enabled) { diff --git a/src/citra_qt/loading_screen.cpp b/src/citra_qt/loading_screen.cpp index 0efb6f71a..e4d61652b 100644 --- a/src/citra_qt/loading_screen.cpp +++ b/src/citra_qt/loading_screen.cpp @@ -180,9 +180,10 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size } const auto eta_mseconds = std::chrono::duration_cast( rolling_average * (total - value)); + const auto limited_mseconds = std::max(eta_mseconds.count(), 1000); estimate = tr("Estimated Time %1") .arg(QTime(0, 0, 0, 0) - .addMSecs(std::max(eta_mseconds.count(), 1000)) + .addMSecs(static_cast(limited_mseconds)) .toString(QStringLiteral("mm:ss"))); } diff --git a/src/citra_qt/movie/movie_play_dialog.cpp b/src/citra_qt/movie/movie_play_dialog.cpp index dfdc799f1..6df973af5 100644 --- a/src/citra_qt/movie/movie_play_dialog.cpp +++ b/src/citra_qt/movie/movie_play_dialog.cpp @@ -125,8 +125,8 @@ void MoviePlayDialog::UpdateUIDisplay() { } else { const u64 msecs = Service::HID::Module::pad_update_ticks * metadata.input_count * 1000 / BASE_CLOCK_RATE_ARM11; - ui->lengthLineEdit->setText( - QTime::fromMSecsSinceStartOfDay(msecs).toString(QStringLiteral("hh:mm:ss.zzz"))); + ui->lengthLineEdit->setText(QTime::fromMSecsSinceStartOfDay(static_cast(msecs)) + .toString(QStringLiteral("hh:mm:ss.zzz"))); } } } diff --git a/src/citra_qt/multiplayer/lobby.cpp b/src/citra_qt/multiplayer/lobby.cpp index 862ed19a5..7cd2ae7e1 100644 --- a/src/citra_qt/multiplayer/lobby.cpp +++ b/src/citra_qt/multiplayer/lobby.cpp @@ -284,7 +284,7 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s // filter by empty rooms if (filter_empty) { QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent); - const int player_count = + const qsizetype player_count = sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size(); if (player_count == 0) { return false; @@ -294,7 +294,7 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s // filter by filled rooms if (filter_full) { QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent); - const int player_count = + const qsizetype player_count = sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size(); const int max_players = sourceModel()->data(member_list, LobbyItemMemberList::MaxPlayerRole).toInt(); diff --git a/src/citra_qt/multiplayer/lobby_p.h b/src/citra_qt/multiplayer/lobby_p.h index 749ca627f..16db78eae 100644 --- a/src/citra_qt/multiplayer/lobby_p.h +++ b/src/citra_qt/multiplayer/lobby_p.h @@ -198,8 +198,8 @@ public: bool operator<(const QStandardItem& other) const override { // sort by rooms that have the most players - int left_members = data(MemberListRole).toList().size(); - int right_members = other.data(MemberListRole).toList().size(); + qsizetype left_members = data(MemberListRole).toList().size(); + qsizetype right_members = other.data(MemberListRole).toList().size(); return left_members < right_members; } }; diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index 18af19695..722af05e3 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -194,7 +194,7 @@ QString CSpinBox::TextFromValue() { } qint64 CSpinBox::ValueFromText() { - unsigned strpos = prefix.length(); + qsizetype strpos = prefix.length(); QString num_string = text().mid(strpos, text().length() - strpos - suffix.length()); return num_string.toLongLong(nullptr, base); @@ -216,7 +216,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const { if (!prefix.isEmpty() && input.left(prefix.length()) != prefix) return QValidator::Invalid; - int strpos = prefix.length(); + qsizetype strpos = prefix.length(); // Empty "numbers" allowed as intermediate values if (strpos >= input.length() - HasSign() - suffix.length()) @@ -245,7 +245,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const { // Match string QRegularExpression num_regexp(QRegularExpression::anchoredPattern(regexp)); - int num_pos = strpos; + qsizetype num_pos = strpos; QString sub_input = input.mid(strpos, input.length() - strpos - suffix.length()); auto match = num_regexp.match(sub_input); diff --git a/src/core/cheats/gateway_cheat.cpp b/src/core/cheats/gateway_cheat.cpp index b44d60477..c7782127d 100644 --- a/src/core/cheats/gateway_cheat.cpp +++ b/src/core/cheats/gateway_cheat.cpp @@ -197,9 +197,9 @@ GatewayCheat::CheatLine::CheatLine(const std::string& line) { if (type_temp == "D" || type_temp == "d") sub_type_temp = line.substr(1, 1); type = static_cast(std::stoi(type_temp + sub_type_temp, 0, 16)); - first = std::stoul(line.substr(0, 8), 0, 16); + first = static_cast(std::stoul(line.substr(0, 8), 0, 16)); address = first & 0x0FFFFFFF; - value = std::stoul(line.substr(9, 8), 0, 16); + value = static_cast(std::stoul(line.substr(9, 8), 0, 16)); cheat_line = line; } catch (const std::logic_error&) { type = CheatType::Null; diff --git a/src/core/dumping/ffmpeg_backend.cpp b/src/core/dumping/ffmpeg_backend.cpp index 3a87fca06..46e2453a9 100644 --- a/src/core/dumping/ffmpeg_backend.cpp +++ b/src/core/dumping/ffmpeg_backend.cpp @@ -513,7 +513,7 @@ bool FFmpegAudioStream::Init(FFmpegMuxer& muxer) { } if (codec_context->frame_size) { - frame_size = static_cast(codec_context->frame_size); + frame_size = codec_context->frame_size; } else { // variable frame size support frame_size = std::tuple_size::value; } diff --git a/src/core/file_sys/plugin_3gx.cpp b/src/core/file_sys/plugin_3gx.cpp index f8a01be9b..839bd8f80 100644 --- a/src/core/file_sys/plugin_3gx.cpp +++ b/src/core/file_sys/plugin_3gx.cpp @@ -184,7 +184,7 @@ Loader::ResultStatus FileSys::Plugin3GXLoader::Map( const u32 block_size = mem_region_sizes[header.infos.flags.memory_region_size.Value()]; const u32 exe_size = (sizeof(PluginHeader) + text_section.size() + rodata_section.size() + data_section.size() + header.executable.bss_size + 0x1000) & - ~0xFFF; + ~0xFFFu; // Allocate the framebuffer block so that is in the highest FCRAM position possible auto offset_fb = diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index e0257f0a6..b1d958f8e 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -509,7 +509,8 @@ void SendReply(const char* reply) { u8* ptr = command_buffer; u32 left = command_length + 4; while (left > 0) { - int sent_size = send(gdbserver_socket, reinterpret_cast(ptr), left, 0); + s32 sent_size = + static_cast(send(gdbserver_socket, reinterpret_cast(ptr), left, 0)); if (sent_size < 0) { LOG_ERROR(Debug_GDBStub, "gdb: send failed"); return Shutdown(); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 8a7939ea1..ee5d0c88e 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -589,7 +589,7 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo Common::SplitPath(entry.virtualName, nullptr, &filename_filename, &filename_extension); if (filename_extension == ".tmd") { - const u32 id = std::stoul(filename_filename, nullptr, 16); + const u32 id = static_cast(std::stoul(filename_filename, nullptr, 16)); base_id = std::min(base_id, id); update_id = std::max(update_id, id); } diff --git a/src/core/hle/service/soc/soc_u.cpp b/src/core/hle/service/soc/soc_u.cpp index f07dffafb..031320eb2 100644 --- a/src/core/hle/service/soc/soc_u.cpp +++ b/src/core/hle/service/soc/soc_u.cpp @@ -982,11 +982,13 @@ void SOC_U::SendToOther(Kernel::HLERequestContext& ctx) { CTRSockAddr ctr_dest_addr; std::memcpy(&ctr_dest_addr, dest_addr_buffer.data(), sizeof(ctr_dest_addr)); sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr); - ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast(input_buff.data()), - len, flags, &dest_addr, sizeof(dest_addr)); + ret = static_cast(::sendto(fd_info->second.socket_fd, + reinterpret_cast(input_buff.data()), len, + flags, &dest_addr, sizeof(dest_addr))); } else { - ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast(input_buff.data()), - len, flags, nullptr, 0); + ret = static_cast(::sendto(fd_info->second.socket_fd, + reinterpret_cast(input_buff.data()), len, + flags, nullptr, 0)); } const auto send_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0; @@ -1040,11 +1042,13 @@ void SOC_U::SendTo(Kernel::HLERequestContext& ctx) { CTRSockAddr ctr_dest_addr; std::memcpy(&ctr_dest_addr, dest_addr_buff.data(), sizeof(ctr_dest_addr)); sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr); - ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast(input_buff.data()), - len, flags, &dest_addr, sizeof(dest_addr)); + ret = static_cast(::sendto(fd_info->second.socket_fd, + reinterpret_cast(input_buff.data()), len, + flags, &dest_addr, sizeof(dest_addr))); } else { - ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast(input_buff.data()), - len, flags, nullptr, 0); + ret = static_cast(::sendto(fd_info->second.socket_fd, + reinterpret_cast(input_buff.data()), len, + flags, nullptr, 0)); } auto send_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0; @@ -1103,15 +1107,17 @@ void SOC_U::RecvFromOther(Kernel::HLERequestContext& ctx) { } if (addr_len > 0) { - ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast(output_buff.data()), - len, flags, &src_addr, &src_addr_len); + ret = static_cast(::recvfrom(fd_info->second.socket_fd, + reinterpret_cast(output_buff.data()), len, flags, + &src_addr, &src_addr_len)); if (ret >= 0 && src_addr_len > 0) { ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len); } } else { - ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast(output_buff.data()), - len, flags, NULL, 0); + ret = static_cast(::recvfrom(fd_info->second.socket_fd, + reinterpret_cast(output_buff.data()), len, flags, + NULL, 0)); addr_buff.resize(0); } int recv_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0; @@ -1178,15 +1184,17 @@ void SOC_U::RecvFrom(Kernel::HLERequestContext& ctx) { } if (addr_len > 0) { // Only get src adr if input adr available - ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast(output_buff.data()), - len, flags, &src_addr, &src_addr_len); + ret = static_cast(::recvfrom(fd_info->second.socket_fd, + reinterpret_cast(output_buff.data()), len, flags, + &src_addr, &src_addr_len)); if (ret >= 0 && src_addr_len > 0) { ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len); } } else { - ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast(output_buff.data()), - len, flags, NULL, 0); + ret = static_cast(::recvfrom(fd_info->second.socket_fd, + reinterpret_cast(output_buff.data()), len, flags, + NULL, 0)); addr_buff.resize(0); } int recv_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0; @@ -1753,7 +1761,11 @@ std::optional SOC_U::GetDefaultInterfaceInfo() { } InterfaceInfo ret; - s64 sock_fd = -1; +#ifdef _WIN32 + SOCKET sock_fd = -1; +#else + int sock_fd = -1; +#endif bool interface_found = false; struct sockaddr_in s_in = {.sin_family = AF_INET, .sin_port = htons(53), .sin_addr = {}}; s_in.sin_addr.s_addr = inet_addr("8.8.8.8");