summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2025-01-27service: Implement GPU error handling IPC commands for AMZephyron
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-26nvnflinger: Implement reference counting for binder objectsZephyron
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-26service: vi: Implement missing IApplicationDisplayService functionsZephyron
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-25Revert "core/hle: Reorganize ErrorModule enum numerically"Zephyron
This reverts commit b55be320b75d01bdc1320bc78179542b2ce10fb2.
2025-01-25core/hle: Reorganize ErrorModule enum numericallyZephyron
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-25service: sm: Update to match official IPC interfaceZephyron
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-25service: mm: Refactor Memory Management service implementationZephyron
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-25service: mm: Implement proper parameter handling for MM serviceZephyron
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-21service/nvdrv: Relax GPU validation and improve error handlingZephyron
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-20service/nvdrv: Implement stubbed GPU functionsZephyron
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-20service-am: Handle panic conditions in SetTerminateResultZephyron
- 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-20service: vi: Remove stubbed warning from GetManagerDisplayServiceZephyron
- 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-18arm/video: Fix shader extension and exception handlingZephyron
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-18memory: Improve null pointer and unmapped memory handlingZephyron
- 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-15fix(sm_controller): Correct QueryPointerBufferSize implementationZephyron
- 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-15fix: Implement SetGestureOutputRanges to handle unimplemented function errorZephyron
- 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-14Revert incorrect copyright attribution for non-contributed filesZephyron
- In commit b3facaa6bb30cdc39f2b7d632fef1e3bfeee7785, 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-08nvdrv: Add MSVC compatibility for packed structsZephyron
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-07kernel: Implement SystemResourceSize info type for VAMM initializationZephyron
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-06core: Improve device memory and buffer queue handlingZephyron
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-06service/am: Implement friend invitation storage channelZephyron
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-05nvdrv: Fix incorrect IoctlZbcSetTable structure size assertionZephyron
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-04nvdrv: Implement ZBCSetTable functionalityZephyron
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-04core: 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-01-02arm: Skip duplicate consecutive addresses in backtrace outputZephyron
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.
2024-12-31api_version: Update constants for HOS 19.0.1Zephyron
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-31core: Update copyright headersZephyron
- Update copyright headers to include Citron Homebrew Project - Add 2025 to copyright years
2024-12-31core: Fix telemetry ID personalization array sizeZephyron
- 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-31chore: update project references and add Citron copyrightZephyron
- Replaced all references to the old project name with Citron. - Added Citron copyright information alongside existing notices in all files.
2024-03-04"Merge Tagged PR 13018"yuzubot
2024-02-27Merge pull request #13135 from german77/hid-interfaceliamwhite
service: hid: Migrate HidServer to new IPC
2024-02-26general: fix asan errorsLiam
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-26video_core: make gpu context aware of rendering programLiam
2024-02-24ldn: return no connection from GetStateForMonitorLiam
2024-02-24ssl: add cert storeLiam
2024-02-24glue: load initial year setting as s32Liam
2024-02-24acc: add account manager for acc:u1Liam
2024-02-24fs: add stubs for online web appletLiam
2024-02-24erpt: stub report creationLiam
2024-02-24set: add GetPlatformRegionLiam
2024-02-24service: set: Fix GetSettingsItemValuegerman77
2024-02-24Merge pull request #13153 from german77/defaultsetliamwhite
service: set: Enable nfc and others by default and bump version
2024-02-24Merge pull request #13081 from FearlessTobi/aoc-ipcliamwhite
aoc: Migrate to use cmif serialization
2024-02-24service: set: Enable nfc and others by default and bump versiongerman77
2024-02-24set: fix region code for system settingsLiam
2024-02-23service: audio: Add missing logging properties of SetHeadphoneOutputLevelModeNarr the Reg
2024-02-23service: btdrv: Add EnableRadio for QlaunchNarr the Reg
2024-02-23service: friend: Add GetFriendCount, GetNewlyFriendCount, ↵Narr the Reg
GetReceivedFriendRequestCount, GetPlayHistoryStatistics, GetReceivedFriendInvitationCountCache for QLaunch