mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-23 02:42:09 +00:00
htc: add htcfs service api definitions
This commit is contained in:
parent
b898241112
commit
dec06ff649
5 changed files with 148 additions and 0 deletions
|
@ -17,3 +17,4 @@
|
|||
|
||||
#include <stratosphere/tma/tma_i_htc_manager.hpp>
|
||||
#include <stratosphere/tma/tma_i_htcs_manager.hpp>
|
||||
#include <stratosphere/tma/tma_i_file_manager.hpp>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/sf.hpp>
|
||||
#include <stratosphere/fs/fs_directory.hpp>
|
||||
|
||||
/* NOTE: Minimum firmware version not enforced for any commands. */
|
||||
#define AMS_TMA_I_DIRECTORY_ACCESSOR_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, GetEntryCount, (ams::sf::Out<s64> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, Read, (ams::sf::Out<s64> out, const ams::sf::OutMapAliasArray<fs::DirectoryEntry> &out_entries), (out, out_entries)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, SetPriorityForDirectory, (s32 priority), (priority)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, GetPriorityForDirectory, (ams::sf::Out<s32> out), (out))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::tma, IDirectoryAccessor, AMS_TMA_I_DIRECTORY_ACCESSOR_INTERFACE_INFO)
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/sf.hpp>
|
||||
#include <stratosphere/fs/fs_file.hpp>
|
||||
|
||||
/* NOTE: Minimum firmware version not enforced for any commands. */
|
||||
#define AMS_TMA_I_FILE_ACCESSOR_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ReadFile, (ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, ams::fs::ReadOption option), (out, offset, buffer, option)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, WriteFile, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, ams::fs::WriteOption option), (offset, buffer, option)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, GetFileSize, (ams::sf::Out<s64> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, SetFileSize, (s64 size), (size)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 4, Result, FlushFile, (), ()) \
|
||||
AMS_SF_METHOD_INFO(C, H, 5, Result, SetPriorityForFile, (s32 priority), (priority)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 6, Result, GetPriorityForFile, (ams::sf::Out<s32> out), (out))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::tma, IFileAccessor, AMS_TMA_I_FILE_ACCESSOR_INTERFACE_INFO)
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/tma/tma_i_directory_accessor.hpp>
|
||||
#include <stratosphere/tma/tma_i_file_accessor.hpp>
|
||||
#include <stratosphere/tma/tma_path.hpp>
|
||||
|
||||
/* NOTE: Minimum firmware version not enforced for any commands. */
|
||||
#define AMS_TMA_I_FILE_MANAGER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, OpenFile, (sf::Out<sf::SharedPointer<tma::IFileAccessor>> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, FileExists, (sf::Out<bool> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, DeleteFile, (const tma::Path &path, bool case_sensitive), (path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, RenameFile, (const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive), (old_path, new_path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 4, Result, GetIOType, (sf::Out<s32> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 5, Result, OpenDirectory, (sf::Out<sf::SharedPointer<tma::IDirectoryAccessor>> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 6, Result, DirectoryExists, (sf::Out<bool> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 7, Result, CreateDirectory, (const tma::Path &path, bool case_sensitive), (path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 8, Result, DeleteDirectory, (const tma::Path &path, bool case_sensitive), (path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 9, Result, RenameDirectory, (const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive), (old_path, new_path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 10, Result, CreateFile, (const tma::Path &path, s64 size, bool case_sensitive), (path, size, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 11, Result, GetFileTimeStamp, (sf::Out<u64> out_create, sf::Out<u64> out_access, sf::Out<u64> out_modify, const tma::Path &path, bool case_sensitive), (out_create, out_access, out_modify, path, case_sensitive)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 12, Result, GetCaseSensitivePath, (const tma::Path &path, const sf::OutBuffer &out), (path, out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 13, Result, GetDiskFreeSpaceExW, (sf::Out<s64> out_free, sf::Out<s64> out_total, sf::Out<s64> out_total_free, const tma::Path &path), (out_free, out_total, out_total_free, path))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::tma, IFileManager, AMS_TMA_I_FILE_MANAGER_INTERFACE_INFO)
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/fs/fs_common.hpp>
|
||||
#include <stratosphere/fs/fs_directory.hpp>
|
||||
#include <stratosphere/sf/sf_buffer_tags.hpp>
|
||||
|
||||
namespace ams::tma {
|
||||
|
||||
struct Path : ams::sf::LargeData {
|
||||
char str[fs::EntryNameLengthMax + 1];
|
||||
|
||||
static constexpr Path Encode(const char *p) {
|
||||
Path path = {};
|
||||
for (size_t i = 0; i < sizeof(path) - 1; i++) {
|
||||
path.str[i] = p[i];
|
||||
if (p[i] == '\x00') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static constexpr size_t GetLength(const Path &path) {
|
||||
size_t len = 0;
|
||||
for (size_t i = 0; i < sizeof(path) - 1 && path.str[i] != '\x00'; i++) {
|
||||
len++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(util::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax + 1);
|
||||
|
||||
}
|
Loading…
Reference in a new issue