diff --git a/README.md b/README.md index bf53488c3..03ce876e9 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1912. +This is the source code for early-access 1915. ## Legal Notice diff --git a/dist/yuzu.ico b/dist/yuzu.ico index 7c998a5c5..df3be8464 100755 Binary files a/dist/yuzu.ico and b/dist/yuzu.ico differ diff --git a/dist/yuzu.svg b/dist/yuzu.svg index 98ded2d8f..93171d1bf 100755 --- a/dist/yuzu.svg +++ b/dist/yuzu.svg @@ -1 +1 @@ -newAsset 7 \ No newline at end of file +Artboard 1 \ No newline at end of file diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 3e34c6c2d..57922b51c 100755 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -169,7 +169,7 @@ endif() create_target_directory_groups(common) -target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile) +target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) target_link_libraries(common PRIVATE lz4::lz4 xbyak) if (MSVC) target_link_libraries(common PRIVATE zstd::zstd) diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 4f42fffcb..6c1edce33 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp @@ -68,7 +68,6 @@ void nvhost_nvdec::OnOpen(DeviceFD fd) {} void nvhost_nvdec::OnClose(DeviceFD fd) { LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); system.GPU().ClearCdmaInstance(); - system.GPU().MemoryManager().InvalidateQueuedCaches(); } } // namespace Service::Nvidia::Devices diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 704788a8c..1403a39d0 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp @@ -193,13 +193,7 @@ NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector& input, std::vec return NvResult::InvalidState; } if (const auto size{RemoveBufferMap(object->dma_map_addr)}; size) { - if (vic_device) { - // UnmapVicFrame defers texture_cache invalidation of the frame address until - // the stream is over - gpu.MemoryManager().UnmapVicFrame(object->dma_map_addr, *size); - } else { - gpu.MemoryManager().Unmap(object->dma_map_addr, *size); - } + gpu.MemoryManager().Unmap(object->dma_map_addr, *size); } else { // This occurs quite frequently, however does not seem to impact functionality LOG_DEBUG(Service_NVDRV, "invalid offset=0x{:X} dma=0x{:X}", object->addr, diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index 46c81f906..da10f5f41 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h @@ -160,7 +160,6 @@ protected: s32_le nvmap_fd{}; u32_le submit_timeout{}; - bool vic_device{}; std::shared_ptr nvmap_dev; SyncpointManager& syncpoint_manager; std::array device_syncpoints{}; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 64aa7b06f..21d101e8a 100755 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp @@ -12,9 +12,8 @@ namespace Service::Nvidia::Devices { nvhost_vic::nvhost_vic(Core::System& system_, std::shared_ptr nvmap_dev_, SyncpointManager& syncpoint_manager_) - : nvhost_nvdec_common(system_, std::move(nvmap_dev_), syncpoint_manager_) { - vic_device = true; -} + : nvhost_nvdec_common{system_, std::move(nvmap_dev_), syncpoint_manager_} {} + nvhost_vic::~nvhost_vic() = default; NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector& input, diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index 3c3b6fbde..a2f1bb67c 100755 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp @@ -14,73 +14,15 @@ namespace GCAdapter { -class LibUSBContext { -public: - explicit LibUSBContext() { - init_result = libusb_init(&ctx); - } - - ~LibUSBContext() { - libusb_exit(ctx); - } - - LibUSBContext& operator=(const LibUSBContext&) = delete; - LibUSBContext(const LibUSBContext&) = delete; - - LibUSBContext& operator=(LibUSBContext&&) noexcept = delete; - LibUSBContext(LibUSBContext&&) noexcept = delete; - - [[nodiscard]] int InitResult() const noexcept { - return init_result; - } - - [[nodiscard]] libusb_context* get() noexcept { - return ctx; - } - -private: - libusb_context* ctx; - int init_result{}; -}; - -class LibUSBDeviceHandle { -public: - explicit LibUSBDeviceHandle(libusb_context* ctx, uint16_t vid, uint16_t pid) noexcept { - handle = libusb_open_device_with_vid_pid(ctx, vid, pid); - } - - ~LibUSBDeviceHandle() noexcept { - if (handle) { - libusb_release_interface(handle, 1); - libusb_close(handle); - } - } - - LibUSBDeviceHandle& operator=(const LibUSBDeviceHandle&) = delete; - LibUSBDeviceHandle(const LibUSBDeviceHandle&) = delete; - - LibUSBDeviceHandle& operator=(LibUSBDeviceHandle&&) noexcept = delete; - LibUSBDeviceHandle(LibUSBDeviceHandle&&) noexcept = delete; - - [[nodiscard]] libusb_device_handle* get() noexcept { - return handle; - } - -private: - libusb_device_handle* handle{}; -}; - Adapter::Adapter() { - if (usb_adapter_handle) { + if (usb_adapter_handle != nullptr) { return; } LOG_INFO(Input, "GC Adapter Initialization started"); - libusb_ctx = std::make_unique(); - const int init_res = libusb_ctx->InitResult(); + const int init_res = libusb_init(&libusb_ctx); if (init_res == LIBUSB_SUCCESS) { - adapter_scan_thread = - std::jthread([this](std::stop_token stop_token) { AdapterScanThread(stop_token); }); + adapter_scan_thread = std::thread(&Adapter::AdapterScanThread, this); } else { LOG_ERROR(Input, "libusb could not be initialized. failed with error = {}", init_res); } @@ -90,15 +32,17 @@ Adapter::~Adapter() { Reset(); } -void Adapter::AdapterInputThread(std::stop_token stop_token) { +void Adapter::AdapterInputThread() { LOG_DEBUG(Input, "GC Adapter input thread started"); s32 payload_size{}; AdapterPayload adapter_payload{}; - adapter_scan_thread = {}; + if (adapter_scan_thread.joinable()) { + adapter_scan_thread.join(); + } - while (!stop_token.stop_requested()) { - libusb_interrupt_transfer(usb_adapter_handle->get(), input_endpoint, adapter_payload.data(), + while (adapter_input_thread_running) { + libusb_interrupt_transfer(usb_adapter_handle, input_endpoint, adapter_payload.data(), static_cast(adapter_payload.size()), &payload_size, 16); if (IsPayloadCorrect(adapter_payload, payload_size)) { UpdateControllers(adapter_payload); @@ -108,8 +52,7 @@ void Adapter::AdapterInputThread(std::stop_token stop_token) { } if (restart_scan_thread) { - adapter_scan_thread = - std::jthread([this](std::stop_token token) { AdapterScanThread(token); }); + adapter_scan_thread = std::thread(&Adapter::AdapterScanThread, this); restart_scan_thread = false; } } @@ -121,7 +64,7 @@ bool Adapter::IsPayloadCorrect(const AdapterPayload& adapter_payload, s32 payloa adapter_payload[0]); if (input_error_counter++ > 20) { LOG_ERROR(Input, "GC adapter timeout, Is the adapter connected?"); - adapter_input_thread.request_stop(); + adapter_input_thread_running = false; restart_scan_thread = true; } return false; @@ -153,7 +96,7 @@ void Adapter::UpdatePadType(std::size_t port, ControllerTypes pad_type) { return; } // Device changed reset device and set new type - pads[port] = {}; + ResetDevice(port); pads[port].type = pad_type; } @@ -270,9 +213,8 @@ void Adapter::SendVibrations() { const u8 p3 = pads[2].enable_vibration; const u8 p4 = pads[3].enable_vibration; std::array payload = {rumble_command, p1, p2, p3, p4}; - const int err = - libusb_interrupt_transfer(usb_adapter_handle->get(), output_endpoint, payload.data(), - static_cast(payload.size()), &size, 16); + const int err = libusb_interrupt_transfer(usb_adapter_handle, output_endpoint, payload.data(), + static_cast(payload.size()), &size, 16); if (err) { LOG_DEBUG(Input, "Adapter libusb write failed: {}", libusb_error_name(err)); if (output_error_counter++ > 5) { @@ -291,53 +233,56 @@ bool Adapter::RumblePlay(std::size_t port, u8 amplitude) { return rumble_enabled; } -void Adapter::AdapterScanThread(std::stop_token stop_token) { - usb_adapter_handle = nullptr; - pads = {}; - while (!stop_token.stop_requested() && !Setup()) { - std::this_thread::sleep_for(std::chrono::seconds(2)); +void Adapter::AdapterScanThread() { + adapter_scan_thread_running = true; + adapter_input_thread_running = false; + if (adapter_input_thread.joinable()) { + adapter_input_thread.join(); + } + ClearLibusbHandle(); + ResetDevices(); + while (adapter_scan_thread_running && !adapter_input_thread_running) { + Setup(); + std::this_thread::sleep_for(std::chrono::seconds(1)); } } -bool Adapter::Setup() { - constexpr u16 nintendo_vid = 0x057e; - constexpr u16 gc_adapter_pid = 0x0337; - usb_adapter_handle = - std::make_unique(libusb_ctx->get(), nintendo_vid, gc_adapter_pid); - if (!usb_adapter_handle->get()) { - return false; +void Adapter::Setup() { + usb_adapter_handle = libusb_open_device_with_vid_pid(libusb_ctx, 0x057e, 0x0337); + + if (usb_adapter_handle == NULL) { + return; } if (!CheckDeviceAccess()) { - usb_adapter_handle = nullptr; - return false; + ClearLibusbHandle(); + return; } - libusb_device* const device = libusb_get_device(usb_adapter_handle->get()); + libusb_device* device = libusb_get_device(usb_adapter_handle); LOG_INFO(Input, "GC adapter is now connected"); // GC Adapter found and accessible, registering it if (GetGCEndpoint(device)) { + adapter_scan_thread_running = false; + adapter_input_thread_running = true; rumble_enabled = true; input_error_counter = 0; output_error_counter = 0; - adapter_input_thread = - std::jthread([this](std::stop_token stop_token) { AdapterInputThread(stop_token); }); - return true; + adapter_input_thread = std::thread(&Adapter::AdapterInputThread, this); } - return false; } bool Adapter::CheckDeviceAccess() { // This fixes payload problems from offbrand GCAdapters const s32 control_transfer_error = - libusb_control_transfer(usb_adapter_handle->get(), 0x21, 11, 0x0001, 0, nullptr, 0, 1000); + libusb_control_transfer(usb_adapter_handle, 0x21, 11, 0x0001, 0, nullptr, 0, 1000); if (control_transfer_error < 0) { LOG_ERROR(Input, "libusb_control_transfer failed with error= {}", control_transfer_error); } - s32 kernel_driver_error = libusb_kernel_driver_active(usb_adapter_handle->get(), 0); + s32 kernel_driver_error = libusb_kernel_driver_active(usb_adapter_handle, 0); if (kernel_driver_error == 1) { - kernel_driver_error = libusb_detach_kernel_driver(usb_adapter_handle->get(), 0); + kernel_driver_error = libusb_detach_kernel_driver(usb_adapter_handle, 0); if (kernel_driver_error != 0 && kernel_driver_error != LIBUSB_ERROR_NOT_SUPPORTED) { LOG_ERROR(Input, "libusb_detach_kernel_driver failed with error = {}", kernel_driver_error); @@ -345,13 +290,15 @@ bool Adapter::CheckDeviceAccess() { } if (kernel_driver_error && kernel_driver_error != LIBUSB_ERROR_NOT_SUPPORTED) { + libusb_close(usb_adapter_handle); usb_adapter_handle = nullptr; return false; } - const int interface_claim_error = libusb_claim_interface(usb_adapter_handle->get(), 0); + const int interface_claim_error = libusb_claim_interface(usb_adapter_handle, 0); if (interface_claim_error) { LOG_ERROR(Input, "libusb_claim_interface failed with error = {}", interface_claim_error); + libusb_close(usb_adapter_handle); usb_adapter_handle = nullptr; return false; } @@ -385,17 +332,57 @@ bool Adapter::GetGCEndpoint(libusb_device* device) { // This transfer seems to be responsible for clearing the state of the adapter // Used to clear the "busy" state of when the device is unexpectedly unplugged unsigned char clear_payload = 0x13; - libusb_interrupt_transfer(usb_adapter_handle->get(), output_endpoint, &clear_payload, + libusb_interrupt_transfer(usb_adapter_handle, output_endpoint, &clear_payload, sizeof(clear_payload), nullptr, 16); return true; } +void Adapter::JoinThreads() { + restart_scan_thread = false; + adapter_input_thread_running = false; + adapter_scan_thread_running = false; + + if (adapter_scan_thread.joinable()) { + adapter_scan_thread.join(); + } + + if (adapter_input_thread.joinable()) { + adapter_input_thread.join(); + } +} + +void Adapter::ClearLibusbHandle() { + if (usb_adapter_handle) { + libusb_release_interface(usb_adapter_handle, 1); + libusb_close(usb_adapter_handle); + usb_adapter_handle = nullptr; + } +} + +void Adapter::ResetDevices() { + for (std::size_t i = 0; i < pads.size(); ++i) { + ResetDevice(i); + } +} + +void Adapter::ResetDevice(std::size_t port) { + pads[port].type = ControllerTypes::None; + pads[port].enable_vibration = false; + pads[port].rumble_amplitude = 0; + pads[port].buttons = 0; + pads[port].last_button = PadButton::Undefined; + pads[port].axis_values.fill(0); + pads[port].reset_origin_counter = 0; +} + void Adapter::Reset() { - adapter_scan_thread = {}; - adapter_input_thread = {}; - usb_adapter_handle = nullptr; - pads = {}; - libusb_ctx = nullptr; + JoinThreads(); + ClearLibusbHandle(); + ResetDevices(); + + if (libusb_ctx) { + libusb_exit(libusb_ctx); + } } std::vector Adapter::GetInputDevices() const { diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index 28dbcbe05..e5de5e94f 100755 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h @@ -3,14 +3,11 @@ // Refer to the license.txt file included. #pragma once - #include #include #include -#include #include #include - #include "common/common_types.h" #include "common/threadsafe_queue.h" #include "input_common/main.h" @@ -21,9 +18,6 @@ struct libusb_device_handle; namespace GCAdapter { -class LibUSBContext; -class LibUSBDeviceHandle; - enum class PadButton { Undefined = 0x0000, ButtonLeft = 0x0001, @@ -69,11 +63,11 @@ struct GCPadStatus { }; struct GCController { - ControllerTypes type = ControllerTypes::None; - bool enable_vibration = false; - u8 rumble_amplitude = 0; - u16 buttons = 0; - PadButton last_button = PadButton::Undefined; + ControllerTypes type{}; + bool enable_vibration{}; + u8 rumble_amplitude{}; + u16 buttons{}; + PadButton last_button{}; std::array axis_values{}; std::array axis_origin{}; u8 reset_origin_counter{}; @@ -115,9 +109,9 @@ private: void UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_payload); void UpdateVibrations(); - void AdapterInputThread(std::stop_token stop_token); + void AdapterInputThread(); - void AdapterScanThread(std::stop_token stop_token); + void AdapterScanThread(); bool IsPayloadCorrect(const AdapterPayload& adapter_payload, s32 payload_size); @@ -125,7 +119,13 @@ private: void SendVibrations(); /// For use in initialization, querying devices to find the adapter - bool Setup(); + void Setup(); + + /// Resets status of all GC controller devices to a disconnected state + void ResetDevices(); + + /// Resets status of device connected to a disconnected state + void ResetDevice(std::size_t port); /// Returns true if we successfully gain access to GC Adapter bool CheckDeviceAccess(); @@ -137,15 +137,23 @@ private: /// For shutting down, clear all data, join all threads, release usb void Reset(); - std::unique_ptr usb_adapter_handle; + // Join all threads + void JoinThreads(); + + // Release usb handles + void ClearLibusbHandle(); + + libusb_device_handle* usb_adapter_handle = nullptr; std::array pads; Common::SPSCQueue pad_queue; - std::jthread adapter_input_thread; - std::jthread adapter_scan_thread; - bool restart_scan_thread{}; + std::thread adapter_input_thread; + std::thread adapter_scan_thread; + bool adapter_input_thread_running; + bool adapter_scan_thread_running; + bool restart_scan_thread; - std::unique_ptr libusb_ctx; + libusb_context* libusb_ctx; u8 input_endpoint{0}; u8 output_endpoint{0}; diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 121f380f8..70ac7c620 100755 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -4,8 +4,6 @@ #include #include -#include "common/scope_exit.h" -#include "video_core/dirty_flags.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/macro/macro_hle.h" #include "video_core/rasterizer_interface.h" @@ -58,7 +56,6 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& maxwell3d.regs.index_array.first = parameters[3]; maxwell3d.regs.reg_array[0x446] = element_base; // vertex id base? maxwell3d.regs.index_array.count = parameters[1]; - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.regs.vb_element_base = element_base; maxwell3d.regs.vb_base_instance = base_instance; maxwell3d.mme_draw.instance_count = instance_count; @@ -80,70 +77,12 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& maxwell3d.CallMethodFromMME(0x8e5, 0x0); maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; } - -// Multidraw Indirect -void HLE_3f5e74b9c9a50164(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - SCOPE_EXIT({ - // Clean everything. - maxwell3d.regs.reg_array[0x446] = 0x0; // vertex id base? - maxwell3d.regs.index_array.count = 0; - maxwell3d.regs.vb_element_base = 0x0; - maxwell3d.regs.vb_base_instance = 0x0; - maxwell3d.mme_draw.instance_count = 0; - maxwell3d.CallMethodFromMME(0x8e3, 0x640); - maxwell3d.CallMethodFromMME(0x8e4, 0x0); - maxwell3d.CallMethodFromMME(0x8e5, 0x0); - maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - }); - const u32 start_indirect = parameters[0]; - const u32 end_indirect = parameters[1]; - if (start_indirect >= end_indirect) { - // Nothing to do. - return; - } - const auto topology = - static_cast(parameters[2]); - maxwell3d.regs.draw.topology.Assign(topology); - const u32 padding = parameters[3]; - const std::size_t max_draws = parameters[4]; - - const u32 indirect_words = 5 + padding; - const std::size_t first_draw = start_indirect; - const std::size_t effective_draws = end_indirect - start_indirect; - const std::size_t last_draw = start_indirect + std::min(effective_draws, max_draws); - - for (std::size_t index = first_draw; index < last_draw; index++) { - const std::size_t base = index * indirect_words + 5; - const u32 num_vertices = parameters[base]; - const u32 instance_count = parameters[base + 1]; - const u32 first_index = parameters[base + 2]; - const u32 base_vertex = parameters[base + 3]; - const u32 base_instance = parameters[base + 4]; - maxwell3d.regs.index_array.first = first_index; - maxwell3d.regs.reg_array[0x446] = base_vertex; - maxwell3d.regs.index_array.count = num_vertices; - maxwell3d.regs.vb_element_base = base_vertex; - maxwell3d.regs.vb_base_instance = base_instance; - maxwell3d.mme_draw.instance_count = instance_count; - maxwell3d.CallMethodFromMME(0x8e3, 0x640); - maxwell3d.CallMethodFromMME(0x8e4, base_vertex); - maxwell3d.CallMethodFromMME(0x8e5, base_instance); - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - if (maxwell3d.ShouldExecute()) { - maxwell3d.Rasterizer().Draw(true, true); - } - maxwell3d.mme_draw.current_mode = Engines::Maxwell3D::MMEDrawMode::Undefined; - } -} - } // Anonymous namespace -constexpr std::array, 4> hle_funcs{{ +constexpr std::array, 3> hle_funcs{{ {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD}, {0x0217920100488FF7, &HLE_0217920100488FF7}, - {0x3f5e74b9c9a50164, &HLE_3f5e74b9c9a50164}, }}; HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index fa396ccf8..882eff880 100755 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -118,25 +118,6 @@ void MemoryManager::TryUnlockPage(PageEntry page_entry, std::size_t size) { .IsSuccess()); } -void MemoryManager::UnmapVicFrame(GPUVAddr gpu_addr, std::size_t size) { - if (!size) { - return; - } - - const std::optional cpu_addr = GpuToCpuAddress(gpu_addr); - ASSERT(cpu_addr); - rasterizer->InvalidateExceptTextureCache(*cpu_addr, size); - cache_invalidate_queue.push_back({*cpu_addr, size}); - - UpdateRange(gpu_addr, PageEntry::State::Unmapped, size); -} - -void MemoryManager::InvalidateQueuedCaches() { - for (const auto& entry : cache_invalidate_queue) { - rasterizer->InvalidateTextureCache(entry.first, entry.second); - } - cache_invalidate_queue.clear(); -} PageEntry MemoryManager::GetPageEntry(GPUVAddr gpu_addr) const { return page_table[PageEntryIndex(gpu_addr)]; } diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 509f14f26..99d13e7f6 100755 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h @@ -143,14 +143,6 @@ public: [[nodiscard]] GPUVAddr Allocate(std::size_t size, std::size_t align); void Unmap(GPUVAddr gpu_addr, std::size_t size); - /** - * Some Decoded NVDEC frames require that texture cache does not get invalidated. - * UnmapVicFrame defers the texture cache invalidation until the stream ends - * by invoking InvalidateQueuedCaches to invalidate all frame texture caches. - */ - void UnmapVicFrame(GPUVAddr gpu_addr, std::size_t size); - void InvalidateQueuedCaches(); - private: [[nodiscard]] PageEntry GetPageEntry(GPUVAddr gpu_addr) const; void SetPageEntry(GPUVAddr gpu_addr, PageEntry page_entry, std::size_t size = page_size); diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index e9e7a1064..b094fc064 100755 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -77,12 +77,6 @@ public: /// Notify rasterizer that any caches of the specified region should be flushed to Switch memory virtual void FlushRegion(VAddr addr, u64 size) = 0; - /// Notify rasterizer to flush the texture cache to Switch memory - virtual void InvalidateExceptTextureCache(VAddr addr, u64 size) = 0; - - /// Notify rasterizer to invalidate the texture cache - virtual void InvalidateTextureCache(VAddr addr, u64 size) = 0; - /// Check if the the specified memory area requires flushing to CPU Memory. virtual bool MustFlushRegion(VAddr addr, u64 size) = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d5169e9c4..41d2b73f4 100755 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -322,26 +322,6 @@ void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) { query_cache.FlushRegion(addr, size); } -void RasterizerOpenGL::InvalidateExceptTextureCache(VAddr addr, u64 size) { - if (addr == 0 || size == 0) { - return; - } - shader_cache.InvalidateRegion(addr, size); - { - std::scoped_lock lock{buffer_cache.mutex}; - buffer_cache.WriteMemory(addr, size); - } - query_cache.InvalidateRegion(addr, size); -} - -void RasterizerOpenGL::InvalidateTextureCache(VAddr addr, u64 size) { - if (addr == 0 || size == 0) { - return; - } - std::scoped_lock lock{texture_cache.mutex}; - texture_cache.UnmapMemory(addr, size); -} - bool RasterizerOpenGL::MustFlushRegion(VAddr addr, u64 size) { std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; if (!Settings::IsGPULevelHigh()) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 2618e095a..d0397b745 100755 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -86,8 +86,6 @@ public: void DisableGraphicsUniformBuffer(size_t stage, u32 index) override; void FlushAll() override; void FlushRegion(VAddr addr, u64 size) override; - void InvalidateExceptTextureCache(VAddr addr, u64 size) override; - void InvalidateTextureCache(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; void InvalidateRegion(VAddr addr, u64 size) override; void OnCPUWrite(VAddr addr, u64 size) override; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 609f5c576..c7a07fdd8 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -311,26 +311,6 @@ void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) { query_cache.FlushRegion(addr, size); } -void Vulkan::RasterizerVulkan::InvalidateExceptTextureCache(VAddr addr, u64 size) { - if (addr == 0 || size == 0) { - return; - } - pipeline_cache.InvalidateRegion(addr, size); - { - std::scoped_lock lock{buffer_cache.mutex}; - buffer_cache.WriteMemory(addr, size); - } - query_cache.InvalidateRegion(addr, size); -} - -void Vulkan::RasterizerVulkan::InvalidateTextureCache(VAddr addr, u64 size) { - if (addr == 0 || size == 0) { - return; - } - std::scoped_lock lock{texture_cache.mutex}; - texture_cache.UnmapMemory(addr, size); -} - bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size) { std::scoped_lock lock{texture_cache.mutex, buffer_cache.mutex}; if (!Settings::IsGPULevelHigh()) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 2fc249563..866827247 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -79,8 +79,6 @@ public: void DisableGraphicsUniformBuffer(size_t stage, u32 index) override; void FlushAll() override; void FlushRegion(VAddr addr, u64 size) override; - void InvalidateExceptTextureCache(VAddr addr, u64 size) override; - void InvalidateTextureCache(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; void InvalidateRegion(VAddr addr, u64 size) override; void OnCPUWrite(VAddr addr, u64 size) override; diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 87e1750e4..b112dd7b0 100755 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp @@ -112,7 +112,6 @@ void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, SetExitReason(Service::AM::Applets::WebExitReason::EndButtonPressed); SetLastURL("http://localhost/"); StartInputThread(); - FocusFirstLinkElement(); load(QUrl(QUrl::fromLocalFile(QString::fromStdString(main_url)).toString() + QString::fromStdString(additional_args))); @@ -129,8 +128,6 @@ void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, StartInputThread(); load(QUrl(QString::fromStdString(main_url) + QString::fromStdString(additional_args))); - - FocusFirstLinkElement(); } void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) { @@ -211,7 +208,7 @@ void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { if (input_interpreter->IsButtonPressedOnce(button)) { page()->runJavaScript( QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast(button)), - [this, button](const QVariant& variant) { + [&](const QVariant& variant) { if (variant.toBool()) { switch (button) { case HIDButton::A: @@ -367,17 +364,6 @@ void QtNXWebEngineView::LoadExtractedFonts() { Qt::QueuedConnection); } -void QtNXWebEngineView::FocusFirstLinkElement() { - QWebEngineScript focus_link_element; - - focus_link_element.setName(QStringLiteral("focus_link_element.js")); - focus_link_element.setSourceCode(QString::fromStdString(FOCUS_LINK_ELEMENT_SCRIPT)); - focus_link_element.setWorldId(QWebEngineScript::MainWorld); - focus_link_element.setInjectionPoint(QWebEngineScript::Deferred); - focus_link_element.setRunsOnSubFrames(true); - default_profile->scripts()->insert(focus_link_element); -} - #endif QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 7e9f703fc..7ad07409f 100755 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h @@ -161,9 +161,6 @@ private: /// Loads the extracted fonts using JavaScript. void LoadExtractedFonts(); - /// Brings focus to the first available link element. - void FocusFirstLinkElement(); - InputCommon::InputSubsystem* input_subsystem; std::unique_ptr url_interceptor; diff --git a/src/yuzu/applets/qt_web_browser_scripts.h b/src/yuzu/applets/qt_web_browser_scripts.h index c4ba8d40f..992837a85 100755 --- a/src/yuzu/applets/qt_web_browser_scripts.h +++ b/src/yuzu/applets/qt_web_browser_scripts.h @@ -73,12 +73,6 @@ constexpr char LOAD_NX_FONT[] = R"( })(); )"; -constexpr char FOCUS_LINK_ELEMENT_SCRIPT[] = R"( -if (document.getElementsByTagName("a").length > 0) { - document.getElementsByTagName("a")[0].focus(); -} -)"; - constexpr char GAMEPAD_SCRIPT[] = R"( window.addEventListener("gamepadconnected", function(e) { console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.", diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp index aad06ac2a..a93733b26 100755 --- a/src/yuzu/discord_impl.cpp +++ b/src/yuzu/discord_impl.cpp @@ -38,7 +38,7 @@ void DiscordImpl::Update() { if (Core::System::GetInstance().IsPoweredOn()) Core::System::GetInstance().GetAppLoader().ReadTitle(title); DiscordRichPresence presence{}; - presence.largeImageKey = "yuzu_logo_ea"; + presence.largeImageKey = "yuzu_logo"; presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; if (Core::System::GetInstance().IsPoweredOn()) { presence.state = title.c_str(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 37c4df217..2f84ada73 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2821,7 +2821,7 @@ void GMainWindow::OnCaptureScreenshot() { QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); const auto date = QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz")); - QString filename = QStringLiteral("%1%2_%3.png") + QString filename = QStringLiteral("%1/%2_%3.png") .arg(screenshot_path) .arg(title_id, 16, 16, QLatin1Char{'0'}) .arg(date);