Switch 2: Compatibility Mode: Difference between revisions
| (9 intermediate revisions by 2 users not shown) | |||
| Line 7: | Line 7: | ||
These binaries are compiled with PAC enabled. | These binaries are compiled with PAC enabled. | ||
= NPDM Adjustments = | |||
* Game has access to SVC 0x54, 0x80 even though it's not in the game NPDM. | |||
* Game has CoreMask 0x3F (so access to core0-5) even though the game NPDM only has CoreMask 0x7. | |||
* It's unknown if the service whitelist is updated for the game when running in Compatibility mode. | |||
= Hooking = | = Hooking = | ||
| Line 16: | Line 20: | ||
Below is a breakdown what some of the hooks and what their purpose is. | Below is a breakdown what some of the hooks and what their purpose is. | ||
== Modules == | |||
Rtld is identical besides the extra page at the end of .bss for [[#CompatibilityParameter|CompatibilityParameter]]. | |||
The compat modules are loaded between the main module and the (sub)sdk* modules. | |||
The existing modules are not directly modified. | |||
== CompatibilityParameter == | == CompatibilityParameter == | ||
| Line 49: | Line 60: | ||
|- | |- | ||
| 4 || SerializeSavedataAccess || A global mutex is taken when a file starting with "savedata" is opened, and held until the file has been closed. Commit-action also takes the mutex, so the commit will not complete until the file has been closed. | | 4 || SerializeSavedataAccess || A global mutex is taken when a file starting with "savedata" is opened, and held until the file has been closed. Commit-action also takes the mutex, so the commit will not complete until the file has been closed. | ||
|- | |||
| 6 || PreventNegativeVibrationValue || | |||
|- | |- | ||
| 10 || NeedsWaitingLaunchLogo || | | 10 || NeedsWaitingLaunchLogo || | ||
| Line 65: | Line 78: | ||
|- | |- | ||
|} | |} | ||
= ApplicationCompatibilityInfo = | |||
The [[Switch 2: Title list|ApplicationCompatibilityInfo]] SystemData contains "ApplicationCompatibilityInfo.json". | |||
The json "records" contains an array, each object entry then contains the following: | |||
* "application_id": "0x<lowercase hex ApplicationId>" | |||
* "target_max_version": <value> (normally u32-max) | |||
* "application_layer_info": This object contains various number fields, only fields needed by the current entry are present. "graphics_config", "misc_config", ... | |||
** The data from here is likely passed as input to [[#CompatibilityParameter|CompatibilityParameter]]. | |||
= nnCompatTrampoline = | = nnCompatTrampoline = | ||
| Line 83: | Line 105: | ||
| nn::audio::GetAudioInName || If the primary audio in name is "XUac", it returns the secondary device name instead. Presumably, the "XUac" device has been removed in Switch 2. || | | nn::audio::GetAudioInName || If the primary audio in name is "XUac", it returns the secondary device name instead. Presumably, the "XUac" device has been removed in Switch 2. || | ||
|- | |- | ||
| nn::audio::GetReleasedWaveBuffer || Now returns NULL under certain circumstances. || | | nn::audio::GetReleasedWaveBuffer || Now returns NULL under certain circumstances. || AudioControlData bit0 | ||
|- | |- | ||
| nn::web::OfflineWebSession::Appear || Added sleep 50000000 before calling the original function. || MiscControlData bit13 | | nn::web::OfflineWebSession::Appear || Added sleep 50000000 before calling the original function. || MiscControlData bit13 | ||
| Line 96: | Line 118: | ||
|- | |- | ||
| nn::os::QueryMemoryInfo,nn::os::QueryMemoryInfoForDebug || Hides stolen Heap memory that it uses for itself... || | | nn::os::QueryMemoryInfo,nn::os::QueryMemoryInfoForDebug || Hides stolen Heap memory that it uses for itself... || | ||
|- | |||
| nn::hid::VibrationPlayer::SetCurrentPosition || If position is negative, drop the call. || MiscControlData bit6 | |||
|} | |} | ||
| Line 106: | Line 130: | ||
|- | |- | ||
| nn::os::ConvertToTick || Uses conversion ratio 31250000 instead of 19200000. | | nn::os::ConvertToTick || Uses conversion ratio 31250000 instead of 19200000. | ||
|- | |||
| gl*, _gl*, egl* || OpenGL API translation for new GPU? | |||
|- | |||
| vk* || Vulkan API translation for new GPU? | |||
|- | |||
| NvOsFopen || | |||
|- | |||
| NvOsGetTimeMS || Adjusted for new clock frequency. | |||
|- | |||
| nn::vi::* || Translation layer because vi:u was removed? | |||
|- | |||
| nn::pl::IsRunningOnOunce || Returns 1 instead of 0. | |||
|} | |} | ||