Skip to content

Add fsDeviceOperator* types for IDeviceOperator#730

Draft
borntohonk wants to merge 2 commits intoswitchbrew:masterfrom
borntohonk:master
Draft

Add fsDeviceOperator* types for IDeviceOperator#730
borntohonk wants to merge 2 commits intoswitchbrew:masterfrom
borntohonk:master

Conversation

@borntohonk
Copy link
Copy Markdown

@borntohonk borntohonk commented May 2, 2026

helper for cleaner implementation of Atmosphere-NX/Atmosphere#2804 (and to allow the implementation to be more consistent with how other atmosphere IDeviceOperator related things are implemented.)

https://switchbrew.org/wiki/NS_services#GetGameCardPlatformRegion
https://switchbrew.org/wiki/Filesystem_services#GetGameCardHandle
https://switchbrew.org/wiki/Filesystem_services#IDeviceOperator

Comment thread nx/include/switch/services/fs.h Outdated
@borntohonk borntohonk force-pushed the master branch 2 times, most recently from ed4110a to efbc80a Compare May 2, 2026 15:39
@borntohonk
Copy link
Copy Markdown
Author

(intended use currently WIP borntohonk/Atmosphere@0f36778 but related to topic from closed PR linked above)

@borntohonk borntohonk marked this pull request as draft May 3, 2026 19:37
@borntohonk borntohonk changed the title Add fsDeviceOperatorGetGameCardCompatibilityType for IDeviceOperator Add fsDeviceOperator* types for IDeviceOperator May 3, 2026
@borntohonk
Copy link
Copy Markdown
Author

The scope of what has to be implemented on atmosphere end is the entirity of the IDeviceOperator interface, so the scope has changed a tiny bit

@borntohonk
Copy link
Copy Markdown
Author

This requires implementing some still undocumented entries within https://switchbrew.org/wiki/Filesystem_services#IDeviceOperator; those ones I am not entirely 100% sure on, but i am checking them with ghidra to

cmd 7; SetSdCardActivationMode
cmd 8; TryGetSdCardInfo
cmd 118; MarkBeforeEraseMmcPartitionUserData
cmd 119; CheckAfterEraseMmcPartitionUserData
cmd 225; RegisterGameCardConfigurationData
cmd 226; GetGameCardDetailedErrorReportInfo
cmd 303; SetGameCardClockRateForSpeedEmulation
cmd 304; ClearGameCardClockRateForSpeedEmulation

@hexkyz
Copy link
Copy Markdown
Contributor

hexkyz commented May 5, 2026

This requires implementing some still undocumented entries within https://switchbrew.org/wiki/Filesystem_services#IDeviceOperator; those ones I am not entirely 100% sure on, but i am checking them with ghidra to

cmd 7; SetSdCardActivationMode cmd 8; TryGetSdCardInfo cmd 118; MarkBeforeEraseMmcPartitionUserData cmd 119; CheckAfterEraseMmcPartitionUserData cmd 225; RegisterGameCardConfigurationData cmd 226; GetGameCardDetailedErrorReportInfo cmd 303; SetGameCardClockRateForSpeedEmulation cmd 304; ClearGameCardClockRateForSpeedEmulation

I've added the missing commands to switchbrew.
On a cursory inspection, the only mismatch seems to be "SetSdCardActivationMode" which takes a "nn::fs::SdCardActivationMode". This is an u8 enum (see the ninupdates entry) which should be added to the fs types ("FsSdCardActivationMode"). RE'ing the meaning of the enum's values is still TODO, but, if need be, leaving them with dummy names in the meantime should be fine.

@borntohonk
Copy link
Copy Markdown
Author

borntohonk commented May 6, 2026

This requires implementing some still undocumented entries within https://switchbrew.org/wiki/Filesystem_services#IDeviceOperator; those ones I am not entirely 100% sure on, but i am checking them with ghidra to
cmd 7; SetSdCardActivationMode cmd 8; TryGetSdCardInfo cmd 118; MarkBeforeEraseMmcPartitionUserData cmd 119; CheckAfterEraseMmcPartitionUserData cmd 225; RegisterGameCardConfigurationData cmd 226; GetGameCardDetailedErrorReportInfo cmd 303; SetGameCardClockRateForSpeedEmulation cmd 304; ClearGameCardClockRateForSpeedEmulation

I've added the missing commands to switchbrew. On a cursory inspection, the only mismatch seems to be "SetSdCardActivationMode" which takes a "nn::fs::SdCardActivationMode". This is an u8 enum (see the ninupdates entry) which should be added to the fs types ("FsSdCardActivationMode"). RE'ing the meaning of the enum's values is still TODO, but, if need be, leaving them with dummy names in the meantime should be fine.

upon testing, the current way i have implemented fsDeviceOperatorRegisterGameCardConfigurationData results in (nn::ns::detail::IApplicationManagerInterface:Cmd502, RequestCheckGameCardRegistration ) to crash.

(or similar, i am just working with the coincidence of words clashing and whats new as to identify the cause, and since that one is one of the new ones, i'm guessing it has to be that one)

so i am going to look over again with the updated information, as I most likely am mishandling RegisterGameCardConfigurationData (or something else)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants