Commit graph

23972 commits

Author SHA1 Message Date
Zephyron
f4b9e54b22
common/nvdrv: improve memory validation and error handling
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-02-01 21:50:33 +10:00
Zephyron
70a9f20ae1
common: add missing <memory> include in common_types.h
Adds missing <memory> header include in common_types.h. This header is
needed for std::unique_ptr and other smart pointer types that may be used
by code including this header.
2025-02-01 21:47:55 +10:00
Zephyron
ecc32958ec
nvdrv: Add GetTpcMasks2 support and improve memory mapping validation
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-02-01 19:48:11 +10:00
Zephyron
0216eaa071
feat: Add RAM usage overlay and improve thermal display
- Add new RAM usage overlay showing current/max memory usage with color gradient
- Simplify thermal overlay to show temperature in C/F with color indication
- Add SHOW_RAM_OVERLAY boolean setting (disabled by default in UI)
- Set default values for thermal overlay and black backgrounds to true
- Update copyright headers to include Citron Emulator Project

The RAM overlay displays native heap usage with color gradient from green
(low usage) to red (high usage). The thermal display was simplified to show
just temperatures while maintaining the color indication based on system
thermal status.
2025-02-01 19:18:35 +10:00
Zephyron
8f76ef2579
video_core: Add sRGB to D24S8 depth-stencil conversion support
Implements conversion from sRGB color formats to D24S8 depth-stencil format
in the Vulkan renderer. This change includes:

- New fragment shader convert_abgr8_srgb_to_d24s8.frag that handles proper
  sRGB to linear conversion before depth calculation
- Added shader to CMake build system
- Extended BlitImageHelper with new conversion pipeline and methods
- Updated texture cache to handle sRGB to D24S8 format conversion paths

The conversion properly handles sRGB color space by first converting to
linear space before calculating luminance values for the depth component,
while preserving alpha channel data for the stencil component.
2025-02-01 16:57:49 +10:00
Zephyron
4e8d00f034
string_util: Replace deprecated wstring_convert with direct UTF conversions
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-02-01 12:27:03 +10:00
Zephyron
f638922129
common: Improve error handling in host memory management
Add proper error handling and recovery mechanisms for memory mapping
operations instead of using assertions.
2025-02-01 11:45:40 +10:00
Zephyron
a96216ff35
Android: Update build configuration for Android 15
Update build configuration to support Android 15 (API 35) devices and
optimize build settings for better compatibility.
2025-02-01 11:44:39 +10:00
Zephyron
6ab82e8eeb
service: Implement rebootless system update stubs and types
Adds initial support for rebootless system update related functionality:

- Add system archive title IDs for ApplicationBlackList, RebootlessSystemUpdateVersion,
  and ContentActionTable
- Add NS service result codes for system update operations
- Implement stubs for ISystemUpdateControl::SetupToReceiveSystemUpdate and
  RequestCheckLatestUpdateIncludesRebootlessUpdate
- Add RebootlessSystemUpdateVersion settings type and implement
  GetRebootlessSystemUpdateVersion in SET service
- Fix GetSettingsItemValueImpl template implementation

This provides basic infrastructure for handling system updates, particularly
the rebootless update feature, though actual update functionality remains
stubbed.
2025-01-30 22:10:08 +10:00
vampiric_x
733721f0a1 android: Fix non-scrollable legal disclaimer on setup 2025-01-30 01:59:00 +01:00
Zephyron
613099703a
kernel/svc: Implement InitialProcessIdRange and improve process exit handling
- Replace stubbed InitialProcessIdRange implementation with proper bounds (1-0x50)
- Add handle and info_sub_id validation for InitialProcessIdRange
- Replace process exit ASSERT with graceful error handling and logging
- Add try-catch block around system.Exit() for safer shutdown
- Add atomic header inclusion for binder.h

This improves system call reliability by properly implementing process ID
range checks and adding safer process exit handling with proper error logging.
2025-01-29 13:17:07 +10:00
Zephyron
9a3d4f0489
ui: Update repository URLs to git.citron-emu.org
Updates all GitHub repository URLs to point to the new self-hosted Git instance
at git.citron-emu.org. This includes:

- Links in the About dialog UI and translations
- Android app string resources
- Documentation/wiki links
- Source code comments

The website URL (citron-emu.org) and support links remain unchanged.
2025-01-28 17:33:57 +10:00
Zephyron
8c630a8bea
network: Add NOMEM errno handling for socket operations
Implements support for ENOMEM (errno 12) across the network stack:
- Added NOMEM to Network::Errno enum
- Added NOMEM = 12 to sockets Errno enum
- Added translation case in sockets_translate.cpp

This is the first step towards addressing the 0.0 FPS bug that occurs
when the system runs out of memory during socket operations. Previously,
these operations would trigger an unimplemented assertion, causing the
emulator to halt. Now the error will be properly propagated to the guest
application.
2025-01-28 16:20:54 +10:00
Zephyron
2e4db14bc1
qt: Replace deprecated stateChanged with checkStateChanged
Updates QCheckBox signal connections to use checkStateChanged instead of
the deprecated stateChanged signal. This change affects:

- qt_controller.cpp
- configure_filesystem.cpp
- configure_input.cpp
- configure_input_advanced.cpp
- configure_system.cpp
- configure_ui.cpp
- shared_widget.cpp

