eden/src/core/loader
JPikachu 8599c47fe0 service: sm/kernel/loader: Implement QueryPointerBufferSize, automatic pointer buffer sizing, and SM service improvements
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.
2025-04-30 06:35:22 +00:00
..
deconstructed_rom_directory.cpp Merge pull request #12677 from GPUCode/whyy-modders 2024-01-15 13:52:38 -05:00
deconstructed_rom_directory.h core: improve debug workflow 2023-09-14 16:44:15 -04:00
kip.cpp kernel: Manually specify aslr region start 2023-11-25 00:46:15 -05:00
kip.h general: Convert source file copyright comments over to SPDX 2022-04-23 05:55:32 -04:00
loader.cpp Port changes from Early Access 2025-04-04 03:40:46 +02:00
loader.h vfs: Move vfs files to their own directory 2024-01-25 16:40:42 -05:00
nax.cpp vfs: expand support for NCA reading 2023-08-15 17:47:25 -04:00
nax.h vfs: expand support for NCA reading 2023-08-15 17:47:25 -04:00
nca.cpp service: sm/kernel/loader: Implement QueryPointerBufferSize, automatic pointer buffer sizing, and SM service improvements 2025-04-30 06:35:22 +00:00
nca.h core: implement basic integrity verification 2023-09-06 16:49:27 -04:00
nro.cpp vfs: Move vfs files to their own directory 2024-01-25 16:40:42 -05:00
nro.h arm: Implement native code execution backend 2023-11-25 00:46:47 -05:00
nso.cpp core: Support multiple modules per patcher 2024-01-15 00:46:05 +02:00
nso.h core: Support multiple modules per patcher 2024-01-15 00:46:05 +02:00
nsp.cpp loader: also register fs process for raw exefs partition 2024-01-23 00:01:38 -05:00
nsp.h core: implement basic integrity verification 2023-09-06 16:49:27 -04:00
xci.cpp fsp-srv: use program registry for SetCurrentProcess 2024-01-11 11:28:52 -05:00
xci.h core: implement basic integrity verification 2023-09-06 16:49:27 -04:00