Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[fs] Add known FileSystemAttribute struct fields (from libhac) (#3275)

Maufeateb7f74ce979c
diff --git a/src/core/file_sys/fs_filesystem.h b/src/core/file_sys/fs_filesystem.h
index 329b5aca57..e895502e9a 100644
--- a/src/core/file_sys/fs_filesystem.h
+++ b/src/core/file_sys/fs_filesystem.h
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -43,17 +46,31 @@ struct FileSystemAttribute {
u8 file_entry_name_length_max_defined;
u8 dir_path_name_length_max_defined;
u8 file_path_name_length_max_defined;
- INSERT_PADDING_BYTES_NOINIT(0x5);
+
+ u8 utf16_create_dir_path_len_max_defined;
+ u8 utf16_delete_dir_path_len_max_defined;
+ u8 utf16_rename_src_dir_path_len_max_defined;
+ u8 utf16_rename_dest_dir_path_len_max_defined;
+ u8 utf16_open_dir_path_len_max_defined;
+
u8 utf16_dir_entry_name_length_max_defined;
u8 utf16_file_entry_name_length_max_defined;
u8 utf16_dir_path_name_length_max_defined;
u8 utf16_file_path_name_length_max_defined;
+
INSERT_PADDING_BYTES_NOINIT(0x18);
+
s32 dir_entry_name_length_max;
s32 file_entry_name_length_max;
s32 dir_path_name_length_max;
s32 file_path_name_length_max;
- INSERT_PADDING_WORDS_NOINIT(0x5);
+
+ s32 utf16_create_dir_path_length_max;
+ s32 utf16_delete_dir_path_length_max;
+ s32 utf16_rename_src_dir_path_length_max;
+ s32 utf16_rename_dest_dir_path_length_max;
+ s32 utf16_open_dir_path_length_max;
+
s32 utf16_dir_entry_name_length_max;
s32 utf16_file_entry_name_length_max;
s32 utf16_dir_path_name_length_max;
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
index 352b8f77b0..0638111ae9 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
+++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
@@ -163,11 +163,42 @@ Result IFileSystem::GetFileTimeStampRaw(
Result IFileSystem::GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute) {
LOG_WARNING(Service_FS, "(STUBBED) called");
+ constexpr s32 kEntryNameLengthMax = 0x80;
+ constexpr s32 kPathLengthMax = 0x300;
+
FileSys::FileSystemAttribute savedata_attribute{};
+
savedata_attribute.dir_entry_name_length_max_defined = true;
savedata_attribute.file_entry_name_length_max_defined = true;
- savedata_attribute.dir_entry_name_length_max = 0x40;
- savedata_attribute.file_entry_name_length_max = 0x40;
+ savedata_attribute.dir_path_name_length_max_defined = true;
+ savedata_attribute.file_path_name_length_max_defined = true;
+
+ savedata_attribute.utf16_create_dir_path_len_max_defined = true;
+ savedata_attribute.utf16_delete_dir_path_len_max_defined = true;
+ savedata_attribute.utf16_rename_src_dir_path_len_max_defined = true;
+ savedata_attribute.utf16_rename_dest_dir_path_len_max_defined = true;
+ savedata_attribute.utf16_open_dir_path_len_max_defined = true;
+
+ savedata_attribute.utf16_dir_entry_name_length_max_defined = true;
+ savedata_attribute.utf16_file_entry_name_length_max_defined = true;
+ savedata_attribute.utf16_dir_path_name_length_max_defined = true;
+ savedata_attribute.utf16_file_path_name_length_max_defined = true;
+
+ savedata_attribute.dir_entry_name_length_max = kEntryNameLengthMax;
+ savedata_attribute.file_entry_name_length_max = kEntryNameLengthMax;
+ savedata_attribute.dir_path_name_length_max = kPathLengthMax;
+ savedata_attribute.file_path_name_length_max = kPathLengthMax;
+
+ savedata_attribute.utf16_create_dir_path_length_max = kPathLengthMax;
+ savedata_attribute.utf16_delete_dir_path_length_max = kPathLengthMax;
+ savedata_attribute.utf16_rename_src_dir_path_length_max = kPathLengthMax;
+ savedata_attribute.utf16_rename_dest_dir_path_length_max = kPathLengthMax;
+ savedata_attribute.utf16_open_dir_path_length_max = kPathLengthMax;
+
+ savedata_attribute.utf16_dir_entry_name_length_max = kEntryNameLengthMax;
+ savedata_attribute.utf16_file_entry_name_length_max = kEntryNameLengthMax;
+ savedata_attribute.utf16_dir_path_name_length_max = kPathLengthMax;
+ savedata_attribute.utf16_file_path_name_length_max = kPathLengthMax;
*out_attribute = savedata_attribute;
R_SUCCEED();