Also updates lambda signatures to use Qt::CheckState instead of int for
the state parameter where needed.
2025-01-27 15:36:29 +10:00
Zephyron
c36151d6e3
vulkan: Relax VRAM allocation limits for better stability
Adjusts VRAM allocation strategy to be more conservative while maintaining
performance:

- Increases reserve memory from 1/8th to 1/4th (max 2GB) for discrete GPUs
- Increases base memory limit from 6GB to 8GB
- Doubles resolution scaling memory from 1GB to 2GB per scale factor
- Reduces system memory reservation from 8GB to 4GB for integrated GPUs
- Increases maximum memory limit from 4GB to 6GB for integrated GPUs

These changes help prevent memory leaks while still providing adequate
VRAM for optimal performance.
2025-01-27 15:34:00 +10:00
Zephyron
c5a2689cef android: Update Gradle and Java version requirements
Updates Android build configuration to use newer versions:
- Upgrade Java/JVM target from 17 to 21
- Update Android Gradle Plugin from 8.1.2 to 8.8.0

These changes modernize the Android build system to use the latest LTS
version of Java and the most recent stable Android Gradle Plugin.
This enables access to newer language features and build optimizations
while maintaining compatibility with modern Android development tools.
2025-01-27 00:47:43 +10:00
Zephyron
f380744c61 android: Fix compilation by adding missing log.h include
Adds missing include for common/logging/log.h in gpu.h which was causing
compilation failures on Android. This header is needed for logging
functionality used in GPU-related operations.

The include was previously indirectly available through other headers,
but making it explicit improves code clarity and prevents potential
future compilation issues.
2025-01-27 00:46:46 +10:00
Zephyron
b7e11d3724 service: Implement GPU error handling IPC commands for AM
Implements several IPC commands in IApplicationFunctions related to GPU error
handling and system events:

- EnableApplicationAllThreadDumpOnCrash (cmd 124)
- SetDelayTimeToAbortOnGpuError (cmd 131)
- TryPopFromNotificationStorageChannel (cmd 151)
- SetHdcpAuthenticationActivated (cmd 170)
- GetLaunchRequiredVersion (cmd 180)
- UpgradeLaunchRequiredVersion (cmd 181)

Also adds the LaunchRequiredVersion struct definition to the header file.
These are currently stubbed implementations that log warnings when called.

REFS: switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent
2025-01-27 00:45:27 +10:00
Zephyron
be191f740a buffer_cache: Simplify storage buffer binding logic
Reverts overly restrictive storage buffer validation and size calculation
that was causing rendering issues in The Legend of Zelda: Tears of the
Kingdom, particularly in underground/depth areas. The simplified approach:

- Uses GetMemoryLayoutSize() instead of manual page probing
- Removes unnecessary 4GB memory bounds validation
- Streamlines address translation and alignment handling

This fixes numerous reported cases of missing or corrupted rendering in
TOTK's underground areas where storage buffer operations are heavily used
for depth-related effects.
2025-01-26 16:13:05 +10:00
Zephyron
a5d62fa4ec nvnflinger: Implement reference counting for binder objects
Implements proper reference counting for binder objects based on the official
documentation. This adds both weak and strong reference counting support to
the IBinder interface and its implementations (BufferQueueProducer and
BufferQueueConsumer).

The implementation follows the documented behavior where:
- type 0 affects weak references
- type 1 affects strong references
- During initialization: {addval=1, type=0} followed by {addval=1, type=1}
- For onFirstRef: {addval=1, type=1}
- For onLastStrongRef: {addval=-1, type=1}

Reference counters are implemented using std::atomic to ensure thread safety.

REFS: switchbrew.org/wiki/Nvnflinger_services#AdjustRefcount
2025-01-26 14:21:36 +10:00
Zephyron
a6063bbd64 service: vi: Implement missing IApplicationDisplayService functions
Implements missing functions and improves permission handling in the VI
(Visual Interface) IApplicationDisplayService based on official documentation.

Key changes:
- Add session type enum to properly handle vi:u/vi:s/vi:m permissions
- Implement GetIndirectLayerImageCropMap for handling cropped layer images
- Implement GetDisplayVsyncEventForDebug for debug vsync event handling
- Add proper permission checks for GetSystemDisplayService and GetManagerDisplayService
- Improve AppletResourceUserId validation in OpenLayer
- Clean up logging and error handling

The changes follow the official documentation for permission handling:
- vi:u sessions can only use GetRelayService
- vi:s sessions can use everything except GetManagerDisplayService
- vi:m sessions can use all commands

REFS: switchbrew.org/wiki/Display_services#IApplicationDisplayService
2025-01-26 13:27:06 +10:00
Zephyron
924c06d88f Revert "core/hle: Reorganize ErrorModule enum numerically"
This reverts commit b55be320b7.
2025-01-25 18:24:30 +10:00
Zephyron
b55be320b7 core/hle: Reorganize ErrorModule enum numerically
Reorganizes the ErrorModule enum in result.h by grouping error codes into
numerical ranges with descriptive comments. This improves readability and
makes it easier to:

- Find specific modules by their number
- See which numbers are used/unused in each range
- Understand the overall distribution of module numbers

Also standardizes naming conventions across modules and fixes some
inconsistent casing (e.g. FS -> Fs, HDCP -> Hdcp).

REFS: switchbrew.org/w/index.php?title=Error_codes
2025-01-25 18:02:43 +10:00
Zephyron
5ba970b574 service: sm: Update to match official IPC interface
Updates the SM service implementation to better match the official
"nn::sm::detail::IUserInterface" interface. Key changes include:

- Replace Initialize with RegisterClient command (cmd 0)
- Add DetachClient command implementation (cmd 4)
- Update service name handling to use u64-encoded names
- Add proper PID descriptor handling for RegisterClient/DetachClient
- Add ResultNotAllowed error code
- Update handler registration for both CMIF and TIPC

This brings the implementation closer to the official documentation while
maintaining compatibility with existing code.

Refs: switchbrew.org/wiki/Services_API#sm:
2025-01-25 15:20:01 +10:00
Zephyron
58ed33dd9f ui: Remove save states menu and unused help links
Removes the save states menu and unused help menu items as they require
additional research and implementation work. Specifically:

- Remove save states menu and associated actions (Save/Load)
  as proper implementation requires more research
- Remove unused help menu items:
  * Open Mods Page
  * Open Quickstart Guide
  * Open FAQ
- Keep core help functionality (Report Compatibility and About)
- Reorder menu properties for better organization

This change helps maintain a cleaner UI by removing placeholder
features that are not yet ready for implementation.
2025-01-25 14:58:40 +10:00
Zephyron
c279df9cfe service: mm: Refactor Memory Management service implementation
Refactors the MM (Memory Management) service implementation with improved:

- Session management using a vector of Session objects instead of global vars
- Type safety with proper enums and member encapsulation
- Error handling with consistent patterns
- Modern C++ features (std::erase_if, std::find_if, emplace_back)
- Logging with detailed debug messages
- Code organization and const correctness

Key changes:
- Add Session class with proper encapsulation
- Add EventClearMode enum (Manual = 0, Auto = 1)
- Update Module enum naming for consistency
- Implement proper session tracking and lookup
- Add detailed parameter logging
- Use modern C++ algorithms for session management

The implementation now properly handles multiple sessions and matches
the documented nn::mmnv::IRequest interface more closely.

Refs: switchbrew.org/wiki/Display_services#mm:u
2025-01-25 14:55:50 +10:00
Zephyron
0adeac26af service: mm: Implement proper parameter handling for MM service
Add proper type definitions and parameter handling for the Memory Management
(mm:u) service based on the Switch documentation:

- Add Module enum for hardware components (CPU, GPU, EMC, etc)
- Add Priority and Setting type definitions as u32
- Add EventClearMode enum for initialization
- Implement proper parameter handling for all IPC calls
- Add detailed logging with parameter values

The Module enum now properly reflects the documented hardware components:
CPU, GPU, EMC, System Bus, Memory Select, and NVIDIA modules (NVDEC,
NVENC, NVJPG).

This makes the implementation match the documented nn::mmnv::IRequest
interface.

Refs: switchbrew.org/wiki/Display_services#mm:u
2025-01-25 14:23:22 +10:00
Zephyron
37677052c1 feat: implement modern dark theme and loading screen redesign
- Redesign loading screen progress bar with gradient animation
- Update loading screen typography using Segoe UI
- Add comprehensive dark theme styling to main window
- Modernize menu, toolbar, and dock widget appearances
2025-01-25 13:50:48 +10:00
Zephyron
774d8d9eba service/nvdrv: Relax GPU validation and improve error handling
Relaxes validation checks in the NVDRV GPU service and improves error notifier
handling to prevent potential hangs. Key changes:

- Remove strict size validation in SetErrorNotifier
- Relax GPFIFO entry count validation to only check for non-zero values
- Add proper error notifier state tracking in GPU class
- Improve debug logging messages

The previous strict validation was causing issues with some games like ACNH.
These changes maintain necessary checks while being more permissive with
edge cases that don't impact functionality.

Technical changes:
- Store error notifier state in GPU class for future implementation
- Remove upper bound check on GPFIFO entries
- Simplify error notifier setup flow

This should resolve hanging issues while maintaining core functionality.
2025-01-21 16:07:44 +10:00
Zephyron
d7dc87bbf3 service/nvdrv: Implement stubbed GPU functions
Implements several previously stubbed functions in the NVDRV service:
- Initialize proper transfer memory handling
- Add error notifier configuration
- Implement channel timeout and timeslice management
- Add object context allocation and tracking
- Add GPU interface stubs for new functionality

