build: Fix compiling citra-qt for iOS. (#6983)

* build: Fix compiling citra-qt for iOS.

* Update src/citra_qt/configuration/configure_general.cpp

Co-authored-by: Tobias <thm.frey@gmail.com>

---------

Co-authored-by: Tobias <thm.frey@gmail.com>
This commit is contained in:
Steveice10 2023-09-17 16:07:56 -07:00 committed by GitHub
parent d1c16bad78
commit 28c542c2c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 38 deletions

View File

@ -292,7 +292,11 @@ public:
if (GetWindowSystemType() == Frontend::WindowSystemType::Wayland) { if (GetWindowSystemType() == Frontend::WindowSystemType::Wayland) {
setAttribute(Qt::WA_DontCreateNativeAncestors); setAttribute(Qt::WA_DontCreateNativeAncestors);
} }
#ifdef __APPLE__
windowHandle()->setSurfaceType(QWindow::MetalSurface);
#else
windowHandle()->setSurfaceType(QWindow::VulkanSurface); windowHandle()->setSurfaceType(QWindow::VulkanSurface);
#endif
} }
QPaintEngine* paintEngine() const override { QPaintEngine* paintEngine() const override {

View File

@ -31,7 +31,8 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
// Set a minimum width for the label to prevent the slider from changing size. // Set a minimum width for the label to prevent the slider from changing size.
// This scales across DPIs, and is acceptable for uncapitalized strings. // 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<int>(tr("unthrottled").size() * 6);
ui->emulation_speed_display_label->setMinimumWidth(width);
ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->updateBox->setVisible(UISettings::values.updater_found); ui->updateBox->setVisible(UISettings::values.updater_found);

View File

@ -285,12 +285,12 @@ void ConfigureSystem::SetConfiguration() {
date_time.setSecsSinceEpoch(Settings::values.init_time.GetValue()); date_time.setSecsSinceEpoch(Settings::values.init_time.GetValue());
ui->edit_init_time->setDateTime(date_time); ui->edit_init_time->setDateTime(date_time);
long long init_time_offset = Settings::values.init_time_offset.GetValue(); s64 init_time_offset = Settings::values.init_time_offset.GetValue();
long long days_offset = init_time_offset / 86400; int days_offset = static_cast<int>(init_time_offset / 86400);
ui->edit_init_time_offset_days->setValue(days_offset); ui->edit_init_time_offset_days->setValue(days_offset);
unsigned long long time_offset = std::abs(init_time_offset) - std::abs(days_offset * 86400); u64 time_offset = std::abs(init_time_offset) - std::abs(days_offset * 86400);
QTime time = QTime::fromMSecsSinceStartOfDay(time_offset * 1000); QTime time = QTime::fromMSecsSinceStartOfDay(static_cast<int>(time_offset * 1000));
ui->edit_init_time_offset_time->setTime(time); ui->edit_init_time_offset_time->setTime(time);
if (!enabled) { if (!enabled) {

View File

@ -180,9 +180,10 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size
} }
const auto eta_mseconds = std::chrono::duration_cast<std::chrono::milliseconds>( const auto eta_mseconds = std::chrono::duration_cast<std::chrono::milliseconds>(
rolling_average * (total - value)); rolling_average * (total - value));
const auto limited_mseconds = std::max<long>(eta_mseconds.count(), 1000);
estimate = tr("Estimated Time %1") estimate = tr("Estimated Time %1")
.arg(QTime(0, 0, 0, 0) .arg(QTime(0, 0, 0, 0)
.addMSecs(std::max<long>(eta_mseconds.count(), 1000)) .addMSecs(static_cast<int>(limited_mseconds))
.toString(QStringLiteral("mm:ss"))); .toString(QStringLiteral("mm:ss")));
} }

View File

@ -125,8 +125,8 @@ void MoviePlayDialog::UpdateUIDisplay() {
} else { } else {
const u64 msecs = Service::HID::Module::pad_update_ticks * metadata.input_count * 1000 / const u64 msecs = Service::HID::Module::pad_update_ticks * metadata.input_count * 1000 /
BASE_CLOCK_RATE_ARM11; BASE_CLOCK_RATE_ARM11;
ui->lengthLineEdit->setText( ui->lengthLineEdit->setText(QTime::fromMSecsSinceStartOfDay(static_cast<int>(msecs))
QTime::fromMSecsSinceStartOfDay(msecs).toString(QStringLiteral("hh:mm:ss.zzz"))); .toString(QStringLiteral("hh:mm:ss.zzz")));
} }
} }
} }

View File

