ryubing-ryujinx/src
yell0wsuit f8167eb625
Some checks are pending
Canary CI / Release for linux-arm64 (push) Waiting to run
Canary CI / Release for linux-x64 (push) Waiting to run
Canary CI / Release for win-x64 (push) Waiting to run
Canary CI / Release MacOS universal (push) Waiting to run
Canary CI / Post CI Steps (push) Blocked by required conditions
[HLE] Match hardware screenshot buffer size behavior for captures (#44)
## Description

~~Fixes a fatal CLR crash when `caps` screenshot saving receives an input buffer larger than `0x384000`.~~

~~Resolves a crash in Tomodachi Life: Living the Dream where saving the pictures to the system's album crashes with 0x80131506.~~

Follow up to #18. This PR adjusts the validation and copy behavior to better match real hardware, and adds logging to make invalid screenshot buffer cases easier to diagnose.

Real hardware accepts screenshot buffers with a size greater than or equal to `0x384000`, but only `0x384000` bytes are needed for the 1280x720 RGBA image.

This changes screenshot saving to:

- reject buffers smaller than `0x384000`
- accept buffers equal to or larger than `0x384000`
- copy only the first `0x384000` bytes into the 1280x720 bitmap

## Testing

Tested with a real Switch NRO using `capssuSaveScreenShotEx0`, `capssuSaveScreenShotEx1`, and `capssuSaveScreenShotEx2`.

Observed hardware behavior:

```text
0x384000     => OK
0x384000 - 1 => NullInputBuffer
0x384000 + 1 => OK
0x3C0000     => OK // Tomo life picture size
```

Co-authored-by: yell0wsuit <5692900+yell0wsuit@users.noreply.github.com>
Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/44
2026-05-10 23:57:05 +00:00
..
ARMeilleure [ci skip] replace all usages of IntPtr with nint 2026-01-27 17:41:46 -06:00
Ryujinx Fix Windows fullscreen gap when toggling from maximized (#80) 2026-05-10 23:47:39 +00:00
Ryujinx.Audio audio: Fix crash due to invalid Splitter size (ryubing/ryujinx!257) 2026-01-31 11:22:14 -06:00
Ryujinx.Audio.Backends.Apple fix AppleHardwareDeviceDriver.IsSupported (no fancy check is needed; it's on any macOS version 10.5 (Leopard) and above) 2026-01-28 00:05:02 -06:00
Ryujinx.Audio.Backends.OpenAL audio backend projects code cleanup 2026-01-27 17:34:51 -06:00
Ryujinx.Audio.Backends.SDL3 audio backend projects code cleanup 2026-01-27 17:34:51 -06:00
Ryujinx.Audio.Backends.SoundIo [ci skip] replace all usages of IntPtr with nint 2026-01-27 17:41:46 -06:00
Ryujinx.BuildValidationTasks Fixed spelling in LocalesValidationTask.cs (ryubing/ryujinx!269) 2026-02-21 04:37:02 -06:00
Ryujinx.Common [HLE] Renamed INotificationServicesForSystem and implemented a few commands and stubs (#6) 2026-05-10 23:31:45 +00:00
Ryujinx.Cpu [CPU] Increased base JIT cache size (#22) 2026-05-02 02:49:59 +00:00
Ryujinx.Graphics.Device Memory changes 2.2 (ryubing/ryujinx!143) 2025-09-06 11:10:55 -05:00
Ryujinx.Graphics.GAL Memory Changes 3.2 (ryubing/ryujinx!234) 2025-12-06 17:19:19 -06:00
Ryujinx.Graphics.Gpu [ci skip] replace all usages of IntPtr with nint 2026-01-27 17:41:46 -06:00
Ryujinx.Graphics.Host1x Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" 2025-06-15 20:45:26 -05:00
Ryujinx.Graphics.Nvdec Memory Changes part 2 (ryubing/ryujinx!123) 2025-08-25 17:44:15 -05:00
Ryujinx.Graphics.Nvdec.FFmpeg Memory Changes part 2 (ryubing/ryujinx!123) 2025-08-25 17:44:15 -05:00
Ryujinx.Graphics.Nvdec.Vp9 Memory Changes part 2 (ryubing/ryujinx!123) 2025-08-25 17:44:15 -05:00
Ryujinx.Graphics.OpenGL Updated OpenGL calls to no longer be deprecated (#83) 2026-05-10 23:18:23 +00:00
Ryujinx.Graphics.RenderDocApi RenderDoc API support (ryubing/ryujinx!242) 2026-01-01 00:10:21 -06:00
Ryujinx.Graphics.Shader Use the new C# 14 null propagation setter 2025-11-16 19:14:26 -06:00
Ryujinx.Graphics.Texture Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" 2025-06-15 20:45:26 -05:00
Ryujinx.Graphics.Vic chore: Overall code cleanup 2025-10-26 01:22:20 -05:00
Ryujinx.Graphics.Video Fix ~3500 analyser issues 2025-05-30 17:08:34 -05:00
Ryujinx.Graphics.Vulkan UI: LoadGuestApplication asynchronous cancellation (#1) 2026-05-02 02:30:57 +00:00
Ryujinx.HLE [HLE] Match hardware screenshot buffer size behavior for captures (#44) 2026-05-10 23:57:05 +00:00
Ryujinx.HLE.Generators Fix ~3500 analyser issues 2025-05-30 17:08:34 -05:00
Ryujinx.Horizon Accurate Service Names (ryubing/ryujinx!296) 2026-04-01 11:08:10 -05:00
Ryujinx.Horizon.Common Fix ~3500 analyser issues 2025-05-30 17:08:34 -05:00
Ryujinx.Horizon.Generators Fix ~3500 analyser issues 2025-05-30 17:08:34 -05:00
Ryujinx.Horizon.Kernel.Generators Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" 2025-06-15 20:45:26 -05:00
Ryujinx.Input fix/sdl3-gamepad-bugs (#19) 2026-04-18 13:54:25 +00:00
Ryujinx.Input.SDL3 fix/sdl3-gamepad-bugs (#19) 2026-04-18 13:54:25 +00:00
Ryujinx.Memory [ci skip] replace all usages of IntPtr with nint 2026-01-27 17:41:46 -06:00
Ryujinx.SDL3.Common revert b7f42de5a6 (#46) 2026-05-02 01:03:53 +00:00
Ryujinx.ShaderTools Revert the Metal Experiment (#701) 2025-02-22 21:26:46 -06:00
Ryujinx.Tests [HLE] Match hardware screenshot buffer size behavior for captures (#44) 2026-05-10 23:57:05 +00:00
Ryujinx.Tests.Memory feature: .NET 10 (ryubing/ryujinx!214) 2025-11-11 12:55:36 -06:00
Ryujinx.Tests.Unicorn Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" 2025-06-15 20:45:26 -05:00
Ryujinx.UI.LocaleGenerator Fractured Locales Support (ryubing/ryujinx!238) 2025-12-27 14:07:56 -06:00
Spv.Generator Revert "Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)" 2025-06-15 20:45:26 -05:00