From 31abbca36c4d2cb0328ccc0d8149a171c881cd99 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 17 Dec 2022 10:45:25 +0100 Subject: [PATCH] Revert "early-access version 0032" This reverts commit efb3a9f4b23d3e056ed9736ee6d61b61299a168e. --- README.md | 2 +- src/audio_core/device/audio_buffers.h | 8 +- src/audio_core/device/device_session.cpp | 6 - src/audio_core/device/device_session.h | 5 - src/audio_core/in/audio_in_system.cpp | 7 +- src/audio_core/out/audio_out_system.cpp | 7 +- src/common/assert.h | 4 +- src/common/settings.cpp | 1 - src/common/settings.h | 1 - src/core/hle/kernel/hle_ipc.cpp | 22 +-- src/core/hle/kernel/k_process.cpp | 11 -- src/core/hle/kernel/k_process.h | 3 - src/core/hle/kernel/svc.cpp | 130 ++++++++------ src/core/hle/service/set/set.cpp | 9 +- src/core/hle/service/set/set.h | 1 - src/core/hle/service/set/set_sys.cpp | 10 +- src/core/hle/service/set/set_sys.h | 1 - src/yuzu/bootmanager.cpp | 7 +- src/yuzu/configuration/config.cpp | 3 - src/yuzu/configuration/configure_system.cpp | 4 - src/yuzu/configuration/configure_system.ui | 14 -- src/yuzu/game_list.cpp | 14 -- src/yuzu/game_list.h | 7 - src/yuzu/main.cpp | 184 +------------------- src/yuzu/main.h | 7 - src/yuzu/uisettings.h | 1 - 26 files changed, 103 insertions(+), 366 deletions(-) diff --git a/README.md b/README.md index 17ebd2eb9..0e3675181 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 0032. +This is the source code for early-access 3217. ## Legal Notice diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h index 1e1616f4e..986590c6d 100755 --- a/src/audio_core/device/audio_buffers.h +++ b/src/audio_core/device/audio_buffers.h @@ -91,10 +91,9 @@ public: * @param core_timing - The CoreTiming instance * @param session - The device session * - * @return If any buffer was released. + * @return Is the buffer was released. */ - bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session, - bool force) { + bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session) { std::scoped_lock l{lock}; bool buffer_released{false}; while (registered_count > 0) { @@ -104,8 +103,7 @@ public: } // Check with the backend if this buffer can be released yet. - // If we're shutting down, we don't care if it's been played or not. - if (!force && !session.IsBufferConsumed(buffers[index])) { + if (!session.IsBufferConsumed(buffers[index])) { break; } diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp index f60bd14e9..c1b270cac 100755 --- a/src/audio_core/device/device_session.cpp +++ b/src/audio_core/device/device_session.cpp @@ -73,12 +73,6 @@ void DeviceSession::Stop() { } } -void DeviceSession::ClearBuffers() { - if (stream) { - stream->ClearQueue(); - } -} - void DeviceSession::AppendBuffers(std::span buffers) const { for (const auto& buffer : buffers) { Sink::SinkBuffer new_buffer{ diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h index f65c850bd..676580ea9 100755 --- a/src/audio_core/device/device_session.h +++ b/src/audio_core/device/device_session.h @@ -90,11 +90,6 @@ public: */ void Stop(); - /** - * Clear out the underlying audio buffers in the backend stream. - */ - void ClearBuffers(); - /** * Set this device session's volume. * diff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cpp index 45aade449..46b0cf2b3 100755 --- a/src/audio_core/in/audio_in_system.cpp +++ b/src/audio_core/in/audio_in_system.cpp @@ -23,6 +23,7 @@ System::~System() { void System::Finalize() { Stop(); session->Finalize(); + buffer_event->Signal(); } void System::StartSession() { @@ -101,10 +102,6 @@ Result System::Stop() { if (state == State::Started) { session->Stop(); session->SetVolume(0.0f); - session->ClearBuffers(); - if (buffers.ReleaseBuffers(system.CoreTiming(), *session, true)) { - buffer_event->Signal(); - } state = State::Stopped; } @@ -141,7 +138,7 @@ void System::RegisterBuffers() { } void System::ReleaseBuffers() { - bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session, false)}; + bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)}; if (signal) { // Signal if any buffer was released, or if none are registered, we need more. diff --git a/src/audio_core/out/audio_out_system.cpp b/src/audio_core/out/audio_out_system.cpp index 9f75cd1a8..432820128 100755 --- a/src/audio_core/out/audio_out_system.cpp +++ b/src/audio_core/out/audio_out_system.cpp @@ -24,6 +24,7 @@ System::~System() { void System::Finalize() { Stop(); session->Finalize(); + buffer_event->Signal(); } std::string_view System::GetDefaultOutputDeviceName() const { @@ -101,10 +102,6 @@ Result System::Stop() { if (state == State::Started) { session->Stop(); session->SetVolume(0.0f); - session->ClearBuffers(); - if (buffers.ReleaseBuffers(system.CoreTiming(), *session, true)) { - buffer_event->Signal(); - } state = State::Stopped; } @@ -141,7 +138,7 @@ void System::RegisterBuffers() { } void System::ReleaseBuffers() { - bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session, false)}; + bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)}; if (signal) { // Signal if any buffer was released, or if none are registered, we need more. buffer_event->Signal(); diff --git a/src/common/assert.h b/src/common/assert.h index 9bac95677..eef2055ed 100755 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -69,7 +69,7 @@ void assert_fail_impl(); #define ASSERT_OR_EXECUTE(_a_, _b_) \ do { \ ASSERT(_a_); \ - if (!(_a_)) [[unlikely]] { \ + if (!(_a_)) { \ _b_ \ } \ } while (0) @@ -78,7 +78,7 @@ void assert_fail_impl(); #define ASSERT_OR_EXECUTE_MSG(_a_, _b_, ...) \ do { \ ASSERT_MSG(_a_, __VA_ARGS__); \ - if (!(_a_)) [[unlikely]] { \ + if (!(_a_)) { \ _b_ \ } \ } while (0) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index d11d7620e..0a5fffd25 100755 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -40,7 +40,6 @@ void LogSettings() { LOG_INFO(Config, "yuzu Configuration:"); log_setting("Controls_UseDockedMode", values.use_docked_mode.GetValue()); log_setting("System_RngSeed", values.rng_seed.GetValue().value_or(0)); - log_setting("System_DeviceName", values.device_name.GetValue()); log_setting("System_CurrentUser", values.current_user.GetValue()); log_setting("System_LanguageIndex", values.language_index.GetValue()); log_setting("System_RegionIndex", values.region_index.GetValue()); diff --git a/src/common/settings.h b/src/common/settings.h index 4c32f3ee8..5bc31c12b 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -458,7 +458,6 @@ struct Values { // System SwitchableSetting> rng_seed{std::optional(), "rng_seed"}; - Setting device_name{"Yuzu", "device_name"}; // Measured in seconds since epoch std::optional custom_rtc; // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index b2879a24d..a3bfae208 100755 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -167,9 +167,6 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32 } if (incoming) { // Populate the object lists with the data in the IPC request. - incoming_copy_handles.reserve(handle_descriptor_header->num_handles_to_copy); - incoming_move_handles.reserve(handle_descriptor_header->num_handles_to_move); - for (u32 handle = 0; handle < handle_descriptor_header->num_handles_to_copy; ++handle) { incoming_copy_handles.push_back(rp.Pop()); } @@ -184,11 +181,6 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32 } } - buffer_x_desciptors.reserve(command_header->num_buf_x_descriptors); - buffer_a_desciptors.reserve(command_header->num_buf_a_descriptors); - buffer_b_desciptors.reserve(command_header->num_buf_b_descriptors); - buffer_w_desciptors.reserve(command_header->num_buf_w_descriptors); - for (u32 i = 0; i < command_header->num_buf_x_descriptors; ++i) { buffer_x_desciptors.push_back(rp.PopRaw()); } @@ -326,23 +318,25 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa } std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const { + std::vector buffer{}; const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && BufferDescriptorA()[buffer_index].Size()}; + if (is_buffer_a) { ASSERT_OR_EXECUTE_MSG( - BufferDescriptorA().size() > buffer_index, { return {}; }, + BufferDescriptorA().size() > buffer_index, { return buffer; }, "BufferDescriptorA invalid buffer_index {}", buffer_index); - std::vector buffer(BufferDescriptorA()[buffer_index].Size()); + buffer.resize(BufferDescriptorA()[buffer_index].Size()); memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size()); - return buffer; } else { ASSERT_OR_EXECUTE_MSG( - BufferDescriptorX().size() > buffer_index, { return {}; }, + BufferDescriptorX().size() > buffer_index, { return buffer; }, "BufferDescriptorX invalid buffer_index {}", buffer_index); - std::vector buffer(BufferDescriptorX()[buffer_index].Size()); + buffer.resize(BufferDescriptorX()[buffer_index].Size()); memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size()); - return buffer; } + + return buffer; } std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 33dee56ae..09864c478 100755 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -285,17 +285,6 @@ void KProcess::UnregisterThread(KThread* thread) { thread_list.remove(thread); } -u64 KProcess::GetFreeThreadCount() const { - if (resource_limit != nullptr) { - const auto current_value = - resource_limit->GetCurrentValue(LimitableResource::ThreadCountMax); - const auto limit_value = resource_limit->GetLimitValue(LimitableResource::ThreadCountMax); - return limit_value - current_value; - } else { - return 0; - } -} - Result KProcess::Reset() { // Lock the process and the scheduler. KScopedLightLock lk(state_lock); diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index 2cf132bef..9eed67dcd 100755 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h @@ -304,9 +304,6 @@ public: /// from this process' thread list. void UnregisterThread(KThread* thread); - /// Retrieves the number of available threads for this process. - u64 GetFreeThreadCount() const; - /// Clears the signaled state of the process if and only if it's signaled. /// /// @pre The process must not be already terminated. If this is called on a diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 735a74258..f564e8690 100755 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -784,29 +784,63 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, info_sub_id, handle); - const auto info_id_type = static_cast(info_id); + enum class GetInfoType : u64 { + // 1.0.0+ + AllowedCPUCoreMask = 0, + AllowedThreadPriorityMask = 1, + MapRegionBaseAddr = 2, + MapRegionSize = 3, + HeapRegionBaseAddr = 4, + HeapRegionSize = 5, + TotalPhysicalMemoryAvailable = 6, + TotalPhysicalMemoryUsed = 7, + IsCurrentProcessBeingDebugged = 8, + RegisterResourceLimit = 9, + IdleTickCount = 10, + RandomEntropy = 11, + ThreadTickCount = 0xF0000002, + // 2.0.0+ + ASLRRegionBaseAddr = 12, + ASLRRegionSize = 13, + StackRegionBaseAddr = 14, + StackRegionSize = 15, + // 3.0.0+ + SystemResourceSize = 16, + SystemResourceUsage = 17, + TitleId = 18, + // 4.0.0+ + PrivilegedProcessId = 19, + // 5.0.0+ + UserExceptionContextAddr = 20, + // 6.0.0+ + TotalPhysicalMemoryAvailableWithoutSystemResource = 21, + TotalPhysicalMemoryUsedWithoutSystemResource = 22, + + // Homebrew only + MesosphereCurrentProcess = 65001, + }; + + const auto info_id_type = static_cast(info_id); switch (info_id_type) { - case InfoType::CoreMask: - case InfoType::PriorityMask: - case InfoType::AliasRegionAddress: - case InfoType::AliasRegionSize: - case InfoType::HeapRegionAddress: - case InfoType::HeapRegionSize: - case InfoType::AslrRegionAddress: - case InfoType::AslrRegionSize: - case InfoType::StackRegionAddress: - case InfoType::StackRegionSize: - case InfoType::TotalMemorySize: - case InfoType::UsedMemorySize: - case InfoType::SystemResourceSizeTotal: - case InfoType::SystemResourceSizeUsed: - case InfoType::ProgramId: - case InfoType::UserExceptionContextAddress: - case InfoType::TotalNonSystemMemorySize: - case InfoType::UsedNonSystemMemorySize: - case InfoType::IsApplication: - case InfoType::FreeThreadCount: { + case GetInfoType::AllowedCPUCoreMask: + case GetInfoType::AllowedThreadPriorityMask: + case GetInfoType::MapRegionBaseAddr: + case GetInfoType::MapRegionSize: + case GetInfoType::HeapRegionBaseAddr: + case GetInfoType::HeapRegionSize: + case GetInfoType::ASLRRegionBaseAddr: + case GetInfoType::ASLRRegionSize: + case GetInfoType::StackRegionBaseAddr: + case GetInfoType::StackRegionSize: + case GetInfoType::TotalPhysicalMemoryAvailable: + case GetInfoType::TotalPhysicalMemoryUsed: + case GetInfoType::SystemResourceSize: + case GetInfoType::SystemResourceUsage: + case GetInfoType::TitleId: + case GetInfoType::UserExceptionContextAddr: + case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource: + case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource: { if (info_sub_id != 0) { LOG_ERROR(Kernel_SVC, "Info sub id is non zero! info_id={}, info_sub_id={}", info_id, info_sub_id); @@ -822,83 +856,79 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han } switch (info_id_type) { - case InfoType::CoreMask: + case GetInfoType::AllowedCPUCoreMask: *result = process->GetCoreMask(); return ResultSuccess; - case InfoType::PriorityMask: + case GetInfoType::AllowedThreadPriorityMask: *result = process->GetPriorityMask(); return ResultSuccess; - case InfoType::AliasRegionAddress: + case GetInfoType::MapRegionBaseAddr: *result = process->PageTable().GetAliasRegionStart(); return ResultSuccess; - case InfoType::AliasRegionSize: + case GetInfoType::MapRegionSize: *result = process->PageTable().GetAliasRegionSize(); return ResultSuccess; - case InfoType::HeapRegionAddress: + case GetInfoType::HeapRegionBaseAddr: *result = process->PageTable().GetHeapRegionStart(); return ResultSuccess; - case InfoType::HeapRegionSize: + case GetInfoType::HeapRegionSize: *result = process->PageTable().GetHeapRegionSize(); return ResultSuccess; - case InfoType::AslrRegionAddress: + case GetInfoType::ASLRRegionBaseAddr: *result = process->PageTable().GetAliasCodeRegionStart(); return ResultSuccess; - case InfoType::AslrRegionSize: + case GetInfoType::ASLRRegionSize: *result = process->PageTable().GetAliasCodeRegionSize(); return ResultSuccess; - case InfoType::StackRegionAddress: + case GetInfoType::StackRegionBaseAddr: *result = process->PageTable().GetStackRegionStart(); return ResultSuccess; - case InfoType::StackRegionSize: + case GetInfoType::StackRegionSize: *result = process->PageTable().GetStackRegionSize(); return ResultSuccess; - case InfoType::TotalMemorySize: + case GetInfoType::TotalPhysicalMemoryAvailable: *result = process->GetTotalPhysicalMemoryAvailable(); return ResultSuccess; - case InfoType::UsedMemorySize: + case GetInfoType::TotalPhysicalMemoryUsed: *result = process->GetTotalPhysicalMemoryUsed(); return ResultSuccess; - case InfoType::SystemResourceSizeTotal: + case GetInfoType::SystemResourceSize: *result = process->GetSystemResourceSize(); return ResultSuccess; - case InfoType::SystemResourceSizeUsed: + case GetInfoType::SystemResourceUsage: LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query system resource usage"); *result = process->GetSystemResourceUsage(); return ResultSuccess; - case InfoType::ProgramId: + case GetInfoType::TitleId: *result = process->GetProgramID(); return ResultSuccess; - case InfoType::UserExceptionContextAddress: + case GetInfoType::UserExceptionContextAddr: *result = process->GetProcessLocalRegionAddress(); return ResultSuccess; - case InfoType::TotalNonSystemMemorySize: + case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource: *result = process->GetTotalPhysicalMemoryAvailableWithoutSystemResource(); return ResultSuccess; - case InfoType::UsedNonSystemMemorySize: + case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource: *result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource(); return ResultSuccess; - case InfoType::FreeThreadCount: - *result = process->GetFreeThreadCount(); - return ResultSuccess; - default: break; } @@ -907,11 +937,11 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han return ResultInvalidEnumValue; } - case InfoType::DebuggerAttached: + case GetInfoType::IsCurrentProcessBeingDebugged: *result = 0; return ResultSuccess; - case InfoType::ResourceLimit: { + case GetInfoType::RegisterResourceLimit: { if (handle != 0) { LOG_ERROR(Kernel, "Handle is non zero! handle={:08X}", handle); return ResultInvalidHandle; @@ -939,7 +969,7 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han return ResultSuccess; } - case InfoType::RandomEntropy: + case GetInfoType::RandomEntropy: if (handle != 0) { LOG_ERROR(Kernel_SVC, "Process Handle is non zero, expected 0 result but got {:016X}", handle); @@ -955,13 +985,13 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han *result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id); return ResultSuccess; - case InfoType::InitialProcessIdRange: + case GetInfoType::PrivilegedProcessId: LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query privileged process id bounds, returned 0"); *result = 0; return ResultSuccess; - case InfoType::ThreadTickCount: { + case GetInfoType::ThreadTickCount: { constexpr u64 num_cpus = 4; if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus, @@ -996,7 +1026,7 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han *result = out_ticks; return ResultSuccess; } - case InfoType::IdleTickCount: { + case GetInfoType::IdleTickCount: { // Verify the input handle is invalid. R_UNLESS(handle == InvalidHandle, ResultInvalidHandle); @@ -1010,7 +1040,7 @@ static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle han *result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime(); return ResultSuccess; } - case InfoType::MesosphereCurrentProcess: { + case GetInfoType::MesosphereCurrentProcess: { // Verify the input handle is invalid. R_UNLESS(handle == InvalidHandle, ResultInvalidHandle); diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 34a3009fa..524376505 100755 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp @@ -191,13 +191,6 @@ void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) { GetKeyCodeMapImpl(ctx); } -void SET::GetDeviceNickName(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_SET, "called"); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - ctx.WriteBuffer(Settings::values.device_name.GetValue()); -} - SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} { // clang-format off static const FunctionInfo functions[] = { @@ -212,7 +205,7 @@ SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} { {8, &SET::GetQuestFlag, "GetQuestFlag"}, {9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"}, {10, nullptr, "GetFirmwareVersionForDebug"}, - {11, &SET::GetDeviceNickName, "GetDeviceNickName"}, + {11, nullptr, "GetDeviceNickName"}, }; // clang-format on diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 38fa16366..0c2f1e081 100755 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h @@ -50,7 +50,6 @@ private: void GetRegionCode(Kernel::HLERequestContext& ctx); void GetKeyCodeMap(Kernel::HLERequestContext& ctx); void GetKeyCodeMap2(Kernel::HLERequestContext& ctx); - void GetDeviceNickName(Kernel::HLERequestContext& ctx); }; } // namespace Service::Set diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp index ae6770101..c7313450e 100755 --- a/src/core/hle/service/set/set_sys.cpp +++ b/src/core/hle/service/set/set_sys.cpp @@ -3,7 +3,6 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "common/settings.h" #include "core/file_sys/errors.h" #include "core/file_sys/system_archive/system_version.h" #include "core/hle/ipc_helpers.h" @@ -177,13 +176,6 @@ void SET_SYS::GetSettingsItemValue(Kernel::HLERequestContext& ctx) { rb.Push(response); } -void SET_SYS::GetDeviceNickName(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_SET, "called"); - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - ctx.WriteBuffer(::Settings::values.device_name.GetValue()); -} - SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { // clang-format off static const FunctionInfo functions[] = { @@ -261,7 +253,7 @@ SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} { {74, nullptr, "SetWirelessLanEnableFlag"}, {75, nullptr, "GetInitialLaunchSettings"}, {76, nullptr, "SetInitialLaunchSettings"}, - {77, &SET_SYS::GetDeviceNickName, "GetDeviceNickName"}, + {77, nullptr, "GetDeviceNickName"}, {78, nullptr, "SetDeviceNickName"}, {79, nullptr, "GetProductModel"}, {80, nullptr, "GetLdnChannel"}, diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h index 1116f6bb3..7add7f526 100755 --- a/src/core/hle/service/set/set_sys.h +++ b/src/core/hle/service/set/set_sys.h @@ -29,7 +29,6 @@ private: void GetFirmwareVersion2(Kernel::HLERequestContext& ctx); void GetColorSetId(Kernel::HLERequestContext& ctx); void SetColorSetId(Kernel::HLERequestContext& ctx); - void GetDeviceNickName(Kernel::HLERequestContext& ctx); ColorSet color_set = ColorSet::BasicWhite; }; diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 33aa66b33..750902fa6 100755 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -274,14 +274,12 @@ static Core::Frontend::WindowSystemType GetWindowSystemType() { return Core::Frontend::WindowSystemType::X11; else if (platform_name == QStringLiteral("wayland")) return Core::Frontend::WindowSystemType::Wayland; - else if (platform_name == QStringLiteral("wayland-egl")) - return Core::Frontend::WindowSystemType::Wayland; else if (platform_name == QStringLiteral("cocoa")) return Core::Frontend::WindowSystemType::Cocoa; else if (platform_name == QStringLiteral("android")) return Core::Frontend::WindowSystemType::Android; - LOG_CRITICAL(Frontend, "Unknown Qt platform {}!", platform_name.toStdString()); + LOG_CRITICAL(Frontend, "Unknown Qt platform!"); return Core::Frontend::WindowSystemType::Windows; } @@ -321,8 +319,7 @@ GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, input_subsystem->Initialize(); this->setMouseTracking(true); - strict_context_required = QGuiApplication::platformName() == QStringLiteral("wayland") || - QGuiApplication::platformName() == QStringLiteral("wayland-egl"); + strict_context_required = QGuiApplication::platformName() == QStringLiteral("wayland"); connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 746dcdd8f..9f17d4f41 100755 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -783,8 +783,6 @@ void Config::ReadSystemValues() { } } - ReadBasicSetting(Settings::values.device_name); - if (global) { ReadBasicSetting(Settings::values.current_user); Settings::values.current_user = std::clamp(Settings::values.current_user.GetValue(), 0, @@ -1407,7 +1405,6 @@ void Config::SaveSystemValues() { Settings::values.rng_seed.UsingGlobal()); WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0), 0, Settings::values.rng_seed.UsingGlobal()); - WriteBasicSetting(Settings::values.device_name); if (global) { WriteBasicSetting(Settings::values.current_user); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index cf0d902b7..b49a382bb 100755 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -72,8 +72,6 @@ void ConfigureSystem::SetConfiguration() { ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time)); - ui->device_name_edit->setText( - QString::fromUtf8(Settings::values.device_name.GetValue().c_str())); if (Settings::IsConfiguringGlobal()) { ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); @@ -117,8 +115,6 @@ void ConfigureSystem::ApplyConfiguration() { } } - Settings::values.device_name = ui->device_name_edit->text().toStdString(); - if (!enabled) { return; } diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index c36060ef8..70fec763b 100755 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui @@ -432,13 +432,6 @@ - - - - Device Name - - - @@ -483,13 +476,6 @@ - - - - 128 - - - diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 9476e3fce..2e9f4e76a 100755 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -554,12 +554,6 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri QAction* dump_romfs_sdmc = dump_romfs_menu->addAction(tr("Dump RomFS to SDMC")); QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard")); QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry")); -#ifndef WIN32 - QMenu* shortcut_menu = context_menu.addMenu(tr("Create Shortcut")); - QAction* create_desktop_shortcut = shortcut_menu->addAction(tr("Add to Desktop")); - QAction* create_applications_menu_shortcut = - shortcut_menu->addAction(tr("Add to Applications Menu")); -#endif context_menu.addSeparator(); QAction* properties = context_menu.addAction(tr("Properties")); @@ -625,14 +619,6 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri connect(navigate_to_gamedb_entry, &QAction::triggered, [this, program_id]() { emit NavigateToGamedbEntryRequested(program_id, compatibility_list); }); -#ifndef WIN32 - connect(create_desktop_shortcut, &QAction::triggered, [this, program_id, path]() { - emit CreateShortcut(program_id, path, GameListShortcutTarget::Desktop); - }); - connect(create_applications_menu_shortcut, &QAction::triggered, [this, program_id, path]() { - emit CreateShortcut(program_id, path, GameListShortcutTarget::Applications); - }); -#endif connect(properties, &QAction::triggered, [this, path]() { emit OpenPerGameGeneralRequested(path); }); }; diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 71b26d2b5..5ee456ace 100755 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -52,11 +52,6 @@ enum class DumpRomFSTarget { SDMC, }; -enum class GameListShortcutTarget { - Desktop, - Applications, -}; - enum class InstalledEntryType { Game, Update, @@ -113,8 +108,6 @@ signals: const std::string& game_path); void DumpRomFSRequested(u64 program_id, const std::string& game_path, DumpRomFSTarget target); void CopyTIDRequested(u64 program_id); - void CreateShortcut(u64 program_id, const std::string& game_path, - GameListShortcutTarget target); void NavigateToGamedbEntryRequested(u64 program_id, const CompatibilityList& compatibility_list); void OpenPerGameGeneralRequested(const std::string& file); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index aa725d8c2..47e2c865d 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -4,8 +4,6 @@ #include #include #include -#include -#include #include #include #ifdef __APPLE__ @@ -1250,7 +1248,6 @@ void GMainWindow::ConnectWidgetEvents() { connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, &GMainWindow::OnGameListNavigateToGamedbEntry); - connect(game_list, &GameList::CreateShortcut, this, &GMainWindow::OnGameListCreateShortcut); connect(game_list, &GameList::AddDirectory, this, &GMainWindow::OnGameListAddDirectory); connect(game_list_placeholder, &GameListPlaceholder::AddDirectory, this, &GMainWindow::OnGameListAddDirectory); @@ -2381,152 +2378,6 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id, QDesktopServices::openUrl(QUrl(QStringLiteral("https://yuzu-emu.org/game/") + directory)); } -void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& game_path, - GameListShortcutTarget target) { - // Get path to yuzu executable - const QStringList args = QApplication::arguments(); - std::filesystem::path yuzu_command = args[0].toStdString(); - -#if defined(__linux__) || defined(__FreeBSD__) - // If relative path, make it an absolute path - if (yuzu_command.c_str()[0] == '.') { - yuzu_command = Common::FS::GetCurrentDir() / yuzu_command; - } - -#if defined(__linux__) - // Warn once if we are making a shortcut to a volatile AppImage - const std::string appimage_ending = - std::string(Common::g_scm_rev).substr(0, 9).append(".AppImage"); - if (yuzu_command.string().ends_with(appimage_ending) && - !UISettings::values.shortcut_already_warned) { - if (QMessageBox::warning(this, tr("Create Shortcut"), - tr("This will create a shortcut to the current AppImage. This may " - "not work well if you update. Continue?"), - QMessageBox::StandardButton::Ok | - QMessageBox::StandardButton::Cancel) == - QMessageBox::StandardButton::Cancel) { - return; - } - UISettings::values.shortcut_already_warned = true; - } -#endif // __linux__ -#endif // __linux__ || __FreeBSD__ - - std::filesystem::path target_directory{}; - // Determine target directory for shortcut -#if defined(__linux__) || defined(__FreeBSD__) - const char* home = std::getenv("HOME"); - const std::filesystem::path home_path = (home == nullptr ? "~" : home); - const char* xdg_data_home = std::getenv("XDG_DATA_HOME"); - - if (target == GameListShortcutTarget::Desktop) { - target_directory = home_path / "Desktop"; - if (!Common::FS::IsDir(target_directory)) { - QMessageBox::critical( - this, tr("Create Shortcut"), - tr("Cannot create shortcut on desktop. Path \"%1\" does not exist.") - .arg(QString::fromStdString(target_directory)), - QMessageBox::StandardButton::Ok); - return; - } - } else if (target == GameListShortcutTarget::Applications) { - target_directory = (xdg_data_home == nullptr ? home_path / ".local/share" : xdg_data_home) / - "applications"; - if (!Common::FS::CreateDirs(target_directory)) { - QMessageBox::critical(this, tr("Create Shortcut"), - tr("Cannot create shortcut in applications menu. Path \"%1\" " - "does not exist and cannot be created.") - .arg(QString::fromStdString(target_directory)), - QMessageBox::StandardButton::Ok); - return; - } - } -#endif - - const std::string game_file_name = std::filesystem::path(game_path).filename().string(); - // Determine full paths for icon and shortcut -#if defined(__linux__) || defined(__FreeBSD__) - std::filesystem::path system_icons_path = - (xdg_data_home == nullptr ? home_path / ".local/share/" : xdg_data_home) / - "icons/hicolor/256x256"; - if (!Common::FS::CreateDirs(system_icons_path)) { - QMessageBox::critical( - this, tr("Create Icon"), - tr("Cannot create icon file. Path \"%1\" does not exist and cannot be created.") - .arg(QString::fromStdString(system_icons_path)), - QMessageBox::StandardButton::Ok); - return; - } - std::filesystem::path icon_path = - system_icons_path / (program_id == 0 ? fmt::format("yuzu-{}.png", game_file_name) - : fmt::format("yuzu-{:016X}.png", program_id)); - const std::filesystem::path shortcut_path = - target_directory / (program_id == 0 ? fmt::format("yuzu-{}.desktop", game_file_name) - : fmt::format("yuzu-{:016X}.desktop", program_id)); -#else - const std::filesystem::path icon_path{}; - const std::filesystem::path shortcut_path{}; -#endif - - // Get title from game file - const FileSys::PatchManager pm{program_id, system->GetFileSystemController(), - system->GetContentProvider()}; - const auto control = pm.GetControlMetadata(); - const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); - - std::string title{fmt::format("{:016X}", program_id)}; - - if (control.first != nullptr) { - title = control.first->GetApplicationName(); - } else { - loader->ReadTitle(title); - } - - // Get icon from game file - std::vector icon_image_file{}; - if (control.second != nullptr) { - icon_image_file = control.second->ReadAllBytes(); - } else if (loader->ReadIcon(icon_image_file) != Loader::ResultStatus::Success) { - LOG_WARNING(Frontend, "Could not read icon from {:s}", game_path); - } - - QImage icon_jpeg = - QImage::fromData(icon_image_file.data(), static_cast(icon_image_file.size())); -#if defined(__linux__) || defined(__FreeBSD__) - // Convert and write the icon as a PNG - if (!icon_jpeg.save(QString::fromStdString(icon_path.string()))) { - LOG_ERROR(Frontend, "Could not write icon as PNG to file"); - } else { - LOG_INFO(Frontend, "Wrote an icon to {}", icon_path.string()); - } -#endif // __linux__ - -#if defined(__linux__) || defined(__FreeBSD__) - const std::string comment = - tr("Start %1 with the yuzu Emulator").arg(QString::fromStdString(title)).toStdString(); - const std::string arguments = fmt::format("-g \"{:s}\"", game_path); - const std::string categories = "Game;Emulator;Qt;"; - const std::string keywords = "Switch;Nintendo;"; -#else - const std::string comment{}; - const std::string arguments{}; - const std::string categories{}; - const std::string keywords{}; -#endif - if (!CreateShortcut(shortcut_path.string(), title, comment, icon_path.string(), - yuzu_command.string(), arguments, categories, keywords)) { - QMessageBox::critical(this, tr("Create Shortcut"), - tr("Failed to create a shortcut at %1") - .arg(QString::fromStdString(shortcut_path.string()))); - return; - } - - LOG_INFO(Frontend, "Wrote a shortcut to {}", shortcut_path.string()); - QMessageBox::information( - this, tr("Create Shortcut"), - tr("Successfully created a shortcut to %1").arg(QString::fromStdString(title))); -} - void GMainWindow::OnGameListOpenDirectory(const QString& directory) { std::filesystem::path fs_path; if (directory == QStringLiteral("SDMC")) { @@ -3066,8 +2917,7 @@ static QScreen* GuessCurrentScreen(QWidget* window) { bool GMainWindow::UsingExclusiveFullscreen() { return Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive || - QGuiApplication::platformName() == QStringLiteral("wayland") || - QGuiApplication::platformName() == QStringLiteral("wayland-egl"); + QGuiApplication::platformName() == QStringLiteral("wayland"); } void GMainWindow::ShowFullscreen() { @@ -3451,38 +3301,6 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file } } -bool GMainWindow::CreateShortcut(const std::string& shortcut_path, const std::string& title, - const std::string& comment, const std::string& icon_path, - const std::string& command, const std::string& arguments, - const std::string& categories, const std::string& keywords) { -#if defined(__linux__) || defined(__FreeBSD__) - // This desktop file template was writting referencing - // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html - std::string shortcut_contents{}; - shortcut_contents.append("[Desktop Entry]\n"); - shortcut_contents.append("Type=Application\n"); - shortcut_contents.append("Version=1.0\n"); - shortcut_contents.append(fmt::format("Name={:s}\n", title)); - shortcut_contents.append(fmt::format("Comment={:s}\n", comment)); - shortcut_contents.append(fmt::format("Icon={:s}\n", icon_path)); - shortcut_contents.append(fmt::format("TryExec={:s}\n", command)); - shortcut_contents.append(fmt::format("Exec={:s} {:s}\n", command, arguments)); - shortcut_contents.append(fmt::format("Categories={:s}\n", categories)); - shortcut_contents.append(fmt::format("Keywords={:s}\n", keywords)); - - std::ofstream shortcut_stream(shortcut_path); - if (!shortcut_stream.is_open()) { - LOG_WARNING(Common, "Failed to create file {:s}", shortcut_path); - return false; - } - shortcut_stream << shortcut_contents; - shortcut_stream.close(); - - return true; -#endif - return false; -} - void GMainWindow::OnLoadAmiibo() { if (emu_thread == nullptr || !emu_thread->IsRunning()) { return; diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 29cf0205b..7e6868ad2 100755 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -38,7 +38,6 @@ class QProgressDialog; class WaitTreeWidget; enum class GameListOpenTarget; enum class GameListRemoveTarget; -enum class GameListShortcutTarget; enum class DumpRomFSTarget; enum class InstalledEntryType; class GameListPlaceholder; @@ -294,8 +293,6 @@ private slots: void OnGameListCopyTID(u64 program_id); void OnGameListNavigateToGamedbEntry(u64 program_id, const CompatibilityList& compatibility_list); - void OnGameListCreateShortcut(u64 program_id, const std::string& game_path, - GameListShortcutTarget target); void OnGameListOpenDirectory(const QString& directory); void OnGameListAddDirectory(); void OnGameListShowList(bool show); @@ -369,10 +366,6 @@ private: bool CheckDarkMode(); QString GetTasStateDescription() const; - bool CreateShortcut(const std::string& shortcut_path, const std::string& title, - const std::string& comment, const std::string& icon_path, - const std::string& command, const std::string& arguments, - const std::string& categories, const std::string& keywords); std::unique_ptr ui; diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 8941d7c6f..054a36c84 100755 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -138,7 +138,6 @@ struct Values { bool configuration_applied; bool reset_to_defaults; - bool shortcut_already_warned{false}; Settings::Setting disable_web_applet{true, "disable_web_applet"}; };