general: Remove MakeResult helpers

This is made obsolete by the presence of implicit constructors.
This commit is contained in:
Morph
2021-11-02 17:23:19 -04:00
parent 98b351758c
commit cb09ea0f01
13 changed files with 48 additions and 69 deletions

View File

@ -226,11 +226,10 @@ ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::
}
if (mode == FileSys::Mode::Append) {
return MakeResult<FileSys::VirtualFile>(
std::make_shared<FileSys::OffsetVfsFile>(file, 0, file->GetSize()));
return std::make_shared<FileSys::OffsetVfsFile>(file, 0, file->GetSize());
}
return MakeResult<FileSys::VirtualFile>(file);
return file;
}
ResultVal<FileSys::VirtualDir> VfsDirectoryServiceWrapper::OpenDirectory(const std::string& path_) {
@ -240,7 +239,7 @@ ResultVal<FileSys::VirtualDir> VfsDirectoryServiceWrapper::OpenDirectory(const s
// TODO(DarkLordZach): Find a better error code for this
return FileSys::ERROR_PATH_NOT_FOUND;
}
return MakeResult(dir);
return dir;
}
ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
@ -252,12 +251,12 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
auto filename = Common::FS::GetFilename(path);
// TODO(Subv): Some games use the '/' path, find out what this means.
if (filename.empty())
return MakeResult(FileSys::EntryType::Directory);
return FileSys::EntryType::Directory;
if (dir->GetFile(filename) != nullptr)
return MakeResult(FileSys::EntryType::File);
return FileSys::EntryType::File;
if (dir->GetSubdirectory(filename) != nullptr)
return MakeResult(FileSys::EntryType::Directory);
return FileSys::EntryType::Directory;
return FileSys::ERROR_PATH_NOT_FOUND;
}
@ -270,7 +269,7 @@ ResultVal<FileSys::FileTimeStampRaw> VfsDirectoryServiceWrapper::GetFileTimeStam
if (GetEntryType(path).Failed()) {
return FileSys::ERROR_PATH_NOT_FOUND;
}
return MakeResult(dir->GetFileTimeStamp(Common::FS::GetFilename(path)));
return dir->GetFileTimeStamp(Common::FS::GetFilename(path));
}
FileSystemController::FileSystemController(Core::System& system_) : system{system_} {}
@ -395,7 +394,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenSaveDataSpace(
return FileSys::ERROR_ENTITY_NOT_FOUND;
}
return MakeResult(save_data_factory->GetSaveDataSpaceDirectory(space));
return save_data_factory->GetSaveDataSpaceDirectory(space);
}
ResultVal<FileSys::VirtualDir> FileSystemController::OpenSDMC() const {
@ -421,7 +420,7 @@ ResultVal<FileSys::VirtualDir> FileSystemController::OpenBISPartition(
return FileSys::ERROR_INVALID_ARGUMENT;
}
return MakeResult<FileSys::VirtualDir>(std::move(part));
return part;
}
ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage(
@ -437,7 +436,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage(
return FileSys::ERROR_INVALID_ARGUMENT;
}
return MakeResult<FileSys::VirtualFile>(std::move(part));
return part;
}
u64 FileSystemController::GetFreeSpaceSize(FileSys::StorageId id) const {

View File

@ -26,7 +26,7 @@ ResultVal<ApplicationLaunchProperty> ARPManager::GetLaunchProperty(u64 title_id)
return ERR_NOT_REGISTERED;
}
return MakeResult<ApplicationLaunchProperty>(iter->second.launch);
return iter->second.launch;
}
ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
@ -39,7 +39,7 @@ ResultVal<std::vector<u8>> ARPManager::GetControlProperty(u64 title_id) const {
return ERR_NOT_REGISTERED;
}
return MakeResult<std::vector<u8>>(iter->second.control);
return iter->second.control;
}
ResultCode ARPManager::Register(u64 title_id, ApplicationLaunchProperty launch,

View File

@ -335,7 +335,7 @@ public:
CASCADE_CODE(result);
if (ValidateRegionForMap(page_table, addr, size)) {
return MakeResult<VAddr>(addr);
return addr;
}
}
@ -371,7 +371,7 @@ public:
}
if (ValidateRegionForMap(page_table, addr, size)) {
return MakeResult<VAddr>(addr);
return addr;
}
}

