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>
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
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>
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>
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>
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>
- Update required VulkanHeaders from 1.4.307 to 1.4.313
- Ensures compatibility with newer Vulkan development packages
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- 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>
- Update SDL to fix pipewire-related compile error
- Removes need to hardcode -DSDL_PIPEWIRE=OFF in toolchain
- Update vcpkg to latest version
- Update Vulkan-Headers to latest version
Signed-off-by: Zephyron <zephyron@citron-emu.org>
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>
Updates the Android Vulkan Validation Layer (VVL) from version 1.4.304.1
to 1.4.309.0. This ensures compatibility with the latest Vulkan specification
and provides improved validation capabilities for the Android build.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
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>
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>
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>
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>
Update Vulkan-Headers, Vulkan-Utility-Libraries, VulkanMemoryAllocator, and vcpkg submodules to their latest versions to ensure compatibility with newer Vulkan features and improve rendering performance.
Signed-off-by: Zephyron <zephyron@citron-emu.org>
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>
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>
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>
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>
- Remove special handling for reversed depth scenarios that were added for Civilization 7
- Remove excessive logging in Vulkan renderer
- Update Discord client ID
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>
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>
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>
- Update Vulkan-Headers from cacef303 to 78c35974
- Update VulkanMemoryAllocator from c788c521 to 29b35ea4
- Update vcpkg from e40d24cb to a7d06b3a
Signed-off-by: Zephyron <zephyron@citron-emu.org>
- Modify CMakeLists.txt to detect whether the host system is Windows or Linux
- Set VCPKG_HOST_TRIPLET dynamically to either "x64-windows" or "x64-linux" based on CMAKE_HOST_SYSTEM_NAME
- Previously, the host triplet was hardcoded to "x64-windows", which prevented proper building on Linux hosts
Signed-off-by: Zephyron <zephyron@citron-emu.org>
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>
- 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>
- 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>
- 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>
- 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
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>
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>
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.