The changes improve the accuracy of GPU-related operations while maintaining
compatibility with the existing codebase. All functions now properly validate
parameters and handle endianness correctly using _le types.
2025-01-20 18:04:11 +10:00
Zephyron
07024f7ea6 ui: Add Save States menu stubs
Adds UI elements for future save state support:
- New "Save States" menu in the main menubar
- Save and Load action items with keyboard shortcuts
- No functionality implemented yet, just UI stubs
2025-01-20 17:14:46 +10:00
Zephyron
04f9d8b61a shader: Implement EmitInvocationInfo across all backends
- Add proper invocation info handling for tessellation and fragment stages
- Return patch vertices info shifted by 16 bits for tessellation stages
- Return sample mask shifted by 16 bits for fragment stage
- Return standard format (0x00ff0000) for compute and other stages
- Implement consistently across SPIRV, GLSL, and GLASM backends
- Remove stubbed warning message
2025-01-20 17:02:01 +10:00
Zephyron
b574aba98b service-am: Handle panic conditions in SetTerminateResult
- Prevents propagation of panic conditions when setting termination results
- Previously, panic error codes could trigger cascading crashes
- Only stores non-error termination results while allowing successful completion
- Fixes crash when applications set panic-related termination codes (0x1A80A)
2025-01-20 16:06:08 +10:00
Zephyron
6d225eb94a service: vi: Remove stubbed warning from GetManagerDisplayService
- The GetManagerDisplayService function in IApplicationDisplayService is fully implemented, so remove the stubbed warning and change the log level to DEBUG to match its implementation status.
2025-01-20 16:03:43 +10:00
Zephyron
d4d3061eb7 arm/video: Fix shader extension and exception handling
Two main changes in this commit:

1. Replace NVIDIA-specific GL_NV_gpu_shader5 extension with the more widely
   supported GL_EXT_shader_explicit_arithmetic_types_float16 in the scaleforce
   shader. This improves compatibility across different GPU vendors.

2. Refactor ARM32 exception handling:
   - Restructure exception cases for better readability
   - Update exception handling to match current Dynarmic API
   - Fix indentation in switch statement
   - Remove AccessViolation case as it's no longer supported in current API

These changes improve shader compatibility and align the exception handling
with the current Dynarmic implementation.
2025-01-18 19:09:03 +10:00
Zephyron
b938893599 memory: Improve null pointer and unmapped memory handling
- Update vcpkg baseline to a42af01b72c28a8e1d7b48107b33e4f286a55ef6
- Add SPIRV-Tools and SPIRV-Headers as submodules
- Update Vulkan-related submodules to latest stable versions
- Improve memory access error handling:
  - Add specific handling for null pointer accesses in ARM32 emulation
  - Return 0 for null pointer reads instead of undefined behavior
  - Silently ignore writes to null pointers
  - Add more detailed error messages distinguishing between null pointer
    access and other unmapped memory errors
  - Treat addresses below 0x1000 as potential null pointer accesses

These changes should provide more graceful handling of null pointer
accesses and improve stability when running games that attempt invalid
memory operations.
2025-01-18 15:20:13 +10:00
vampiric_x
07b949025f Add QT Network package 2025-01-18 02:16:13 +01:00
vampiric_x
913cc27e3a feat(network): Ip input field for multiplayer room creation 2025-01-17 19:03:31 +01:00
Zephyron
3698478977 android: Fix battery temperature reading in EmulationFragment
Replaces the battery temperature reading implementation with a more
compatible approach using ACTION_BATTERY_CHANGED broadcast intent.
This change provides better backwards compatibility and adds proper
error handling for the temperature reading functionality.
2025-01-17 19:59:13 +10:00
Zephyron
382999025a shader_recompiler: Add stubs for CSM/FCSM flow test conditions
Add stub implementations for previously unhandled flow test conditions in the
shader recompiler's IR emitter. These conditions were previously throwing
"Not Implemented" exceptions when encountered.

The following flow test cases are now stubbed:
- FCSM_TR (Fragment Shader Coarse/Fine Mode Test and Reject)
- CSM_TA (Coarse/Fine Mode Test Accept)
- CSM_TR (Coarse/Fine Mode Test and Reject)
- CSM_MX (Coarse/Fine Mode Maximum)
- FCSM_TA (Fragment Shader Coarse/Fine Mode Test Accept)
- FCSM_MX (Fragment Shader Coarse/Fine Mode Maximum)

Currently these stubs:
1. Return false (ir.Imm1(false)) as a placeholder value
2. Log a warning message indicating the stub
3. Allow shaders using these conditions to compile rather than fail

This is a step toward proper implementation of coarse/fine mode shader
operations. The stubs prevent crashes while making it clear which code paths
need full implementation.

Technical notes:
- Removed the previous FCSM_TR implementation that used flag operations
- Added consistent warning messages for tracking stub usage
- Kept within the existing GetFlowTest switch statement structure
2025-01-17 19:28:11 +10:00
Zephyron
62de5aa9de Downgrade Android SDK and build tools
- Reduce compileSdkVersion and targetSdk from 35 to 34
- Change NDK version to 26.1.10909125
- Downgrade Android Gradle Plugin from 8.8.0 to 8.1.2
- Add androidx.constraintlayout dependency

These changes improve compatibility with current Android development
environment and add necessary layout support.
2025-01-17 15:16:15 +10:00
vampiric_x
43170513b6 Revert "shader-recompiler: implement FCSM_TR flow test case"
This reverts commit 496b010927.
2025-01-17 01:27:35 +01:00
Zephyron
3635b6e602 android: Add USE_AUTO_STUB setting
Implements the USE_AUTO_STUB setting in the Android frontend:

- Added USE_AUTO_STUB to BooleanSetting enum
- Added UI switch setting with description in SettingsItem
- Added setting to system settings section in SettingsFragmentPresenter
- Added string resources for setting title and description