View File

@ -443,14 +443,14 @@ ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_
std::vector<MiiInfoElement> result;
if ((source_flag & SourceFlag::Default) == SourceFlag::None) {
return MakeResult(std::move(result));
return result;
}
for (std::size_t index = BaseMiiCount; index < DefaultMiiCount; index++) {
result.emplace_back(BuildDefault(index), Source::Default);
}
return MakeResult(std::move(result));
return result;
}
ResultCode MiiManager::GetIndex([[maybe_unused]] const MiiInfo& info, u32& index) {

View File

@ -414,7 +414,7 @@ ResultVal<u8> IApplicationManagerInterface::GetApplicationDesiredLanguage(
for (const auto lang : *priority_list) {
const auto supported_flag = GetSupportedLanguageFlag(lang);
if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) {
return MakeResult(static_cast<u8>(lang));
return static_cast<u8>(lang);
}
}
@ -448,7 +448,7 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
return ERR_APPLICATION_LANGUAGE_NOT_FOUND;
}
return MakeResult(static_cast<u64>(*language_code));
return static_cast<u64>(*language_code);
}
IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_)

View File

@ -87,7 +87,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
auto handler = it->second;
port->GetServerPort().SetSessionHandler(std::move(handler));
return MakeResult(port);
return port;
}
/**
@ -165,7 +165,7 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());
return MakeResult(session);
return session;
}
void SM::RegisterService(Kernel::HLERequestContext& ctx) {

View File

@ -120,40 +120,40 @@ ResultVal<u64> Module::Interface::GetConfigImpl(ConfigItem config_item) const {
return ResultSecureMonitorNotImplemented;
case ConfigItem::ExosphereApiVersion:
// Get information about the current exosphere version.
return MakeResult((u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) |
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) |
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) |
(static_cast<u64>(HLE::ApiVersion::GetTargetFirmware())));
return (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) |
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) |
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) |
(static_cast<u64>(HLE::ApiVersion::GetTargetFirmware()));
case ConfigItem::ExosphereNeedsReboot:
// We are executing, so we aren't in the process of rebooting.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereNeedsShutdown:
// We are executing, so we aren't in the process of shutting down.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereGitCommitHash:
// Get information about the current exosphere git commit hash.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereHasRcmBugPatch:
// Get information about whether this unit has the RCM bug patched.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereBlankProdInfo:
// Get whether this unit should simulate a "blanked" PRODINFO.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereAllowCalWrites:
// Get whether this unit should allow writing to the calibration partition.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereEmummcType:
// Get what kind of emummc this unit has active.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExospherePayloadAddress:
// Gets the physical address of the reboot payload buffer, if one exists.
return ResultSecureMonitorNotInitialized;
case ConfigItem::ExosphereLogConfiguration:
// Get the log configuration.
return MakeResult(u64{0});
return u64{0};
case ConfigItem::ExosphereForceEnableUsb30:
// Get whether usb 3.0 should be force-enabled.
return MakeResult(u64{0});
return u64{0};
default:
return ResultSecureMonitorInvalidArgument;
}

View File

@ -1284,15 +1284,15 @@ private:
static ResultVal<ConvertedScaleMode> ConvertScalingModeImpl(NintendoScaleMode mode) {
switch (mode) {
case NintendoScaleMode::None:
return MakeResult(ConvertedScaleMode::None);
return ConvertedScaleMode::None;
case NintendoScaleMode::Freeze:
return MakeResult(ConvertedScaleMode::Freeze);
return ConvertedScaleMode::Freeze;
case NintendoScaleMode::ScaleToWindow:
return MakeResult(ConvertedScaleMode::ScaleToWindow);
return ConvertedScaleMode::ScaleToWindow;
case NintendoScaleMode::ScaleAndCrop:
return MakeResult(ConvertedScaleMode::ScaleAndCrop);
return ConvertedScaleMode::ScaleAndCrop;
case NintendoScaleMode::PreserveAspectRatio:
return MakeResult(ConvertedScaleMode::PreserveAspectRatio);
return ConvertedScaleMode::PreserveAspectRatio;
default:
LOG_ERROR(Service_VI, "Invalid scaling mode specified, mode={}", mode);
return ERR_OPERATION_FAILED;