ams: use R_DISCARD everywhere
This commit is contained in:
@@ -489,7 +489,7 @@ namespace ams::kvdb {
|
||||
private:
|
||||
Result SaveArchiveToFile(const char *path, const void *buf, size_t size) {
|
||||
/* Try to delete the archive, but allow deletion failure. */
|
||||
fs::DeleteFile(path);
|
||||
R_DISCARD(fs::DeleteFile(path));
|
||||
|
||||
/* Create new archive. */
|
||||
R_TRY(fs::CreateFile(path, size));
|
||||
@@ -514,7 +514,7 @@ namespace ams::kvdb {
|
||||
R_TRY(SaveArchiveToFile(m_temp_path.Get(), buffer.Get(), buffer.GetSize()));
|
||||
|
||||
/* Try to delete the saved archive, but allow deletion failure. */
|
||||
fs::DeleteFile(m_path.Get());
|
||||
R_DISCARD(fs::DeleteFile(m_path.Get()));
|
||||
|
||||
/* Rename the path. */
|
||||
R_TRY(fs::RenameFile(m_temp_path.Get(), m_path.Get()));
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ams::diag::impl {
|
||||
AMS_AUDIT(msg != nullptr || size == 0);
|
||||
|
||||
if (size != 0) {
|
||||
svc::OutputDebugString(msg, size);
|
||||
R_DISCARD(svc::OutputDebugString(msg, size));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,26 +499,26 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
void ClearFsInfo() {
|
||||
Context::ClearContext(CategoryId_NANDTypeInfo);
|
||||
Context::ClearContext(CategoryId_NANDSpeedModeInfo);
|
||||
Context::ClearContext(CategoryId_NANDExtendedCsd);
|
||||
Context::ClearContext(CategoryId_NANDPatrolInfo);
|
||||
Context::ClearContext(CategoryId_NANDErrorInfo);
|
||||
Context::ClearContext(CategoryId_NANDDriverLog);
|
||||
Context::ClearContext(CategoryId_MicroSDTypeInfo);
|
||||
Context::ClearContext(CategoryId_MicroSDSpeedModeInfo);
|
||||
Context::ClearContext(CategoryId_SdCardSizeSpec);
|
||||
Context::ClearContext(CategoryId_SdCardActivationInfo);
|
||||
Context::ClearContext(CategoryId_SdCardErrorInfo);
|
||||
Context::ClearContext(CategoryId_SdCardDriverLog);
|
||||
Context::ClearContext(CategoryId_GameCardCIDInfo);
|
||||
Context::ClearContext(CategoryId_GameCardErrorInfo);
|
||||
Context::ClearContext(CategoryId_GameCardDetailedErrorInfo);
|
||||
Context::ClearContext(CategoryId_GameCardLogInfo);
|
||||
Context::ClearContext(CategoryId_FsProxyErrorInfo);
|
||||
Context::ClearContext(CategoryId_FsProxyErrorInfo2);
|
||||
Context::ClearContext(CategoryId_FsProxyErrorInfo3);
|
||||
Context::ClearContext(CategoryId_FsMemoryInfo);
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDTypeInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDSpeedModeInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDExtendedCsd));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDPatrolInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDErrorInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_NANDDriverLog));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_MicroSDTypeInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_MicroSDSpeedModeInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_SdCardSizeSpec));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_SdCardActivationInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_SdCardErrorInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_SdCardDriverLog));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_GameCardCIDInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_GameCardErrorInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_GameCardDetailedErrorInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_GameCardLogInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_FsProxyErrorInfo));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_FsProxyErrorInfo2));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_FsProxyErrorInfo3));
|
||||
R_DISCARD(Context::ClearContext(CategoryId_FsMemoryInfo));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
} else{
|
||||
/* Pre 21.0.0, Nintendo just calls restore and ignores the result. */
|
||||
Journal::Restore();
|
||||
R_DISCARD(Journal::Restore());
|
||||
}
|
||||
|
||||
Reporter::UpdatePowerOnTime();
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
/* If we have a regulator session, set voltage to 2.9V. */
|
||||
if (m_has_regulator_session) {
|
||||
/* NOTE: Nintendo does not check the result, here. */
|
||||
regulator::SetVoltageValue(std::addressof(m_regulator_session), 2'900'000u);
|
||||
R_DISCARD(regulator::SetVoltageValue(std::addressof(m_regulator_session), 2'900'000u));
|
||||
}
|
||||
|
||||
/* Initialize clock/reset library. */
|
||||
@@ -130,7 +130,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
const bool was_enabled = regulator::GetVoltageEnabled(std::addressof(m_regulator_session));
|
||||
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
regulator::SetVoltageEnabled(std::addressof(m_regulator_session), true);
|
||||
R_DISCARD(regulator::SetVoltageEnabled(std::addressof(m_regulator_session), true));
|
||||
|
||||
/* If we enabled voltage, delay to give our enable time to take. */
|
||||
if (!was_enabled) {
|
||||
@@ -163,7 +163,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
/* If we have a regulator session, disable voltage. */
|
||||
if (m_has_regulator_session) {
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
regulator::SetVoltageEnabled(std::addressof(m_regulator_session), false);
|
||||
R_DISCARD(regulator::SetVoltageEnabled(std::addressof(m_regulator_session), false));
|
||||
}
|
||||
|
||||
/* Finalize the clock/reset library. */
|
||||
@@ -233,7 +233,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
|
||||
/* Disable voltage. */
|
||||
if (m_has_regulator_session) {
|
||||
regulator::SetVoltageEnabled(std::addressof(m_regulator_session), false);
|
||||
R_DISCARD(regulator::SetVoltageEnabled(std::addressof(m_regulator_session), false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
const bool was_enabled = regulator::GetVoltageEnabled(std::addressof(m_regulator_session));
|
||||
|
||||
/* NOTE: Nintendo does not check the result of this call. */
|
||||
regulator::SetVoltageEnabled(std::addressof(m_regulator_session), true);
|
||||
R_DISCARD(regulator::SetVoltageEnabled(std::addressof(m_regulator_session), true));
|
||||
|
||||
/* If we enabled voltage, delay to give our enable time to take. */
|
||||
if (!was_enabled) {
|
||||
@@ -337,7 +337,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
this->SetPacketModeRegisters();
|
||||
|
||||
/* Flush fifos. */
|
||||
this->FlushFifos();
|
||||
R_DISCARD(this->FlushFifos());
|
||||
}
|
||||
|
||||
Result I2cBusAccessor::Send(const u8 *src, size_t src_size, TransactionOption option, u16 slave_address, AddressingMode addressing_mode) {
|
||||
@@ -516,7 +516,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
const u32 slave_addr = ((static_cast<u32>(slave_address) & 0x7F) << 1) | (is_read ? 1 : 0);
|
||||
|
||||
/* Flush fifos. */
|
||||
this->FlushFifos();
|
||||
R_DISCARD(this->FlushFifos());
|
||||
|
||||
/* Enqueue the first header word. */
|
||||
reg::Write(m_registers->tx_packet_fifo, IO_PACKET_BITS_ENUM (HEADER_WORD0_PROT_HDR_SZ, 1_WORD),
|
||||
@@ -765,7 +765,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||
this->SetPacketModeRegisters();
|
||||
|
||||
/* Flush fifos. */
|
||||
this->FlushFifos();
|
||||
R_DISCARD(this->FlushFifos());
|
||||
}
|
||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace ams::kvdb {
|
||||
|
||||
/* Delete the file, if it exists. Don't check result, since it's okay if it's already deleted. */
|
||||
auto key_path = this->GetPath(key, key_size);
|
||||
fs::DeleteFile(key_path);
|
||||
R_DISCARD(fs::DeleteFile(key_path));
|
||||
|
||||
/* Create the new value file. */
|
||||
R_TRY(fs::CreateFile(key_path, value_size));
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ams::lm {
|
||||
}
|
||||
|
||||
void SetDestination(u32 destination) {
|
||||
g_logger->SetDestination(destination);
|
||||
R_DISCARD(g_logger->SetDestination(destination));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace ams::lr {
|
||||
|
||||
/* Refresh the resolver. */
|
||||
if (storage_id != ncm::StorageId::Host) {
|
||||
(*resolver)->Refresh();
|
||||
R_DISCARD((*resolver)->Refresh());
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace ams::ncm {
|
||||
|
||||
if (root.content_storage != nullptr) {
|
||||
/* N doesn't bother checking the result of this. */
|
||||
root.content_storage->DisableForcibly();
|
||||
R_DISCARD(root.content_storage->DisableForcibly());
|
||||
root.content_storage = nullptr;
|
||||
|
||||
if (root.storage_id == StorageId::Host) {
|
||||
@@ -514,7 +514,7 @@ namespace ams::ncm {
|
||||
|
||||
if (root.content_meta_database != nullptr) {
|
||||
/* N doesn't bother checking the result of this. */
|
||||
root.content_meta_database->DisableForcibly();
|
||||
R_DISCARD(root.content_meta_database->DisableForcibly());
|
||||
root.content_meta_database = nullptr;
|
||||
root.kvs = util::nullopt;
|
||||
|
||||
@@ -618,12 +618,12 @@ namespace ams::ncm {
|
||||
|
||||
/* Disable and unmount all content storage roots. */
|
||||
for (size_t i = 0; i < m_num_integrated_content_storage_entries; ++i) {
|
||||
this->InactivateContentStorage(m_integrated_content_storage_roots[i].m_config->storage_id);
|
||||
R_DISCARD(this->InactivateContentStorage(m_integrated_content_storage_roots[i].m_config->storage_id));
|
||||
}
|
||||
|
||||
/* Disable and unmount all content meta database roots. */
|
||||
for (size_t i = 0; i < m_num_integrated_content_meta_entries; ++i) {
|
||||
this->InactivateContentMetaDatabase(m_integrated_content_meta_database_roots[i].m_config->storage_id);
|
||||
R_DISCARD(this->InactivateContentMetaDatabase(m_integrated_content_meta_database_roots[i].m_config->storage_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,7 +796,7 @@ namespace ams::ncm {
|
||||
Result ContentManagerImpl::BuildContentMetaDatabaseImpl(StorageId storage_id) {
|
||||
/* Temporarily activate the database. */
|
||||
R_TRY(this->ActivateContentMetaDatabase(storage_id));
|
||||
ON_SCOPE_EXIT { this->InactivateContentMetaDatabase(storage_id); };
|
||||
ON_SCOPE_EXIT { R_DISCARD(this->InactivateContentMetaDatabase(storage_id)); };
|
||||
|
||||
/* Open the content meta database and storage. */
|
||||
ContentMetaDatabase meta_db;
|
||||
@@ -848,7 +848,7 @@ namespace ams::ncm {
|
||||
if (R_FAILED(this->ActivateContentMetaDatabase(StorageId::BuiltInSystem))) {
|
||||
return true;
|
||||
}
|
||||
ON_SCOPE_EXIT { this->InactivateContentMetaDatabase(StorageId::BuiltInSystem); };
|
||||
ON_SCOPE_EXIT { R_DISCARD(this->InactivateContentMetaDatabase(StorageId::BuiltInSystem)); };
|
||||
|
||||
/* Open the content meta db. */
|
||||
ContentMetaDatabase meta_db;
|
||||
@@ -976,7 +976,7 @@ namespace ams::ncm {
|
||||
/* or an empty kvs, both of which we can fix by performing a rebuild. */
|
||||
if (this->IsNeedRebuildSystemContentMetaDatabase()) {
|
||||
/* Clean up the system content meta database, to ensure creation can succeed. */
|
||||
this->CleanupContentMetaDatabase(StorageId::BuiltInSystem);
|
||||
R_DISCARD(this->CleanupContentMetaDatabase(StorageId::BuiltInSystem));
|
||||
|
||||
/* Create the content meta database. */
|
||||
R_TRY(this->CreateContentMetaDatabase(StorageId::BuiltInSystem));
|
||||
@@ -1005,7 +1005,7 @@ namespace ams::ncm {
|
||||
/* NOTE: Nintendo does not check this succeeds, and it does on older system versions. */
|
||||
/* We will not check the error, either, even though this kind of defeats the call's purpose. */
|
||||
if (hos::GetVersion() >= hos::Version_2_0_0) {
|
||||
EnsureBuiltInSystemSaveDataFlags();
|
||||
R_DISCARD(EnsureBuiltInSystemSaveDataFlags());
|
||||
}
|
||||
|
||||
/* Activate the content meta database. */
|
||||
|
||||
@@ -510,7 +510,7 @@ namespace ams::ncm {
|
||||
PlaceHolderAccessor::MakeBaseDirectoryPath(std::addressof(placeholder_dir), m_root_path);
|
||||
|
||||
/* Cleanup the placeholder base directory. */
|
||||
CleanDirectoryRecursively(placeholder_dir);
|
||||
R_DISCARD(CleanDirectoryRecursively(placeholder_dir));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ams::ncm {
|
||||
void Finalize() {
|
||||
/* If we're unused and mapped, we should unmap. */
|
||||
if (!m_is_using && m_is_mapped) {
|
||||
this->Unmap();
|
||||
R_DISCARD(this->Unmap());
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Cleanup the content meta. */
|
||||
/* N doesn't check the result of this. */
|
||||
this->CleanupOne(content_meta);
|
||||
R_DISCARD(this->CleanupOne(content_meta));
|
||||
}
|
||||
|
||||
/* Cleanup the data and progress. */
|
||||
@@ -215,7 +215,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Delete placeholders for Prepared or Installed content infos. */
|
||||
if (content_info->install_state == InstallState::Prepared || content_info->install_state == InstallState::Installed) {
|
||||
content_storage.DeletePlaceHolder(content_info->placeholder_id);
|
||||
R_DISCARD(content_storage.DeletePlaceHolder(content_info->placeholder_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace ams::ncm {
|
||||
/* Write all prepared content infos. */
|
||||
{
|
||||
/* If we fail while writing, update (but don't check the result). */
|
||||
ON_RESULT_FAILURE { m_data->Update(content_meta, i); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(m_data->Update(content_meta, i)); };
|
||||
|
||||
/* Create a writer. */
|
||||
const auto writer = content_meta.GetWriter();
|
||||
@@ -449,7 +449,7 @@ namespace ams::ncm {
|
||||
/* Commit the current meta. */
|
||||
{
|
||||
/* Ensure that if something goes wrong during commit, we still try to update. */
|
||||
ON_RESULT_FAILURE { m_data->Update(content_meta, i); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(m_data->Update(content_meta, i)); };
|
||||
|
||||
/* Open a writer. */
|
||||
const auto writer = content_meta.GetWriter();
|
||||
@@ -636,7 +636,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Update the data (and check result) when we are done. */
|
||||
{
|
||||
ON_RESULT_FAILURE { m_data->Update(content_meta, i); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(m_data->Update(content_meta, i)); };
|
||||
|
||||
/* Automatically choose a suitable storage id. */
|
||||
auto reader = content_meta.GetReader();
|
||||
@@ -713,7 +713,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Create the placeholder. */
|
||||
R_TRY(storage->CreatePlaceHolder(placeholder_id, meta_info.content_id, meta_info.content_size));
|
||||
ON_RESULT_FAILURE { storage->DeletePlaceHolder(placeholder_id); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(storage->DeletePlaceHolder(placeholder_id)); };
|
||||
|
||||
/* Output install content info. */
|
||||
*out_install_content_info = this->MakeInstallContentInfoFrom(meta_info, placeholder_id, is_temporary);
|
||||
@@ -740,7 +740,7 @@ namespace ams::ncm {
|
||||
content_storage.GetPlaceHolderPath(std::addressof(path), content_info.GetPlaceHolderId());
|
||||
|
||||
/* If we fail, delete the placeholder. */
|
||||
ON_RESULT_FAILURE { content_storage.DeletePlaceHolder(content_info.GetPlaceHolderId()); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(content_storage.DeletePlaceHolder(content_info.GetPlaceHolderId())); };
|
||||
|
||||
/* Create a new temporary InstallContentInfo if relevant. */
|
||||
const bool is_temporary = content_info.is_temporary;
|
||||
@@ -775,7 +775,7 @@ namespace ams::ncm {
|
||||
|
||||
/* If the placeholder is temporary, delete it. */
|
||||
if (is_temporary) {
|
||||
content_storage.DeletePlaceHolder(content_info.GetPlaceHolderId());
|
||||
R_DISCARD(content_storage.DeletePlaceHolder(content_info.GetPlaceHolderId()));
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
@@ -793,7 +793,7 @@ namespace ams::ncm {
|
||||
reader.ConvertToInstallContentMeta(tmp_buffer.Get(), tmp_buffer.GetSize(), InstallContentInfo::Make(ContentInfo::Make(content_id, size, ContentInfo::DefaultContentAttributes, ContentType::Meta), meta_type));
|
||||
|
||||
/* Push the content meta. */
|
||||
m_data->Push(tmp_buffer.Get(), tmp_buffer.GetSize());
|
||||
R_DISCARD(m_data->Push(tmp_buffer.Get(), tmp_buffer.GetSize()));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ namespace ams::ncm {
|
||||
|
||||
Result InstallTaskBase::PrepareSystemUpdateDependency() {
|
||||
/* Cleanup on failure. */
|
||||
ON_RESULT_FAILURE { this->Cleanup(); };
|
||||
ON_RESULT_FAILURE { R_DISCARD(this->Cleanup()); };
|
||||
|
||||
/* Count the number of content meta entries. */
|
||||
s32 count;
|
||||
@@ -1066,7 +1066,7 @@ namespace ams::ncm {
|
||||
|
||||
void InstallTaskBase::SetLastResult(Result last_result) {
|
||||
std::scoped_lock lk(m_progress_mutex);
|
||||
m_data->SetLastResult(last_result);
|
||||
R_DISCARD(m_data->SetLastResult(last_result));
|
||||
m_progress.SetLastResult(last_result);
|
||||
}
|
||||
|
||||
@@ -1183,7 +1183,7 @@ namespace ams::ncm {
|
||||
R_TRY(ReadVariationContentMetaInfoList(out_count, out_meta_infos, path, attr, m_firmware_variation_id));
|
||||
|
||||
/* Delete the placeholder. */
|
||||
content_storage.DeletePlaceHolder(placeholder_id);
|
||||
R_DISCARD(content_storage.DeletePlaceHolder(placeholder_id));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
@@ -1275,7 +1275,7 @@ namespace ams::ncm {
|
||||
|
||||
void InstallTaskBase::SetProgressState(InstallProgressState state) {
|
||||
std::scoped_lock lk(m_progress_mutex);
|
||||
m_data->SetState(state);
|
||||
R_DISCARD(m_data->SetState(state));
|
||||
m_progress.state = state;
|
||||
}
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace ams::ncm {
|
||||
}
|
||||
|
||||
/* NOTE: Nintendo doesn't check that this operation succeeds. */
|
||||
install_task_data.Push(content_meta.data.get(), content_meta.size);
|
||||
R_DISCARD(install_task_data.Push(content_meta.data.get(), content_meta.size));
|
||||
}
|
||||
|
||||
/* Change from our current data to the new data. */
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace ams::ncm {
|
||||
|
||||
/* Remove matching keys. */
|
||||
for (auto i = 0; i < count.total; i++) {
|
||||
meta_db.Remove(keys[i]);
|
||||
R_DISCARD(meta_db.Remove(keys[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace ams::ncm {
|
||||
|
||||
PackageSystemUpdateTask::~PackageSystemUpdateTask() {
|
||||
if (m_context_path.GetLength() > 0) {
|
||||
fs::DeleteFile(m_context_path);
|
||||
R_DISCARD(fs::DeleteFile(m_context_path));
|
||||
}
|
||||
this->Inactivate();
|
||||
}
|
||||
|
||||
void PackageSystemUpdateTask::Inactivate() {
|
||||
if (m_gamecard_content_meta_database_active) {
|
||||
InactivateContentMetaDatabase(StorageId::GameCard);
|
||||
R_DISCARD(InactivateContentMetaDatabase(StorageId::GameCard));
|
||||
m_gamecard_content_meta_database_active = false;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace ams::ncm {
|
||||
auto meta_db_guard = SCOPE_GUARD { this->Inactivate(); };
|
||||
|
||||
/* Open the game card content meta database. */
|
||||
OpenContentMetaDatabase(std::addressof(m_package_db), StorageId::GameCard);
|
||||
R_DISCARD(OpenContentMetaDatabase(std::addressof(m_package_db), StorageId::GameCard));
|
||||
|
||||
ContentMetaDatabaseBuilder builder(std::addressof(m_package_db));
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace ams::ncm {
|
||||
R_TRY(builder.BuildFromPackage(package_root));
|
||||
|
||||
/* Create a new context file. */
|
||||
fs::DeleteFile(context_path);
|
||||
R_DISCARD(fs::DeleteFile(context_path));
|
||||
R_TRY(FileInstallTaskData::Create(context_path, GameCardMaxContentMetaCount));
|
||||
auto context_guard = SCOPE_GUARD { fs::DeleteFile(context_path); };
|
||||
auto context_guard = SCOPE_GUARD { R_DISCARD(fs::DeleteFile(context_path)); };
|
||||
|
||||
/* Initialize data. */
|
||||
R_TRY(m_data.Initialize(context_path));
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ams::ncm {
|
||||
void PlaceHolderAccessor::Invalidate(CacheEntry *entry) {
|
||||
/* Flush and close the cached entry's file. */
|
||||
if (entry != nullptr) {
|
||||
fs::FlushFile(entry->handle);
|
||||
R_DISCARD(fs::FlushFile(entry->handle));
|
||||
fs::CloseFile(entry->handle);
|
||||
entry->id = InvalidPlaceHolderId;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace ams::ncm {
|
||||
R_TRY(m_impl->Initialize());
|
||||
|
||||
/* Initialize parent. N doesn't check the result. */
|
||||
PackageInstallTask::Initialize(impl::GetRootDirectoryPath(m_impl->GetMountName()).str, storage_id, buffer, buffer_size, ignore_ticket);
|
||||
R_DISCARD(PackageInstallTask::Initialize(impl::GetRootDirectoryPath(m_impl->GetMountName()).str, storage_id, buffer, buffer_size, ignore_ticket));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace ams::os::impl {
|
||||
public:
|
||||
DynamicUnitHeap(uintptr_t address, size_t size, size_t unit_size) : m_start(address), m_end(address + size) {
|
||||
/* Allocate the start of our buffer. */
|
||||
VammManagerImpl::AllocatePhysicalMemoryImpl(m_start, PhysicalMemoryUnitSize);
|
||||
R_DISCARD(VammManagerImpl::AllocatePhysicalMemoryImpl(m_start, PhysicalMemoryUnitSize));
|
||||
|
||||
/* Set our current limit. */
|
||||
m_limit = m_start + PhysicalMemoryUnitSize;
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace ams::pgl::srv {
|
||||
const size_t sz = settings::fwdbg::GetSettingsItemValue(std::addressof(enable_application_extra_thread), sizeof(enable_application_extra_thread), "application_extra_thread", "enable_application_extra_thread");
|
||||
if (sz == sizeof(enable_application_extra_thread) && enable_application_extra_thread != 0) {
|
||||
/* NOTE: Nintendo does not check that this succeeds. */
|
||||
pm::shell::BoostApplicationThreadResourceLimit();
|
||||
R_DISCARD(pm::shell::BoostApplicationThreadResourceLimit());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace ams::pgl::srv {
|
||||
const size_t sz = settings::fwdbg::GetSettingsItemValue(std::addressof(enable_system_extra_thread), sizeof(enable_system_extra_thread), "application_extra_thread", "enable_system_extra_thread");
|
||||
if (sz == sizeof(enable_system_extra_thread) && enable_system_extra_thread != 0) {
|
||||
/* NOTE: Nintendo does not check that this succeeds. */
|
||||
pm::shell::BoostSystemThreadResourceLimit();
|
||||
R_DISCARD(pm::shell::BoostSystemThreadResourceLimit());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace ams::pgl::srv {
|
||||
}
|
||||
|
||||
void TriggerSnapShotDumper(os::ProcessId process_id) {
|
||||
TriggerSnapShotDumper(process_id, GetSnapShotDumpType(), nullptr);
|
||||
R_DISCARD(TriggerSnapShotDumper(process_id, GetSnapShotDumpType(), nullptr));
|
||||
}
|
||||
|
||||
s32 GetCrashReportDetailedArgument(u32 data_flags) {
|
||||
@@ -195,8 +195,8 @@ namespace ams::pgl::srv {
|
||||
void TriggerCrashReport(os::ProcessId process_id) {
|
||||
/* If the program that crashed is creport, we should just terminate both processes and return. */
|
||||
if (process_id == g_creport_process_id) {
|
||||
TerminateProcess(g_crashed_process_id);
|
||||
TerminateProcess(g_creport_process_id);
|
||||
R_DISCARD(TerminateProcess(g_crashed_process_id));
|
||||
R_DISCARD(TerminateProcess(g_creport_process_id));
|
||||
g_crashed_process_id = os::InvalidProcessId;
|
||||
g_creport_process_id = os::InvalidProcessId;
|
||||
return;
|
||||
@@ -244,7 +244,7 @@ namespace ams::pgl::srv {
|
||||
if (data != nullptr) {
|
||||
TriggerSnapShotDumper(process_id);
|
||||
} else {
|
||||
TerminateProcess(process_id);
|
||||
R_DISCARD(TerminateProcess(process_id));
|
||||
}
|
||||
} else {
|
||||
/* Otherwise, we want to launch creport. */
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
|
||||
BatteryDevice::BatteryDevice(bool ev) : m_use_event_handler(ev), m_event_handler() {
|
||||
if (m_use_event_handler) {
|
||||
/* Create the system event. */
|
||||
os::CreateSystemEvent(std::addressof(m_system_event), os::EventClearMode_ManualClear, true);
|
||||
R_DISCARD(os::CreateSystemEvent(std::addressof(m_system_event), os::EventClearMode_ManualClear, true));
|
||||
|
||||
/* Create the handler. */
|
||||
m_event_handler.emplace(this);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
|
||||
ChargerDevice::ChargerDevice(bool ev) : m_gpio_pad_session(), m_watchdog_timer_enabled(false), m_watchdog_timer_timeout(0), m_use_event_handler(ev), m_event_handler() {
|
||||
if (m_use_event_handler) {
|
||||
/* Create the system event. */
|
||||
os::CreateSystemEvent(std::addressof(m_system_event), os::EventClearMode_ManualClear, true);
|
||||
R_DISCARD(os::CreateSystemEvent(std::addressof(m_system_event), os::EventClearMode_ManualClear, true));
|
||||
|
||||
/* Create the handler. */
|
||||
m_event_handler.emplace(this);
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
|
||||
void PwmDriverImpl::PowerOff() {
|
||||
/* Disable clock and hold pwm in reset. */
|
||||
/* NOTE: Nintendo does not check this succeeds. */
|
||||
pcv::SetClockEnabled(pcv::Module_Pwm, false);
|
||||
pcv::SetReset(pcv::Module_Pwm, true);
|
||||
R_DISCARD(pcv::SetClockEnabled(pcv::Module_Pwm, false));
|
||||
R_DISCARD(pcv::SetReset(pcv::Module_Pwm, true));
|
||||
|
||||
/* Finalize pcv driver. */
|
||||
pcv::Finalize();
|
||||
@@ -78,9 +78,9 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
|
||||
|
||||
/* Configure initial settings. */
|
||||
/* NOTE: None of these results are checked. */
|
||||
this->SetEnabled(device, false);
|
||||
this->SetScale(device, 0.0);
|
||||
this->SetPeriod(device, DefaultChannelPeriod);
|
||||
R_DISCARD(this->SetEnabled(device, false));
|
||||
R_DISCARD(this->SetScale(device, 0.0));
|
||||
R_DISCARD(this->SetPeriod(device, DefaultChannelPeriod));
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace ams::scs {
|
||||
|
||||
void FlushProgramArgument(ncm::ProgramId program_id) {
|
||||
/* Ensure there are no arguments for the program. */
|
||||
ldr::SetProgramArgument(program_id, "", 1);
|
||||
R_DISCARD(ldr::SetProgramArgument(program_id, "", 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -382,7 +382,7 @@ namespace ams::scs {
|
||||
|
||||
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, const void *args, size_t args_size, u32 process_flags) {
|
||||
/* Set up the arguments. */
|
||||
PrepareToLaunchProgram(loc.program_id, args, args_size);
|
||||
R_DISCARD(PrepareToLaunchProgram(loc.program_id, args, args_size));
|
||||
|
||||
/* Ensure arguments are managed correctly. */
|
||||
ON_SCOPE_EXIT { FlushProgramArgument(loc.program_id); };
|
||||
|
||||
@@ -1167,7 +1167,7 @@ namespace ams::settings::impl {
|
||||
map_value.current_value_size = prev_value_size;
|
||||
map_value.current_value = prev_value;
|
||||
|
||||
SaveKeyValueStoreMap(*map);
|
||||
R_DISCARD(SaveKeyValueStoreMap(*map));
|
||||
};
|
||||
|
||||
/* Attempt to save the key value store map. */
|
||||
@@ -1239,7 +1239,7 @@ namespace ams::settings::impl {
|
||||
std::swap(map_value.current_value_size, value_size);
|
||||
std::swap(map_value.current_value, value_buffer);
|
||||
|
||||
SaveKeyValueStoreMap(*map);
|
||||
R_DISCARD(SaveKeyValueStoreMap(*map));
|
||||
};
|
||||
|
||||
/* Attempt to save the key value store map. */
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace ams::spl::impl {
|
||||
}
|
||||
~ScopedAesKeySlot() {
|
||||
if (m_allocated) {
|
||||
DeallocateAesKeySlot(m_slot_index);
|
||||
R_DISCARD(DeallocateAesKeySlot(m_slot_index));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace ams::spl::impl {
|
||||
void InitializeAsyncOperation() {
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
u64 interrupt_number;
|
||||
impl::GetConfig(std::addressof(interrupt_number), ConfigItem::SecurityEngineInterruptNumber);
|
||||
R_DISCARD(impl::GetConfig(std::addressof(interrupt_number), ConfigItem::SecurityEngineInterruptNumber));
|
||||
g_interrupt_name = static_cast<os::InterruptName>(interrupt_number);
|
||||
|
||||
os::InitializeInterruptEvent(std::addressof(g_interrupt), g_interrupt_name, os::EventClearMode_AutoClear);
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace ams::sprofile::srv {
|
||||
R_UNLESS(!m_profile_importer.has_value(), sprofile::ResultInvalidState());
|
||||
|
||||
/* Try to load profile metadata. NOTE: result is not checked, it is okay if this fails. */
|
||||
this->LoadPrimaryMetadataImpl();
|
||||
R_DISCARD(this->LoadPrimaryMetadataImpl());
|
||||
|
||||
/* Create importer. */
|
||||
m_profile_importer.emplace(m_profile_metadata);
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace ams::usb {
|
||||
R_TRY(m_client->AddInterface(this, std::addressof(m_interface), m_interface_num));
|
||||
|
||||
/* Ensure we cleanup if we fail after this. */
|
||||
auto intf_guard = SCOPE_GUARD { m_client->DeleteInterface(m_interface_num); m_interface = nullptr; };
|
||||
auto intf_guard = SCOPE_GUARD { R_DISCARD(m_client->DeleteInterface(m_interface_num)); m_interface = nullptr; };
|
||||
|
||||
/* Get events. */
|
||||
sf::NativeHandle setup_event_handle;
|
||||
@@ -313,7 +313,7 @@ namespace ams::usb {
|
||||
os::DestroySystemEvent(std::addressof(m_ctrl_out_completion_event));
|
||||
|
||||
/* Delete ourselves from our cleint. */
|
||||
m_client->DeleteInterface(m_interface_num);
|
||||
R_DISCARD(m_client->DeleteInterface(m_interface_num));
|
||||
|
||||
/* Destroy our service. */
|
||||
m_interface = nullptr;
|
||||
@@ -643,7 +643,7 @@ namespace ams::usb {
|
||||
m_address = bEndpointAddress;
|
||||
|
||||
/* Ensure we clean up if we fail after this. */
|
||||
auto ep_guard = SCOPE_GUARD { m_interface->DeleteEndpoint(m_address); m_endpoint = nullptr; };
|
||||
auto ep_guard = SCOPE_GUARD { R_DISCARD(m_interface->DeleteEndpoint(m_address)); m_endpoint = nullptr; };
|
||||
|
||||
/* Get completion event. */
|
||||
sf::NativeHandle event_handle;
|
||||
@@ -672,7 +672,7 @@ namespace ams::usb {
|
||||
R_UNLESS(m_is_initialized, usb::ResultNotInitialized());
|
||||
|
||||
/* Cancel any pending transactions. */
|
||||
m_endpoint->Cancel();
|
||||
R_DISCARD(m_endpoint->Cancel());
|
||||
|
||||
/* Wait for us to be at one reference count. */
|
||||
while (m_reference_count > 1) {
|
||||
|
||||
Reference in New Issue
Block a user