The setting allows users to toggle automatic stubbing of missing services
and functions, which may improve compatibility at the cost of stability.
2025-01-16 17:05:02 +10:00
Zephyron
496b010927 shader-recompiler: implement FCSM_TR flow test case
Remove the stubbed implementation of FCSM_TR (Forward Condition Set Mode -
Thread Reduction) flow test and replace it with an initial implementation
using SFlag and ZFlag conditions. This provides basic functionality while
allowing for future refinement based on specific shader architecture
requirements.
2025-01-15 20:19:57 +10:00
Zephyron
498d016873 fix(sm_controller): Correct QueryPointerBufferSize implementation
- Updated the QueryPointerBufferSize function to return the correct u16 pointer buffer size.
- Ensured the function logs its call at the debug level.
- Used IPC::ResponseBuilder to construct the response with the correct buffer size.

This change addresses the stubbed implementation and ensures compliance with the HIPC protocol.
2025-01-15 19:38:09 +10:00
Zephyron
132077e18f fix: Implement SetGestureOutputRanges to handle unimplemented function error
- Added the SetGestureOutputRanges function to the IHidServer class to address the unimplemented function '92' error.
- This fix was discovered through log analysis, which showed a critical assertion failure in the HID service for an unknown function '92'.
- The log indicated a userspace panic and backtrace, pointing to the need for implementing this function to prevent execution breaks.
- Updated CMakeLists.txt to remove specific version requirements for several packages, enhancing flexibility.
- Updated subproject commit references for VulkanMemoryAllocator and vcpkg.

- REF: https://switchbrew.org/wiki/HID_services#ActivateGesture
2025-01-15 19:20:37 +10:00
Zephyron
236ad28d61 feat: Improve thermal display and build system
- Replace emoji thermal indicators with modern progress bar UI
- Switch temperature source to battery sensor for better accuracy
- Adjust temperature thresholds (30°C-45°C range)
- Add automatic Vulkan Validation Layer download for Android
- Downgrade Java/Kotlin target to 17 for wider compatibility

The thermal display now shows a visual progress bar with percentage
instead of emojis, making it easier to gauge system temperature at
a glance. Temperature reading now comes from the battery sensor
which is more reliable across devices.

Build system improvements include automated VVL binary downloads
and installation for Android builds when CITRON_DOWNLOAD_ANDROID_VVL
is enabled. Java target downgraded to 17 to ensure compatibility
with current Android toolchain.
2025-01-15 16:44:07 +10:00
Zephyron
9ae0eeeb87 Revert incorrect copyright attribution for non-contributed files
- In commit b3facaa6bb, the copyright header was
  updated to include "Citron Homebrew Project" across multiple files, regardless
  of whether any contributions were made.

- This commit removes the incorrect attribution and reverts the copyright header
  to its previous state.

- Copyright attribution should only be added when meaningful contributions have
  been made to the file.

- This commit ensures proper compliance with copyright standards and maintains
  correct attribution to the respective contributors.

- Special thanks to Tachi for pointing out the need for these corrections and
  ensuring that proper attribution practices are followed.
2025-01-14 15:33:24 +10:00
Zephyron
cce4abbb0b Android: Update dependencies and improve UI feedback
- Update Kotlin and various AndroidX dependencies to stable versions
- Add temperature monitoring with color-coded display in emulation
- Add FPS color indication (red to green based on performance)
- Add legal disclaimer page to initial setup
- Remove x86_64 ABI filter to focus on arm64-v8a
- Adjust thermal and FPS update intervals for consistency
- Clean up redundant dependency declarations

The temperature display now shows both Celsius and Fahrenheit with
color coding based on safe operating ranges [WIP]. FPS counter provides
visual feedback through colors, making performance issues more
immediately apparent to users.
2025-01-13 17:48:02 +10:00
Zephyron
6d5475a9cf Android: Update build system and dependencies
- Update Gradle from 8.1 to 8.10.2
- Update Android Gradle Plugin from 8.1.2 to 8.8.0
- Update Kotlin from 1.9.20 to 2.1.20-Beta1
- Update various AndroidX dependencies to latest versions
- Update NDK from 26.1 to 27.2 (with RC1/RC2 options commented)
- Update Java target from 17 to 21
- Update Android target SDK from 34 to 35
- Enable additional optimizations in release builds:
  - Enable shrinkResources
  - Use proguard-android-optimize.txt
  - Disable JNI debugging
- Replace vector drawables with PNG for ic_citron
- Comment out unused ComputeInline constant in dma_pusher.cpp
- Update Gradle wrapper and configuration files

This updates the Android build system and dependencies to their latest
versions while enabling additional optimizations for release builds.
The ic_citron icon was converted from vector to PNG format for better
compatibility.
2025-01-13 15:17:39 +10:00
vampiric_x
2d7f9d921b ui(QT): QT 6.7.3 Implementation 2025-01-12 04:26:22 +01:00
Zephyron
0cf545858d
vulkan: Fix crashes with bindless texture constant buffer handling
Previously, the code would unconditionally add a constant buffer descriptor
at index 0 whenever storage buffers were present, which could cause conflicts
and crashes. This change:

- Adds validation to check if constant buffer 0 already exists
- Only adds the descriptor if it's not already present
- Prevents potential descriptor conflicts in shaders

This should resolve crashes in Vulkan games related to invalid descriptor
layouts and resource binding conflicts.
2025-01-09 17:13:12 +10:00
Zephyron
08be9b0617
Revert "refactor: Improve game list scanning with std::filesystem"
This reverts commit 60cb826e93.
2025-01-08 21:39:22 +10:00
Zephyron
3f151c5111
nvdrv: Add MSVC compatibility for packed structs
Add conditional compilation directives to handle packed struct definitions
differently between MSVC and other compilers. MSVC uses #pragma pack
while GCC/Clang use __attribute__((packed)). This change affects:

- ZBCColorEntry
- ZBCDepthEntry
- IoctlZbcSetTable

The functionality remains the same, but ensures proper struct packing
across different compiler environments.
2025-01-08 21:16:04 +10:00
Zephyron
c65c8ac45e
vulkan: Add bindless texture constant buffer support in compute pipeline
Add support for bindless texture constant buffers in the compute pipeline
creation process. When storage buffer descriptors are present, create a
constant buffer descriptor to handle bindless textures. This fixes the
"Failed to track bindless texture constant buffer" error.

Changes:
- Add constant buffer descriptor with index 0 and count 1 when storage
  buffers are present
- Place descriptor creation before SPIR-V code generation to ensure proper
  shader compilation

This resolves issues with bindless texture access in compute shaders.
2025-01-08 19:13:03 +10:00
Zephyron
dae1524eb5
kernel: Implement SystemResourceSize info type for VAMM initialization
Adds support for InfoType::SystemResourceSize (0x1C) which is required for
proper initialization of the Virtual Address Memory Manager (VAMM). This
implementation:

1. Adds SystemResourceSize to the InfoType enum in svc_types.h
2. Implements the GetInfo handler for SystemResourceSize in svc_info.cpp
3. Returns 512MB (0x20000000 bytes) as the system resource size
4. Adds debug logging for the SVC call

The 512MB value is chosen based on typical system resource allocations
needed for VAMM initialization on the Nintendo Switch.

This fixes crashes in games that rely on VAMM functionality, particularly
during nn::os::detail::VammManager::InitializeIfEnabled().
2025-01-07 18:50:11 +10:00
Zephyron
66b6d5b2da
core: Improve device memory and buffer queue handling
This commit makes several improvements to device memory management and buffer
queue handling:

DeviceMemoryManager:
- Add null pointer and size checks for ReadBlock
- Fill unmapped memory with a known pattern (0xCC) instead of zeros
- Add better error logging for invalid memory accesses
- Add null pointer check for source pointer in memcpy

BufferQueueProducer:
- Improve error handling in WaitForFreeSlotThenRelock
- Add proper abandoned state checking during wait conditions
- Clean up and simplify buffer scanning logic
- Improve logging messages with more descriptive information
- Remove redundant buffer count validation
- Fix potential infinite loop condition during wait

These changes improve stability and error handling while making the code more
maintainable and debuggable. The use of a known pattern for unmapped memory
helps identify uninitialized memory access issues.
2025-01-06 20:04:35 +10:00
Zephyron
83393a6c6b
service/am: Implement friend invitation storage channel
Implements TryPopFromFriendInvitationStorageChannel to properly handle
friend invitation data storage and retrieval. This includes:

- Add ResultNoData error code to am_results.h
- Add friend_invitation_storage_channel storage queue to Applet struct
- Implement proper data handling in TryPopFromFriendInvitationStorageChannel

The implementation now properly manages a queue of friend invitation data
and returns appropriate results based on data availability.
2025-01-06 16:57:45 +10:00
Zephyron
60cb826e93
refactor: Improve game list scanning with std::filesystem
Refactors the game list scanning code to use std::filesystem instead of custom
directory iteration functions. Main changes include:

- Replace Common::FS directory iteration with std::filesystem iterators
- Split game file processing logic into separate ProcessGameFile method
- Improve error handling with try-catch for filesystem operations
- Simplify control NCA metadata extraction
- Use more modern C++ features and cleaner code organization

This change should improve maintainability and reliability of the game
scanning system while potentially offering better performance through
native filesystem APIs.
2025-01-06 14:41:06 +10:00
Zephyron
3100d13fc0
discord: Improve game image handling and UI presentation
Updates the Discord Rich Presence implementation to use Tinfoil's media
server for game images and improves the overall presentation.

Technical changes:
- Switch to Tinfoil media server for game images
- Add proper title ID handling and display
- Improve error handling for image requests
- Increase network timeout to 10 seconds
- Cache URL to prevent string destruction
- Update Discord client ID
- Clean up code formatting and organization

UI/UX improvements:
- Remove title ID from game state display
- Update default text to be more descriptive
- Improve error logging for failed image fetches
- Maintain image persistence between updates

This change provides better game image support and a cleaner Discord
presence display while improving reliability of the integration.
2025-01-06 14:06:41 +10:00
Zephyron
08f1ed4011
common: Use consistent cache line size in RingBuffer
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-01-06 12:41:42 +10:00
Zephyron
21f94d5825
web: Simplify web configuration and token management
- Remove telemetry functionality and related UI elements
- Add automatic token generation using UUID
- Remove manual token verification process
- Sync Citron username with profile username automatically
- Simplify web configuration UI and improve error messages
- Update host room error message for clarity

