Commit graph

453 commits

Author SHA1 Message Date
wildcard
41ffa5a342
[core, nce] module_id cache key handling (#195)
Uses Module_id plus offset for cache key, Module_id is unique to each module. Also passes the module_id everytime new patcher is created in case the module is too big.

Co-authored-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/195
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: wildcard <nubieluv@gmail.com>
Co-committed-by: wildcard <nubieluv@gmail.com>
2025-08-04 18:41:28 +02:00
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
darktux
616619c8f7 Port changes from Early Access 2025-04-04 03:40:46 +02:00
FearlessTobi
4d55e58ee4 scope_exit: Make constexpr
Allows the use of the macro in constexpr-contexts.
Also avoids some potential problems when nesting braces inside it.
2024-02-19 16:00:46 +01:00
FearlessTobi
24f979a4b8 vfs: Move vfs files to their own directory 2024-01-25 16:40:42 -05:00
Liam
9528c40b1e loader: also register fs process for raw exefs partition 2024-01-23 00:01:38 -05:00
liamwhite
f05d1c60be Merge pull request #12677 from GPUCode/whyy-modders
core: Support multiple modules per patcher
2024-01-15 13:52:38 -05:00
GPUCode
26a25d2280 core: Support multiple modules per patcher 2024-01-15 00:46:05 +02:00
Liam
36739873d2 loader: fix homebrew nro registration 2024-01-13 13:48:56 -05:00
Liam
2397093e4f fsp-srv: use program registry for SetCurrentProcess 2024-01-11 11:28:52 -05:00
Liam
a7ff872a4c kernel: restrict nce to applications 2023-12-22 21:52:49 -05:00
Liam
4321fc6154 file_sys: handle null romfs 2023-12-01 23:39:48 -05:00
GPUCode
e6e15d2d10 core: Rename patcher file 2023-11-29 23:49:16 +02:00
Liam
d7db22185a loader: fix gcc compile 2023-11-26 19:34:07 -05:00
Liam
982183d4c6 loader: apply nso patch to offset program image 2023-11-25 00:47:36 -05:00
GPUCode
3930e3d7fd core: Define HAS_NCE macro 2023-11-25 00:47:36 -05:00
GPUCode
3814ca9d84 Address some review comments 2023-11-25 00:47:35 -05:00
GPUCode
3764cc4be2 android: Add cpu bakend gui toggle 2023-11-25 00:47:28 -05:00
Liam
19619b1b14 arm: Implement native code execution backend 2023-11-25 00:46:47 -05:00
Liam
3a5992f2ef kernel: Manually specify aslr region start 2023-11-25 00:46:15 -05:00
Liam
bb4e14e7ac loader: don't reassign program ID on npdm reparse 2023-09-30 11:35:42 -04:00
Liam
efef3d8487 core: improve debug workflow 2023-09-14 16:44:15 -04:00
Liam
76671fdede core: implement basic integrity verification 2023-09-06 16:49:27 -04:00
liamwhite
aa16fd2422 kernel: offset code entry point for 39-bit address space type (#11326) 2023-08-25 23:59:32 +02:00
Liam
5e3139e7c6 vfs: expand support for NCA reading 2023-08-15 17:47:25 -04:00
Liam
6b6f0b21b9 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Tobias
16590ff2d0 file_sys/content_archive: Detect compressed NCAs (#11047) 2023-07-12 23:17:18 +02:00
Charles Lombardo
b1b9075f2d android: Add proper homebrew check 2023-06-09 20:17:51 -04:00
Liam
156516e399 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
c68577384a general: rename CurrentProcess to ApplicationProcess 2023-02-13 19:03:12 -05:00
Merry
62b91b0094 core/loader: Return nullptr if file is nullptr 2022-09-25 19:31:35 +01:00
Kyle Kienapfel
ea00332a67 code: dodge PAGE_SIZE #define
Some header files, specifically for OSX and Musl libc define PAGE_SIZE to be a number
This is great except in yuzu we're using PAGE_SIZE as a variable

Specific example
`static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;`

PAGE_SIZE PAGE_BITS PAGE_MASK are all similar variables.
Simply deleted the underscores, and then added YUZU_ prefix

Might be worth noting that there are multiple uses in different classes/namespaces
This list may not be exhaustive

Core::Memory   12 bits (4096)
QueryCacheBase 12 bits
ShaderCache    14 bits (16384)
TextureCache   20 bits (1048576, or 1MB)

Fixes #8779
2022-08-19 16:08:40 -07:00
Liam
9080ea9ab1 core/loader: remove ELF loader 2022-08-01 17:19:23 -04:00
Liam
79bf4bc3ff general: fix compilation on MinGW GCC 12 2022-06-13 20:09:32 -04:00
Liam
8f979d453d common: consolidate ELF structure definitions 2022-06-05 09:42:05 -04:00
Andrea Pappacoda
b2eb103829 chore: add missing SPDX tags
Follow-up to 2b87305d31
2022-04-28 18:24:11 +02:00
Morph
2b87305d31 general: Convert source file copyright comments over to SPDX
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
2022-04-23 05:55:32 -04:00
BytesGalore
8f530cbb09 loader: log the type of mismatching file-extension 2022-03-03 06:45:13 +01:00
Lioncash
8a509e5a2c general: Replace NonCopyable struct with equivalents 2022-02-02 13:17:12 -05:00
bunnei
acd1fff964 core: loader: kip: Minimal changes to fix KIP loading.
- Allows us to boot KIP (kernal apps), useful for testing the kernel.
2021-12-17 23:08:51 -08:00
jam1garner
9ea4d9cb8c loader: Support loading subsdk{8,9} 2021-12-05 23:07:50 -05:00
ameerj
d27abf5546 core: Remove unused includes 2021-11-03 21:42:57 -04:00
Feng Chen
77f209e391 file_sys: Support load game collection (#6582)
Adds support for loading games with multiple programs embedded within such as the Dragon Quest 1+2+3 Collection
2021-07-20 01:10:05 -04:00
lat9nq
794c444285 general: Make most settings a BasicSetting
Creates a new BasicSettings class in common/settings, and forces setting
a default and label for each setting that uses it in common/settings.
Moves defaults and labels from both frontends into common settings.
Creates a helper function in each frontend to facillitate reading the
settings now with the new default and label properties.

Settings::Setting is also now a subclass of Settings::BasicSetting. Also
adds documentation for both Setting and BasicSetting.
2021-06-28 17:32:17 -04:00
Morph
e8f1d7145e common: fs: Rework the Common Filesystem interface to make use of std::filesystem (#6270)
* common: fs: fs_types: Create filesystem types

Contains various filesystem types used by the Common::FS library

* common: fs: fs_util: Add std::string to std::u8string conversion utility

* common: fs: path_util: Add utlity functions for paths

Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library

* common: fs: file: Rewrite the IOFile implementation

* common: fs: Reimplement Common::FS library using std::filesystem

* common: fs: fs_paths: Add fs_paths to replace common_paths

* common: fs: path_util: Add the rest of the path functions

* common: Remove the previous Common::FS implementation

* general: Remove unused fs includes

* string_util: Remove unused function and include

* nvidia_flags: Migrate to the new Common::FS library

* settings: Migrate to the new Common::FS library

* logging: backend: Migrate to the new Common::FS library

* core: Migrate to the new Common::FS library

* perf_stats: Migrate to the new Common::FS library

* reporter: Migrate to the new Common::FS library

* telemetry_session: Migrate to the new Common::FS library

* key_manager: Migrate to the new Common::FS library

* bis_factory: Migrate to the new Common::FS library

* registered_cache: Migrate to the new Common::FS library

* xts_archive: Migrate to the new Common::FS library

* service: acc: Migrate to the new Common::FS library

* applets/profile: Migrate to the new Common::FS library

* applets/web: Migrate to the new Common::FS library

* service: filesystem: Migrate to the new Common::FS library

* loader: Migrate to the new Common::FS library

* gl_shader_disk_cache: Migrate to the new Common::FS library

* nsight_aftermath_tracker: Migrate to the new Common::FS library

* vulkan_library: Migrate to the new Common::FS library

* configure_debug: Migrate to the new Common::FS library

* game_list_worker: Migrate to the new Common::FS library

* config: Migrate to the new Common::FS library

* configure_filesystem: Migrate to the new Common::FS library

* configure_per_game_addons: Migrate to the new Common::FS library

* configure_profile_manager: Migrate to the new Common::FS library

* configure_ui: Migrate to the new Common::FS library

* input_profiles: Migrate to the new Common::FS library

* yuzu_cmd: config: Migrate to the new Common::FS library

* yuzu_cmd: Migrate to the new Common::FS library

* vfs_real: Migrate to the new Common::FS library

* vfs: Migrate to the new Common::FS library

* vfs_libzip: Migrate to the new Common::FS library

* service: bcat: Migrate to the new Common::FS library

* yuzu: main: Migrate to the new Common::FS library

* vfs_real: Delete the contents of an existing file in CreateFile

Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now.

* input_profiles: Don't iterate the input profile dir if it does not exist

Silences an error produced in the log if the directory does not exist.

* game_list_worker: Skip parsing file if the returned VfsFile is nullptr

Prevents crashes in GetLoader when the virtual file is nullptr

* common: fs: Validate paths for path length

* service: filesystem: Open the mod load directory as read only
2021-05-25 19:32:56 -04:00
Lioncash
eeae5217ba core: Make variable shadowing a compile-time error
Now that we have most of core free of shadowing, we can enable the
warning as an error to catch anything that may be remaining and also
eliminate this class of logic bug entirely.
2021-05-16 03:43:16 -04:00
bunnei
ad048de3d6 hle: kernel: Rename Process to KProcess. 2021-05-05 16:40:52 -07:00
Lioncash
84b656fbbd core: Resolve misc cases of variable shadowing
Resolves shadowing warnings that aren't in a particularly large
subsection of core. Brings us closer to turning -Wshadow into an error.

All that remains now is for cases in the kernel (left untouched for now
since a big change by bunnei is pending), and a few left over in the
service code (will be tackled next).
2021-05-03 01:19:13 -04:00
Lioncash
41c7ce33b6 loader: Resolve instances of variable shadowing
Eliminates variable shadowing cases across all the loaders to bring us
closer to enabling variable shadowing as an error in core.
2021-04-27 12:48:15 -04:00
Morph
0357607044 program_metadata: Set a default resource size when a NPDM is not present
Sets a default size of 0x1FE00000 bytes (510 MiB) for the system_resource_size when a NPDM is not present.
2021-04-23 12:47:31 -04:00