Line 1:
Line 1:
−
[[Category:Services]]
−
= Services =
= Services =
+
{{Anchor|FS}}{{Anchor|FSUSER}}{{Anchor|fs:USER}}
== Filesystem service "fs:USER" ==
== Filesystem service "fs:USER" ==
You can at most have 32 FS archive handles.
You can at most have 32 FS archive handles.
Line 554:
Line 553:
| 0x086B00C2
| 0x086B00C2
|?
|?
−
|?
+
|SetOtherSaveDataSecureValue
| 00121004
| 00121004
|-
|-
| 0x086C00C2
| 0x086C00C2
|?
|?
−
|?
+
|GetOtherSaveDataSecureValue
| 00121004
| 00121004
|-
|-
Line 568:
Line 567:
|-
|-
| 0x086E00C0
| 0x086E00C0
−
|?
+
|Related to Secure Value? Used in Pokemon Sun/Moon.
−
|?
+
|SetThisSaveDataSecureValue
|None?
|None?
|-
|-
| 0x086F0040
| 0x086F0040
−
|?
+
|Related to Secure Value? Used in Pokemon Sun/Moon.
−
|?
+
|GetThisSaveDataSecureValue
| 0xE
| 0xE
|-
|-
Line 632:
Line 631:
| 0x00200000
| 0x00200000
|-
|-
−
| 0x087B....
+
| 0x087B0080
| [[9.6.0-24|9.6.0-X]]
| [[9.6.0-24|9.6.0-X]]
−
| Wrapper for the code internally used for command <0x087A....>.
+
| [[FS:GetSeed|GetSeed]]
| 0x00200000
| 0x00200000
|-
|-
−
| 0x087C....
+
| 0x087C0080
| [[9.6.0-24|9.6.0-X]]
| [[9.6.0-24|9.6.0-X]]
−
| Eventually calls same code as command <0x087A....>.
+
| [[FS:DeleteSeed|DeleteSeed]]
| 0x00200000
| 0x00200000
|-
|-
| 0x087D0000
| 0x087D0000
| [[9.6.0-24|9.6.0-X]]
| [[9.6.0-24|9.6.0-X]]
−
| Writes an u32 from state to cmdreply[2]. Probably the total number of titles in the SEEDDB?
+
| [[FS:GetNumSeeds|GetNumSeeds]]
| 0x00200000
| 0x00200000
|-
|-
Line 662:
Line 661:
| 0x00200000
| 0x00200000
|-
|-
−
| 0x0881....
+
| 0x8810080
| [[9.6.0-24|9.6.0-X]]
| [[9.6.0-24|9.6.0-X]]
| Eventually calls same code as command <0x087A....>.
| Eventually calls same code as command <0x087A....>.
Line 699:
Line 698:
Each session for fs:USER has separate permissions, initially these are set to all zero's for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).
Each session for fs:USER has separate permissions, initially these are set to all zero's for new fs:USER sessions. The permissions/etc for fs:USER sessions are initialized via [[FS:Initialize]](loaded from the user process exheader).
+
{{Anchor|FSLDR}}{{Anchor|fs:LDR}}
== Filesystem service "fs:LDR" ==
== Filesystem service "fs:LDR" ==
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.
This service is identical to fs:USER, except [[FS:OpenArchive]] archive 0x2345678E can only be accessed with fs:LDR.
+
{{Anchor|FSReg}}{{Anchor|FSREG}}{{Anchor|fs:REG}}
== ProgramRegistry service "fs:REG" ==
== ProgramRegistry service "fs:REG" ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 734:
Line 735:
=File and directory access=
=File and directory access=
==Files==
==Files==
−
File session handles obtained via [[FS:OpenFile]] et al can be used to access files through a service-like interface, despite not being an actual service registered using [[SRV:RegisterService]].
+
File session handles obtained via [[FS:OpenFile]] and [[FS:OpenFileDirectly]] can be used to access files through a service-like interface, despite not being an actual service registered using [[SRV:RegisterService]]. To use this service-like interface, simply call the SendSyncRequest SVC with a file session handle, using the IPC buffer in thread-local storage for parameters and responses, just like you would with a proper service.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 788:
Line 789:
==Directories==
==Directories==
+
Directory session handles obtained via [[FS:OpenDirectory]] are usable via a service-like interface, following the exact same procedure described above for file sessions.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 831:
Line 833:
|-
|-
| 0x00000003
| 0x00000003
−
| Application [[#RomFS|RomFS]]
+
| SelfNCCH (including [[#RomFS|RomFS]])
| Yes
| Yes
| No
| No
Line 951:
Line 953:
|-
|-
| 0x12345681
| 0x12345681
−
| Unknown. Accessed by FS service.
+
| Used for dumping raw [[System_SaveData|System Save Data]] during system tranfers.
−
| ?
+
| Yes
−
| ?
+
| Yes
| No
| No
−
| ?
+
| Yes
| ?
| ?
|-
|-
Line 1,088:
Line 1,090:
= Filenames and Paths =
= Filenames and Paths =
−
PathType:
+
{{Anchor|PathType}} PathType:
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 1,117:
Line 1,119:
== Binary LowPath ==
== Binary LowPath ==
The format of the data that a binary LowPath points to is custom per archive.
The format of the data that a binary LowPath points to is custom per archive.
+
+
=== SelfNCCH File Path Data Format ===
+
{| class="wikitable" border="1"
+
|-
+
! Index word
+
! Description
+
|-
+
| 0
+
| Type:
+
* 0x0: RomFS
+
* 0x1: error 0xD9004676
+
* 0x2: ExeFS
+
* 0x3: Error 0xE0E046BE.
+
* 0x4: FS-module crashes on this
+
* 0x5: Update RomFS?
+
|-
+
| 1-2
+
| File name for ExeFS ("icon"/"banner"/"logo"). ".code" is not allowed
+
|}
+
+
Note that ExeFS files only support reading from offset=0 and with size=file_size.
=== SystemSaveData Archive Path Data Format ===
=== SystemSaveData Archive Path Data Format ===
Line 1,171:
Line 1,194:
|-
|-
| 1
| 1
−
| Lower word saveid
+
| <code><nowiki>Lower_word_saveid >> 8</nowiki></code> ?
|-
|-
| 2
| 2
−
| Unknown. Game calculate this using formula <code><nowiki>(unknown_a & 0xFFFFFF00) | unknown_b)</nowiki></code>
+
| Unknown. Game calculate this using formula <code><nowiki>0xFFFFFF00 | unknown_b</nowiki></code>
+
|}
+
+
=== 0x12345681 Archive Path Data Format ===
+
Archive path:
+
{| class="wikitable" border="1"
+
|-
+
! Index word !! Description
+
|-
+
| 0 ||
+
{| class="wikitable" border="1"
+
|-
+
! Offset !! Size !! Description
+
|-
+
| 0x0 || 0x1 || Media Type
+
|-
+
| 0x1 || 0x1 || bool, for writing
+
|-
+
| 0x2 || 0x2 || padding
+
|}
+
|}
+
+
File path:
+
{| class="wikitable" border="1"
+
|-
+
! Index word !! Description
+
|-
+
| 0 || [[System_SaveData|System Savedata Save ID]]
+
|-
+
| 1 || 0
|}
|}
Line 1,207:
Line 1,259:
|-
|-
| 2
| 2
−
| [[Mediatypes|Mediatype]]
+
| ([[Mediatypes|Mediatype]] & 0xFF) | (uninitialized_data? & 0xFFFFFF00)
|-
|-
| 3
| 3
−
| Reserved
+
| Number of something? Hardcoded per-archive, 0 for ExeFS, 200 for area:, 100 for rate:, 40 for eula:, etc.
|}
|}
Line 1,237:
Line 1,289:
Archives 0x3 and 0x2345678E both allow for accessing the [[RomFS#Level_3_Format|level-3 IVFC images]] for RomFS access. The main CXI RomFS is accessible via an all-zero 0xc-byte binary file-lowpath. The update RomFS can be accessed with the first u32 in the binary file-lowpath being set to 0x5. The user must handle parsing the filesystem used in the exposed image itself.
Archives 0x3 and 0x2345678E both allow for accessing the [[RomFS#Level_3_Format|level-3 IVFC images]] for RomFS access. The main CXI RomFS is accessible via an all-zero 0xc-byte binary file-lowpath. The update RomFS can be accessed with the first u32 in the binary file-lowpath being set to 0x5. The user must handle parsing the filesystem used in the exposed image itself.
+
+
With FSPXI the returned data for RomFS is the entire RomFS section from the NCCH, starting at the IVFC header.
The 0x3 archive is an interface for the 0x2345678E archive with the current process programID+mediatype. The file lowpath is 3-words. These words are written to 0x2345678E-archive file_lowpath+0, with the rest of that lowpath set to all-zero(lowpath is different from archive 0x2345678A). File lowpath:
The 0x3 archive is an interface for the 0x2345678E archive with the current process programID+mediatype. The file lowpath is 3-words. These words are written to 0x2345678E-archive file_lowpath+0, with the rest of that lowpath set to all-zero(lowpath is different from archive 0x2345678A). File lowpath:
Line 1,291:
Line 1,345:
| SD
| SD
|-
|-
−
| 2
+
| 3
| TWL Photo
| TWL Photo
|}
|}
Line 1,472:
Line 1,526:
| 0x10
| 0x10
| 0x120
| 0x120
−
| The [[nand/private/movable.sed]], encrypted with AES-CTR using the above MAC for the counter.
+
| The [[nand/private/movable.sed]], encrypted with AES-CBC using the above MAC for the counter.
|}
|}
Line 1,609:
Line 1,663:
=Errors=
=Errors=
See [[Filesystem_services_PXI]].
See [[Filesystem_services_PXI]].
+
+
[[Category:Services]]