@ -284,7 +284,7 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
// filter by empty rooms // filter by empty rooms
if (filter_empty) { if (filter_empty) {
QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent); 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(); sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size();
if (player_count == 0) { if (player_count == 0) {
return false; return false;
@ -294,7 +294,7 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
// filter by filled rooms // filter by filled rooms
if (filter_full) { if (filter_full) {
QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent); 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(); sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size();
const int max_players = const int max_players =
sourceModel()->data(member_list, LobbyItemMemberList::MaxPlayerRole).toInt(); sourceModel()->data(member_list, LobbyItemMemberList::MaxPlayerRole).toInt();

View File

@ -198,8 +198,8 @@ public:
bool operator<(const QStandardItem& other) const override { bool operator<(const QStandardItem& other) const override {
// sort by rooms that have the most players // sort by rooms that have the most players
int left_members = data(MemberListRole).toList().size(); qsizetype left_members = data(MemberListRole).toList().size();
int right_members = other.data(MemberListRole).toList().size(); qsizetype right_members = other.data(MemberListRole).toList().size();
return left_members < right_members; return left_members < right_members;
} }
}; };

View File

@ -194,7 +194,7 @@ QString CSpinBox::TextFromValue() {
} }
qint64 CSpinBox::ValueFromText() { qint64 CSpinBox::ValueFromText() {
unsigned strpos = prefix.length(); qsizetype strpos = prefix.length();
QString num_string = text().mid(strpos, text().length() - strpos - suffix.length()); QString num_string = text().mid(strpos, text().length() - strpos - suffix.length());
return num_string.toLongLong(nullptr, base); 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) if (!prefix.isEmpty() && input.left(prefix.length()) != prefix)
return QValidator::Invalid; return QValidator::Invalid;
int strpos = prefix.length(); qsizetype strpos = prefix.length();
// Empty "numbers" allowed as intermediate values // Empty "numbers" allowed as intermediate values
if (strpos >= input.length() - HasSign() - suffix.length()) if (strpos >= input.length() - HasSign() - suffix.length())
@ -245,7 +245,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const {
// Match string // Match string
QRegularExpression num_regexp(QRegularExpression::anchoredPattern(regexp)); 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()); QString sub_input = input.mid(strpos, input.length() - strpos - suffix.length());
auto match = num_regexp.match(sub_input); auto match = num_regexp.match(sub_input);

View File

@ -197,9 +197,9 @@ GatewayCheat::CheatLine::CheatLine(const std::string& line) {
if (type_temp == "D" || type_temp == "d") if (type_temp == "D" || type_temp == "d")
sub_type_temp = line.substr(1, 1); sub_type_temp = line.substr(1, 1);
type = static_cast<CheatType>(std::stoi(type_temp + sub_type_temp, 0, 16)); type = static_cast<CheatType>(std::stoi(type_temp + sub_type_temp, 0, 16));
first = std::stoul(line.substr(0, 8), 0, 16); first = static_cast<u32>(std::stoul(line.substr(0, 8), 0, 16));
address = first & 0x0FFFFFFF; address = first & 0x0FFFFFFF;
value = std::stoul(line.substr(9, 8), 0, 16); value = static_cast<u32>(std::stoul(line.substr(9, 8), 0, 16));
cheat_line = line; cheat_line = line;
} catch (const std::logic_error&) { } catch (const std::logic_error&) {
type = CheatType::Null; type = CheatType::Null;

View File

@ -513,7 +513,7 @@ bool FFmpegAudioStream::Init(FFmpegMuxer& muxer) {
} }
if (codec_context->frame_size) { if (codec_context->frame_size) {
frame_size = static_cast<u64>(codec_context->frame_size); frame_size = codec_context->frame_size;
} else { // variable frame size support } else { // variable frame size support
frame_size = std::tuple_size<AudioCore::StereoFrame16>::value; frame_size = std::tuple_size<AudioCore::StereoFrame16>::value;
} }

View File

@ -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 block_size = mem_region_sizes[header.infos.flags.memory_region_size.Value()];
const u32 exe_size = (sizeof(PluginHeader) + text_section.size() + rodata_section.size() + const u32 exe_size = (sizeof(PluginHeader) + text_section.size() + rodata_section.size() +
data_section.size() + header.executable.bss_size + 0x1000) & data_section.size() + header.executable.bss_size + 0x1000) &
~0xFFF; ~0xFFFu;
// Allocate the framebuffer block so that is in the highest FCRAM position possible // Allocate the framebuffer block so that is in the highest FCRAM position possible
auto offset_fb = auto offset_fb =

View File

@ -509,7 +509,8 @@ void SendReply(const char* reply) {
u8* ptr = command_buffer; u8* ptr = command_buffer;
u32 left = command_length + 4; u32 left = command_length + 4;
while (left > 0) { while (left > 0) {
int sent_size = send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0); s32 sent_size =
static_cast<s32>(send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0));
if (sent_size < 0) { if (sent_size < 0) {
LOG_ERROR(Debug_GDBStub, "gdb: send failed"); LOG_ERROR(Debug_GDBStub, "gdb: send failed");
return Shutdown(); return Shutdown();

View File

@ -589,7 +589,7 @@ std::string GetTitleMetadataPath(Service::FS::MediaType media_type, u64 tid, boo
Common::SplitPath(entry.virtualName, nullptr, &filename_filename, &filename_extension); Common::SplitPath(entry.virtualName, nullptr, &filename_filename, &filename_extension);
if (filename_extension == ".tmd") { if (filename_extension == ".tmd") {
const u32 id = std::stoul(filename_filename, nullptr, 16); const u32 id = static_cast<u32>(std::stoul(filename_filename, nullptr, 16));
base_id = std::min(base_id, id); base_id = std::min(base_id, id);
update_id = std::max(update_id, id); update_id = std::max(update_id, id);
} }

View File

@ -982,11 +982,13 @@ void SOC_U::SendToOther(Kernel::HLERequestContext& ctx) {
CTRSockAddr ctr_dest_addr; CTRSockAddr ctr_dest_addr;
std::memcpy(&ctr_dest_addr, dest_addr_buffer.data(), sizeof(ctr_dest_addr)); std::memcpy(&ctr_dest_addr, dest_addr_buffer.data(), sizeof(ctr_dest_addr));
sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr); sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr);
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()), ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
len, flags, &dest_addr, sizeof(dest_addr)); reinterpret_cast<const char*>(input_buff.data()), len,
flags, &dest_addr, sizeof(dest_addr)));
} else { } else {
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()), ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
len, flags, nullptr, 0); reinterpret_cast<const char*>(input_buff.data()), len,
flags, nullptr, 0));
} }
const auto send_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 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; CTRSockAddr ctr_dest_addr;
std::memcpy(&ctr_dest_addr, dest_addr_buff.data(), sizeof(ctr_dest_addr)); std::memcpy(&ctr_dest_addr, dest_addr_buff.data(), sizeof(ctr_dest_addr));
sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr); sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr);
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()), ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
len, flags, &dest_addr, sizeof(dest_addr)); reinterpret_cast<const char*>(input_buff.data()), len,
flags, &dest_addr, sizeof(dest_addr)));
} else { } else {
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()), ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
len, flags, nullptr, 0); reinterpret_cast<const char*>(input_buff.data()), len,
flags, nullptr, 0));
} }
auto send_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 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) { if (addr_len > 0) {
ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast<char*>(output_buff.data()), ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
len, flags, &src_addr, &src_addr_len); reinterpret_cast<char*>(output_buff.data()), len, flags,
&src_addr, &src_addr_len));
if (ret >= 0 && src_addr_len > 0) { if (ret >= 0 && src_addr_len > 0) {
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len); std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len);
} }
} else { } else {
ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast<char*>(output_buff.data()), ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
len, flags, NULL, 0); reinterpret_cast<char*>(output_buff.data()), len, flags,
NULL, 0));
addr_buff.resize(0); addr_buff.resize(0);
} }
int recv_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 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) { if (addr_len > 0) {
// Only get src adr if input adr available // Only get src adr if input adr available
ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast<char*>(output_buff.data()), ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
len, flags, &src_addr, &src_addr_len); reinterpret_cast<char*>(output_buff.data()), len, flags,
&src_addr, &src_addr_len));
if (ret >= 0 && src_addr_len > 0) { if (ret >= 0 && src_addr_len > 0) {
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len); std::memcpy(addr_buff.data(), &ctr_src_addr, addr_len);
} }
} else { } else {
ret = ::recvfrom(fd_info->second.socket_fd, reinterpret_cast<char*>(output_buff.data()), ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
len, flags, NULL, 0); reinterpret_cast<char*>(output_buff.data()), len, flags,
NULL, 0));
addr_buff.resize(0); addr_buff.resize(0);
} }
int recv_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0; int recv_error = (ret == SOCKET_ERROR_VALUE) ? GET_ERRNO : 0;
@ -1753,7 +1761,11 @@ std::optional<SOC_U::InterfaceInfo> SOC_U::GetDefaultInterfaceInfo() {
} }
InterfaceInfo ret; InterfaceInfo ret;
s64 sock_fd = -1; #ifdef _WIN32
SOCKET sock_fd = -1;
#else
int sock_fd = -1;
#endif
bool interface_found = false; bool interface_found = false;
struct sockaddr_in s_in = {.sin_family = AF_INET, .sin_port = htons(53), .sin_addr = {}}; 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"); s_in.sin_addr.s_addr = inet_addr("8.8.8.8");