summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2025-09-02service: mii: Fix building with Clang 21Mike Lothian
2025-09-02kernel: Fix compilation with Clang 21Mike Lothian
2025-06-17video_core: Rework VAAPI codeMike Lothian
Use public ffmpeg headers only Fall back gracefully to software decoding when codec is unsupported on VAAPI e.g. VP8
2025-06-15Update FFmpeg to 7.1.1, libvpx to 1.13.1 and libx264 to c24e06c on Android ↵MaranBr
(#187) This updates FFmpeg to 7.1.1, libvpx to 1.13.1 and libx264 to c24e06c on Android. Co-authored-by: MaranBr <maranbr@outlook.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/187 Reviewed-by: crueter <crueter@noreply.localhost> Co-authored-by: MaranBr <maranbr@noreply.localhost> Co-committed-by: MaranBr <maranbr@noreply.localhost>
2025-06-15Fix video decoding on newer versions of FFmpeg (#155)MaranBr
Fixes video decoding issues and enables compatibility with newer versions of FFmpeg. Co-authored-by: MaranBr <maranbr@outlook.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/155
2025-05-12Fix compile warningMike Lothian
2025-05-12Add Samsung Game Hub support, GAME category, optional NFC, and minor cleanupWasted
2025-05-12api_version: Update constants for HOS 20.0.1Zephyron
Updates version constants to match Nintendo Switch firmware 20.0.1: - HOS version numbers (20.0.1) - Version hash - Display version string - Display title string Signed-off-by: Zephyron <zephyron@citron-emu.org>
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-12api_version: Update constants for HOS 20.0.0Zephyron
Updates version constants to match Nintendo Switch firmware 20.0.0: - HOS version numbers (20.0.0) - Version hash - Display version string - Display title string Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12chore: Make firmware optional rather than requiredZephyron
This commit makes firmware non-mandatory for the emulator to function. Changes include: - Converting firmware errors to warnings in loader - Removing firmware requirement checks in Android - Removing firmware and title.keys setup screens - Adding --allow-unsupported flag for Android vcpkg - Updating vcpkg baseline - Enforce software keyboard in Android Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12fix: remove invalid WSAEBUSY Windows socket error codeZephyron
- Fixes Windows compilation error by removing the WSAEBUSY case in TranslateNativeError. - This error code does not exist in the Windows Sockets API as documented in the Microsoft documentation, but was incorrectly included in the Windows-specific error handling code. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12socket: Implement missing errno values and improve network error handlingZephyron
Add support for missing errno values needed by TOTK: - Add BUSY (16) for "Device or resource busy" errors - Add NOTSOCK (88) for "Socket operation on non-socket" errors Improvements: - Update TranslateNativeError on both Windows and Unix to handle new error codes - Change socket error logging for NOTSOCK from WARNING to DEBUG level - Fix formatting in Unix errno translation code - Update shader storage buffer tracking range to accommodate TOTK buffers - Add hex format to storage buffer logging for easier comparison with bias range - Change storage buffer tracking log level from WARNING to DEBUG These changes help prevent error messages in games that use network features not fully implemented in the emulator yet. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12android: Update build configuration and package identifiersZephyron
Updates the Android build configuration with several important changes: - Change application ID from com.antutu.ABenchMark to org.citron.citron_emu - Upgrade CMake version from 3.31.6 to 4.0.1 - Update Android Gradle plugin from 8.9.0 to 8.9.2 - Add CMAKE_POLICY_VERSION_MINIMUM=3.5 to CMake arguments - Keep Kotlin version at 1.9.20 These changes align the Android package identifier with the Citron project and update build tool versions to ensure compatibility with modern Android development requirements. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12video_core: Add fallback handling for failed storage buffer lookupsZephyron
Implements a more robust error handling approach when storage buffer lookups fail in the buffer cache. Instead of returning a null binding, the code now: - Provides a fallback buffer with safe default values - Implements warning rate limiting to prevent log spam - Tracks warning counts per cbuf_index - Logs detailed debug information periodically This change helps prevent potential crashes when storage buffer lookups fail while still maintaining visibility into the issue through strategic logging. The fallback mechanism uses a safe static address and a reasonable buffer size (16KB) to handle cases where the normal GPU to CPU address translation fails. Also updates copyright headers to include citron Emulator Project. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12video_core: Improve texture cache memory management to prevent leaksZephyron
Implement several improvements to the texture cache memory management system to address memory leaks that occur in memory-intensive games like TOTK (Title ID 0100F2C0115B6000). These changes prevent the gradual memory increase that eventually leads to crashes or undefined behavior. Key improvements: - Enhance garbage collection with more aggressive cleanup thresholds - Add emergency resource cleanup for persistent high memory usage - Improve DeleteImage to ensure proper resource deallocation - Make DelayedDestructionRing thread-safe with proper mutex protection - Track consecutive high-memory frames to detect potential leaks - Add emergency cleanup mechanism for extreme memory pressure situations - Use proper type casting in std::max to fix compilation errors This should significantly improve stability during extended gameplay sessions with memory-intensive titles. 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-12fix: correct implementation of present interval 0 for unlocked FPSZephyron
Fixes issues in commit bbd32531697fbfb8ed5b6859d3951bf8380e5999 that could cause crashes and deadlocks. The feature now works as intended, allowing games using present interval 0 to run with truly unlocked FPS. This ensures proper functionality of dynamic framerate mods like UltraCam by MaxLastBreath (https://www.nxoptimizer.com/) without stability problems. 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-12service/sockets: Implement network services for new firmware versionsZephyron
This commit implements various network services required for newer firmware versions. Key changes include: - Add bsd:nu service for firmware 15.0.0+ with proper event handling - Add bsdcfg implementation with complete interface declarations - Add dns:priv and ethc (c/i) services - Register all new services in the service manager - Extend BSD implementation with additional socket operations - Remove room_network instance variable in favor of system.GetRoomNetwork() - Fix kernel event creation by using ServiceContext in all appropriate places - Update build system to include new source files Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12refactor(vulkan): remove depth buffer workarounds and excessive loggingZephyron
- Remove special handling for reversed depth scenarios that were added for Civilization 7 - Remove excessive logging in Vulkan renderer - Update Discord client ID
2025-05-12nvn(fix): Optimize shader performance by enhancing NVN bias settingsZephyron
Improve GPU storage buffer detection and memory access patterns: - Expand NVN bias address range (0x100-0x800 vs 0x110-0x610) - Increase alignment from 16 to 32 bytes for optimal memory access - Raise default alignment from 8 to 16 bytes for non-biased addresses - Refactor bias handling code for better readability - Add detailed performance-related comments These changes help identify more storage buffers within shaders and ensure memory accesses are better aligned, which improves overall shader compilation and execution performance. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12renderer/friend: Improve reversed depth handling and Friend serviceZephyron
This commit makes two significant improvements: 1. Vulkan renderer: - Detect and properly handle reversed depth buffers (clear_depth < 0.5) - Force depth write enable when needed with reversed depth - Use GREATER_OR_EQUAL comparison for reversed depth scenarios - Fix transparency issues in games like Civilization 7 by adjusting blend factors - Add detailed logging for depth buffer operations 2. Friend service: - Implement previously stubbed functions including EnsureFriendListAvailable and EnsureBlockedUserListAvailable - Add proper event signaling to prevent games from hanging - Implement Cancel function for improved compatibility - Update copyright notice for the Citron project These changes improve compatibility with modern games using reversed depth buffers and prevent hangs in titles that rely on Friend service functionality. Co-authored-by: m33ts4k0z <m33ts4k0z@citron-emu.org> Co-committed-by: m33ts4k0z <m33ts4k0z@citron-emu.org> Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12memory: Implement enhanced memory management systemZephyron
Add a flexible memory region management system that provides: - Memory region type classification (System, Graphics, IO, Binary) - Memory region permission management (executable, writable) - Binary base address randomization for ASLR - Dynamic memory mapping capabilities Credit: boss.smc@citron-emu.org Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12service/ssl: Register ssl:s service to fix game hangsZephyron
Added registration for the 'ssl:s' service using the same implementation as the regular 'ssl' service. This fixes issues with certain titles that hang indefinitely while waiting for this service to become available. The issue appears in logs as: "Server is not registered! service=ssl:s" "Waiting for service ssl:s to become available" This is a simple fix that reuses the existing SSL implementation instead of creating a separate one, as both services share the same functionality. This commit enhances the Multiplayer Function Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12vulkan: Implement AMD driver workaround for logic operationsZephyron
- Added conditional check for AMD graphics drivers - Automatically disable logic operations when float vertex attributes are present to work around driver quirks - Maintain original logic op state to preserve emulator behavior - Prepare dynamic state management infrastructure for future OpenGL implementation changes OpenGL implementation will follow in subsequent commits. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12core(base_clock_rate): Revert Back To 1,020 MHzZephyron
- This Commit Accidentally Slipped By In A Previous Commit (dad885967942477d887b5dd16a97f07d2316bd3a) - This Has Caused Many Errors & Networking Issues Particularly On Android - Now Uses Safe, Default 1.02 GHz 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-12Fix a few stringsvampiric_x
2025-05-12android: Initial multiplayer supportvampiric_x
And give room owners mod access on both Android and QT
2025-05-12Remove quickstart guide references to address legal concernsZephyron
- Removed "Open Quickstart Guide" menu item and associated functions - Replaced ROM loading error popup containing quickstart guide links with a neutral disclaimer stating the software is provided as-is without warranty or support - This change helps minimize legal liability by avoiding specific instructional content while directing users to community resources for assistance
2025-05-12arm: Improve TLB implementation and fault handling in NCEZephyron
This commit enhances the Translation Lookaside Buffer (TLB) implementation in the ARM Native Code Execution (NCE) component to increase stability, particularly on Android devices. The changes prioritize robustness and error recovery over performance optimizations. Key improvements: - Replace set-associative TLB with a simpler linear search implementation - Implement a basic LRU replacement policy for TLB entries - Add validation checks for memory addresses before TLB insertion - Ensure proper page alignment for guest and host addresses - Enhance alignment fault handling with instruction skipping as fallback - Add comprehensive debug logging for memory access errors - Improve error recovery in guest memory access scenarios These changes should significantly reduce crashes during emulation on Android devices by gracefully handling memory access edge cases that previously resulted in hard crashes. Co-Authored-By: Camille LaVey <camillelavey@citron-emu.org> Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12shader_recompiler: Implement vertex count lookup for Geometry stageZephyron
Add proper handling of input topologies in the Geometry stage for all three shader backends (GLASM, GLSL, SPIRV). This implementation uses a lookup table approach to determine vertex counts based on input topology type (Points, Lines, LinesAdjacency, Triangles, TrianglesAdjacency) and shifts the vertex count by 16 bits as required by the invocation info format. Additional changes: - Fixed TessellationControl and TessellationEval stages to properly break after emitting code - Added proper header include for runtime_info.h in GLASM backend - Improved code documentation with clear commenting patterns This change ensures accurate geometry shader behavior across all backends, improving compatibility with games that rely on proper vertex count reporting. Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-12core/arm/nce: Implement TLB caching systemZephyron
Adds a software TLB cache to improve memory access performance in the NCE (Native Code Execution) system. Key changes include: - Implement set-associative TLB with 64 sets and 8 ways - Add TLB lookup before memory access in HandleGuestAccessFault - Implement LRU replacement policy with access frequency consideration - Add thread context caching to reduce overhead - Add proper synchronization with mutex locks - Add helper functions for TLB management (lookup, insert, invalidate) This change should improve performance by reducing redundant memory translations and providing faster access to frequently used pages.
2025-05-12vulkan: Improve memory allocation robustnessZephyron
Enhances the Vulkan memory allocator with better OOM handling and memory alignment: * Add memory recovery by cleaning up empty allocations before failing * Implement proper fallback to non-device-local memory * Simplify memory alignment handling for different vendors * Add better error logging for allocation failures * Add IsEmpty() helper to track unused allocations * Fix alignment requirements for Adreno (4KB) vs other vendors These changes improve the robustness of memory allocation, particularly in low-memory situations, and streamline vendor-specific alignment requirements.
2025-05-12android: Update build dependencies and configurationsZephyron
Updates various build dependencies and configurations for the Android build: * Upgrade Android Gradle Plugin to 8.8.1 * Update Kotlin to 2.1.20-RC * Upgrade NDK to 28.0.13004108 * Update target/compile SDK to Android 35 * Upgrade Java/Kotlin target to JVM 21 * Enable additional release optimizations (shrinkResources, proguard-android-optimize) * Update CMake to 3.31.5 * Update various AndroidX and support library dependencies * Change CMake boolean flags from 0/1 to OFF/ON * Update ktlint to 0.51.1 and related plugins This commit modernizes the Android build system and enables additional optimizations for release builds.
2025-05-12Remove redundant TranslateIPv4 functionZephyron
Remove the TranslateIPv4 function that converts in_addr to IPv4Address, as it appears to be unused or redundant. The functionality might be handled elsewhere in the codebase or no longer needed.
2025-05-12network: Improve network interface handling and address resolutionZephyron
- Return loopback address (127.0.0.1) when no network interface is selected - Improve IPv4 address string conversion and handling - Add explicit handling for "None" network interface selection - Change IsAnyInternetRequestAccepted logging from ERROR to DEBUG - Simplify internet request acceptance check to assume availability This change makes the network interface handling more robust by providing fallback behaviors and improving address resolution. It also reduces unnecessary error logging for expected scenarios.
2025-05-12feat: Add Home Menu launch support and system improvementsZephyron
This commit adds support for launching the system Home Menu and implements several system-level improvements: - Add Home Menu launch functionality through new UI action - Implement shutdown/reboot sequence handlers in GlobalStateController - Add support for reserved region extra size in page tables - Enhance audio controller with output management - Expand parental control service capabilities - Add profile service improvements for user management Technical changes: - Add OnHomeMenu() handler to launch QLaunch system applet - Implement m_alias_region_extra_size tracking in page tables - Add new CreateProcessFlag for reserved region extra size - Expand audio controller interface with output management - Add self-controller methods to various services - Implement play timer and profile service improvements The changes primarily focus on system menu integration and core service improvements to better support system functionality.
2025-05-12texture_cache: Add equality operators for ImageInfo and ImageViewInfoZephyron
- Add operator== to ImageInfo and ImageViewInfo classes to enable direct equality comparisons. The implementations use std::tie to perform member-wise comparisons of all relevant fields in a safe and efficient manner. This allows for easier comparison of texture cache entries and view information, which can be useful for cache management and debugging.
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-11service/am: Implement SetRequestExitToLibraryAppletAtExecuteNextProgramEnabledZephyron
- Removes STUBBED designation as implementation is now complete - Changes log level from WARNING to DEBUG - Properly sets the exit request flag under lock protection
2025-05-11service/am: Implement CreateManagedDisplaySeparableLayerZephyron
- Removes STUBBED designation as implementation is now complete - Changes log level from WARNING to DEBUG - Adds proper locking when accessing the display layer manager - Fixes parameter alignment in function declaration
2025-05-11service/nvnflinger: Unstub GetNativeHandleZephyron
Removes the STUBBED designation from GetNativeHandle in IHOSBinderDriver as the implementation is now complete. Changes the log level from WARNING to DEBUG to reflect this status. The function properly handles binder ID validation and returns the appropriate handle as documented in switchbrew.
2025-05-11service/vi: Improve OpenDisplay validationZephyron
Updates the OpenDisplay function in IApplicationDisplayService to properly validate display names. Instead of only accepting "Default", now validates against all known valid display names: "Default", "External", "Edid", "Internal", and "Null". - Changes log level from WARNING to DEBUG since this is no longer stubbed - Adds proper validation for all valid display names - Returns ResultOperationFailed for invalid display names - Improves logging by including the requested display name
2025-05-11service/aoc: Implement CheckAddOnContentMountStatusZephyron
Implements the CheckAddOnContentMountStatus command for the aoc:u service. This function checks whether add-on content (DLC) is currently mounted. Currently returns false as we don't yet track mounted content state. Changed log level from WARNING to DEBUG since this is no longer stubbed.
2025-05-11android: Disable RAM Overlay By DefaultZephyron
- TODO
2025-05-11vulkan: Rename resolve_image to resolve_image_holderZephyron
Fix Android compilation with latest NDK (28.0.13004108) and Java JDK 21 by renaming the resolve_image variable to resolve_image_holder to avoid potential naming conflicts. This change helps maintain compatibility with the updated build toolchain while keeping the core functionality intact. The change affects the MSAA image copy operation in the Vulkan texture cache implementation.
2025-05-11network: Fix 0.0 FPS bug on Android (Part 2)Zephyron
- Add network interface enumeration support for Android - Implement fallback loopback interface when no interfaces are detected - Add ability to force offline mode on critical network errors - Improve socket initialization with better error handling - Add socket state tracking (domain, type, protocol) - Make translation functions static and mark as maybe_unused - Add detailed logging for network initialization failures Part 2 of the Android FPS bug fix focuses on network resilience, particularly handling cases where network initialization fails. Instead of hanging the emulator, it now gracefully falls back to offline mode and provides better diagnostic information.