summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2014-10-25 12:39:22 -0400
committerGravatar bunnei2014-10-25 12:39:22 -0400
commitfd7f92d2422058cc2eddbaa4d6c46aaa099c16a1 (patch)
tree4a41ea3070eb25e80b6093b2928c9275de261576
parentMerge pull request #133 from archshift/sdmc-enabled (diff)
parentDon’t fail on empty filename in OpenFileDirectly, return the archive handle... (diff)
downloadyuzu-fd7f92d2422058cc2eddbaa4d6c46aaa099c16a1.tar.gz
yuzu-fd7f92d2422058cc2eddbaa4d6c46aaa099c16a1.tar.xz
yuzu-fd7f92d2422058cc2eddbaa4d6c46aaa099c16a1.zip
Merge pull request #149 from linkmauve/open-file-directly-fix
Don’t fail on empty filename in OpenFileDirectly, return the archive handle instead
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/fs.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/hle/service/fs.cpp b/src/core/hle/service/fs.cpp
index 8469d9840..662c4f247 100644
--- a/src/core/hle/service/fs.cpp
+++ b/src/core/hle/service/fs.cpp
@@ -83,7 +83,7 @@ void OpenFileDirectly(Service::Interface* self) {
83 auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]); 83 auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]);
84 LowPathType archive_type = static_cast<LowPathType>(cmd_buff[3]); 84 LowPathType archive_type = static_cast<LowPathType>(cmd_buff[3]);
85 u32 archive_size = cmd_buff[4]; 85 u32 archive_size = cmd_buff[4];
86 LowPathType type = static_cast<LowPathType>(cmd_buff[5]); 86 LowPathType file_type = static_cast<LowPathType>(cmd_buff[5]);
87 u32 size = cmd_buff[6]; 87 u32 size = cmd_buff[6];
88 FileSys::Mode mode; mode.hex = cmd_buff[7]; 88 FileSys::Mode mode; mode.hex = cmd_buff[7];
89 u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes. 89 u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes.
@@ -96,19 +96,13 @@ void OpenFileDirectly(Service::Interface* self) {
96 return; 96 return;
97 } 97 }
98 98
99 if (type != LowPathType::Char) {
100 ERROR_LOG(KERNEL, "file LowPath type other than char is currently unsupported");
101 cmd_buff[1] = -1;
102 return;
103 }
104
105 std::string archive_name = GetStringFromCmdBuff(archive_pointer, archive_size); 99 std::string archive_name = GetStringFromCmdBuff(archive_pointer, archive_size);
106 std::string file_name = GetStringFromCmdBuff(pointer, size); 100 std::string file_name = GetStringFromCmdBuff(pointer, size);
107 101
108 DEBUG_LOG(KERNEL, "archive_type=%d archive_size=%d archive_data=%s" 102 DEBUG_LOG(KERNEL, "archive_type=%d archive_size=%d archive_data=%s"
109 "file_type=%d file_size=%d file_mode=%d file_attrs=%d file_data=%s", 103 "file_type=%d file_size=%d file_mode=%d file_attrs=%d file_data=%s",
110 archive_type, archive_size, archive_name.c_str(), 104 archive_type, archive_size, archive_name.c_str(),
111 type, size, mode, attributes, file_name.c_str()); 105 file_type, size, mode, attributes, file_name.c_str());
112 106
113 // TODO(Link Mauve): check if we should even get a handle for the archive, and don't leak it. 107 // TODO(Link Mauve): check if we should even get a handle for the archive, and don't leak it.
114 Handle archive_handle = Kernel::OpenArchive(archive_id); 108 Handle archive_handle = Kernel::OpenArchive(archive_id);
@@ -123,6 +117,11 @@ void OpenFileDirectly(Service::Interface* self) {
123 return; 117 return;
124 } 118 }
125 119
120 if (file_type != LowPathType::Char) {
121 WARN_LOG(KERNEL, "file LowPath type other than char is currently unsupported; returning archive handle instead");
122 return;
123 }
124
126 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_name, mode); 125 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_name, mode);
127 if (handle) { 126 if (handle) {
128 cmd_buff[1] = 0; 127 cmd_buff[1] = 0;