Author SHA1 Message Date
PabloMK7 10df158dc6 Fix clang format. 2024-01-30 14:24:04 +01:00
PabloMK7 a110843115 Add log regex filter 2024-01-30 14:07:01 +01:00
Steveice10andGitHub 469f76b075 qt: Display OpenGL renderer name and add Mesa override to support Windows OpenGLOn12. (#7395) 2024-01-29 12:24:41 -08:00
SachinVinandGitHub 7a4854c519 shader_setup.h: Initialise program_code (#7396) 2024-01-28 06:02:40 -08:00
Steveice10andGitHub d1e3dddf6a core: Fix invalid log formatting in ARM interpreter. (#7391) 2024-01-27 00:39:27 -08:00
Charles LombardoandGitHub 265e8193b9 Merge pull request #7392 from amwatson/patch-1
[SettingsFragmentPresenter.kt] correct RESOLUTION_FACTOR key/default
2024-01-26 22:43:04 -05:00
Amanda WatsonandGitHub e8c20fa782 [SettingsFragmentPresenter.kt] set RESOLUTION_FACTOR preference with RESOLUTION_FACTOR setting instead of GRAPHICS_API
Currently, the RESOLUTION_FACTOR preference is being set with the GRAPHICS_API key and default. Therefore, it will set/retrieve the wrong values

This revision updates the RESOLUTION_FACTOR preference to use the RESOLUTION_FACTOR key and default value. As a result, RESOLUTION_FACTOR and GRAPHICS_API should store and return the correct (separate) values
2024-01-26 19:14:27 -06:00
PabloMK7andGitHub 95ae46f6a8 SOC_U: Account for variable CTRSockAddr size (#7387)
* SOC_U: Account for variable CTRSockAddr size.

* Apply suggestions
2024-01-26 08:00:19 -08:00
Steveice10andGitHub 41fe75acb7 renderer_vulkan: Pass physical device API version to VMA instead of instance version. (#7390) 2024-01-26 16:34:12 +02:00
26 changed files with 198 additions and 61 deletions
@@ -687,8 +687,8 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
1,
10,
"x",
IntSetting.GRAPHICS_API.key,
IntSetting.GRAPHICS_API.defaultValue.toFloat()
IntSetting.RESOLUTION_FACTOR.key,
IntSetting.RESOLUTION_FACTOR.defaultValue.toFloat()
)
)
add(
+2
View File
@@ -244,12 +244,14 @@ void Config::ReadValues() {
// Miscellaneous
ReadSetting("Miscellaneous", Settings::values.log_filter);
ReadSetting("Miscellaneous", Settings::values.log_regex_filter);
// Apply the log_filter setting as the logger has already been initialized
// and doesn't pick up the filter on its own.
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
Common::Log::SetGlobalFilter(filter);
Common::Log::SetRegexFilter(Settings::values.log_regex_filter.GetValue());
// Debugging
Settings::values.record_frame_times =
+2
View File
@@ -306,12 +306,14 @@ void Config::ReadValues() {
// Miscellaneous
ReadSetting("Miscellaneous", Settings::values.log_filter);
ReadSetting("Miscellaneous", Settings::values.log_regex_filter);
// Apply the log_filter setting as the logger has already been initialized
// and doesn't pick up the filter on its own.
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
Common::Log::SetGlobalFilter(filter);
Common::Log::SetRegexFilter(Settings::values.log_regex_filter.GetValue());
// Debugging
Settings::values.record_frame_times =
+2 -7
View File
@@ -179,6 +179,8 @@ add_executable(citra-qt
qt_image_interface.h
util/clickable_label.cpp
util/clickable_label.h
util/graphics_device_info.cpp
util/graphics_device_info.h
util/sequence_dialog/sequence_dialog.cpp
util/sequence_dialog/sequence_dialog.h
util/spinbox.cpp
@@ -187,13 +189,6 @@ add_executable(citra-qt
util/util.h
)
if (ENABLE_VULKAN)
target_sources(citra-qt PRIVATE
util/vk_device_info.cpp
util/vk_device_info.h
)
endif()
file(GLOB COMPAT_LIST
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
+2
View File
@@ -531,6 +531,7 @@ void Config::ReadMiscellaneousValues() {
qt_config->beginGroup(QStringLiteral("Miscellaneous"));
ReadBasicSetting(Settings::values.log_filter);
ReadBasicSetting(Settings::values.log_regex_filter);
ReadBasicSetting(Settings::values.enable_gamemode);
qt_config->endGroup();
@@ -1054,6 +1055,7 @@ void Config::SaveMiscellaneousValues() {
qt_config->beginGroup(QStringLiteral("Miscellaneous"));
WriteBasicSetting(Settings::values.log_filter);
WriteBasicSetting(Settings::values.log_regex_filter);
WriteBasicSetting(Settings::values.enable_gamemode);
qt_config->endGroup();
@@ -97,6 +97,8 @@ void ConfigureDebug::SetConfiguration() {
ui->toggle_console->setEnabled(!is_powered_on);
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
ui->log_regex_filter_edit->setText(
QString::fromStdString(Settings::values.log_regex_filter.GetValue()));
ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit.GetValue());
ui->delay_start_for_lle_modules->setChecked(
Settings::values.delay_start_for_lle_modules.GetValue());
@@ -126,10 +128,12 @@ void ConfigureDebug::ApplyConfiguration() {
Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
UISettings::values.show_console = ui->toggle_console->isChecked();
Settings::values.log_filter = ui->log_filter_edit->text().toStdString();
Settings::values.log_regex_filter = ui->log_regex_filter_edit->text().toStdString();
Debugger::ToggleConsole();
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
Common::Log::SetGlobalFilter(filter);
Common::Log::SetRegexFilter(Settings::values.log_regex_filter.GetValue());
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked();
Settings::values.delay_start_for_lle_modules = ui->delay_start_for_lle_modules->isChecked();
Settings::values.renderer_debug = ui->toggle_renderer_debug->isChecked();
@@ -85,6 +85,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Regex Log Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="log_regex_filter_edit"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -23,14 +23,16 @@
#include "ui_configure.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Core::System& system_,
std::span<const QString> physical_devices, bool enable_web_config)
QString gl_renderer, std::span<const QString> physical_devices,
bool enable_web_config)
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, registry{registry_},
system{system_}, is_powered_on{system.IsPoweredOn()},
general_tab{std::make_unique<ConfigureGeneral>(this)},
system_tab{std::make_unique<ConfigureSystem>(system, this)},
input_tab{std::make_unique<ConfigureInput>(this)},
hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)},
graphics_tab{std::make_unique<ConfigureGraphics>(physical_devices, is_powered_on, this)},
graphics_tab{
std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this)},
enhancements_tab{std::make_unique<ConfigureEnhancements>(this)},
audio_tab{std::make_unique<ConfigureAudio>(is_powered_on, this)},
camera_tab{std::make_unique<ConfigureCamera>(this)},
@@ -37,7 +37,7 @@ class ConfigureDialog : public QDialog {
public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, Core::System& system,
std::span<const QString> physical_devices,
QString gl_renderer, std::span<const QString> physical_devices,
bool enable_web_config = true);
~ConfigureDialog() override;
@@ -12,17 +12,13 @@
#include "video_core/renderer_vulkan/vk_instance.h"
#endif
ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
QWidget* parent)
ConfigureGraphics::ConfigureGraphics(QString gl_renderer, std::span<const QString> physical_devices,
bool is_powered_on, QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureGraphics>()) {
ui->setupUi(this);
SetupPerGameUI();
for (const QString& name : physical_devices) {
ui->physical_device_combo->addItem(name);
}
ui->graphics_api_combo->setEnabled(!is_powered_on);
ui->physical_device_combo->setEnabled(!is_powered_on);
ui->toggle_async_shaders->setEnabled(!is_powered_on);
@@ -37,11 +33,15 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Software));
software_item->setFlags(software_item->flags() & ~Qt::ItemIsEnabled);
#endif
#ifndef ENABLE_OPENGL
const auto opengl_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::OpenGL));
opengl_item->setFlags(opengl_item->flags() & ~Qt::ItemIsEnabled);
#else
ui->opengl_renderer_name_label->setText(gl_renderer);
#endif
#ifndef ENABLE_VULKAN
const auto vulkan_item =
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
@@ -54,6 +54,10 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
ui->physical_device_combo->setVisible(false);
ui->spirv_shader_gen->setVisible(false);
} else {
for (const QString& name : physical_devices) {
ui->physical_device_combo->addItem(name);
}
}
#endif
@@ -202,24 +206,24 @@ void ConfigureGraphics::SetupPerGameUI() {
}
void ConfigureGraphics::SetPhysicalDeviceComboVisibility(int index) {
bool is_visible{};
Settings::GraphicsAPI effective_api{};
// When configuring per-game the physical device combo should be
// shown either when the global api is used and that is Vulkan or
// Vulkan is set as the per-game api.
if (!Settings::IsConfiguringGlobal()) {
const auto global_graphics_api = Settings::values.graphics_api.GetValue(true);
const bool using_global = index == 0;
if (!using_global) {
index -= ConfigurationShared::USE_GLOBAL_OFFSET;
if (using_global) {
effective_api = Settings::values.graphics_api.GetValue(true);
} else {
effective_api =
static_cast<Settings::GraphicsAPI>(index - ConfigurationShared::USE_GLOBAL_OFFSET);
}
const auto graphics_api = static_cast<Settings::GraphicsAPI>(index);
is_visible = (using_global && global_graphics_api == Settings::GraphicsAPI::Vulkan) ||
graphics_api == Settings::GraphicsAPI::Vulkan;
} else {
const auto graphics_api = static_cast<Settings::GraphicsAPI>(index);
is_visible = graphics_api == Settings::GraphicsAPI::Vulkan;
effective_api = static_cast<Settings::GraphicsAPI>(index);
}
ui->physical_device_group->setVisible(is_visible);
ui->spirv_shader_gen->setVisible(is_visible);
ui->physical_device_group->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
ui->spirv_shader_gen->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
ui->opengl_renderer_group->setVisible(effective_api == Settings::GraphicsAPI::OpenGL);
}
@@ -21,8 +21,8 @@ class ConfigureGraphics : public QWidget {
Q_OBJECT
public:
explicit ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
QWidget* parent = nullptr);
explicit ConfigureGraphics(QString gl_renderer, std::span<const QString> physical_devices,
bool is_powered_on, QWidget* parent = nullptr);
~ConfigureGraphics() override;
void ApplyConfiguration();
@@ -101,6 +101,34 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="opengl_renderer_group" native="true">
<layout class="QHBoxLayout" name="opengl_renderer_group_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="opengl_renderer_label">
<property name="text">
<string>OpenGL Renderer</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="opengl_renderer_name_label"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="spirv_shader_gen">
<property name="text">
@@ -24,7 +24,8 @@
#include "ui_configure_per_game.h"
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString& file_name,
std::span<const QString> physical_devices, Core::System& system_)
QString gl_renderer, std::span<const QString> physical_devices,
Core::System& system_)
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()),
filename{file_name.toStdString()}, title_id{title_id_}, system{system_} {
const auto config_file_name = title_id == 0 ? std::string(FileUtil::GetFilename(filename))
@@ -35,7 +36,8 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
audio_tab = std::make_unique<ConfigureAudio>(is_powered_on, this);
general_tab = std::make_unique<ConfigureGeneral>(this);
enhancements_tab = std::make_unique<ConfigureEnhancements>(this);
graphics_tab = std::make_unique<ConfigureGraphics>(physical_devices, is_powered_on, this);
graphics_tab =
std::make_unique<ConfigureGraphics>(gl_renderer, physical_devices, is_powered_on, this);
system_tab = std::make_unique<ConfigureSystem>(system, this);
debug_tab = std::make_unique<ConfigureDebug>(is_powered_on, this);
cheat_tab = std::make_unique<ConfigureCheats>(system.CheatEngine(), title_id, this);
@@ -38,7 +38,8 @@ class ConfigurePerGame : public QDialog {
public:
explicit ConfigurePerGame(QWidget* parent, u64 title_id_, const QString& file_name,
std::span<const QString> physical_devices, Core::System& system_);
QString gl_renderer, std::span<const QString> physical_devices,
Core::System& system_);
~ConfigurePerGame() override;
/// Loads all button configurations to settings file
+15 -3
View File
@@ -64,7 +64,7 @@
#include "citra_qt/uisettings.h"
#include "citra_qt/updater/updater.h"
#include "citra_qt/util/clickable_label.h"
#include "citra_qt/util/vk_device_info.h"
#include "citra_qt/util/graphics_device_info.h"
#include "common/arch.h"
#include "common/common_paths.h"
#include "common/detached_tasks.h"
@@ -270,6 +270,18 @@ GMainWindow::GMainWindow(Core::System& system_)
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::OnMouseActivity);
#ifdef ENABLE_OPENGL
gl_renderer = GetOpenGLRenderer();
#if defined(_WIN32)
if (gl_renderer.startsWith(QStringLiteral("D3D12"))) {
// OpenGLOn12 supports but does not yet advertise OpenGL 4.0+
// We can override the version here to allow Citra to work.
// TODO: Remove this when OpenGL 4.0+ is advertised.
qputenv("MESA_GL_VERSION_OVERRIDE", "4.6");
}
#endif
#endif
#ifdef ENABLE_VULKAN
physical_devices = GetVulkanPhysicalDevices();
if (physical_devices.empty()) {
@@ -2158,7 +2170,7 @@ void GMainWindow::OnLoadState() {
void GMainWindow::OnConfigure() {
game_list->SetDirectoryWatcherEnabled(false);
Settings::SetConfiguringGlobal(true);
ConfigureDialog configureDialog(this, hotkey_registry, system, physical_devices,
ConfigureDialog configureDialog(this, hotkey_registry, system, gl_renderer, physical_devices,
!multiplayer_state->IsHostingPublicRoom());
connect(&configureDialog, &ConfigureDialog::LanguageChanged, this,
&GMainWindow::OnLanguageChanged);
@@ -3006,7 +3018,7 @@ void GMainWindow::OnConfigurePerGame() {
void GMainWindow::OpenPerGameConfiguration(u64 title_id, const QString& file_name) {
Settings::SetConfiguringGlobal(false);
ConfigurePerGame dialog(this, title_id, file_name, physical_devices, system);
ConfigurePerGame dialog(this, title_id, file_name, gl_renderer, physical_devices, system);
const auto result = dialog.exec();
if (result != QDialog::Accepted) {
+1
View File
@@ -344,6 +344,7 @@ private:
// Whether game was paused due to stopping video dumping
bool game_paused_for_dumping = false;
QString gl_renderer;
std::vector<QString> physical_devices;
// Debugger panes
@@ -2,9 +2,34 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "citra_qt/util/vk_device_info.h"
#include "video_core/renderer_vulkan/vk_instance.h"
#include "citra_qt/util/graphics_device_info.h"
#ifdef ENABLE_OPENGL
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#endif
#ifdef ENABLE_VULKAN
#include "video_core/renderer_vulkan/vk_instance.h"
#endif
#ifdef ENABLE_OPENGL
QString GetOpenGLRenderer() {
QOffscreenSurface surface;
surface.create();
QOpenGLContext context;
if (context.create()) {
context.makeCurrent(&surface);
return QString::fromUtf8(context.functions()->glGetString(GL_RENDERER));
} else {
return QStringLiteral("");
}
}
#endif
#ifdef ENABLE_VULKAN
std::vector<QString> GetVulkanPhysicalDevices() {
std::vector<QString> result;
try {
@@ -21,3 +46,4 @@ std::vector<QString> GetVulkanPhysicalDevices() {
return result;
}
#endif
@@ -7,5 +7,12 @@
#include <vector>
#include <QString>
#ifdef ENABLE_OPENGL
/// Returns the name of the OpenGL renderer.
QString GetOpenGLRenderer();
#endif
#ifdef ENABLE_VULKAN
/// Returns a list of all available vulkan GPUs.
std::vector<QString> GetVulkanPhysicalDevices();
#endif
+26 -2
View File
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <chrono>
#include <boost/regex.hpp>
#include <fmt/format.h>
@@ -234,6 +235,19 @@ public:
filter = f;
}
bool SetRegexFilter(const std::string& regex) {
if (regex.empty()) {
regex_filter = boost::regex();
return true;
}
regex_filter = boost::regex(regex, boost::regex_constants::no_except);
if (regex_filter.status() != 0) {
regex_filter = boost::regex();
return false;
}
return true;
}
void SetColorConsoleBackendEnabled(bool enabled) {
color_console_backend.SetEnabled(enabled);
}
@@ -243,8 +257,13 @@ public:
if (!filter.CheckMessage(log_class, log_level)) {
return;
}
message_queue.EmplaceWait(
CreateEntry(log_class, log_level, filename, line_num, function, std::move(message)));
Entry new_entry =
CreateEntry(log_class, log_level, filename, line_num, function, std::move(message));
if (!regex_filter.empty() &&
!boost::regex_search(FormatLogMessage(new_entry), regex_filter)) {
return;
}
message_queue.EmplaceWait(new_entry);
}
private:
@@ -406,6 +425,7 @@ private:
static inline std::unique_ptr<Impl, decltype(&Deleter)> instance{nullptr, Deleter};
Filter filter;
boost::regex regex_filter;
DebuggerBackend debugger_backend{};
ColorConsoleBackend color_console_backend{};
FileBackend file_backend;
@@ -446,6 +466,10 @@ void SetGlobalFilter(const Filter& filter) {
Impl::Instance().SetGlobalFilter(filter);
}
bool SetRegexFilter(const std::string& regex) {
return Impl::Instance().SetRegexFilter(regex);
}
void SetColorConsoleBackendEnabled(bool enabled) {
Impl::Instance().SetColorConsoleBackendEnabled(enabled);
}
+6
View File
@@ -26,5 +26,11 @@ void DisableLoggingInTests();
*/
void SetGlobalFilter(const Filter& filter);
/**
* Only allow messages that match the specified regex. The regex is matched against the final log
* text.
*/
bool SetRegexFilter(const std::string& regex);
void SetColorConsoleBackendEnabled(bool enabled);
} // namespace Common::Log
+1
View File
@@ -542,6 +542,7 @@ struct Values {
// Miscellaneous
Setting<std::string> log_filter{"*:Info", "log_filter"};
Setting<std::string> log_regex_filter{"", "log_regex_filter"};
// Video Dumping
std::string output_format;
+1 -1
View File
@@ -101,7 +101,7 @@ void vfp_put_float(ARMul_State* state, s32 val, unsigned int reg) {
u64 vfp_get_double(ARMul_State* state, unsigned int reg) {
u64 result = ((u64)state->ExtReg[reg * 2 + 1]) << 32 | state->ExtReg[reg * 2];
LOG_TRACE(Core_ARM11, "VFP get double: s[{}-{}]=[{:016llx}]", reg * 2 + 1, reg * 2, result);
LOG_TRACE(Core_ARM11, "VFP get double: s[{}-{}]=[{:016x}]", reg * 2 + 1, reg * 2, result);
return result;
}
+3 -4
View File
@@ -64,7 +64,7 @@ static struct vfp_double vfp_double_default_qnan = {
};
static void vfp_double_dump(const char* str, struct vfp_double* d) {
LOG_TRACE(Core_ARM11, "VFP: {}: sign={} exponent={} significand={:016llx}", str, d->sign != 0,
LOG_TRACE(Core_ARM11, "VFP: {}: sign={} exponent={} significand={:016x}", str, d->sign != 0,
d->exponent, d->significand);
}
@@ -166,7 +166,7 @@ u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd,
} else if ((rmode == FPSCR_ROUND_PLUSINF) ^ (vd->sign != 0))
incr = (1ULL << (VFP_DOUBLE_LOW_BITS + 1)) - 1;
LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x{:08llx}", incr);
LOG_TRACE(Core_ARM11, "VFP: rounding increment = 0x{:08x}", incr);
/*
* Is our rounding going to overflow?
@@ -221,8 +221,7 @@ pack:
vfp_double_dump("pack: final", vd);
{
s64 d = vfp_double_pack(vd);
LOG_TRACE(Core_ARM11, "VFP: {}: d(d{})={:016llx} exceptions={:08x}", func, dd, d,
exceptions);
LOG_TRACE(Core_ARM11, "VFP: {}: d(d{})={:016x} exceptions={:08x}", func, dd, d, exceptions);
vfp_put_double(state, d, dd);
}
return exceptions;
+15 -10
View File
@@ -838,7 +838,7 @@ void SOC_U::Bind(Kernel::HLERequestContext& ctx) {
SocketHolder& holder = socket_holder_optional->get();
CTRSockAddr ctr_sock_addr;
std::memcpy(&ctr_sock_addr, sock_addr_buf.data(), len);
std::memcpy(&ctr_sock_addr, sock_addr_buf.data(), std::min<size_t>(len, sizeof(ctr_sock_addr)));
sockaddr sock_addr = CTRSockAddr::ToPlatform(ctr_sock_addr);
@@ -977,7 +977,7 @@ void SOC_U::Accept(Kernel::HLERequestContext& ctx) {
}
if (ctr_addr_buf.size() > async_data->max_addr_len) {
LOG_WARNING(Frontend, "CTRSockAddr is too long, truncating data.");
LOG_DEBUG(Service_SOC, "CTRSockAddr is too long, truncating data.");
ctr_addr_buf.resize(async_data->max_addr_len);
}
@@ -1107,7 +1107,8 @@ void SOC_U::SendToOther(Kernel::HLERequestContext& ctx) {
s32 ret = -1;
if (addr_len > 0) {
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(),
std::min<size_t>(addr_len, sizeof(ctr_dest_addr)));
sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr);
ret = static_cast<s32>(::sendto(holder.socket_fd,
reinterpret_cast<const char*>(input_buff.data()), len,
@@ -1156,7 +1157,8 @@ s32 SOC_U::SendToImpl(SocketHolder& holder, u32 len, u32 flags, u32 addr_len,
s32 ret = -1;
if (addr_len > 0) {
CTRSockAddr ctr_dest_addr;
std::memcpy(&ctr_dest_addr, dest_addr_buff, sizeof(ctr_dest_addr));
std::memcpy(&ctr_dest_addr, dest_addr_buff,
std::min<size_t>(addr_len, sizeof(ctr_dest_addr)));
sockaddr dest_addr = CTRSockAddr::ToPlatform(ctr_dest_addr);
ret = static_cast<s32>(::sendto(holder.socket_fd,
reinterpret_cast<const char*>(input_buff.data()), len,
@@ -1306,7 +1308,8 @@ void SOC_U::RecvFromOther(Kernel::HLERequestContext& ctx) {
async_data->len, async_data->flags, &src_addr, &src_addr_len));
if (async_data->ret >= 0 && src_addr_len > 0) {
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
std::memcpy(async_data->addr_buff.data(), &ctr_src_addr, async_data->addr_len);
std::memcpy(async_data->addr_buff.data(), &ctr_src_addr,
std::min<size_t>(async_data->addr_len, sizeof(ctr_src_addr)));
}
} else {
async_data->ret = static_cast<s32>(
@@ -1422,7 +1425,8 @@ void SOC_U::RecvFrom(Kernel::HLERequestContext& ctx) {
async_data->len, async_data->flags, &src_addr, &src_addr_len));
if (async_data->ret >= 0 && src_addr_len > 0) {
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
std::memcpy(async_data->addr_buff.data(), &ctr_src_addr, async_data->addr_len);
std::memcpy(async_data->addr_buff.data(), &ctr_src_addr,
std::min<size_t>(async_data->addr_len, sizeof(ctr_src_addr)));
}
} else {
async_data->ret = static_cast<s32>(
@@ -1566,7 +1570,7 @@ void SOC_U::GetSockName(Kernel::HLERequestContext& ctx) {
ret = TranslateError(GET_ERRNO);
if (dest_addr_buff.size() > max_addr_len) {
LOG_WARNING(Frontend, "CTRSockAddr is too long, truncating data.");
LOG_DEBUG(Service_SOC, "CTRSockAddr is too long, truncating data.");
dest_addr_buff.resize(max_addr_len);
}
@@ -1708,7 +1712,7 @@ void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) {
}
if (dest_addr_buff.size() > max_addr_len) {
LOG_WARNING(Frontend, "CTRSockAddr is too long, truncating data.");
LOG_DEBUG(Service_SOC, "CTRSockAddr is too long, truncating data.");
dest_addr_buff.resize(max_addr_len);
}
@@ -1724,7 +1728,7 @@ void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) {
void SOC_U::Connect(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
const auto socket_handle = rp.Pop<u32>();
[[maybe_unused]] const auto input_addr_len = rp.Pop<u32>();
const auto input_addr_len = rp.Pop<u32>();
const u32 pid = rp.PopPID();
auto input_addr_buf = rp.PopStaticBuffer();
@@ -1751,7 +1755,8 @@ void SOC_U::Connect(Kernel::HLERequestContext& ctx) {
async_data->pid = pid;
CTRSockAddr ctr_input_addr;
std::memcpy(&ctr_input_addr, input_addr_buf.data(), sizeof(ctr_input_addr));
std::memcpy(&ctr_input_addr, input_addr_buf.data(),
std::min<size_t>(input_addr_len, sizeof(ctr_input_addr)));
async_data->input_addr = CTRSockAddr::ToPlatform(ctr_input_addr);
async_data->socket_handle = socket_handle;
+3 -3
View File
@@ -76,9 +76,9 @@ public:
public:
Uniforms uniforms;
PackedAttribute uniform_queue;
ProgramCode program_code;
SwizzleData swizzle_data;
u32 entry_point;
ProgramCode program_code{};
SwizzleData swizzle_data{};
u32 entry_point{};
const void* cached_shader{};
private:
@@ -629,7 +629,7 @@ void Instance::CreateAllocator() {
.device = *device,
.pVulkanFunctions = &functions,
.instance = *instance,
.vulkanApiVersion = vk::enumerateInstanceVersion(),
.vulkanApiVersion = properties.apiVersion,
};
const VkResult result = vmaCreateAllocator(&allocator_info, &allocator);