Should fix or at least lessen the crashes when leaving runtime emulation on both Android / PC
Also, may have improved the time required to leave the game
Reviewed-on: #75
Co-authored-by: Briar <205427297+icy-briar@users.noreply.github.com>
Co-committed-by: Briar <205427297+icy-briar@users.noreply.github.com>
This commit introduces multiple improvements to IPC handling and system management services, enhancing game compatibility and emulator stability.
--- 1. Fully Implemented QueryPointerBufferSize Service:
- Exposes the per-process IPC pointer buffer size through `QueryPointerBufferSize` instead of returning stubbed values.
- Added `m_pointer_buffer_size` field to `KProcess`, initialized with a safe default (0x8000).
- Introduced getter and setter methods (`GetPointerBufferSize()` / `SetPointerBufferSize()`).
- Registered new handler in `sm_controller` for handling QueryPointerBufferSize requests.
- Ensures accurate buffer size reporting for games relying on this service.
--- 2. Automatic Pointer Buffer Sizing Per-Game:
- Automatically determines heap size by parsing `main.npdm` from the game’s ExeFS:
- Heap size > 1 GiB → pointer buffer size set to `0x10000`.
- Heap size > 512 MiB → pointer buffer size set to `0xC000`.
- Otherwise, defaults to `0x8000`.
- Gracefully handles missing or malformed `main.npdm` by falling back to default settings.
- Automatically configures pointer buffer size during `AppLoader_NCA::Load`.
- Added logging for heap size detection and buffer size configuration for easier debugging.
--- 3. SM Service Improvements:
- Added full implementation of `QueryPointerBufferSize` within the SM service framework.
- Cleaned up stubbed methods and ensured correct domain handling.
- Registered new service commands (e.g., `SetPointerBufferSize` and `QueryPointerBufferSize`) in `sm_controller`.
- Improved session handling with proper conversion to domain objects where necessary.
--- Benefits:
- Greatly improves compatibility with games that require larger IPC pointer buffers
- Eliminates the need for manual per-game pointer buffer overrides.
- More accurate emulation of Switch system services, improving stability for both commercial titles and homebrew.
- Provides cleaner logging for easier debugging and maintenance.
- Future-proofs IPC handling for upcoming titles with higher memory demands.
--- Additional Notes:
- Default pointer buffer size remains 0x8000 for smaller titles or if heap size cannot be determined.
- Falls back to safe defaults without affecting overall emulator performance.
- All new service calls properly registered and integrated without breaking existing functionality.
If the user selects dynamic state = 0, force-disable all Vulkan dynamic state extensions and related struct fields.
This ensures compatibility with drivers and simplifies shader pipeline logic.
Also logs all removals for clarity.
If the setting dyna_state is set to 0 (dynamic state disabled), must_emulate_scaled_formats is forced "true" for proper rendering.
If dyna_state is set to 1, 2, or 3 (dynamic state enabled), must_emulate_scaled_formats is forced "false" for proper dyna-state use.
This change applies globally after all device-specific quirks and is logged clearly at boot for easier debugging.
- Forcefully disabled dynamic state extensions if Vulkan reports that
the device doesn't support it (need to update UI for this)
- Adds some more supported state 3 extensions
- Adds back stencil reinterpretation
- default to 0 on Android and 1 on desktop
Signed-off-by: swurl <swurl@swurl.xyz>
Reviewed-on: #57
Co-authored-by: swurl <swurl@swurl.xyz>
Co-committed-by: swurl <swurl@swurl.xyz>
Just a small fix to the readme, I tested it by the way.
Fixed "Levey" to "LaVey"
Made shortened words complete.
Declared Language.
Used "en-gb" complaint Language.
Signed-off-by: Bix <xq9zp7f2@proton.me>
Reviewed-on: #59
Co-authored-by: Bix <xq9zp7f2@proton.me>
Co-committed-by: Bix <xq9zp7f2@proton.me>
Some games suck with updates on Yuzu, this lets the user know about it.
Currently, only Tears of the Kingdom is known to be affected, but this
can easily be expanded to include more games.
Signed-off-by: swurl <swurl@swurl.xyz>