From 7dc30a5e2db0924b0543f8cb109ba892fe445903 Mon Sep 17 00:00:00 2001 From: DieguinDG Date: Thu, 8 Jan 2026 16:18:11 -0300 Subject: [PATCH] salva isso --- .../service/nvdrv/devices/nvhost_nvdec.cpp | 4 +++- .../hle/service/ssl/ssl_backend_openssl.cpp | 8 +++++-- src/core/internal_network/legacy_online.cpp | 6 ++--- src/video_core/host1x/ffmpeg/ffmpeg.cpp | 23 ++++++------------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 60b89b6284..dd37266bd9 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -66,7 +66,9 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span in void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) { LOG_INFO(Service_NVDRV, "NVDEC video stream started"); - system.SetNVDECActive(true); + if (!system.GetNVDECActive()) { + system.SetNVDECActive(true); + } sessions[fd] = session_id; host1x.StartDevice(fd, Tegra::Host1x::ChannelType::NvDec, channel_syncpoint); } diff --git a/src/core/hle/service/ssl/ssl_backend_openssl.cpp b/src/core/hle/service/ssl/ssl_backend_openssl.cpp index f301bea37c..6526275f69 100644 --- a/src/core/hle/service/ssl/ssl_backend_openssl.cpp +++ b/src/core/hle/service/ssl/ssl_backend_openssl.cpp @@ -217,6 +217,7 @@ public: } Result Write(size_t* out_size, std::span data) override { + const size_t original_size = data.size(); const std::string_view data_view(reinterpret_cast(data.data()), data.size()); // Log all POST requests for debugging @@ -318,8 +319,10 @@ public: } } - const int ret = - SSL_write_ex(ssl, request_str.data(), request_str.size(), out_size); + const int ret = SSL_write_ex(ssl, request_str.data(), request_str.size(), out_size); + if (ret == 1) { // Success + *out_size = original_size; + } return HandleReturn("SSL_write_ex", out_size, ret); } } else { @@ -329,6 +332,7 @@ public: LOG_WARNING(Service_SSL, "jdlo_auth.ini not found at {}", Common::FS::PathToUTF8String(auth_file_path)); } + } const int ret = SSL_write_ex(ssl, data.data(), data.size(), out_size); return HandleReturn("SSL_write_ex", out_size, ret); diff --git a/src/core/internal_network/legacy_online.cpp b/src/core/internal_network/legacy_online.cpp index 8c9969f4df..558d7e5a90 100644 --- a/src/core/internal_network/legacy_online.cpp +++ b/src/core/internal_network/legacy_online.cpp @@ -588,7 +588,7 @@ void LegacyOnlineService::HttpServerLoop() { std::string cmd1 = R"({"__class":"InputSetup_ConsoleCommandData","isEnabled":1,"inputSetup":{"isEnabled":1}})"; std::vector f1; f1.push_back(0x81); f1.push_back(static_cast(cmd1.size())); for(char c:cmd1) f1.push_back(static_cast(c)); #ifdef _WIN32 - send(client_fd, reinterpret_cast(f1.data()), f1.size(), 0); + send(client_fd, reinterpret_cast(f1.data()), static_cast(f1.size()), 0); #else send(client_fd, f1.data(), f1.size(), 0); #endif @@ -597,7 +597,7 @@ void LegacyOnlineService::HttpServerLoop() { std::string cmd2 = R"({"__class":"JD_EnableAccelValuesSending_ConsoleCommandData","isEnabled":1})"; std::vector f2; f2.push_back(0x81); f2.push_back(static_cast(cmd2.size())); for(char c:cmd2) f2.push_back(static_cast(c)); #ifdef _WIN32 - send(client_fd, reinterpret_cast(f2.data()), f2.size(), 0); + send(client_fd, reinterpret_cast(f2.data()), static_cast(f2.size()), 0); #else send(client_fd, f2.data(), f2.size(), 0); #endif @@ -606,7 +606,7 @@ void LegacyOnlineService::HttpServerLoop() { std::string cmd3 = R"({"__class":"JD_PhoneUiSetupData","isPopup":0,"inputSetup":{"isEnabled":1}})"; std::vector f3; f3.push_back(0x81); f3.push_back(static_cast(cmd3.size())); for(char c:cmd3) f3.push_back(static_cast(c)); #ifdef _WIN32 - send(client_fd, reinterpret_cast(f3.data()), f3.size(), 0); + send(client_fd, reinterpret_cast(f3.data()), static_cast(f3.size()), 0); #else send(client_fd, f3.data(), f3.size(), 0); #endif diff --git a/src/video_core/host1x/ffmpeg/ffmpeg.cpp b/src/video_core/host1x/ffmpeg/ffmpeg.cpp index 1c331645f1..d7d1226b9b 100644 --- a/src/video_core/host1x/ffmpeg/ffmpeg.cpp +++ b/src/video_core/host1x/ffmpeg/ffmpeg.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project @@ -212,16 +212,8 @@ bool HardwareContext::InitializeWithType(AVHWDeviceType type) { DecoderContext::DecoderContext(const Decoder& decoder) : m_decoder{decoder} { m_codec_context = avcodec_alloc_context3(m_decoder.GetCodec()); av_opt_set(m_codec_context->priv_data, "tune", "zerolatency", 0); - - // Optimization: Use all available CPU cores for high bitrate decoding - m_codec_context->thread_count = std::thread::hardware_concurrency(); - m_codec_context->thread_type = FF_THREAD_SLICE; - - // EXTREME OPTIMIZATION: Aggressive fast decode for very high bitrates - // Trade-off: Small quality loss for significant speed gain (~40-50% faster) - m_codec_context->skip_loop_filter = AVDISCARD_ALL; // Skip deblock filter (20-30% faster) - m_codec_context->flags2 |= AV_CODEC_FLAG2_FAST; // Enable fast decoding mode (10-15% faster) - m_codec_context->flags |= AV_CODEC_FLAG_LOW_DELAY; // Minimize internal delays + m_codec_context->thread_count = 0; + m_codec_context->thread_type &= ~FF_THREAD_FRAME; } DecoderContext::~DecoderContext() { @@ -271,19 +263,18 @@ std::shared_ptr DecoderContext::ReceiveFrame() { return {}; } - // Optimization: Only create final_frame and do GPU transfer when actually using GPU + m_final_frame = std::make_shared(); if (m_codec_context->hw_device_ctx) { - m_final_frame = std::make_shared(); m_final_frame->SetFormat(PreferredGpuFormat); if (const int ret = av_hwframe_transfer_data(m_final_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) { LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret)); return {}; } - return m_final_frame; + } else { + m_final_frame = std::move(intermediate_frame); } - // CPU decoding: just return the intermediate frame directly (no copy needed) - return intermediate_frame; + return std::move(m_final_frame); } void DecodeApi::Reset() {