1
0
Fork 0

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) {
setAttribute(Qt::WA_DontCreateNativeAncestors);
}
#ifdef __APPLE__
windowHandle()->setSurfaceType(QWindow::MetalSurface);
#else
windowHandle()->setSurfaceType(QWindow::VulkanSurface);
#endif
}
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.
// 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->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->updateBox->setVisible(UISettings::values.updater_found);

View File

@ -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<int>(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<int>(time_offset * 1000));
ui->edit_init_time_offset_time->setTime(time);
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>(
rolling_average * (total - value));
const auto limited_mseconds = std::max<long>(eta_mseconds.count(), 1000);
estimate = tr("Estimated Time %1")
.arg(QTime(0, 0, 0, 0)
.addMSecs(std::max<long>(eta_mseconds.count(), 1000))
.addMSecs(static_cast<int>(limited_mseconds))
.toString(QStringLiteral("mm:ss")));
}

View File

@ -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<int>(msecs))
.toString(QStringLiteral("hh:mm:ss.zzz")));
}
}
}

View File

@ -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();

View File

@ -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;
}
};

View File

@ -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);

View File

@ -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<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;
value = std::stoul(line.substr(9, 8), 0, 16);
value = static_cast<u32>(std::stoul(line.substr(9, 8), 0, 16));
cheat_line = line;
} catch (const std::logic_error&) {
type = CheatType::Null;

View File

@ -513,7 +513,7 @@ bool FFmpegAudioStream::Init(FFmpegMuxer& muxer) {
}
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
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 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 =

View File

@ -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<char*>(ptr), left, 0);
s32 sent_size =
static_cast<s32>(send(gdbserver_socket, reinterpret_cast<char*>(ptr), left, 0));
if (sent_size < 0) {
LOG_ERROR(Debug_GDBStub, "gdb: send failed");
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);
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);
update_id = std::max(update_id, id);
}

View File

@ -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<const char*>(input_buff.data()),
len, flags, &dest_addr, sizeof(dest_addr));
ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
reinterpret_cast<const char*>(input_buff.data()), len,
flags, &dest_addr, sizeof(dest_addr)));
} else {
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()),
len, flags, nullptr, 0);
ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
reinterpret_cast<const char*>(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<const char*>(input_buff.data()),
len, flags, &dest_addr, sizeof(dest_addr));
ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
reinterpret_cast<const char*>(input_buff.data()), len,
flags, &dest_addr, sizeof(dest_addr)));
} else {
ret = ::sendto(fd_info->second.socket_fd, reinterpret_cast<const char*>(input_buff.data()),
len, flags, nullptr, 0);
ret = static_cast<s32>(::sendto(fd_info->second.socket_fd,
reinterpret_cast<const char*>(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<char*>(output_buff.data()),
len, flags, &src_addr, &src_addr_len);
ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
reinterpret_cast<char*>(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<char*>(output_buff.data()),
len, flags, NULL, 0);
ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
reinterpret_cast<char*>(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<char*>(output_buff.data()),
len, flags, &src_addr, &src_addr_len);
ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
reinterpret_cast<char*>(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<char*>(output_buff.data()),
len, flags, NULL, 0);
ret = static_cast<s32>(::recvfrom(fd_info->second.socket_fd,
reinterpret_cast<char*>(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::InterfaceInfo> 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");