diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2024-02-22 12:34:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-22 12:34:47 -0500 |
| commit | d12d9dad4096af6280c6c418cf36a2faacede102 (patch) | |
| tree | ba52bf26efd8b2f7bf282b0564a68870022cccb7 /src/core/file_sys/fssrv | |
| parent | 2b3f1d3fc53c1b7a729c3f1cebbddebcd9427952 (diff) | |
| parent | ef5027712413705802d10c797b0f0b66375a9f58 (diff) | |
Merge pull request #12982 from FearlessTobi/fs-rewrite-part0
fs: Add FileSystemAccessor and use cmif serialization
Diffstat (limited to 'src/core/file_sys/fssrv')
| -rw-r--r-- | src/core/file_sys/fssrv/fssrv_sf_path.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/file_sys/fssrv/fssrv_sf_path.h b/src/core/file_sys/fssrv/fssrv_sf_path.h new file mode 100644 index 000000000..a0c0b2dac --- /dev/null +++ b/src/core/file_sys/fssrv/fssrv_sf_path.h @@ -0,0 +1,36 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/file_sys/fs_directory.h" + +namespace FileSys::Sf { + +struct Path { + char str[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 GetPathLength(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(std::is_trivially_copyable_v<Path>, "Path must be trivially copyable."); + +using FspPath = Path; + +} // namespace FileSys::Sf |
