summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2024-01-18 21:55:15 +0100
committerLiam <byteslice@airmail.cc>2024-01-25 22:42:06 +0100
commitc60ab6bbf61021e247c2574a771d3d88a77ed398 (patch)
tree27e6b6b5d6afaabb7c6d1ba93ad63f140a70a65c /src/core/hle
parentfs: Replace Mode enum by OpenMode enum (diff)
downloadyuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar.gz
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar.bz2
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar.lz
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar.xz
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.tar.zst
yuzu-c60ab6bbf61021e247c2574a771d3d88a77ed398.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp38
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_file.cpp8
-rw-r--r--src/core/hle/service/filesystem/fsp/fs_i_storage.cpp4
-rw-r--r--src/core/hle/service/filesystem/fsp/fsp_srv.cpp4
-rw-r--r--src/core/hle/service/filesystem/save_data_controller.cpp6
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp4
6 files changed, 32 insertions, 32 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index eb8c3c23e..ae230afc0 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -52,12 +52,12 @@ Result VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size
std::string path(Common::FS::SanitizePath(path_));
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
if (dir == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
FileSys::DirectoryEntryType entry_type{};
if (GetEntryType(&entry_type, path) == ResultSuccess) {
- return FileSys::ERROR_PATH_ALREADY_EXISTS;
+ return FileSys::ResultPathAlreadyExists;
}
auto file = dir->CreateFile(Common::FS::GetFilename(path));
@@ -81,7 +81,7 @@ Result VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const {
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
if (dir == nullptr || dir->GetFile(Common::FS::GetFilename(path)) == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
if (!dir->DeleteFile(Common::FS::GetFilename(path))) {
// TODO(DarkLordZach): Find a better error code for this
@@ -152,12 +152,12 @@ Result VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
if (Common::FS::GetParentPath(src_path) == Common::FS::GetParentPath(dest_path)) {
// Use more-optimized vfs implementation rename.
if (src == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
if (dst && Common::FS::Exists(dst->GetFullPath())) {
LOG_ERROR(Service_FS, "File at new_path={} already exists", dst->GetFullPath());
- return FileSys::ERROR_PATH_ALREADY_EXISTS;
+ return FileSys::ResultPathAlreadyExists;
}
if (!src->Rename(Common::FS::GetFilename(dest_path))) {
@@ -194,7 +194,7 @@ Result VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_,
if (Common::FS::GetParentPath(src_path) == Common::FS::GetParentPath(dest_path)) {
// Use more-optimized vfs implementation rename.
if (src == nullptr)
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
if (!src->Rename(Common::FS::GetFilename(dest_path))) {
// TODO(DarkLordZach): Find a better error code for this
return ResultUnknown;
@@ -223,7 +223,7 @@ Result VfsDirectoryServiceWrapper::OpenFile(FileSys::VirtualFile* out_file,
auto file = backing->GetFileRelative(npath);
if (file == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
if (mode == FileSys::OpenMode::AllowAppend) {
@@ -241,7 +241,7 @@ Result VfsDirectoryServiceWrapper::OpenDirectory(FileSys::VirtualDir* out_direct
auto dir = GetDirectoryRelativeWrapped(backing, path);
if (dir == nullptr) {
// TODO(DarkLordZach): Find a better error code for this
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
*out_directory = dir;
return ResultSuccess;
@@ -252,7 +252,7 @@ Result VfsDirectoryServiceWrapper::GetEntryType(FileSys::DirectoryEntryType* out
std::string path(Common::FS::SanitizePath(path_));
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
if (dir == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
auto filename = Common::FS::GetFilename(path);
@@ -272,19 +272,19 @@ Result VfsDirectoryServiceWrapper::GetEntryType(FileSys::DirectoryEntryType* out
return ResultSuccess;
}
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
Result VfsDirectoryServiceWrapper::GetFileTimeStampRaw(
FileSys::FileTimeStampRaw* out_file_time_stamp_raw, const std::string& path) const {
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
if (dir == nullptr) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
FileSys::DirectoryEntryType entry_type;
if (GetEntryType(&entry_type, path) != ResultSuccess) {
- return FileSys::ERROR_PATH_NOT_FOUND;
+ return FileSys::ResultPathNotFound;
}
*out_file_time_stamp_raw = dir->GetFileTimeStamp(Common::FS::GetFilename(path));
@@ -317,7 +317,7 @@ Result FileSystemController::OpenProcess(
const auto it = registrations.find(process_id);
if (it == registrations.end()) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
*out_program_id = it->second.program_id;
@@ -360,12 +360,12 @@ Result FileSystemController::OpenSDMC(FileSys::VirtualDir* out_sdmc) const {
LOG_TRACE(Service_FS, "Opening SDMC");
if (sdmc_factory == nullptr) {
- return FileSys::ERROR_SD_CARD_NOT_FOUND;
+ return FileSys::ResultPortSdCardNoDevice;
}
auto sdmc = sdmc_factory->Open();
if (sdmc == nullptr) {
- return FileSys::ERROR_SD_CARD_NOT_FOUND;
+ return FileSys::ResultPortSdCardNoDevice;
}
*out_sdmc = sdmc;
@@ -377,12 +377,12 @@ Result FileSystemController::OpenBISPartition(FileSys::VirtualDir* out_bis_parti
LOG_TRACE(Service_FS, "Opening BIS Partition with id={:08X}", id);
if (bis_factory == nullptr) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
auto part = bis_factory->OpenPartition(id);
if (part == nullptr) {
- return FileSys::ERROR_INVALID_ARGUMENT;
+ return FileSys::ResultInvalidArgument;
}
*out_bis_partition = part;
@@ -394,12 +394,12 @@ Result FileSystemController::OpenBISPartitionStorage(
LOG_TRACE(Service_FS, "Opening BIS Partition Storage with id={:08X}", id);
if (bis_factory == nullptr) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
auto part = bis_factory->OpenPartitionStorage(id, system.GetFilesystem());
if (part == nullptr) {
- return FileSys::ERROR_INVALID_ARGUMENT;
+ return FileSys::ResultInvalidArgument;
}
*out_bis_partition_storage = part;
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp
index 7e0c90a89..9a18f6ec5 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_file.cpp
+++ b/src/core/hle/service/filesystem/fsp/fs_i_file.cpp
@@ -33,13 +33,13 @@ void IFile::Read(HLERequestContext& ctx) {
if (length < 0) {
LOG_ERROR(Service_FS, "Length is less than 0, length={}", length);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_SIZE);
+ rb.Push(FileSys::ResultInvalidSize);
return;
}
if (offset < 0) {
LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_OFFSET);
+ rb.Push(FileSys::ResultInvalidOffset);
return;
}
@@ -66,13 +66,13 @@ void IFile::Write(HLERequestContext& ctx) {
if (length < 0) {
LOG_ERROR(Service_FS, "Length is less than 0, length={}", length);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_SIZE);
+ rb.Push(FileSys::ResultInvalidSize);
return;
}
if (offset < 0) {
LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_OFFSET);
+ rb.Push(FileSys::ResultInvalidOffset);
return;
}
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp
index 9fe36f31a..98223c1f9 100644
--- a/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp
+++ b/src/core/hle/service/filesystem/fsp/fs_i_storage.cpp
@@ -31,13 +31,13 @@ void IStorage::Read(HLERequestContext& ctx) {
if (length < 0) {
LOG_ERROR(Service_FS, "Length is less than 0, length={}", length);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_SIZE);
+ rb.Push(FileSys::ResultInvalidSize);
return;
}
if (offset < 0) {
LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_INVALID_OFFSET);
+ rb.Push(FileSys::ResultInvalidOffset);
return;
}
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
index c35df5530..2be72b021 100644
--- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp
@@ -430,7 +430,7 @@ void FSP_SRV::OpenSaveDataFileSystem(HLERequestContext& ctx) {
save_data_controller->OpenSaveData(&dir, parameters.space_id, parameters.attribute);
if (result != ResultSuccess) {
IPC::ResponseBuilder rb{ctx, 2, 0, 0};
- rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
+ rb.Push(FileSys::ResultTargetNotFound);
return;
}
@@ -597,7 +597,7 @@ void FSP_SRV::OpenPatchDataStorageByCurrentProcess(HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called with storage_id={:02X}, title_id={:016X}", storage_id, title_id);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(FileSys::ERROR_ENTITY_NOT_FOUND);
+ rb.Push(FileSys::ResultTargetNotFound);
}
void FSP_SRV::OpenDataStorageWithProgramIndex(HLERequestContext& ctx) {
diff --git a/src/core/hle/service/filesystem/save_data_controller.cpp b/src/core/hle/service/filesystem/save_data_controller.cpp
index d19b3ea1e..03e45f7f9 100644
--- a/src/core/hle/service/filesystem/save_data_controller.cpp
+++ b/src/core/hle/service/filesystem/save_data_controller.cpp
@@ -44,7 +44,7 @@ Result SaveDataController::CreateSaveData(FileSys::VirtualDir* out_save_data,
auto save_data = factory->Create(space, attribute);
if (save_data == nullptr) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
*out_save_data = save_data;
@@ -56,7 +56,7 @@ Result SaveDataController::OpenSaveData(FileSys::VirtualDir* out_save_data,
const FileSys::SaveDataAttribute& attribute) {
auto save_data = factory->Open(space, attribute);
if (save_data == nullptr) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
*out_save_data = save_data;
@@ -67,7 +67,7 @@ Result SaveDataController::OpenSaveDataSpace(FileSys::VirtualDir* out_save_data_
FileSys::SaveDataSpaceId space) {
auto save_data_space = factory->GetSaveDataSpaceDirectory(space);
if (save_data_space == nullptr) {
- return FileSys::ERROR_ENTITY_NOT_FOUND;
+ return FileSys::ResultTargetNotFound;
}
*out_save_data_space = save_data_space;
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index f40a1c8f3..b527c39a9 100644
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -67,13 +67,13 @@ Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System&
const auto ver_file = romfs->GetFile("file");
if (ver_file == nullptr) {
return early_exit_failure("The system version archive didn't contain the file 'file'.",
- FileSys::ERROR_INVALID_ARGUMENT);
+ FileSys::ResultInvalidArgument);
}
auto data = ver_file->ReadAllBytes();
if (data.size() != sizeof(FirmwareVersionFormat)) {
return early_exit_failure("The system version file 'file' was not the correct size.",
- FileSys::ERROR_OUT_OF_BOUNDS);
+ FileSys::ResultOutOfRange);
}
std::memcpy(&out_firmware, data.data(), sizeof(FirmwareVersionFormat));