Migration services: Difference between revisions

No edit summary
No edit summary
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Migration is a sysmodule designed for handling the Switch-to-Switch transfer system introduced in firmware [[4.0.0]].
Migration is a sysmodule designed for handling the Switch-to-Switch transfer system introduced in firmware [[4.0.0]].
With newer system-versions this sysmodule is only running when [[qlaunch]] is using migration from the relevant transfer menus (see [[Applet_Manager_services#ActivateMigrationService|ActivateMigrationService]]/[[Applet_Manager_services#DeactivateMigrationService|DeactivateMigrationService]]).


= mig:usr =
= mig:usr =
Line 8: Line 10:
! Cmd || Name
! Cmd || Name
|-
|-
| 10 || TryGetLastMigrationInfo
| 0 || [19.0.0+]
|-
|-
| 100 || [[#CreateServer]]
| 10 || [7.0.0+] TryGetLastUserMigrationInfo ([4.0.0-6.2.0] TryGetLastMigrationInfo)
|-
|-
| 101 || [[#ResumeServer]]
| 100 || [7.0.0+] [[#CreateUserMigrationServer|CreateUserMigrationServer]] ([4.0.0-6.2.0] CreateServer)
|-
|-
| 200 || [[#CreateClient]]
| 101 || [7.0.0+] [[#ResumeUserMigrationServer|ResumeUserMigrationServer]] ([4.0.0-6.2.0] ResumeServer)
|-
|-
| 201 || [[#ResumeClient]]
| 200 || [7.0.0+] [[#CreateUserMigrationClient|CreateUserMigrationClient]] ([4.0.0-6.2.0] CreateClient)
|-
|-
| 1001 || [8.0.0+]  
| 201 || [7.0.0+] [[#ResumeUserMigrationClient|ResumeUserMigrationClient]] ([4.0.0-6.2.0] ResumeClient)
|-
|-
| 1010 || [7.0.0+]
| 1001 || [8.0.0+] [[#GetSaveDataMigrationPolicyInfoAsync|GetSaveDataMigrationPolicyInfoAsync]]
|-
|-
| 1100 || [7.0.0+]
| 1010 || [7.0.0+] TryGetLastSaveDataMigrationInfo
|-
|-
| 1101 || [7.0.0+]
| 1100 || [7.0.0+] [[#CreateSaveDataMigrationServer|CreateSaveDataMigrationServer]]
|-
| 1101 || [7.0.0+] [[#ResumeSaveDataMigrationServer|ResumeSaveDataMigrationServer]]
|-
|-
| 1110 || [17.0.0+]
| 1110 || [17.0.0+]
|-
|-
| 1200 || [7.0.0+]
| 1200 || [7.0.0+] [[#CreateSaveDataMigrationClient|CreateSaveDataMigrationClient]]
|-
|-
| 1201 || [7.0.0+]
| 1201 || [7.0.0+] [[#ResumeSaveDataMigrationClient|ResumeSaveDataMigrationClient]]
|}
|}


== CreateServer ==
== CreateUserMigrationServer ==
Takes a total of 0x18-bytes of input, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IServer]].
Takes a total of 0x18-bytes of input, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IServer]].


== ResumeServer ==
== ResumeUserMigrationServer ==
Takes an input u32, a TransferMemory handle, returns an [[#IServer]].
Takes an input u32, a TransferMemory handle, returns an [[#IServer]].


== CreateClient ==
== CreateUserMigrationClient ==
Takes an input u32, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IClient]].
Takes an input u32, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IClient]].


== ResumeClient ==
== ResumeUserMigrationClient ==
Takes an input u32, a TransferMemory handle, returns an [[#IClient]].
Takes an input u32, a TransferMemory handle, returns an [[#IClient]].


== Cmd1001 ==
== GetSaveDataMigrationPolicyInfoAsync ==
Takes a total of 8-bytes of input, returns an [[#IAsyncSaveDataMigrationPolicyInfoContext]].
Takes an [[NCM_services#ApplicationId|ApplicationId]], returns an [[#IAsyncSaveDataMigrationPolicyInfoContext]].


== Cmd1100 ==
This is used by [[qlaunch]] before the actual savedata transfer is started.
 
This starts a network request for [[Network|save_data_migration_policy]].
 
== CreateSaveDataMigrationServer ==
Takes a total of 0x20-bytes of input, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IServer_2|IServer]].
Takes a total of 0x20-bytes of input, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IServer_2|IServer]].


== Cmd1101 ==
== ResumeSaveDataMigrationServer ==
Takes an input u32, a TransferMemory handle, returns an [[#IServer_2|IServer]].
Takes an input u32, a TransferMemory handle, returns an [[#IServer_2|IServer]].


== Cmd1200 ==
== Cmd1110 ==
Takes a total of 0x18-bytes of input, a type-0x19 input buffer, a type-0x5 input buffer containing an array of u64s, and a TransferMemory handle. Returns an [[#IServer_2|IServer]].
 
This is identical to [[#CreateSaveDataMigrationServer|CreateSaveDataMigrationServer]] except the u64-array is passed directly instead of from a single input u64.
 
== CreateSaveDataMigrationClient ==
Takes an input u32, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IClient_2|IClient]].
Takes an input u32, a type-0x19 input buffer, a TransferMemory handle, returns an [[#IClient_2|IClient]].


== Cmd1201 ==
== ResumeSaveDataMigrationClient ==
Takes an input u32, a TransferMemory handle, returns an [[#IClient_2|IClient]].
Takes an input u32, a TransferMemory handle, returns an [[#IClient_2|IClient]].


Line 88: Line 101:
|-
|-
| 500 || Abort
| 500 || Abort
|-
|}
|}


Line 137: Line 149:
|-
|-
| 999 || DebugSynchronizeStateInFinalizationAsync
| 999 || DebugSynchronizeStateInFinalizationAsync
|-
|}
|}


Line 154: Line 165:
|-
|-
| 3 || GetResult
| 3 || GetResult
|-
|}
|}


Line 164: Line 174:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||  
| 0 || GetSystemEvent
|-
|-
| 1 ||  
| 1 || Cancel
|-
|-
| 2 ||  
| 2 || HasDone
|-
|-
| 3 ||  
| 3 || GetResult
|-
|-
| 100 ||  
| 100 || GetSaveDataMigrationPolicyInfo
|}
|}


Line 184: Line 194:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||  
| 0 || GetUid
|-
|-
| 1 ||  
| 1 || GetApplicationId
|-
|-
| 2 ||  
| 2 || GetServerProfile
|-
|-
| 3 || [17.0.0+]
| 3 || [17.0.0+] ListApplicationIds
|-
|-
| 100 ||  
| 100 || [[#PrepareAsync|PrepareAsync]]
|-
|-
| 101 ||  
| 101 || GetConnectionRequirement
|-
|-
| 200 ||  
| 200 || WaitConnectionAsync
|-
|-
| 201 ||  
| 201 || GetClientProfile
|-
|-
| 210 || [8.0.0+]
| 210 || [8.0.0+] WaitAcceptanceAsync
|-
|-
| 300 ||  
| 300 || ProcessTransferAsync
|-
|-
| 400 ||  
| 400 || CompleteAsync
|-
|-
| 500 ||  
| 500 || Abort
|-
|-
| 998 || [8.0.0+]
| 510 || [19.0.0+]
|-
|-
| 999 || [8.0.0+]
| 998 || [8.0.0+] DebugTryGetState
|-
|-
| 999 || [8.0.0+] DebugWaitStateSynchronizationFinalizedAsync
|}
|}
=== PrepareAsync ===
No input, returns an [[#IAsyncContext|IAsyncContext]].
Besides various other functionality, the async task also uses functionality similar to [[#GetSaveDataMigrationPolicyInfoAsync|GetSaveDataMigrationPolicyInfoAsync]], throwing an error if needed.


== IClient ==
== IClient ==
Line 223: Line 239:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||  
| 0 || GetClientProfile
|-
|-
| 100 ||  
| 100 || GetConnectionRequirement
|-
|-
| 200 ||  
| 200 || ScanServersAsync
|-
|-
| 201 ||  
| 201 || ListServers
|-
|-
| 210 ||  
| 210 || ConnectByServerIdAsync
|-
|-
| 220 || [8.0.0+]
| 220 || [8.0.0+] AcceptAsync
|-
|-
| 221 || [8.0.0+]
| 221 || [8.0.0+] DeclineAsync
|-
|-
| 300 ||  
| 300 || GetStorageShortfall
|-
|-
| 301 ||  
| 301 || GetTotalTransferInfo
|-
|-
| 302 ||  
| 302 || GetImmigrantUid
|-
|-
| 303 ||  
| 303 || GetApplicationId
|-
|-
| 304 || [17.0.0+]
| 304 || [17.0.0+] ListApplicationIds
|-
|-
| 310 ||  
| 310 || GetCurrentTransferInfo
|-
|-
| 320 ||  
| 320 || TransferNextAsync
|-
|-
| 350 ||  
| 350 || SuspendAsync
|-
|-
| 400 ||  
| 400 || CompleteAsync
|-
|-
| 500 ||  
| 500 || Abort
|-
|-
| 996 || [8.0.0+]
| 510 || [19.0.0+]
|-
|-
| 997 || [8.0.0+]
| 996 || [8.0.0+] DebugTryGetState
|-
|-
| 998 || [8.0.0+]
| 997 || [8.0.0+] DebugSynchronizeStateInFinalization0Async
|-
|-
| 999 ||  
| 998 || [8.0.0+] DebugSynchronizeStateInFinalization1Async
|-
|-
| 999 || DebugSynchronizeStateFinalizedAsync
|}
|}
= Notes =
Savedata transfer ("nn::migration::savedata::IServer"/"nn::migration::savedata::IClient") requires that accounts are linked to the same network-account. acc:su [[NS_services#IManagerForSystemService|IManagerForSystemService]] GetAccountId is used here. The server stores this Id into state, and also stores it in the [[LDN_services|ldn]] AdvertiseData. The client also verifies the Id in AdvertiseData against the Id from GetAccountId for the account(s) being used, during ScanServersAsync.


[[Category:Services]]
[[Category:Services]]