From f627a085d363bba569adc43a84f35dbd7cf6bb95 Mon Sep 17 00:00:00 2001 From: Jarrod Norwell Date: Sat, 25 May 2024 15:39:06 +0800 Subject: [PATCH] Updated DiscordRPC, fixed TTYD and fixed Android compiling --- externals/vcpkg | 2 +- externals/xbyak | 2 +- src/android/sudachi/build.gradle.kts | 9 +----- .../set/setting_formats/system_settings.cpp | 3 +- src/core/hle/service/set/system_settings.cpp | 3 +- src/core/hle/service/ssl/ssl.cpp | 28 +++++++++++++++---- src/sudachi/discord_impl.cpp | 2 +- .../renderer_opengl/gl_rasterizer.cpp | 15 +++++++++- .../renderer_opengl/gl_rasterizer.h | 2 ++ .../renderer_vulkan/vk_rasterizer.cpp | 17 +++++++++-- .../renderer_vulkan/vk_rasterizer.h | 2 ++ 11 files changed, 63 insertions(+), 22 deletions(-) diff --git a/externals/vcpkg b/externals/vcpkg index 90542a4..326d8b4 160000 --- a/externals/vcpkg +++ b/externals/vcpkg @@ -1 +1 @@ -Subproject commit 90542a476c8ef3288039e2443a775e48db279173 +Subproject commit 326d8b43e365352ba3ccadf388d989082fe0f2a6 diff --git a/externals/xbyak b/externals/xbyak index 9c0f5d3..80477f6 160000 --- a/externals/xbyak +++ b/externals/xbyak @@ -1 +1 @@ -Subproject commit 9c0f5d3ecb06d2c93c2b59becb9b3b763213e74e +Subproject commit 80477f635345e8f13efc512d84b01b94cad92cd9 diff --git a/src/android/sudachi/build.gradle.kts b/src/android/sudachi/build.gradle.kts index 2bec73b..b72192c 100644 --- a/src/android/sudachi/build.gradle.kts +++ b/src/android/sudachi/build.gradle.kts @@ -186,7 +186,7 @@ android { } tasks.create("ktlintReset") { - delete(File(buildDir.path + File.separator + "intermediates/ktLint")) + delete(File(layout.buildDirectory.toString() + File.separator + "intermediates/ktLint")) } val showFormatHelp = { @@ -203,13 +203,6 @@ ktlint { version.set("0.47.1") android.set(true) ignoreFailures.set(false) - disabledRules.set( - setOf( - "no-wildcard-imports", - "package-name", - "import-ordering" - ) - ) reporters { reporter(ReporterType.CHECKSTYLE) } diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp index 7c3676b..ccae01e 100644 --- a/src/core/hle/service/set/setting_formats/system_settings.cpp +++ b/src/core/hle/service/set/setting_formats/system_settings.cpp @@ -12,7 +12,8 @@ SystemSettings DefaultSystemSettings() { settings.version = 0x140000; settings.flags = 7; - settings.rebootless_system_version = {.version = 38, .reserved = 1, .display_version = 38}; + settings.rebootless_system_version = + RebootlessSystemUpdateVersion{.version = 38, .reserved = {1}, .display_version = {38}}; settings.mii_author_id = Common::UUID::MakeDefault(); diff --git a/src/core/hle/service/set/system_settings.cpp b/src/core/hle/service/set/system_settings.cpp index 838db67..da40c1e 100644 --- a/src/core/hle/service/set/system_settings.cpp +++ b/src/core/hle/service/set/system_settings.cpp @@ -11,7 +11,8 @@ SystemSettings DefaultSystemSettings() { settings.version = 0x140000; settings.flags = 7; - settings.rebootless_system_version = {.version = 38, .reserved = 1, .display_version = 38}; + settings.rebootless_system_version = + RebootlessSystemUpdateVersion{.version = 38, .reserved = {1}, .display_version = {38}}; settings.color_set_id = ColorSet::BasicWhite; diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 6b73115..bf9cbd5 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -38,10 +38,7 @@ enum class IoMode : u32 { }; // This is nn::ssl::sf::OptionType -enum class OptionType : u32 { - DoNotCloseSocket = 0, - GetServerCertChain = 1, -}; +enum class OptionType : u32 { DoNotCloseSocket = 0, GetServerCertChain = 1, EnableAlpn = 3 }; // This is nn::ssl::sf::SslVersion struct SslVersion { @@ -96,8 +93,8 @@ public: {23, nullptr, "GetOption"}, {24, nullptr, "GetVerifyCertErrors"}, {25, nullptr, "GetCipherInfo"}, - {26, nullptr, "SetNextAlpnProto"}, - {27, nullptr, "GetNextAlpnProto"}, + {26, &ISslConnection::SetNextAlpnProto, "SetNextAlpnProto"}, + {27, &ISslConnection::GetNextAlpnProto, "GetNextAlpnProto"}, {28, nullptr, "SetDtlsSocketDescriptor"}, {29, nullptr, "GetDtlsHandshakeTimeout"}, {30, nullptr, "SetPrivateOption"}, @@ -142,6 +139,7 @@ private: bool get_server_cert_chain = false; std::shared_ptr socket; bool did_handshake = false; + bool enable_alpn = false; Result SetSocketDescriptorImpl(s32* out_fd, s32 fd) { LOG_DEBUG(Service_SSL, "called, fd={}", fd); @@ -381,6 +379,10 @@ private: case OptionType::GetServerCertChain: get_server_cert_chain = static_cast(parameters.value); break; + case OptionType::EnableAlpn: + LOG_ERROR(Service_SSL, "(STUBBED) called."); + enable_alpn = static_cast(parameters.value); + break; default: LOG_WARNING(Service_SSL, "Unknown option={}, value={}", parameters.option, parameters.value); @@ -389,6 +391,20 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + void SetNextAlpnProto(HLERequestContext& ctx) { + LOG_ERROR(Service_SSL, "(STUBBED) called."); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void GetNextAlpnProto(HLERequestContext& ctx) { + LOG_ERROR(Service_SSL, "(STUBBED) called."); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + } }; class ISslContext final : public ServiceFramework { diff --git a/src/sudachi/discord_impl.cpp b/src/sudachi/discord_impl.cpp index 7aeb151..c0a1b76 100644 --- a/src/sudachi/discord_impl.cpp +++ b/src/sudachi/discord_impl.cpp @@ -24,7 +24,7 @@ DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} { DiscordEventHandlers handlers{}; // The number is the client ID for sudachi, it's used for images and the // application name - Discord_Initialize("712465656758665259", &handlers, 1, nullptr); + Discord_Initialize("1223291656732934377", &handlers, 1, nullptr); } DiscordImpl::~DiscordImpl() { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d376d86..f1d96b1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1197,6 +1197,10 @@ void RasterizerOpenGL::SyncBlendState() { } } +bool RasterizerOpenGL::IsAnyFloat(Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute) { + return attribute.type == Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type::Float; +}; + void RasterizerOpenGL::SyncLogicOpState() { auto& flags = maxwell3d->dirty.flags; if (!flags[Dirty::LogicOp]) { @@ -1205,7 +1209,16 @@ void RasterizerOpenGL::SyncLogicOpState() { flags[Dirty::LogicOp] = false; const auto& regs = maxwell3d->regs; - if (regs.logic_op.enable) { + + bool has_float = false; + + if (std::any_of(regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(), + [&](Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute) { + return IsAnyFloat(attribute); + })) + has_float = true; + + if (regs.logic_op.enable && !has_float) { glEnable(GL_COLOR_LOGIC_OP); glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.op)); } else { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 6eae51f..84f9f5c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -236,6 +236,8 @@ private: void QueryFallback(GPUVAddr gpu_addr, VideoCommon::QueryType type, VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport); + bool IsAnyFloat(Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute); + Tegra::GPU& gpu; Tegra::MaxwellDeviceMemoryManager& device_memory; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index ceab90a..5b91391 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -1310,12 +1310,25 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re [enable](vk::CommandBuffer cmdbuf) { cmdbuf.SetDepthBiasEnableEXT(enable != 0); }); } +bool RasterizerVulkan::IsAnyFloat(Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute) { + return attribute.type == Tegra::Engines::Maxwell3D::Regs::VertexAttribute::Type::Float; +}; + void RasterizerVulkan::UpdateLogicOpEnable(Tegra::Engines::Maxwell3D::Regs& regs) { if (!state_tracker.TouchLogicOpEnable()) { return; } - scheduler.Record([enable = regs.logic_op.enable](vk::CommandBuffer cmdbuf) { - cmdbuf.SetLogicOpEnableEXT(enable != 0); + + scheduler.Record([&, regs](vk::CommandBuffer cmdbuf) { + bool has_float = false; + + if (std::any_of(regs.vertex_attrib_format.begin(), regs.vertex_attrib_format.end(), + [&](Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute) { + return IsAnyFloat(attribute); + })) + has_float = true; + + cmdbuf.SetLogicOpEnableEXT((regs.logic_op.enable != 0 && !has_float) ? true : false); }); } diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 77fa4f0..e6a06ba 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -180,6 +180,8 @@ private: void UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs); + bool IsAnyFloat(Tegra::Engines::Maxwell3D::Regs::VertexAttribute attribute); + Tegra::GPU& gpu; Tegra::MaxwellDeviceMemoryManager& device_memory;