mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 16:32:05 +00:00
ceci n'est pas une prfile2
This commit is contained in:
parent
c0e3cee657
commit
7418c80e7f
7 changed files with 282 additions and 1 deletions
|
@ -39,3 +39,4 @@
|
||||||
|
|
||||||
#include <vapours/dd.hpp>
|
#include <vapours/dd.hpp>
|
||||||
#include <vapours/sdmmc.hpp>
|
#include <vapours/sdmmc.hpp>
|
||||||
|
#include <vapours/prfile2.hpp>
|
||||||
|
|
24
libraries/libvapours/include/vapours/prfile2.hpp
Normal file
24
libraries/libvapours/include/vapours/prfile2.hpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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/common.hpp>
|
||||||
|
#include <vapours/assert.hpp>
|
||||||
|
#include <vapours/results.hpp>
|
||||||
|
#include <vapours/util.hpp>
|
||||||
|
#include <vapours/svc.hpp>
|
||||||
|
|
||||||
|
#include <vapours/prfile2/prfile2_common.hpp>
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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/prfile2/pf/prfile2_pf_config.hpp>
|
||||||
|
#include <vapours/prfile2/pf/prfile2_pf_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::prfile2::pf {
|
||||||
|
|
||||||
|
int Initialize(u32 config, void *param);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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/prfile2/prfile2_build_config.hpp>
|
||||||
|
|
||||||
|
namespace ams::prfile2::pf {
|
||||||
|
|
||||||
|
constexpr inline const auto MaximumFileCount = 256;
|
||||||
|
constexpr inline const auto MaximumDirectoryCount = 32;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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/prfile2/prfile2_build_config.hpp>
|
||||||
|
|
||||||
|
namespace ams::prfile2::pf {
|
||||||
|
|
||||||
|
enum Error {
|
||||||
|
Error_NoError = 0,
|
||||||
|
Error_Ok = Error_NoError,
|
||||||
|
|
||||||
|
Error_EPERM = 1,
|
||||||
|
Error_ENOENT = 2,
|
||||||
|
Error_ESRCH = 3,
|
||||||
|
Error_EIO = 5,
|
||||||
|
Error_ENOEXEC = 8,
|
||||||
|
Error_EBADF = 9,
|
||||||
|
Error_ENOMEM = 12,
|
||||||
|
Error_EACCES = 13,
|
||||||
|
Error_EBUSY = 16,
|
||||||
|
Error_EEXIST = 17,
|
||||||
|
Error_ENODEV = 19,
|
||||||
|
Error_EISDIR = 21,
|
||||||
|
Error_EINVAL = 22,
|
||||||
|
Error_ENFILE = 23,
|
||||||
|
Error_EMFILE = 24,
|
||||||
|
Error_EFBIG = 27,
|
||||||
|
Error_ENOSPC = 28,
|
||||||
|
Error_ENOLCK = 46,
|
||||||
|
Error_ENOSYS = 88,
|
||||||
|
Error_ENOTEMPTY = 90,
|
||||||
|
|
||||||
|
Error_EMOD_NOTREG = 100,
|
||||||
|
Error_EMOD_NOTSPRT = 101,
|
||||||
|
Error_EMOD_FCS = 102,
|
||||||
|
Error_EMOD_SAFE = 103,
|
||||||
|
|
||||||
|
Error_ENOMEDIUM = 123,
|
||||||
|
|
||||||
|
Error_EEXFAT_NOTSPRT = 200,
|
||||||
|
|
||||||
|
Error_DFNC = 0x1000,
|
||||||
|
|
||||||
|
Error_SYSTEM = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr inline const int ReturnValueNoError = 0;
|
||||||
|
constexpr inline const int ReturnValueError = -1;
|
||||||
|
|
||||||
|
constexpr inline int ConvertReturnValue(Error err) {
|
||||||
|
if (AMS_LIKELY(err == Error_NoError)) {
|
||||||
|
return ReturnValueNoError;
|
||||||
|
} else {
|
||||||
|
return ReturnValueError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* 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/common.hpp>
|
||||||
|
#include <vapours/assert.hpp>
|
||||||
|
#include <vapours/results.hpp>
|
||||||
|
#include <vapours/util.hpp>
|
||||||
|
#include <vapours/svc.hpp>
|
||||||
|
#include <vapours/dd.hpp>
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_IS_EXOSPHERE) || defined(ATMOSPHERE_IS_MESOSPHERE)
|
||||||
|
|
||||||
|
//#define AMS_PRFILE2_THREAD_SAFE
|
||||||
|
|
||||||
|
#elif defined(ATMOSPHERE_IS_MESOSPHERE)
|
||||||
|
|
||||||
|
//#define AMS_PRFILE2_THREAD_SAFE
|
||||||
|
|
||||||
|
#elif defined(ATMOSPHERE_IS_STRATOSPHERE)
|
||||||
|
|
||||||
|
#define AMS_PRFILE2_THREAD_SAFE
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Unknown execution context for ams::prfile2!"
|
||||||
|
#endif
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* 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/prfile2/prfile2_build_config.hpp>
|
||||||
|
#include <vapours/prfile2/pf/prfile2_pf_config.hpp>
|
||||||
|
#include <vapours/prfile2/pf/prfile2_pf_api_common.hpp>
|
||||||
|
|
||||||
|
namespace ams::prfile2 {
|
||||||
|
|
||||||
|
constexpr inline const auto MaximumOpenFileCountSystem = pf::MaximumFileCount;
|
||||||
|
constexpr inline const auto MaximumOpenFileCountUser = pf::MaximumFileCount;
|
||||||
|
constexpr inline const auto MaximumOpenDirectoryCountSystem = pf::MaximumDirectoryCount;
|
||||||
|
constexpr inline const auto MaximumOpenDirectoryCountUser = pf::MaximumDirectoryCount;
|
||||||
|
|
||||||
|
enum InternalError {
|
||||||
|
InternalError_NoError = 0,
|
||||||
|
InternalError_Ok = InternalError_NoError,
|
||||||
|
|
||||||
|
InternalError_Generic = -1,
|
||||||
|
|
||||||
|
InternalError_InvalidFileName = 1,
|
||||||
|
InternalError_InvalidPathName = 2,
|
||||||
|
InternalError_FileNotFound = 3,
|
||||||
|
InternalError_TooManyVolumesAttached = 4,
|
||||||
|
InternalError_DirectoryFull = 5,
|
||||||
|
InternalError_VolumeFull = 6,
|
||||||
|
InternalError_InvalidDiskFormat = 7,
|
||||||
|
InternalError_FileAlreadyExists = 8,
|
||||||
|
InternalError_VolumeNotMounted = 9,
|
||||||
|
InternalError_InvalidParameter = 10,
|
||||||
|
InternalError_WriteProtected = 11,
|
||||||
|
InternalError_UnsupportedFormat = 12,
|
||||||
|
InternalError_BrokenClusterChain = 13,
|
||||||
|
InternalError_InvalidClusterNum = 14,
|
||||||
|
InternalError_InvalidBpb = 15,
|
||||||
|
InternalError_AccessOutOfVolume = 16,
|
||||||
|
InternalError_DriverError = 17,
|
||||||
|
InternalError_InvalidVolumeLabel = 18,
|
||||||
|
InternalError_FileOpened = 19,
|
||||||
|
InternalError_NotADirectory = 20,
|
||||||
|
InternalError_TooManyFilesOpenedS = 21,
|
||||||
|
InternalError_TooManyFilesOpenedU = 22,
|
||||||
|
InternalError_NotAFile = 23,
|
||||||
|
InternalError_ReadOnly = 24,
|
||||||
|
InternalError_LockError = 25,
|
||||||
|
InternalError_InternalError = 26,
|
||||||
|
InternalError_EndOfFile = 27,
|
||||||
|
InternalError_AccessNotAllowed = 28,
|
||||||
|
InternalError_DirectoryNotEmpty = 29,
|
||||||
|
InternalError_NotEnoughCachePages = 30,
|
||||||
|
InternalError_DifferentDrive = 31,
|
||||||
|
InternalError_DifferentEntry = 32,
|
||||||
|
InternalError_InvalidEntry = 33,
|
||||||
|
InternalError_InvalidSector = 34,
|
||||||
|
InternalError_BrokenVolume = 35,
|
||||||
|
InternalError_NotEffective = 36,
|
||||||
|
InternalError_FileSizeOver = 37,
|
||||||
|
InternalError_InvalidFileDiscriptor = 38,
|
||||||
|
InternalError_InvalidLockFile = 39,
|
||||||
|
InternalError_ExtensionNotRegistered = 40,
|
||||||
|
InternalError_ExtensionError = 41,
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr inline const u32 InvalidSector = std::numeric_limits<u32>::max();
|
||||||
|
|
||||||
|
enum OpenMode {
|
||||||
|
OpenMode_None = 0,
|
||||||
|
OpenMode_Write = (1u << 0),
|
||||||
|
OpenMode_Read = (1u << 1),
|
||||||
|
OpenMode_Append = (1u << 2),
|
||||||
|
OpenMode_Plus = (1u << 3),
|
||||||
|
OpenMode_NoOverwrite = (1u << 4),
|
||||||
|
OpenMode_V = (1u << 5),
|
||||||
|
OpenMode_ContCluster = (1u << 6),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FatFormat {
|
||||||
|
FatFormat_Fat12 = 0,
|
||||||
|
FatFormat_Fat16 = 1,
|
||||||
|
FatFormat_Fat32 = 2,
|
||||||
|
FatFormat_ExFat = 3,
|
||||||
|
|
||||||
|
FatFormat_Invalid = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue