summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)Author
2025-05-12fix(renderer_vulkan): resolve asynchronous presentation crashes and ↵Zephyron
compilation errors Fix multiple issues in the Vulkan asynchronous presentation implementation: - Convert regular mutexes to timed_mutex for timeout support - Use condition_variable_any for compatibility with timed_mutex - Fix thread synchronization with proper locking and error handling - Add VkResultToString helper to replace missing ToString function - Implement better error recovery with recreation attempt limits - Add comprehensive logging for better troubleshooting These changes make the asynchronous presentation feature more robust and less prone to deadlocks, while keeping it disabled by default since it may still cause instability in some games. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12feat(services): Implement nn::socket, nn::nifm, and nn::nim networking servicesZephyron
Add Nintendo Switch network service implementations to support modders working with network functionality in their game modifications: - Add nn::socket utilities including InetAton and Connect functions - Implement sockaddr/in_addr structures matching official Nintendo APIs - Add nn::nifm networking interface services with IsNetworkAvailable and SubmitNetworkRequest - Implement nn::nim network installation management services - Fix BSD socket implementation to properly handle proxy packets - Add Service_BSD log category for better debugging These changes provide crucial networking API support for modders like MaxLastBreath and projects like NX Optimizer (https://www.nxoptimizer.com/) that need to hook into Nintendo's network services for code injection mods. This implementation follows the official documentation at SwitchBrew and enables proper network connectivity in modded games. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12feat: add CPU clock rate slider to settingsZephyron
Implement a slider in the CPU settings tab to adjust the BASE_CLOCK_RATE up to 1,785 MHz (Switch's official maximum clock rate). Default remains at 1,020 MHz. This change: - Adds UI slider and spinbox to configure_cpu.ui with range 500-1785 MHz - Makes BASE_CLOCK_RATE dynamic by reading from settings - Modifies WallClock to handle dynamic clock rate changes - Updates APM controller to properly set the clock rate - Changes clock rate settings category from Core to CPU The user can now easily adjust the CPU clock rate to improve performance or manage thermals and power consumption. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12feat: add option to respect present interval 0 as unlocked FPSZephyron
When enabled, this feature allows games using present interval 0 to run with truly unlocked FPS, matching actual hardware behavior more accurately. Previously, Citron would cap present interval 0 at 120FPS to conserve battery, but this prevented proper functionality of dynamic framerate mods like UltraCam by MaxLastBreath (https://www.nxoptimizer.com/). The setting is disabled by default to maintain the current behavior for most users. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12android: Update build system and optimize ARM NCE implementationZephyron
- Update Kotlin from 1.9.20 to 2.1.20-RC2 - Upgrade Java version from 17 to 21 - Update Android Gradle plugin from 8.1.2 to 8.9.0 - Update Gradle wrapper from 8.10.2 to 8.11.1 - Update NDK version to 29.0.13113456 rc1 - Update all Android dependencies to latest versions - Simplify ARM NCE implementation by removing custom TLB handling - Improve alignment and access fault handling - Update hardware BASE_CLOCK_RATE from 1.02GHz to 1.785GHz - Add citron Emulator Project copyright notices Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12android: Initial multiplayer supportvampiric_x
And give room owners mod access on both Android and QT
2025-05-12build: upgrade fmt and SDL2Zephyron
Update fmt library to version 11.0.2 and make necessary adjustments: - Replace fmt/format.h includes with fmt/ranges.h - Add const qualifiers to formatter::format functions - Update CMake to require fmt version 11 Additional dependency updates: - Update SDL2 bundled version from 2.28.2 to 2.32.0 - Update catch2 to version 3.7.1 - Update vcpkg baseline to ca846b21276c9a3171074ac8d2b4f6516894a7d0
2025-05-11common: Enhance memory mapping safety and debuggingZephyron
- Reduce max_memory_size from 512GB to 1GB for safer allocation limits - Add memory operation logging for debugging purposes - Implement MapMemory() with additional safety checks and large allocation handling - Add validation checks for memory mappings - Introduce chunked allocation strategy for large memory requests - Add detailed error logging for memory operations
2025-05-11common: improve host memory mapping validationZephyron
- Add maximum memory size limit of 512GB (Overkill) - Implement additional safety checks for memory mapping: * Validate non-zero addresses * Verify address alignment * Add length validation against maximum size - Remove redundant assertion for host_offset alignment - Remove potentially problematic mapping verification - Improve error logging for invalid mapping attempts These changes enhance memory safety by adding proper bounds checking and validation before performing memory mappings, while removing a potentially problematic post-mapping verification step.
2025-05-11vulkan: Fix parameter naming consistency for Android compilationZephyron
Renames 'size' parameter to 'length' in IsValidMapping() methods to avoid conflicts with Android NDK macros that define 'size'. This fixes compilation issues on Android platforms where the 'size' macro is defined.
2025-05-11common/nvdrv: improve memory validation and error handlingZephyron
Implements several improvements to memory handling and validation: - host_memory: Add IsValidMapping() and IsDirectMappingEnabled() methods to validate memory access - host_memory: Fix virtual base offset calculation to use proper pointer arithmetic - host_memory: Add size field to track allocation size - nvhost_ctrl_gpu: Return InvalidState instead of InvalidValue for TPC mask buffer size validation - Update copyright year for citron The changes improve memory safety by adding explicit validation checks and fixing pointer arithmetic in the virtual memory implementation.
2025-05-11nvdrv: Add GetTpcMasks2 support and improve memory mapping validationZephyron
This commit makes two main changes: 1. Adds support for GetTpcMasks2 (ioctl 0x13) in nvhost_ctrl_gpu: - Implements new GetTpcMasks2 method to handle TPC mask queries - Adds IoctlGetTpcMasks structure to store mask parameters - Returns conservative single TPC configuration for compatibility 2. Enhances memory mapping validation in HostMemory: - Adds verification check after memory mapping operations - Improves error handling for direct mapped address enabling - Adds logging for mapping and direct address failures Additional changes: - Updates copyright headers to include citron Emulator Project - Improves error handling and validation in several paths - Adds debug logging for TPC mask operations This improves GPU virtualization support and memory mapping reliability.
2025-05-11string_util: Replace deprecated wstring_convert with direct UTF conversionsZephyron
Removes usage of std::wstring_convert and std::codecvt_utf8_utf16 which are deprecated since C++17. Implements direct UTF conversions for: - UTF16ToUTF8: Manual conversion with proper surrogate pair handling - UTF8ToUTF16: Direct conversion supporting full Unicode range - UTF8ToUTF32: New implementation with proper code point extraction The new implementations are more robust and handle edge cases better while avoiding deprecated functionality. Windows-specific code paths remain unchanged using the existing UTF16W conversions. This change improves maintainability and removes compiler warnings about deprecated features while maintaining full Unicode support.
2025-05-11common: Improve error handling in host memory managementZephyron
Add proper error handling and recovery mechanisms for memory mapping operations instead of using assertions.
2025-05-11common: Use consistent cache line size in RingBufferZephyron
Replace hardcoded 128-byte alignment with a defined CACHE_LINE_SIZE constant of 64 bytes for the atomic indices in RingBuffer. This value is more appropriate for most modern CPU architectures and simplifies the implementation by using a consistent value regardless of compiler support for hardware_interference_size. Changes: - Add CACHE_LINE_SIZE constant set to 64 bytes - Use CACHE_LINE_SIZE for atomic index alignment in both code paths - Remove outdated TODO comment about hardware_destructive_interference_size
2025-05-11core: Add support for 10GB and 12GB memory configurationsZephyron
- Add Memory_10Gb and Memory_12Gb to MemoryLayout enum - Update memory layout settings to support up to 12GB - Add SMC enums for 10GB and 12GB memory sizes and arrangements - Increase MainMemorySizeMax from 8GB to 12GB - Add memory pool size calculations for 10GB and 12GB configurations - Update UI translations for new memory options
2025-05-11impl(Multiplayer): Switched API To Enable MultiplayerZephyron
2024-12-20Add 12gb DRAM option (#90)Zuckerwatte1
This adds the option to allow the emulator to use 12gb of RAM for something like really big texture packs. Co-authored-by: smiRaphi <neogt404@gmail.com> Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/90 Co-authored-by: Zuckerwatte1 <zuckerwatte1@noreply.localhost> Co-committed-by: Zuckerwatte1 <zuckerwatte1@noreply.localhost>
2024-12-20externals: update fmt to 11.0.2 and vcpkg to 2024.09.30 (#68)lui
Updated to fmt 11 with the required source changes for it to work. Also updated vcpkg for this, and as an added benefit it fixes the `Unable to find a valid Visual Studio instance` error, and the VS 2019 build tools are no longer required. Just make sure to delete the existing downloaded vcpkg tool and binaries in `externals/vcpkg` if you have compiled before, or else it will continue to use the old version and give the error. Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/68 Co-authored-by: lui <lui@vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion> Co-committed-by: lui <lui@vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion>
2024-12-20mark format functions as constSamuliak
2024-12-20renderer: add area sampling scaling method (#57)lui
Adds Area Sampling to the list of scaling options. Works well to achieve a high-quality, smooth super-sampling effect. Dolphin has had this for a while, and now Ryujinx has recently added it too, so I decided to port it. Not sure if adding the extra uniform to the OpenGL WindowAdaptPass was a good idea or not, or if using the push constants under Vulkan was either, but I wasn't sure about the best way to get the window size for use in the shader, and other scaling methods still work fine. Implementation seems to work fine under both Vulkan and OpenGL, but might still need some minor tweaks to the shader. Should definitely do some testing before merging, I have tested on an Nvidia RTX 3080 under Windows. Adapted from these two PRs: https://github.com/Ryujinx/Ryujinx/pull/7304 https://github.com/dolphin-emu/dolphin/pull/11999 Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/57 Co-authored-by: lui <lui@vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion> Co-committed-by: lui <lui@vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion>
2024-12-20Fix Android crash caused by incorrect type in progress dialog callbacks (#58)echosys
Bug discovered via an incomplete fix in Sudachi. Some Progress Dialog callbacks pass the wrong type (Double instead of Long) from C++ to Java code causing a crash at runtime. To fix this a new function is implemented to convert to a Java Long and that is used instead of the function that converts to a Double. Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/58 Co-authored-by: echosys <echosys@noreply.localhost> Co-committed-by: echosys <echosys@noreply.localhost>
2024-12-20Add option to only optimize SPIRV during load (#13)echosys
Adds a new option "On Load" to the "Optimize SPIRV output" option that turns on optimizations during the loading of the shader cache from disk, but turns it off after that. The previous checkbox states have been named "Never" for unchecked and "Always" for checked. The idea is that once the shader cache has most of the shaders in a game cached they can be optimized during initial game startup (where a performance hit matters less) and the few shaders that get compiled during runtime are not optimized to reduce performance hits. Most of the commit is adding the setting to the Android app, the main logic is in the `gl_shader_cache.cpp` and `vk_pipeline_cache.cpp` files. Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/13 Co-authored-by: echosys <echosys@noreply.localhost> Co-committed-by: echosys <echosys@noreply.localhost>
2024-12-20Use fmt 11.0.0Mike Lothian
2024-12-20Disabled problematic MSVC warning-to-errorsspectranator
2024-12-20Added option to synchronize core tick speed to max speed percentagespectranator
2024-12-20Load custom Qt themes from yuzu data directoryflodavid
- Directory is qt_themes, each theme must be in one folder - It should contain a file "style.qss" - It may contain an "icons" sub-directory, to override included icons (with files like mytheme/icons/colorful/48x48/star.png for example) - Directories ending by "_dark" are reserved for dark variant icons. They are not listed as themes in the UI. - If theme directory contains "dark" or "midnight", theme will be considered dark
2024-12-20Optionally optimize generated SPIRV with spirv-opt (#10)darktux
Reviewed-on: http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/darktux/torzu/pulls/10 Co-authored-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion> Co-committed-by: darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion>
2024-12-20Removed telemetry and anonymized SCM (git) stringsdarktux
2024-12-20Fix GCC builds with Debug build typedarktux
When compiling with -DCMAKE_BUILD_TYPE=Debug, GCC would (correctly) fail to compile intrinsics in stb and host1x due to lack of optimizations. Sadly, the compilation error given is bogus and Clang completing the builds without issues does raise some eyebrows. Therefore, force optimizations for the offending files under GCC when creating Debug builds. Signed-off-by: voidanix <voidanix@keyedlimepie.org>
2024-12-20Add option to log synchronously, add tooltip to log filter.Kelebek1
2024-12-20fix: Increased max sensitivity for mouse panningAkatsuki Levi
2024-12-20Added 32:9 aspect rationiansa
2024-12-20Port changes from Early Accessniansa
2024-02-26Merge pull request #13159 from liamwhite/web-errorliamwhite
core: enable error applet, add stubs for web applet
2024-02-26settings: remove global override for smash on amdvlkLiam
2024-02-24settings: enable error appletLiam
2024-02-24common/ring_buffer: Include <limits> headerwheremyfoodat
2024-02-23Merge pull request #13100 from liamwhite/audio-ipcliamwhite
audio: move to new ipc
2024-02-22Merge pull request #13001 from liamwhite/scaled-availabilityNarr the Reg
vulkan_device: don't use fixed cap for memory limits
2024-02-20audio: rewrite IAudioDeviceLiam
2024-02-19scope_exit: Make constexprFearlessTobi
Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it.
2024-02-18vulkan_device: don't use fixed cap for memory limitsLiam
2024-02-17android: Input mappingt895
2024-02-11Merge pull request #12756 from liamwhite/applet-multiprocess-hwcNarr the Reg
general: applet multiprocess
2024-02-09Merge pull request #12920 from t895/jni-commonliamwhite
android: Move JNI setup and helpers to common
2024-02-09general: add default configurations for applet modeLiam
2024-02-08common: fs: Expand android macrost895
2024-02-08android: Move JNI setup and helpers to commont895
2024-02-08Merge pull request #12914 from FernandoS27/vc-refactorliamwhite
VideoCore Refactor Part 1.