early-access version 4096

This commit is contained in:
pineappleEA 2024-01-28 23:16:18 +01:00
parent 239e2d0f9e
commit 124fc3517c
28 changed files with 291 additions and 22 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4095. This is the source code for early-access 4096.
## Legal Notice ## Legal Notice

View File

@ -89,11 +89,13 @@ u32 AudioRenderer::Receive(Direction dir) {
} }
void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
u64 applet_resource_user_id, bool reset) noexcept { u64 applet_resource_user_id, Kernel::KProcess* process,
bool reset) noexcept {
command_buffers[session_id].buffer = buffer; command_buffers[session_id].buffer = buffer;
command_buffers[session_id].size = size; command_buffers[session_id].size = size;
command_buffers[session_id].time_limit = time_limit; command_buffers[session_id].time_limit = time_limit;
command_buffers[session_id].applet_resource_user_id = applet_resource_user_id; command_buffers[session_id].applet_resource_user_id = applet_resource_user_id;
command_buffers[session_id].process = process;
command_buffers[session_id].reset_buffer = reset; command_buffers[session_id].reset_buffer = reset;
} }
@ -173,7 +175,8 @@ void AudioRenderer::Main(std::stop_token stop_token) {
// If there are no remaining commands (from the previous list), // If there are no remaining commands (from the previous list),
// this is a new command list, initialize it. // this is a new command list, initialize it.
if (command_buffer.remaining_command_count == 0) { if (command_buffer.remaining_command_count == 0) {
command_list_processor.Initialize(system, command_buffer.buffer, command_list_processor.Initialize(system, *command_buffer.process,
command_buffer.buffer,
command_buffer.size, streams[index]); command_buffer.size, streams[index]);
} }

View File

@ -19,6 +19,10 @@ namespace Core {
class System; class System;
} // namespace Core } // namespace Core
namespace Kernel {
class KProcess;
}
namespace AudioCore { namespace AudioCore {
namespace Sink { namespace Sink {
class Sink; class Sink;
@ -69,7 +73,8 @@ public:
u32 Receive(Direction dir); u32 Receive(Direction dir);
void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit,
u64 applet_resource_user_id, bool reset) noexcept; u64 applet_resource_user_id, Kernel::KProcess* process,
bool reset) noexcept;
u32 GetRemainCommandCount(s32 session_id) const noexcept; u32 GetRemainCommandCount(s32 session_id) const noexcept;
void ClearRemainCommandCount(s32 session_id) noexcept; void ClearRemainCommandCount(s32 session_id) noexcept;
u64 GetRenderingStartTick(s32 session_id) const noexcept; u64 GetRenderingStartTick(s32 session_id) const noexcept;

View File

@ -6,6 +6,10 @@
#include "audio_core/common/common.h" #include "audio_core/common/common.h"
#include "common/common_types.h" #include "common/common_types.h"
namespace Kernel {
class KProcess;
}
namespace AudioCore::ADSP::AudioRenderer { namespace AudioCore::ADSP::AudioRenderer {
struct CommandBuffer { struct CommandBuffer {
@ -14,6 +18,7 @@ struct CommandBuffer {
u64 size{}; u64 size{};
u64 time_limit{}; u64 time_limit{};
u64 applet_resource_user_id{}; u64 applet_resource_user_id{};
Kernel::KProcess* process{};
bool reset_buffer{}; bool reset_buffer{};
// Set by the DSP // Set by the DSP
u32 remaining_command_count{}; u32 remaining_command_count{};

View File

@ -9,14 +9,15 @@
#include "common/settings.h" #include "common/settings.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/k_process.h"
#include "core/memory.h" #include "core/memory.h"
namespace AudioCore::ADSP::AudioRenderer { namespace AudioCore::ADSP::AudioRenderer {
void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, void CommandListProcessor::Initialize(Core::System& system_, Kernel::KProcess& process,
Sink::SinkStream* stream_) { CpuAddr buffer, u64 size, Sink::SinkStream* stream_) {
system = &system_; system = &system_;
memory = &system->ApplicationMemory(); memory = &process.GetMemory();
stream = stream_; stream = stream_;
header = reinterpret_cast<Renderer::CommandListHeader*>(buffer); header = reinterpret_cast<Renderer::CommandListHeader*>(buffer);
commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader)); commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader));

View File

@ -16,6 +16,10 @@ class Memory;
class System; class System;
} // namespace Core } // namespace Core
namespace Kernel {
class KProcess;
}
namespace AudioCore { namespace AudioCore {
namespace Sink { namespace Sink {
class SinkStream; class SinkStream;
@ -40,7 +44,8 @@ public:
* @param size - The size of the buffer. * @param size - The size of the buffer.
* @param stream - The stream to be used for sending the samples. * @param stream - The stream to be used for sending the samples.
*/ */
void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream); void Initialize(Core::System& system, Kernel::KProcess& process, CpuAddr buffer, u64 size,
Sink::SinkStream* stream);
/** /**
* Set the maximum processing time for this command list. * Set the maximum processing time for this command list.

View File

@ -6,6 +6,7 @@
#include "audio_core/renderer/audio_renderer.h" #include "audio_core/renderer/audio_renderer.h"
#include "audio_core/renderer/system_manager.h" #include "audio_core/renderer/system_manager.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/kernel/k_transfer_memory.h"
#include "core/hle/service/audio/errors.h" #include "core/hle/service/audio/errors.h"
@ -17,7 +18,8 @@ Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* ren
Result Renderer::Initialize(const AudioRendererParameterInternal& params, Result Renderer::Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, Kernel::KTransferMemory* transfer_memory,
const u64 transfer_memory_size, const u32 process_handle, const u64 transfer_memory_size, const u32 process_handle,
const u64 applet_resource_user_id, const s32 session_id) { Kernel::KProcess& process, const u64 applet_resource_user_id,
const s32 session_id) {
if (params.execution_mode == ExecutionMode::Auto) { if (params.execution_mode == ExecutionMode::Auto) {
if (!manager.AddSystem(system)) { if (!manager.AddSystem(system)) {
LOG_ERROR(Service_Audio, LOG_ERROR(Service_Audio,
@ -28,7 +30,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params,
} }
initialized = true; initialized = true;
system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, process,
applet_resource_user_id, session_id); applet_resource_user_id, session_id);
return ResultSuccess; return ResultSuccess;

View File

@ -14,7 +14,8 @@ class System;
namespace Kernel { namespace Kernel {
class KTransferMemory; class KTransferMemory;
} class KProcess;
} // namespace Kernel
namespace AudioCore { namespace AudioCore {
struct AudioRendererParameterInternal; struct AudioRendererParameterInternal;
@ -44,7 +45,8 @@ public:
*/ */
Result Initialize(const AudioRendererParameterInternal& params, Result Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle, u64 applet_resource_user_id, s32 session_id); u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id,
s32 session_id);
/** /**
* Finalize the renderer for shutdown. * Finalize the renderer for shutdown.

View File

@ -32,6 +32,7 @@
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/kernel/k_transfer_memory.h"
#include "core/memory.h" #include "core/memory.h"
@ -101,7 +102,8 @@ System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_)
Result System::Initialize(const AudioRendererParameterInternal& params, Result System::Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) { u32 process_handle_, Kernel::KProcess& process_,
u64 applet_resource_user_id_, s32 session_id_) {
if (!CheckValidRevision(params.revision)) { if (!CheckValidRevision(params.revision)) {
return Service::Audio::ResultInvalidRevision; return Service::Audio::ResultInvalidRevision;
} }
@ -117,6 +119,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
behavior.SetUserLibRevision(params.revision); behavior.SetUserLibRevision(params.revision);
process_handle = process_handle_; process_handle = process_handle_;
process = &process_;
applet_resource_user_id = applet_resource_user_id_; applet_resource_user_id = applet_resource_user_id_;
session_id = session_id_; session_id = session_id_;
@ -129,7 +132,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
render_device = params.rendering_device; render_device = params.rendering_device;
execution_mode = params.execution_mode; execution_mode = params.execution_mode;
core.ApplicationMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size); process->GetMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size);
// Note: We're not actually using the transfer memory because it's a pain to code for. // Note: We're not actually using the transfer memory because it's a pain to code for.
// Allocate the memory normally instead and hope the game doesn't try to read anything back // Allocate the memory normally instead and hope the game doesn't try to read anything back
@ -613,7 +616,8 @@ void System::SendCommandToDsp() {
static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 *
(static_cast<f32>(render_time_limit_percent) / 100.0f))}; (static_cast<f32>(render_time_limit_percent) / 100.0f))};
audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit, audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit,
applet_resource_user_id, reset_command_buffers); applet_resource_user_id, process,
reset_command_buffers);
reset_command_buffers = false; reset_command_buffers = false;
command_buffer_size = command_size; command_buffer_size = command_size;
if (remaining_command_count == 0) { if (remaining_command_count == 0) {

View File

@ -29,6 +29,7 @@ class System;
namespace Kernel { namespace Kernel {
class KEvent; class KEvent;
class KProcess;
class KTransferMemory; class KTransferMemory;
} // namespace Kernel } // namespace Kernel
@ -80,7 +81,8 @@ public:
*/ */
Result Initialize(const AudioRendererParameterInternal& params, Result Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle, u64 applet_resource_user_id, s32 session_id); u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id,
s32 session_id);
/** /**
* Finalize the system. * Finalize the system.
@ -275,6 +277,8 @@ private:
Common::Event terminate_event{}; Common::Event terminate_event{};
/// Does what locks do /// Does what locks do
std::mutex lock{}; std::mutex lock{};
/// Process this audio render is operating within, used for memory reads/writes.
Kernel::KProcess* process{};
/// Handle for the process for this system, unused /// Handle for the process for this system, unused
u32 process_handle{}; u32 process_handle{};
/// Applet resource id for this system, unused /// Applet resource id for this system, unused

View File

@ -35,10 +35,11 @@ public:
explicit IAudioRenderer(Core::System& system_, Manager& manager_, explicit IAudioRenderer(Core::System& system_, Manager& manager_,
AudioCore::AudioRendererParameterInternal& params, AudioCore::AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle, u64 applet_resource_user_id, s32 session_id) u32 process_handle, Kernel::KProcess& process_,
u64 applet_resource_user_id, s32 session_id)
: ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"}, : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_}, rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
impl{std::make_unique<Renderer>(system_, manager, rendered_event)} { impl{std::make_unique<Renderer>(system_, manager, rendered_event)}, process{process_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"}, {0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
@ -59,13 +60,15 @@ public:
// clang-format on // clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, process.Open();
impl->Initialize(params, transfer_memory, transfer_memory_size, process_handle, process,
applet_resource_user_id, session_id); applet_resource_user_id, session_id);
} }
~IAudioRenderer() override { ~IAudioRenderer() override {
impl->Finalize(); impl->Finalize();
service_context.CloseEvent(rendered_event); service_context.CloseEvent(rendered_event);
process.Close();
} }
private: private:
@ -235,6 +238,7 @@ private:
Kernel::KEvent* rendered_event; Kernel::KEvent* rendered_event;
Manager& manager; Manager& manager;
std::unique_ptr<Renderer> impl; std::unique_ptr<Renderer> impl;
Kernel::KProcess& process;
Common::ScratchBuffer<u8> output_buffer; Common::ScratchBuffer<u8> output_buffer;
Common::ScratchBuffer<u8> performance_buffer; Common::ScratchBuffer<u8> performance_buffer;
}; };
@ -455,7 +459,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
return; return;
} }
auto process{ctx.GetObjectFromHandle<Kernel::KProcess>(process_handle)}; auto process{ctx.GetObjectFromHandle<Kernel::KProcess>(process_handle).GetPointerUnsafe()};
auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)}; auto transfer_memory{ctx.GetObjectFromHandle<Kernel::KTransferMemory>(transfer_memory_handle)};
const auto session_id{impl->GetSessionId()}; const auto session_id{impl->GetSessionId()};
@ -472,7 +476,7 @@ void AudRenU::OpenAudioRenderer(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushIpcInterface<IAudioRenderer>(system, *impl, params, transfer_memory.GetPointerUnsafe(), rb.PushIpcInterface<IAudioRenderer>(system, *impl, params, transfer_memory.GetPointerUnsafe(),
transfer_memory_size, process_handle, transfer_memory_size, process_handle, *process,
applet_resource_user_id, session_id); applet_resource_user_id, session_id);
} }
@ -522,7 +526,7 @@ void AudRenU::GetAudioDeviceService(HLERequestContext& ctx) {
} }
void AudRenU::OpenAudioRendererForManualExecution(HLERequestContext& ctx) { void AudRenU::OpenAudioRendererForManualExecution(HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called"); LOG_ERROR(Service_Audio, "called. Implement me!");
} }
void AudRenU::GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx) { void AudRenU::GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx) {

View File

@ -298,6 +298,16 @@ void Config::ReadDebuggingValues() {
EndGroup(); EndGroup();
} }
#ifdef __unix__
void Config::ReadLinuxValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Linux));
ReadCategory(Settings::Category::Linux);
EndGroup();
}
#endif
void Config::ReadServiceValues() { void Config::ReadServiceValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Services)); BeginGroup(Settings::TranslateCategory(Settings::Category::Services));
@ -404,6 +414,9 @@ void Config::ReadValues() {
ReadControlValues(); ReadControlValues();
ReadCoreValues(); ReadCoreValues();
ReadCpuValues(); ReadCpuValues();
#ifdef __unix__
ReadLinuxValues();
#endif
ReadRendererValues(); ReadRendererValues();
ReadAudioValues(); ReadAudioValues();
ReadSystemValues(); ReadSystemValues();
@ -504,6 +517,9 @@ void Config::SaveValues() {
SaveControlValues(); SaveControlValues();
SaveCoreValues(); SaveCoreValues();
SaveCpuValues(); SaveCpuValues();
#ifdef __unix__
SaveLinuxValues();
#endif
SaveRendererValues(); SaveRendererValues();
SaveAudioValues(); SaveAudioValues();
SaveSystemValues(); SaveSystemValues();
@ -578,6 +594,16 @@ void Config::SaveDebuggingValues() {
EndGroup(); EndGroup();
} }
#ifdef __unix__
void Config::SaveLinuxValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Linux));
WriteCategory(Settings::Category::Linux);
EndGroup();
}
#endif
void Config::SaveNetworkValues() { void Config::SaveNetworkValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Services)); BeginGroup(Settings::TranslateCategory(Settings::Category::Services));

View File

@ -76,6 +76,9 @@ protected:
void ReadCoreValues(); void ReadCoreValues();
void ReadDataStorageValues(); void ReadDataStorageValues();
void ReadDebuggingValues(); void ReadDebuggingValues();
#ifdef __unix__
void ReadLinuxValues();
#endif
void ReadServiceValues(); void ReadServiceValues();
void ReadDisabledAddOnValues(); void ReadDisabledAddOnValues();
void ReadMiscellaneousValues(); void ReadMiscellaneousValues();
@ -107,6 +110,9 @@ protected:
void SaveCoreValues(); void SaveCoreValues();
void SaveDataStorageValues(); void SaveDataStorageValues();
void SaveDebuggingValues(); void SaveDebuggingValues();
#ifdef __unix__
void SaveLinuxValues();
#endif
void SaveNetworkValues(); void SaveNetworkValues();
void SaveDisabledAddOnValues(); void SaveDisabledAddOnValues();
void SaveMiscellaneousValues(); void SaveMiscellaneousValues();

View File

@ -96,6 +96,9 @@ add_executable(yuzu
configuration/configure_input_profile_dialog.cpp configuration/configure_input_profile_dialog.cpp
configuration/configure_input_profile_dialog.h configuration/configure_input_profile_dialog.h
configuration/configure_input_profile_dialog.ui configuration/configure_input_profile_dialog.ui
configuration/configure_linux_tab.cpp
configuration/configure_linux_tab.h
configuration/configure_linux_tab.ui
configuration/configure_mouse_panning.cpp configuration/configure_mouse_panning.cpp
configuration/configure_mouse_panning.h configuration/configure_mouse_panning.h
configuration/configure_mouse_panning.ui configuration/configure_mouse_panning.ui

View File

@ -24,6 +24,8 @@ class Builder;
} }
class ConfigureAudio : public ConfigurationShared::Tab { class ConfigureAudio : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureAudio(const Core::System& system_, explicit ConfigureAudio(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -24,6 +24,8 @@ class Builder;
} }
class ConfigureCpu : public ConfigurationShared::Tab { class ConfigureCpu : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureCpu(const Core::System& system_, explicit ConfigureCpu(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -25,6 +25,8 @@ class Builder;
} }
class ConfigureGeneral : public ConfigurationShared::Tab { class ConfigureGeneral : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGeneral(const Core::System& system_, explicit ConfigureGeneral(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -224,6 +224,11 @@ void ConfigureGraphics::PopulateVSyncModeSelection(bool use_setting) {
} }
void ConfigureGraphics::UpdateVsyncSetting() const { void ConfigureGraphics::UpdateVsyncSetting() const {
const Settings::RendererBackend backend{GetCurrentGraphicsBackend()};
if (backend == Settings::RendererBackend::Null) {
return;
}
const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()];
const auto vsync_mode = PresentModeToSetting(mode); const auto vsync_mode = PresentModeToSetting(mode);
Settings::values.vsync_mode.SetValue(vsync_mode); Settings::values.vsync_mode.SetValue(vsync_mode);

View File

@ -43,6 +43,8 @@ class Builder;
} }
class ConfigureGraphics : public ConfigurationShared::Tab { class ConfigureGraphics : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGraphics( explicit ConfigureGraphics(
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records, const Core::System& system_, std::vector<VkDeviceInfo::Record>& records,

View File

@ -21,6 +21,8 @@ class Builder;
} }
class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab { class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureGraphicsAdvanced( explicit ConfigureGraphicsAdvanced(
const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,

View File

@ -0,0 +1,75 @@
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure_linux_tab.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_linux_tab.h"
#include "yuzu/configuration/shared_widget.h"
ConfigureLinuxTab::ConfigureLinuxTab(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
const ConfigurationShared::Builder& builder, QWidget* parent)
: Tab(group_, parent), ui(std::make_unique<Ui::ConfigureLinuxTab>()), system{system_} {
ui->setupUi(this);
Setup(builder);
SetConfiguration();
}
ConfigureLinuxTab::~ConfigureLinuxTab() = default;
void ConfigureLinuxTab::SetConfiguration() {}
void ConfigureLinuxTab::Setup(const ConfigurationShared::Builder& builder) {
QLayout& linux_layout = *ui->linux_widget->layout();
std::map<u32, QWidget*> linux_hold{};
std::vector<Settings::BasicSetting*> settings;
const auto push = [&](Settings::Category category) {
for (const auto setting : Settings::values.linkage.by_category[category]) {
settings.push_back(setting);
}
};
push(Settings::Category::Linux);
for (auto* setting : settings) {
auto* widget = builder.BuildWidget(setting, apply_funcs);
if (widget == nullptr) {
continue;
}
if (!widget->Valid()) {
widget->deleteLater();
continue;
}
linux_hold.insert({setting->Id(), widget});
}
for (const auto& [id, widget] : linux_hold) {
linux_layout.addWidget(widget);
}
}
void ConfigureLinuxTab::ApplyConfiguration() {
const bool is_powered_on = system.IsPoweredOn();
for (const auto& apply_func : apply_funcs) {
apply_func(is_powered_on);
}
}
void ConfigureLinuxTab::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureLinuxTab::RetranslateUI() {
ui->retranslateUi(this);
}

View File

@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QWidget>
namespace Core {
class System;
}
namespace Ui {
class ConfigureLinuxTab;
}
namespace ConfigurationShared {
class Builder;
}
class ConfigureLinuxTab : public ConfigurationShared::Tab {
Q_OBJECT
public:
explicit ConfigureLinuxTab(const Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,
const ConfigurationShared::Builder& builder,
QWidget* parent = nullptr);
~ConfigureLinuxTab() override;
void ApplyConfiguration() override;
void SetConfiguration() override;
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void Setup(const ConfigurationShared::Builder& builder);
std::unique_ptr<Ui::ConfigureLinuxTab> ui;
const Core::System& system;
std::vector<std::function<void(bool)>> apply_funcs{};
};

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureLinuxTab</class>
<widget class="QWidget" name="ConfigureLinuxTab">
<property name="accessibleName">
<string>Linux</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="LinuxGroupBox">
<property name="title">
<string>Linux</string>
</property>
<layout class="QVBoxLayout" name="LinuxVerticalLayout_1">
<item>
<widget class="QWidget" name="linux_widget" native="true">
<layout class="QVBoxLayout" name="LinuxVerticalLayout_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>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -26,6 +26,7 @@ class ConfigureMotionTouch;
/// A dialog for touchpad calibration configuration. /// A dialog for touchpad calibration configuration.
class CalibrationConfigurationDialog : public QDialog { class CalibrationConfigurationDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port); explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port);
~CalibrationConfigurationDialog() override; ~CalibrationConfigurationDialog() override;

View File

@ -16,6 +16,7 @@ class ConfigureMousePanning;
class ConfigureMousePanning : public QDialog { class ConfigureMousePanning : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureMousePanning(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_, explicit ConfigureMousePanning(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_,
float right_stick_deadzone, float right_stick_range); float right_stick_deadzone, float right_stick_range);

View File

@ -33,6 +33,7 @@
#include "yuzu/configuration/configure_graphics.h" #include "yuzu/configuration/configure_graphics.h"
#include "yuzu/configuration/configure_graphics_advanced.h" #include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_input_per_game.h" #include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/configuration/configure_linux_tab.h"
#include "yuzu/configuration/configure_per_game.h" #include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.h" #include "yuzu/configuration/configure_per_game_addons.h"
#include "yuzu/configuration/configure_system.h" #include "yuzu/configuration/configure_system.h"
@ -60,6 +61,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
[](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this); [](Settings::AspectRatio, Settings::ResolutionSetup) {}, tab_group, *builder, this);
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this); input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
linux_tab = std::make_unique<ConfigureLinuxTab>(system_, tab_group, *builder, this);
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this); system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *builder, this);
ui->setupUi(this); ui->setupUi(this);
@ -71,6 +73,10 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics")); ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles")); ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles"));
// Only show Linux tab on Unix
#ifdef __unix__
ui->tabWidget->addTab(linux_tab.get(), tr("Linux"));
#endif
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties")); setWindowTitle(tr("Properties"));

View File

@ -32,6 +32,7 @@ class ConfigureCpu;
class ConfigureGraphics; class ConfigureGraphics;
class ConfigureGraphicsAdvanced; class ConfigureGraphicsAdvanced;
class ConfigureInputPerGame; class ConfigureInputPerGame;
class ConfigureLinuxTab;
class ConfigureSystem; class ConfigureSystem;
class QGraphicsScene; class QGraphicsScene;
@ -85,5 +86,6 @@ private:
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab; std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureInputPerGame> input_tab; std::unique_ptr<ConfigureInputPerGame> input_tab;
std::unique_ptr<ConfigureLinuxTab> linux_tab;
std::unique_ptr<ConfigureSystem> system_tab; std::unique_ptr<ConfigureSystem> system_tab;
}; };

View File

@ -27,6 +27,8 @@ class Builder;
} }
class ConfigureSystem : public ConfigurationShared::Tab { class ConfigureSystem : public ConfigurationShared::Tab {
Q_OBJECT
public: public:
explicit ConfigureSystem(Core::System& system_, explicit ConfigureSystem(Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,