This change streamlines the web service configuration by removing
unnecessary complexity and automating token management. Users no longer
need to manually verify tokens, and the Citron username is automatically
kept in sync with their profile username.
2025-01-05 18:17:47 +10:00
Zephyron
8f5e3516fe
nvdrv: Fix incorrect IoctlZbcSetTable structure size assertion
Resolves a build failure caused by a mismatch between the defined and expected size of the `IoctlZbcSetTable` structure in `nvhost_ctrl_gpu`. The `static_assert` incorrectly expected the size to be 44 bytes, while the actual size was 48 bytes.

Changes include:
- Updated `static_assert` to correctly reflect the 48-byte size of `IoctlZbcSetTable`.
- Verified packing and alignment to ensure compliance with hardware specifications.
- Reviewed and confirmed correctness of `u32` type definitions.

This fix addresses a regression introduced in commit 9be4bf9aa5, which implemented ZBCSetTable functionality, and ensures successful compilation and adherence to the ZBC table implementation's design.
2025-01-05 13:45:04 +10:00
Zephyron
9be4bf9aa5
nvdrv: Implement ZBCSetTable functionality
Implements basic Zero Bandwidth Clear (ZBC) table support in nvhost_ctrl_gpu.
This adds storage and validation for both color and depth clear values,
replacing the previous stub implementation. ZBC is a hardware optimization
technique used by NVIDIA GPUs to efficiently handle buffer clearing operations.

Changes include:
- Added ZBC table storage structures
- Implemented parameter validation
- Added separate handling for color and depth modes
- Improved debug logging
- Added documentation explaining ZBC functionality
2025-01-04 18:57:12 +10:00
Zephyron
e11c6c03ec
core: Add support for 10GB and 12GB memory configurations
- 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-01-04 17:33:22 +10:00
Zephyron
b685d5701d
Audio Core: Add support tags for compressor stats and volume reset
Added two new audio feature support tags with their corresponding revision
numbers:
- AudioCompressorStatistics (rev 16): For tracking compressor statistics
- AudioVolumeResetSupport (rev 17): For volume reset functionality

These features align with the documented Nintendo Switch audio service
capabilities and maintain compatibility with the existing feature support
system.
2025-01-03 13:34:14 +10:00
Zephyron
eb2a666a69
buffer_cache: Fix storage buffer memory validation and size detection
Fixes the StorageBufferBinding function to properly handle memory validation
and size detection. Key changes include:

- Fix ReadBlock usage to properly handle void return values
- Implement safer memory validation using byte-level reads
- Improve size detection logic for storage buffers
- Fix NVN buffer size reading
- Add proper bounds checking for device memory addresses
- Add better error logging for invalid conditions

This addresses the "Failed to find storage buffer for cbuf index 0" errors
by implementing more robust memory validation and size detection. The changes
ensure proper handling of invalid memory addresses and prevent crashes from
accessing out-of-bounds memory.
2025-01-02 18:03:47 +10:00
Zephyron
167a9e1a5b
arm: Skip duplicate consecutive addresses in backtrace output
Adds logic to track and skip duplicate consecutive addresses when logging
backtraces. This improves log readability by removing redundant entries
that point to the same address in sequence.
2025-01-02 17:25:36 +10:00
Zephyron
7dc72a0e95
impl(Multiplayer): Switched API To Enable Multiplayer 2025-01-02 16:40:28 +10:00
Zephyron
822152c538
fix(CMake): Remove /DEBUG Flag From Release Builds 2025-01-02 16:39:58 +10:00
Zephyron
1cbcd142fa
video_core: Enforce safe memory reads for compute dispatch
- Modify DmaPusher to use safe memory reads when handling compute
  operations at High GPU accuracy
- Prevent potential memory corruption issues that could lead to
  invalid dispatch parameters
- Previously, unsafe reads could result in corrupted launch_description
  data in KeplerCompute::ProcessLaunch, causing invalid vkCmdDispatch
  calls
- By enforcing safe reads specifically for compute operations, we
  maintain performance for other GPU tasks while ensuring compute
  dispatch stability

This change requires >= High GPU accuracy level to take effect.
2025-01-02 16:38:18 +10:00
Zephyron
749d083197
shader_recompiler: Fix ISBERD instruction implementation
- Simplify ISBERD instruction to handle register-to-register moves
- Remove incorrect CompositeConstruct usage
- Replace with direct register value passing
- Fix compilation errors in internal stage buffer handling
2024-12-31 23:22:54 +10:00
Zephyron
2b5082b30d
shader_recompiler: Use FPRecip in FSWZADD implementation
Simplifies the negative reciprocal calculation in FSWZADD by using the
dedicated FPRecip operation instead of manually constructing a division.
This change:

- Replaces FPDiv(Imm32(f32(1.0f)), src_b) with FPRecip(src_b)
- Results in more efficient code for calculating 1.0/x
- Fixes build errors from undefined IR emitter methods
2024-12-31 22:54:55 +10:00
Zephyron
6f160628c0
shader_recompiler: Fix method names in FSWZADD implementation
Fixes incorrect method names in the floating point swizzled add implementation:
- FNeg -> FPNeg
- FDiv -> FPDiv
- FImm32(1.0f) -> Imm32(ir.f32(1.0f))

These changes align with the correct IR emitter interface naming conventions,
where floating-point operations use the 'FP' prefix and immediate values are
properly constructed using f32().
2024-12-31 22:43:09 +10:00
Zephyron
5d529baafb
shader_recompiler: Implement ISBERD instruction
Implements the Internal Stage Buffer Entry Read (ISBERD) instruction in the
Maxwell shader recompiler. This replaces the previous stubbed implementation
with actual buffer reading functionality.

The implementation:
- Validates unsupported features (skew, o, mode, shift)
- Performs buffer read using IR::InternalStageBufferRead
- Stores the read value to the destination register

This removes the "(STUBBED) called" warning messages that were previously
being logged during shader compilation.
2024-12-31 21:33:37 +10:00
Zephyron
d7df623485
shader_recompiler: Implement ISBERD instruction modes and shifts
Implements the ISBERD (Internal Stage Buffer Entry Read) instruction's
mode and shift options that were previously throwing NotImplemented
exceptions. This includes:

- Patch mode for reading patch data
- Prim mode for reading primitive data
- Attr mode for reading attribute data
- U16 shift for 16-bit unsigned values
- B32 shift for 32-bit values

The implementation follows Maxwell's ISA specification for handling
different buffer read modes and data shifts.
2024-12-31 21:30:58 +10:00
Zephyron
fd74ac4473
api_version: Update constants for HOS 19.0.1
Updates version constants to match Nintendo Switch firmware 19.0.1:
- HOS version numbers (19.0.1)
- Version hash
- Display version string
- Display title string
2024-12-31 18:45:36 +10:00
Zephyron
a9f539e193
audio_core: Add comprehensive audio feature support tags
Added new feature support tags to track audio functionality across firmware
versions. Changes include:

- Added Audio Out/In Auto buffer support tags (3.0.0+)
- Added Final Output Recorder features including work buffer (3.0.0+, 9.0.0+)
- Added Audio Renderer features like manual execution and voice drop
- Added Audio Device features including notifications and auto volume
- Added Hardware Opus decoder features including large frame support
- Added System Audio features like master volume and hearing protection

This provides more complete feature detection for audio functionality
introduced in firmware versions 3.0.0 through 19.0.1.
2024-12-31 18:42:49 +10:00
Zephyron
468ace6b0b
core: Update copyright headers
- Update copyright headers to include Citron Homebrew Project
- Add 2025 to copyright years
2024-12-31 17:36:08 +10:00
Zephyron
c972c5129d
core: Fix telemetry ID personalization array size
- The personalization array in GenerateTelemetryId() was too small (18 bytes)
  for the string "citron Telemetry ID" which requires 20 bytes including the
  null terminator
- Increased the array size to 20 to properly accommodate the full string
2024-12-31 17:33:34 +10:00
Zephyron
b3facaa6bb
chore: update project references and add Citron copyright
- Replaced all references to the old project name with Citron.
- Added Citron copyright information alongside existing notices in all files.
2024-12-31 17:07:49 +10:00
Zephyron
6778aa8ec8
chore: update project branding to Citron 2024-12-31 16:22:24 +10:00
Zephyron
9427e27e24
chore: update project branding to citron 2024-12-31 16:19:25 +10:00
yuzubot
537296095a "Merge Tagged PR 13018" 2024-03-04 13:02:54 +00:00
yuzubot
2ddac7b02b "Merge Tagged PR 13178" 2024-03-04 13:02:53 +00:00
Pengfei Zhu
2f57c5a0e9
Revert arbaic translation 2024-03-01 15:20:53 +08:00
Pengfei Zhu
338e088b9d
Remove trailing whitespaces 2024-03-01 14:19:02 +08:00
The yuzu Community
56c9107d08 Update translations (2024-03-01) 2024-03-01 03:12:19 +00:00
liamwhite
dc94882c90
Merge pull request #13135 from german77/hid-interface
service: hid: Migrate HidServer to new IPC
2024-02-27 12:26:26 -05:00
liamwhite
30567a5909
Merge pull request #13175 from liamwhite/asan
general: fix asan errors
2024-02-27 09:42:59 -05:00
liamwhite
f1b1530249
Merge pull request #13171 from liamwhite/fake-address
texture_cache: do not track invalid addresses
2024-02-27 09:42:46 -05:00
liamwhite
6948ac8c16
general: workarounds for SMMU syncing issues (#12749) 2024-02-27 15:42:15 +01:00
liamwhite
b2e129eaa5
vk_rasterizer: flip scissor y on lower left origin mode (#13122) 2024-02-27 15:40:33 +01:00
liamwhite
1de37306a5
buffer_cache: avoid overflow in usage tracker (#13166) 2024-02-27 15:39:11 +01:00
liamwhite
9bc85dda5f
texture_cache: use two-pass collection for costly load resources (#13096) 2024-02-27 15:38:14 +01:00
Liam
c7174d5f61 general: fix asan errors 2024-02-26 19:28:49 -05:00
Narr the Reg
1bec420695
Merge pull request #13172 from liamwhite/gl-streams
renderer_opengl: declare geometry stream support in profile
2024-02-26 11:51:25 -06:00
liamwhite
79edad2533
Merge pull request #13159 from liamwhite/web-error
core: enable error applet, add stubs for web applet
2024-02-26 12:44:55 -05:00
Liam
a0e254e7c4 renderer_opengl: declare geometry stream support in profile 2024-02-26 11:18:30 -05:00
Liam
25c3bbba0e settings: remove global override for smash on amdvlk 2024-02-26 11:16:18 -05:00