summaryrefslogtreecommitdiff
path: root/src/core/hle/service/fs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/fs.cpp')
-rw-r--r--src/core/hle/service/fs.cpp148
1 files changed, 148 insertions, 0 deletions
diff --git a/src/core/hle/service/fs.cpp b/src/core/hle/service/fs.cpp
new file mode 100644
index 000000000..5eabf36ad
--- /dev/null
+++ b/src/core/hle/service/fs.cpp
@@ -0,0 +1,148 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "common/common.h"
6
7#include "core/loader/loader.h"
8#include "core/hle/hle.h"
9#include "core/hle/service/fs.h"
10#include "core/hle/kernel/archive.h"
11
12////////////////////////////////////////////////////////////////////////////////////////////////////
13// Namespace FS_User
14
15namespace FS_User {
16
17void Initialize(Service::Interface* self) {
18 u32* cmd_buff = Service::GetCommandBuffer();
19 cmd_buff[1] = 0; // No error
20 DEBUG_LOG(KERNEL, "called");
21}
22
23void OpenFileDirectly(Service::Interface* self) {
24 u32* cmd_buff = Service::GetCommandBuffer();
25
26 FileSys::Archive::IdCode arch_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]);
27
28 // TODO(bunnei): Properly implement use of these...
29 //u32 transaction = cmd_buff[1];
30 //u32 arch_lowpath_type = cmd_buff[3];
31 //u32 arch_lowpath_sz = cmd_buff[4];
32 //u32 file_lowpath_type = cmd_buff[5];
33 //u32 file_lowpath_sz = cmd_buff[6];
34 //u32 flags = cmd_buff[7];
35 //u32 attr = cmd_buff[8];
36 //u32 arch_lowpath_desc = cmd_buff[9];
37 //u32 arch_lowpath_ptr = cmd_buff[10];
38 //u32 file_lowpath_desc = cmd_buff[11];
39 //u32 file_lowpath_ptr = cmd_buff[12];
40
41 Handle handle = Kernel::OpenArchive(arch_id);
42 if (0 != handle) {
43 cmd_buff[1] = 0; // No error
44 cmd_buff[3] = handle;
45 }
46 DEBUG_LOG(KERNEL, "called");
47}
48
49const Interface::FunctionInfo FunctionTable[] = {
50 {0x000100C6, nullptr, "Dummy1"},
51 {0x040100C4, nullptr, "Control"},
52 {0x08010002, Initialize, "Initialize"},
53 {0x080201C2, nullptr, "OpenFile"},
54 {0x08030204, OpenFileDirectly, "OpenFileDirectly"},
55 {0x08040142, nullptr, "DeleteFile"},
56 {0x08050244, nullptr, "RenameFile"},
57 {0x08060142, nullptr, "DeleteDirectory"},
58 {0x08070142, nullptr, "DeleteDirectoryRecursively"},
59 {0x08080202, nullptr, "CreateFile"},
60 {0x08090182, nullptr, "CreateDirectory"},
61 {0x080A0244, nullptr, "RenameDirectory"},
62 {0x080B0102, nullptr, "OpenDirectory"},
63 {0x080C00C2, nullptr, "OpenArchive"},
64 {0x080D0144, nullptr, "ControlArchive"},
65 {0x080E0080, nullptr, "CloseArchive"},
66 {0x080F0180, nullptr, "FormatThisUserSaveData"},
67 {0x08100200, nullptr, "CreateSystemSaveData"},
68 {0x08110040, nullptr, "DeleteSystemSaveData"},
69 {0x08120080, nullptr, "GetFreeBytes"},
70 {0x08130000, nullptr, "GetCardType"},
71 {0x08140000, nullptr, "GetSdmcArchiveResource"},
72 {0x08150000, nullptr, "GetNandArchiveResource"},
73 {0x08160000, nullptr, "GetSdmcFatfsErro"},
74 {0x08170000, nullptr, "IsSdmcDetected"},
75 {0x08180000, nullptr, "IsSdmcWritable"},
76 {0x08190042, nullptr, "GetSdmcCid"},
77 {0x081A0042, nullptr, "GetNandCid"},
78 {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
79 {0x081C0000, nullptr, "GetNandSpeedInfo"},
80 {0x081D0042, nullptr, "GetSdmcLog"},
81 {0x081E0042, nullptr, "GetNandLog"},
82 {0x081F0000, nullptr, "ClearSdmcLog"},
83 {0x08200000, nullptr, "ClearNandLog"},
84 {0x08210000, nullptr, "CardSlotIsInserted"},
85 {0x08220000, nullptr, "CardSlotPowerOn"},
86 {0x08230000, nullptr, "CardSlotPowerOff"},
87 {0x08240000, nullptr, "CardSlotGetCardIFPowerStatus"},
88 {0x08250040, nullptr, "CardNorDirectCommand"},
89 {0x08260080, nullptr, "CardNorDirectCommandWithAddress"},
90 {0x08270082, nullptr, "CardNorDirectRead"},
91 {0x082800C2, nullptr, "CardNorDirectReadWithAddress"},
92 {0x08290082, nullptr, "CardNorDirectWrite"},
93 {0x082A00C2, nullptr, "CardNorDirectWriteWithAddress"},
94 {0x082B00C2, nullptr, "CardNorDirectRead_4xIO"},
95 {0x082C0082, nullptr, "CardNorDirectCpuWriteWithoutVerify"},
96 {0x082D0040, nullptr, "CardNorDirectSectorEraseWithoutVerify"},
97 {0x082E0040, nullptr, "GetProductInfo"},
98 {0x082F0040, nullptr, "GetProgramLaunchInfo"},
99 {0x08300182, nullptr, "CreateExtSaveData"},
100 {0x08310180, nullptr, "CreateSharedExtSaveData"},
101 {0x08320102, nullptr, "ReadExtSaveDataIcon"},
102 {0x08330082, nullptr, "EnumerateExtSaveData"},
103 {0x08340082, nullptr, "EnumerateSharedExtSaveData"},
104 {0x08350080, nullptr, "DeleteExtSaveData"},
105 {0x08360080, nullptr, "DeleteSharedExtSaveData"},
106 {0x08370040, nullptr, "SetCardSpiBaudRate"},
107 {0x08380040, nullptr, "SetCardSpiBusMode"},
108 {0x08390000, nullptr, "SendInitializeInfoTo9"},
109 {0x083A0100, nullptr, "GetSpecialContentIndex"},
110 {0x083B00C2, nullptr, "GetLegacyRomHeader"},
111 {0x083C00C2, nullptr, "GetLegacyBannerData"},
112 {0x083D0100, nullptr, "CheckAuthorityToAccessExtSaveData"},
113 {0x083E00C2, nullptr, "QueryTotalQuotaSize"},
114 {0x083F00C0, nullptr, "GetExtDataBlockSize"},
115 {0x08400040, nullptr, "AbnegateAccessRight"},
116 {0x08410000, nullptr, "DeleteSdmcRoot"},
117 {0x08420040, nullptr, "DeleteAllExtSaveDataOnNand"},
118 {0x08430000, nullptr, "InitializeCtrFileSystem"},
119 {0x08440000, nullptr, "CreateSeed"},
120 {0x084500C2, nullptr, "GetFormatInfo"},
121 {0x08460102, nullptr, "GetLegacyRomHeader2"},
122 {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
123 {0x08480042, nullptr, "GetSdmcCtrRootPath"},
124 {0x08490040, nullptr, "GetArchiveResource"},
125 {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
126 {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
127 {0x084C0242, nullptr, "FormatSaveData"},
128 {0x084D0102, nullptr, "GetLegacySubBannerData"},
129 {0x084E0342, nullptr, "UpdateSha256Context"},
130 {0x084F0102, nullptr, "ReadSpecialFile"},
131 {0x08500040, nullptr, "GetSpecialFileSize"},
132 {0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"},
133 {0x08610042, nullptr, "InitializeWithSdkVersion"},
134 {0x08620040, nullptr, "SetPriority"},
135 {0x08630000, nullptr, "GetPriority"},
136};
137
138////////////////////////////////////////////////////////////////////////////////////////////////////
139// Interface class
140
141Interface::Interface() {
142 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
143}
144
145Interface::~Interface() {
146}
147
148} // namespace