diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp index 0b09098d5..567afd8ce 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp @@ -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())); diff --git a/libraries/libstratosphere/source/diag/impl/diag_print_debug_string.os.horizon.cpp b/libraries/libstratosphere/source/diag/impl/diag_print_debug_string.os.horizon.cpp index 55bbcb931..deb5fe51f 100644 --- a/libraries/libstratosphere/source/diag/impl/diag_print_debug_string.os.horizon.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_print_debug_string.os.horizon.cpp @@ -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)); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_fs_info.os.horizon.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_fs_info.os.horizon.cpp index dda71d939..49aeb27ee 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_fs_info.os.horizon.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_fs_info.os.horizon.cpp @@ -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)); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp index 54754cee0..9ecabaf51 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp @@ -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(); diff --git a/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.cpp b/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.cpp index a59c6d65d..50a204e42 100644 --- a/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.cpp +++ b/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.cpp @@ -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(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; } diff --git a/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp b/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp index 955ae0ef0..2e72aaf26 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp @@ -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)); diff --git a/libraries/libstratosphere/source/lm/lm_api.cpp b/libraries/libstratosphere/source/lm/lm_api.cpp index ee4a22e75..15bf66e10 100644 --- a/libraries/libstratosphere/source/lm/lm_api.cpp +++ b/libraries/libstratosphere/source/lm/lm_api.cpp @@ -115,7 +115,7 @@ namespace ams::lm { } void SetDestination(u32 destination) { - g_logger->SetDestination(destination); + R_DISCARD(g_logger->SetDestination(destination)); } } diff --git a/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp b/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp index a7925fa93..c60acdcb5 100644 --- a/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp @@ -88,7 +88,7 @@ namespace ams::lr { /* Refresh the resolver. */ if (storage_id != ncm::StorageId::Host) { - (*resolver)->Refresh(); + R_DISCARD((*resolver)->Refresh()); } R_SUCCEED(); diff --git a/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp index dded90f31..6007b894a 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp @@ -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. */ diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp index db0387503..cc31c7299 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp @@ -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(); } diff --git a/libraries/libstratosphere/source/ncm/ncm_extended_data_mapper.hpp b/libraries/libstratosphere/source/ncm/ncm_extended_data_mapper.hpp index 633ffd809..a4bf6f2bc 100644 --- a/libraries/libstratosphere/source/ncm/ncm_extended_data_mapper.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_extended_data_mapper.hpp @@ -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: diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp index 231d18064..fc1785705 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp @@ -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; } diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp index 362876163..307c63d13 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp @@ -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. */ diff --git a/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp b/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp index f8abab57b..259c99315 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp @@ -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])); } } } diff --git a/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp b/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp index 5332d7e60..2684b98ac 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp @@ -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)); diff --git a/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp b/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp index 4b392c218..b4e360204 100644 --- a/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp @@ -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; } diff --git a/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp b/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp index 6e1be6f24..a9e587e33 100644 --- a/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp @@ -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(); } diff --git a/libraries/libstratosphere/source/os/impl/os_vamm_manager.cpp b/libraries/libstratosphere/source/os/impl/os_vamm_manager.cpp index 7bdfbb2da..ebd8fa719 100644 --- a/libraries/libstratosphere/source/os/impl/os_vamm_manager.cpp +++ b/libraries/libstratosphere/source/os/impl/os_vamm_manager.cpp @@ -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; diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp index 77c4580db..2d0a058db 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp @@ -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()); } } diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp index 2fff47715..76c5c217a 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp @@ -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. */ diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.cpp index 2b4330080..f72a3bad9 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.cpp @@ -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); diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.cpp index 0cf1a6209..2995772b6 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.cpp @@ -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); diff --git a/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_pwm_driver_impl.cpp b/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_pwm_driver_impl.cpp index cc4049e1e..956116890 100644 --- a/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_pwm_driver_impl.cpp +++ b/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_pwm_driver_impl.cpp @@ -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(); } diff --git a/libraries/libstratosphere/source/scs/scs_shell.cpp b/libraries/libstratosphere/source/scs/scs_shell.cpp index 89794ce61..9a1cd336b 100644 --- a/libraries/libstratosphere/source/scs/scs_shell.cpp +++ b/libraries/libstratosphere/source/scs/scs_shell.cpp @@ -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); }; diff --git a/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp b/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp index d15e42c19..e49211e7d 100644 --- a/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp +++ b/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp @@ -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. */ diff --git a/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp b/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp index 93821f85b..820050397 100644 --- a/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp +++ b/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp @@ -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(interrupt_number); os::InitializeInterruptEvent(std::addressof(g_interrupt), g_interrupt_name, os::EventClearMode_AutoClear); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp index 3e2d11e9e..cdd2036f6 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp @@ -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); diff --git a/libraries/libstratosphere/source/usb/usb_device.cpp b/libraries/libstratosphere/source/usb/usb_device.cpp index 15a01d111..491bed2b3 100644 --- a/libraries/libstratosphere/source/usb/usb_device.cpp +++ b/libraries/libstratosphere/source/usb/usb_device.cpp @@ -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) { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_device_detector.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_device_detector.cpp index 48b9a25fc..7fb7210e0 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_device_detector.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_device_detector.cpp @@ -61,7 +61,7 @@ namespace ams::sdmmc::impl { gpio::Initialize(); /* Open and configure the pad session. */ - gpio::OpenSession(std::addressof(m_gpio_pad_session), m_gpio_device_code); + R_DISCARD(gpio::OpenSession(std::addressof(m_gpio_pad_session), m_gpio_device_code)); gpio::SetDirection(std::addressof(m_gpio_pad_session), gpio::Direction_Input); gpio::SetDebounceTime(std::addressof(m_gpio_pad_session), m_gpio_debounce_ms); gpio::SetDebounceEnabled(std::addressof(m_gpio_pad_session), true); @@ -200,7 +200,7 @@ namespace ams::sdmmc::impl { os::InitializeEvent(std::addressof(m_detector_thread_end_event), false, os::EventClearMode_ManualClear); /* Create and start the detector thread. */ - os::CreateThread(std::addressof(m_detector_thread), DetectorThreadEntry, this, m_detector_thread_stack, sizeof(m_detector_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(sdmmc, DeviceDetector)); + R_DISCARD(os::CreateThread(std::addressof(m_detector_thread), DetectorThreadEntry, this, m_detector_thread_stack, sizeof(m_detector_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(sdmmc, DeviceDetector))); os::SetThreadNamePointer(std::addressof(m_detector_thread), AMS_GET_SYSTEM_THREAD_NAME(sdmmc, DeviceDetector)); os::StartThread(std::addressof(m_detector_thread)); } diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.cpp index c3d7a3766..66a9a1806 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.cpp @@ -500,7 +500,7 @@ namespace ams::sdmmc::impl { this->ClearInterrupt(); R_SUCCEED(); } else if (sdmmc::ResultWaitInterruptSoftwareTimeout::Includes(result)) { - SdHostStandardController::AbortTransaction(); + R_DISCARD(SdHostStandardController::AbortTransaction()); R_THROW(sdmmc::ResultIssueTuningCommandSoftwareTimeout()); } else { R_RETURN(result); diff --git a/stratosphere/TioServer/source/tio_file_server_processor.cpp b/stratosphere/TioServer/source/tio_file_server_processor.cpp index 7a1f6e3bb..318fd2936 100644 --- a/stratosphere/TioServer/source/tio_file_server_processor.cpp +++ b/stratosphere/TioServer/source/tio_file_server_processor.cpp @@ -679,7 +679,7 @@ namespace ams::tio { /* NOTE: Nintendo does not check the output of this call. */ s64 read_count = 0; - fs::ReadDirectory(std::addressof(read_count), reinterpret_cast(body), handle, cur); + R_DISCARD(fs::ReadDirectory(std::addressof(read_count), reinterpret_cast(body), handle, cur)); /* Send the current entries. */ const ssize_t cur_size = read_count * sizeof(fs::DirectoryEntry); diff --git a/stratosphere/ams_mitm/source/amsmitm_initialization.cpp b/stratosphere/ams_mitm/source/amsmitm_initialization.cpp index e9979ce52..386048c73 100644 --- a/stratosphere/ams_mitm/source/amsmitm_initialization.cpp +++ b/stratosphere/ams_mitm/source/amsmitm_initialization.cpp @@ -89,7 +89,7 @@ namespace ams::mitm { void CreateAutomaticBackups() { /* Create a backup directory, if one doesn't exist. */ - mitm::fs::CreateAtmosphereSdDirectory("/automatic_backups"); + R_DISCARD(mitm::fs::CreateAtmosphereSdDirectory("/automatic_backups")); /* Initialize PRODINFO and get a reference for the device. */ char device_reference[0x40] = {}; @@ -127,7 +127,7 @@ namespace ams::mitm { char bis_keys_backup_name[ams::fs::EntryNameLengthMax + 1]; GetBackupFileName(bis_keys_backup_name, sizeof(bis_keys_backup_name), device_reference, "BISKEYS.bin"); - mitm::fs::CreateAtmosphereSdFile(bis_keys_backup_name, sizeof(bis_keys), ams::fs::CreateOption_None); + R_DISCARD(mitm::fs::CreateAtmosphereSdFile(bis_keys_backup_name, sizeof(bis_keys), ams::fs::CreateOption_None)); R_ABORT_UNLESS(mitm::fs::OpenAtmosphereSdFile(std::addressof(g_bis_key_file), bis_keys_backup_name, ams::fs::OpenMode_ReadWrite)); R_ABORT_UNLESS(fsFileSetSize(std::addressof(g_bis_key_file), sizeof(bis_keys))); R_ABORT_UNLESS(fsFileWrite(std::addressof(g_bis_key_file), 0, bis_keys, sizeof(bis_keys), FsWriteOption_Flush)); @@ -153,11 +153,11 @@ namespace ams::mitm { mitm::fs::OpenGlobalSdCardFileSystem(); /* Mount the sd card at a convenient mountpoint. */ - ams::fs::MountSdCard(ams::fs::impl::SdCardFileSystemMountName); + R_DISCARD(ams::fs::MountSdCard(ams::fs::impl::SdCardFileSystemMountName)); /* Initialize the reboot manager (load a payload off the SD). */ /* Discard result, since it doesn't need to succeed. */ - mitm::bpc::LoadRebootPayload(); + R_DISCARD(mitm::bpc::LoadRebootPayload()); /* Backup Calibration Binary and BIS keys. */ CreateAutomaticBackups(); @@ -167,7 +167,7 @@ namespace ams::mitm { if (const char *emummc_file_path = emummc::GetFilePath(); emummc_file_path != nullptr) { char emummc_path[ams::fs::EntryNameLengthMax + 1]; util::SNPrintf(emummc_path, sizeof(emummc_path), "%s/eMMC", emummc_file_path); - mitm::fs::OpenSdFile(std::addressof(g_emummc_file), emummc_path, ams::fs::OpenMode_Read); + R_DISCARD(mitm::fs::OpenSdFile(std::addressof(g_emummc_file), emummc_path, ams::fs::OpenMode_Read)); } /* NOTE: due to an Atmosphere bug, NS accesses to the Nintendo dir accessed /Nintendo/Nintendo */ @@ -185,7 +185,7 @@ namespace ams::mitm { /* Ensure Contents directory exists for normal emummc. */ /* NOTE: Allowed to fail on already-exists. */ util::SNPrintf(emummc_path, sizeof(emummc_path), "%s:/%s/Contents", ams::fs::impl::SdCardFileSystemMountName, emummc::GetNintendoDirPath()); - ams::fs::CreateDirectory(emummc_path); + R_DISCARD(ams::fs::CreateDirectory(emummc_path)); /* Fix Contents/private */ util::SNPrintf(emummc_path, sizeof(emummc_path), "%s:/%s/Contents/private", ams::fs::impl::SdCardFileSystemMountName, emummc::GetNintendoDirPath()); diff --git a/stratosphere/ams_mitm/source/amsmitm_prodinfo_utils.cpp b/stratosphere/ams_mitm/source/amsmitm_prodinfo_utils.cpp index 8722877fd..1e419f8f8 100644 --- a/stratosphere/ams_mitm/source/amsmitm_prodinfo_utils.cpp +++ b/stratosphere/ams_mitm/source/amsmitm_prodinfo_utils.cpp @@ -436,7 +436,7 @@ namespace ams::mitm { GetBackupFileName(backup_fn, sizeof(backup_fn), info); /* Create the file, in case it does not exist. */ - mitm::fs::CreateAtmosphereSdFile(backup_fn, sizeof(CalibrationInfo), ams::fs::CreateOption_None); + R_DISCARD(mitm::fs::CreateAtmosphereSdFile(backup_fn, sizeof(CalibrationInfo), ams::fs::CreateOption_None)); /* Open the file. */ FsFile libnx_file; diff --git a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_debug.cpp b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_debug.cpp index 477ac2f98..2c1672a25 100644 --- a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_debug.cpp +++ b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_debug.cpp @@ -40,10 +40,10 @@ namespace ams::mitm::socket::resolver { if (g_log_enabled) { /* Create the logs directory. */ - mitm::fs::CreateAtmosphereSdDirectory("/logs"); + R_DISCARD(mitm::fs::CreateAtmosphereSdDirectory("/logs")); /* Create the log file. */ - mitm::fs::CreateAtmosphereSdFile("/logs/dns_mitm_debug.log", 0, ams::fs::CreateOption_None); + R_DISCARD(mitm::fs::CreateAtmosphereSdFile("/logs/dns_mitm_debug.log", 0, ams::fs::CreateOption_None)); /* Open the log file. */ R_ABORT_UNLESS(mitm::fs::OpenAtmosphereSdFile(std::addressof(g_log_file), "/logs/dns_mitm_debug.log", ams::fs::OpenMode_ReadWrite | ams::fs::OpenMode_AllowAppend)); diff --git a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp index ea6f1eb09..d7364fa60 100644 --- a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp +++ b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_host_redirection.cpp @@ -313,8 +313,8 @@ namespace ams::mitm::socket::resolver { /* Open log file. */ ::FsFile log_file; - mitm::fs::DeleteAtmosphereSdFile("/logs/dns_mitm_startup.log"); - mitm::fs::CreateAtmosphereSdDirectory("/logs"); + R_DISCARD(mitm::fs::DeleteAtmosphereSdFile("/logs/dns_mitm_startup.log")); + R_DISCARD(mitm::fs::CreateAtmosphereSdDirectory("/logs")); R_ABORT_UNLESS(mitm::fs::CreateAtmosphereSdFile("/logs/dns_mitm_startup.log", 0, ams::fs::CreateOption_None)); R_ABORT_UNLESS(mitm::fs::OpenAtmosphereSdFile(std::addressof(log_file), "/logs/dns_mitm_startup.log", ams::fs::OpenMode_ReadWrite | ams::fs::OpenMode_AllowAppend)); ON_SCOPE_EXIT { ::fsFileClose(std::addressof(log_file)); }; @@ -325,7 +325,7 @@ namespace ams::mitm::socket::resolver { if (!mitm::fs::HasAtmosphereSdFile("/hosts/default.txt")) { Log(log_file, "Creating /hosts/default.txt because it does not exist.\n"); - mitm::fs::CreateAtmosphereSdDirectory("/hosts"); + R_DISCARD(mitm::fs::CreateAtmosphereSdDirectory("/hosts")); R_ABORT_UNLESS(mitm::fs::CreateAtmosphereSdFile("/hosts/default.txt", sizeof(DefaultHostsFile) - 1, ams::fs::CreateOption_None)); ::FsFile default_file; diff --git a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_module.cpp b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_module.cpp index 004c3a1c4..5d185cc23 100644 --- a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_module.cpp +++ b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_module.cpp @@ -131,7 +131,7 @@ namespace ams::mitm::socket::resolver { } /* Initialize the socket allocator. */ - ams::socket::InitializeAllocatorForInternal(g_resolver_allocator_buffer, sizeof(g_resolver_allocator_buffer)); + R_DISCARD(ams::socket::InitializeAllocatorForInternal(g_resolver_allocator_buffer, sizeof(g_resolver_allocator_buffer))); /* Initialize debug. */ resolver::InitializeDebug(ShouldEnableDebugLog()); diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp index f82a6e806..adaad71e2 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp @@ -262,7 +262,7 @@ namespace ams::mitm::fs { constexpr const fs::Path root_path = fs::MakeConstantPath("/"); u8 savedata_copy_buffer[2_KB]; - fssystem::CopyDirectoryRecursively(dirsave_ifs.get(), save_ifs.get(), root_path, root_path, std::addressof(work_entry), savedata_copy_buffer, sizeof(savedata_copy_buffer)); + R_DISCARD(fssystem::CopyDirectoryRecursively(dirsave_ifs.get(), save_ifs.get(), root_path, root_path, std::addressof(work_entry), savedata_copy_buffer, sizeof(savedata_copy_buffer))); } /* Set output. */ diff --git a/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp b/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp index 0915a10ab..eacadd8b4 100644 --- a/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp @@ -90,7 +90,7 @@ namespace ams::mitm::settings { } Result SetMitmService::GetLanguageCode(sf::Out out) { - this->EnsureLocale(); + R_DISCARD(this->EnsureLocale()); /* If there's no override locale, just use the actual one. */ if (AMS_UNLIKELY(!m_is_valid_language)) { @@ -109,7 +109,7 @@ namespace ams::mitm::settings { } Result SetMitmService::GetRegionCode(sf::Out out) { - this->EnsureLocale(); + R_DISCARD(this->EnsureLocale()); /* If there's no override locale, just use the actual one. */ if (AMS_UNLIKELY(!m_is_valid_region)) { diff --git a/stratosphere/boot/source/boot_check_battery.cpp b/stratosphere/boot/source/boot_check_battery.cpp index 07fea7065..d6e3ef332 100644 --- a/stratosphere/boot/source/boot_check_battery.cpp +++ b/stratosphere/boot/source/boot_check_battery.cpp @@ -490,7 +490,7 @@ namespace ams::boot { } if (input_current_limit_ma <= 150) { - charger_driver.SetChargerConfiguration(powctl::ChargerConfiguration_ChargeDisable); + R_DISCARD(charger_driver.SetChargerConfiguration(powctl::ChargerConfiguration_ChargeDisable)); boot::ShutdownSystem(); } } diff --git a/stratosphere/boot/source/boot_display.cpp b/stratosphere/boot/source/boot_display.cpp index 52470c972..ee6fdc80a 100644 --- a/stratosphere/boot/source/boot_display.cpp +++ b/stratosphere/boot/source/boot_display.cpp @@ -262,10 +262,10 @@ namespace ams::boot { R_ABORT_UNLESS(i2c::driver::OpenSession(std::addressof(i2c_session), i2c::DeviceCode_Max77620Pmic)); if (g_soc_type == spl::SocType_Mariko) { - WriteI2cRegister(i2c_session, 0x18, 0x3A); - WriteI2cRegister(i2c_session, 0x1F, 0x71); + R_DISCARD(WriteI2cRegister(i2c_session, 0x18, 0x3A)); + R_DISCARD(WriteI2cRegister(i2c_session, 0x1F, 0x71)); } - WriteI2cRegister(i2c_session, 0x23, 0xD0); + R_DISCARD(WriteI2cRegister(i2c_session, 0x23, 0xD0)); i2c::driver::CloseSession(i2c_session); } diff --git a/stratosphere/boot/source/boot_pmic_driver.cpp b/stratosphere/boot/source/boot_pmic_driver.cpp index 2c3d80daf..eb86a0734 100644 --- a/stratosphere/boot/source/boot_pmic_driver.cpp +++ b/stratosphere/boot/source/boot_pmic_driver.cpp @@ -119,7 +119,7 @@ namespace ams::boot { desired_shutdown_enabled &= use_desired_shutdown; if (shutdown_enabled != desired_shutdown_enabled) { - battery_driver.SetI2cShutdownEnabled(desired_shutdown_enabled); + R_DISCARD(battery_driver.SetI2cShutdownEnabled(desired_shutdown_enabled)); } } diff --git a/stratosphere/creport/source/creport_crash_report.cpp b/stratosphere/creport/source/creport_crash_report.cpp index fec6cbc67..6afb794c9 100644 --- a/stratosphere/creport/source/creport_crash_report.cpp +++ b/stratosphere/creport/source/creport_crash_report.cpp @@ -53,8 +53,8 @@ namespace ams::creport { } void TryCreateReportDirectories() { - fs::EnsureDirectory("sdmc:/atmosphere/crash_reports/dumps"); - fs::EnsureDirectory("sdmc:/atmosphere/fatal_reports/dumps"); + R_DISCARD(fs::EnsureDirectory("sdmc:/atmosphere/crash_reports/dumps")); + R_DISCARD(fs::EnsureDirectory("sdmc:/atmosphere/fatal_reports/dumps")); } constexpr const char *GetDebugExceptionString(const svc::DebugException type) { @@ -244,7 +244,7 @@ namespace ams::creport { m_result = creport::ResultUserBreak(); /* Try to parse out the user break result. */ if (hos::GetVersion() >= hos::Version_5_0_0) { - svc::ReadDebugProcessMemory(reinterpret_cast(std::addressof(m_result)), m_debug_handle, d.info.exception.specific.user_break.address, sizeof(m_result)); + R_DISCARD(svc::ReadDebugProcessMemory(reinterpret_cast(std::addressof(m_result)), m_debug_handle, d.info.exception.specific.user_break.address, sizeof(m_result))); } break; case svc::DebugException_UndefinedSystemCall: @@ -289,7 +289,7 @@ namespace ams::creport { } /* Read the dying message. */ - svc::ReadDebugProcessMemory(reinterpret_cast(m_dying_message), m_debug_handle, m_dying_message_address, m_dying_message_size); + R_DISCARD(svc::ReadDebugProcessMemory(reinterpret_cast(m_dying_message), m_debug_handle, m_dying_message_address, m_dying_message_size)); } void CrashReport::SaveReport(bool enable_screenshot) { diff --git a/stratosphere/creport/source/creport_main.cpp b/stratosphere/creport/source/creport_main.cpp index 5e5d38e09..8bcfccec7 100644 --- a/stratosphere/creport/source/creport_main.cpp +++ b/stratosphere/creport/source/creport_main.cpp @@ -123,7 +123,7 @@ namespace ams { if (R_SUCCEEDED(pgl::Initialize())) { ON_SCOPE_EXIT { pgl::Finalize(); }; - pgl::TerminateProcess(crashed_pid); + R_DISCARD(pgl::TerminateProcess(crashed_pid)); } } else { /* Use ns to terminate. */ diff --git a/stratosphere/creport/source/creport_scoped_file.hpp b/stratosphere/creport/source/creport_scoped_file.hpp index 5adcbeb09..dcdd1d773 100644 --- a/stratosphere/creport/source/creport_scoped_file.hpp +++ b/stratosphere/creport/source/creport_scoped_file.hpp @@ -38,9 +38,9 @@ namespace ams::creport { ~ScopedFile() { if (m_opened) { if (m_cache != nullptr) { - this->TryWriteCache(); + R_DISCARD(this->TryWriteCache()); } - fs::FlushFile(m_file); + R_DISCARD(fs::FlushFile(m_file)); fs::CloseFile(m_file); } } diff --git a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager.cpp b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager.cpp index 956226448..99dc434d4 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager.cpp @@ -29,7 +29,7 @@ namespace ams::dmnt { for (size_t i = 0; (bp = static_cast(this->GetBreakPoint(i))) != nullptr; ++i) { if (bp->m_in_use && bp->m_is_step) { AMS_DMNT2_GDB_LOG_DEBUG("BreakPointManager::ClearStep %p 0x%lx (idx=%zu)\n", bp, bp->m_address, i); - bp->Clear(m_debug_process); + R_DISCARD(bp->Clear(m_debug_process)); } } } diff --git a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp index 0819798e3..43022b8b0 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp @@ -28,7 +28,7 @@ namespace ams::dmnt { BreakPointBase *bp = nullptr; for (size_t i = 0; (bp = static_cast(this->GetBreakPoint(i))) != nullptr; ++i) { if (bp->m_in_use) { - bp->Clear(m_debug_process); + R_DISCARD(bp->Clear(m_debug_process)); } } } diff --git a/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp b/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp index 4f25c1f5e..e94ca9731 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp @@ -44,7 +44,7 @@ namespace ams::dmnt { /* Get our process id. */ u64 pid_value = 0; - svc::GetProcessId(std::addressof(pid_value), m_debug_handle); + R_DISCARD(svc::GetProcessId(std::addressof(pid_value), m_debug_handle)); m_process_id = { pid_value }; @@ -413,7 +413,7 @@ namespace ams::dmnt { /* Get the instruction where we were. */ u32 insn = 0; - this->ReadMemory(std::addressof(insn), pc, sizeof(insn)); + R_DISCARD(this->ReadMemory(std::addressof(insn), pc, sizeof(insn))); /* Handle by architecture. */ bool is_call = false; @@ -471,7 +471,7 @@ namespace ams::dmnt { } Result DebugProcess::ClearBreakPoint(uintptr_t address, size_t size) { - m_software_breakpoints.ClearBreakPoint(address, size); + R_DISCARD(m_software_breakpoints.ClearBreakPoint(address, size)); R_SUCCEED(); } @@ -480,7 +480,7 @@ namespace ams::dmnt { } Result DebugProcess::ClearHardwareBreakPoint(uintptr_t address, size_t size) { - m_hardware_breakpoints.ClearBreakPoint(address, size); + R_DISCARD(m_hardware_breakpoints.ClearBreakPoint(address, size)); R_SUCCEED(); } diff --git a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp index 757a237a8..83c2489cb 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp @@ -1030,7 +1030,7 @@ namespace ams::dmnt { const auto reason = info.break_reason & ~svc::BreakReason_NotificationOnlyFlag; if (reason == svc::BreakReason_PostLoadDll || reason == svc::BreakReason_PostUnloadDll) { /* Re-collect the process's modules. */ - m_debug_process.CollectModules(); + R_DISCARD(m_debug_process.CollectModules()); } if (m_debug_process.GetOverrideStatus().IsHbl() && reason == svc::BreakReason_PostLoadDll) { @@ -1049,7 +1049,7 @@ namespace ams::dmnt { } /* This was just a notification, so we should continue. */ - m_debug_process.Continue(); + R_DISCARD(m_debug_process.Continue()); continue; } @@ -1064,7 +1064,7 @@ namespace ams::dmnt { if (!is_svc_break) { AMS_DMNT2_GDB_LOG_ERROR("UserBreak from non-SvcBreak (%08x)\n", insn); - m_debug_process.Continue(); + R_DISCARD(m_debug_process.Continue()); continue; } } @@ -1194,7 +1194,7 @@ namespace ams::dmnt { AMS_DMNT2_GDB_LOG_DEBUG("CreateThread %lx\n", thread_id); if (m_debug_process.IsValid()) { - m_debug_process.Continue(); + R_DISCARD(m_debug_process.Continue()); } else { AppendReplyFormat(reply_cur, reply_end, "W00"); } @@ -1205,7 +1205,7 @@ namespace ams::dmnt { AMS_DMNT2_GDB_LOG_DEBUG("ExitThread %lx\n", thread_id); if (m_debug_process.IsValid()) { - m_debug_process.Continue(); + R_DISCARD(m_debug_process.Continue()); } else { AppendReplyFormat(reply_cur, reply_end, "W00"); } @@ -1227,7 +1227,7 @@ namespace ams::dmnt { break; default: AMS_DMNT2_GDB_LOG_DEBUG("Unhandled ProcessEvent %u %lx\n", static_cast(d.type), thread_id); - m_debug_process.Continue(); + R_DISCARD(m_debug_process.Continue()); break; } @@ -1235,7 +1235,7 @@ namespace ams::dmnt { bool do_break; this->SendPacket(std::addressof(do_break), send_buffer); if (do_break) { - m_debug_process.Break(); + R_DISCARD(m_debug_process.Break()); } } } @@ -1250,7 +1250,7 @@ namespace ams::dmnt { /* Get the thread context. */ svc::ThreadContext thread_context = {}; - m_debug_process.GetThreadContext(std::addressof(thread_context), thread_id, svc::ThreadContextFlag_General | svc::ThreadContextFlag_Control); + R_DISCARD(m_debug_process.GetThreadContext(std::addressof(thread_context), thread_id, svc::ThreadContextFlag_General | svc::ThreadContextFlag_Control)); /* Add important registers. */ /* TODO: aarch32 */ @@ -1280,7 +1280,7 @@ namespace ams::dmnt { /* Add the thread core. */ { u32 core = 0; - m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_id); + R_DISCARD(m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_id)); AppendReplyFormat(m_reply_cur, m_reply_end, ";core:%u;", core); } @@ -1305,7 +1305,7 @@ namespace ams::dmnt { /* If we should, break the process. */ if (do_break) { - m_debug_process.Break(); + R_DISCARD(m_debug_process.Break()); } } } @@ -1721,7 +1721,7 @@ namespace ams::dmnt { } void GdbServerImpl::k() { - m_debug_process.Terminate(); + R_DISCARD(m_debug_process.Terminate()); m_killed = true; } @@ -2369,7 +2369,7 @@ namespace ams::dmnt { /* Get the thread core. */ u32 core = 0; - m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_ids[i]); + R_DISCARD(m_debug_process.GetThreadCurrentCore(std::addressof(core), thread_ids[i])); /* Get the thread name. */ char name[os::ThreadNameLengthMax + 1]; diff --git a/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp b/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp index 563918825..5d9079b4c 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp @@ -197,7 +197,7 @@ namespace ams::dmnt { g_last_bp_ctx_register = g_last_bp_register; for (int i = g_last_bp_ctx_register; i >= static_cast(svc::HardwareBreakPointRegisterName_I0); --i) { const Result result = svc::SetHardwareBreakPoint(static_cast(i), dbgbcr, svc::PseudoHandle::CurrentProcess); - svc::SetHardwareBreakPoint(static_cast(i), 0, 0); + R_DISCARD(svc::SetHardwareBreakPoint(static_cast(i), 0, 0)); if (R_FAILED(result)) { if (!svc::ResultInvalidHandle::Includes(result)) { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index 627c56bdd..521461c89 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -346,7 +346,7 @@ namespace ams::dmnt::cheat::impl { Result ResumeCheatProcessUnsafe() { m_broken_unsafe = false; m_unsafe_break_event.Signal(); - dmnt::cheat::impl::ContinueCheatProcess(this->GetCheatProcessHandle()); + R_DISCARD(dmnt::cheat::impl::ContinueCheatProcess(this->GetCheatProcessHandle())); R_SUCCEED(); } @@ -682,7 +682,7 @@ namespace ams::dmnt::cheat::impl { while (true) { eventLoadRemote(std::addressof(hook), manager->HookToCreateApplicationProcess(), true); if (R_SUCCEEDED(eventWait(std::addressof(hook), std::numeric_limits::max()))) { - manager->AttachToApplicationProcess(true); + R_DISCARD(manager->AttachToApplicationProcess(true)); } eventClose(std::addressof(hook)); } @@ -760,7 +760,7 @@ namespace ams::dmnt::cheat::impl { const auto &value = entry.GetValue(); /* Use Write SVC directly, to avoid the usual frozen address update logic. */ - svc::WriteDebugProcessMemory(manager->GetCheatProcessHandle(), reinterpret_cast(std::addressof(value.value)), address, value.width); + R_DISCARD(svc::WriteDebugProcessMemory(manager->GetCheatProcessHandle(), reinterpret_cast(std::addressof(value.value)), address, value.width)); } } } @@ -1146,8 +1146,8 @@ namespace ams::dmnt::cheat::impl { { char path[fs::EntryNameLengthMax + 1]; util::SNPrintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/toggles.txt", program_id.value); - fs::DeleteFile(path); - fs::CreateFile(path, 0); + R_DISCARD(fs::DeleteFile(path)); + R_DISCARD(fs::CreateFile(path, 0)); if (R_FAILED(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Write | fs::OpenMode_AllowAppend))) { return; } diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp index c1ecfb675..11b25b3a2 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp @@ -21,7 +21,7 @@ namespace ams::dmnt::cheat::impl { void CheatVirtualMachine::DebugLog(u32 log_id, u64 value) { /* Just unconditionally try to create the log folder. */ - fs::EnsureDirectory("sdmc:/atmosphere/cheat_vm_logs"); + R_DISCARD(fs::EnsureDirectory("sdmc:/atmosphere/cheat_vm_logs")); fs::FileHandle log_file; { @@ -40,7 +40,7 @@ namespace ams::dmnt::cheat::impl { char log_value[18]; util::SNPrintf(log_value, sizeof(log_value), "%016lx\n", value); - fs::WriteFile(log_file, log_offset, log_value, std::strlen(log_value), fs::WriteOption::Flush); + R_DISCARD(fs::WriteFile(log_file, log_offset, log_value, std::strlen(log_value), fs::WriteOption::Flush)); } void CheatVirtualMachine::OpenDebugLogFile() { @@ -796,7 +796,7 @@ namespace ams::dmnt::cheat::impl { u64 kHeld = 0; /* Get Keys held. */ - hid::GetKeysHeld(std::addressof(kHeld)); + R_DISCARD(hid::GetKeysHeld(std::addressof(kHeld))); this->OpenDebugLogFile(); ON_SCOPE_EXIT { this->CloseDebugLogFile(); }; @@ -838,7 +838,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.store_static.bit_width); + R_DISCARD(dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.store_static.bit_width)); break; } } @@ -853,7 +853,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(src_address, std::addressof(src_value), cur_opcode.begin_cond.bit_width); + R_DISCARD(dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(src_address, std::addressof(src_value), cur_opcode.begin_cond.bit_width)); break; } /* Check against condition. */ @@ -933,7 +933,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(src_address, std::addressof(m_registers[cur_opcode.ldr_memory.reg_index]), cur_opcode.ldr_memory.bit_width); + R_DISCARD(dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(src_address, std::addressof(m_registers[cur_opcode.ldr_memory.reg_index]), cur_opcode.ldr_memory.bit_width)); break; } } @@ -952,7 +952,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.str_static.bit_width); + R_DISCARD(dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.str_static.bit_width)); break; } /* Increment register if relevant. */ @@ -1143,7 +1143,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.str_register.bit_width); + R_DISCARD(dmnt::cheat::impl::WriteCheatProcessMemoryUnsafe(dst_address, std::addressof(dst_value), cur_opcode.str_register.bit_width)); break; } @@ -1214,7 +1214,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(cond_address, std::addressof(cond_value), cur_opcode.begin_reg_cond.bit_width); + R_DISCARD(dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(cond_address, std::addressof(cond_value), cur_opcode.begin_reg_cond.bit_width)); break; } } @@ -1309,10 +1309,10 @@ namespace ams::dmnt::cheat::impl { } break; case CheatVmOpcodeType_PauseProcess: - dmnt::cheat::impl::PauseCheatProcessUnsafe(); + R_DISCARD(dmnt::cheat::impl::PauseCheatProcessUnsafe()); break; case CheatVmOpcodeType_ResumeProcess: - dmnt::cheat::impl::ResumeCheatProcessUnsafe(); + R_DISCARD(dmnt::cheat::impl::ResumeCheatProcessUnsafe()); break; case CheatVmOpcodeType_DebugLog: { @@ -1356,7 +1356,7 @@ namespace ams::dmnt::cheat::impl { case 2: case 4: case 8: - dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(val_address, std::addressof(log_value), cur_opcode.debug_log.bit_width); + R_DISCARD(dmnt::cheat::impl::ReadCheatProcessMemoryUnsafe(val_address, std::addressof(log_value), cur_opcode.debug_log.bit_width)); break; } } diff --git a/stratosphere/erpt/source/erpt_main.cpp b/stratosphere/erpt/source/erpt_main.cpp index 93096dbcb..9e9f289ad 100644 --- a/stratosphere/erpt/source/erpt_main.cpp +++ b/stratosphere/erpt/source/erpt_main.cpp @@ -62,9 +62,9 @@ namespace ams { { u8 disable_report_cleanup = 0; if (settings::fwdbg::GetSettingsItemValue(std::addressof(disable_report_cleanup), sizeof(disable_report_cleanup), "erpt", "disable_automatic_report_cleanup") == sizeof(disable_report_cleanup)) { - erpt::srv::SetEnabledAutomaticReportCleanup(disable_report_cleanup == 0); + R_DISCARD(erpt::srv::SetEnabledAutomaticReportCleanup(disable_report_cleanup == 0)); } else { - erpt::srv::SetEnabledAutomaticReportCleanup(true); + R_DISCARD(erpt::srv::SetEnabledAutomaticReportCleanup(true)); } } @@ -72,7 +72,7 @@ namespace ams { R_ABORT_UNLESS(erpt::srv::Initialize(erpt::g_memory_heap, erpt::MemoryHeapSize)); /* Atmosphere always wants to redirect new reports to the SD card, to prevent them from being logged. */ - erpt::srv::SetRedirectNewReportsToSdCard(true); + R_DISCARD(erpt::srv::SetRedirectNewReportsToSdCard(true)); /* Configure the serial number, OS version, product model, and region. */ { diff --git a/stratosphere/fatal/source/fatal_repair.cpp b/stratosphere/fatal/source/fatal_repair.cpp index 201ec4ba4..f2054b421 100644 --- a/stratosphere/fatal/source/fatal_repair.cpp +++ b/stratosphere/fatal/source/fatal_repair.cpp @@ -105,11 +105,11 @@ namespace ams::fatal::srv { void CheckRepairStatus() { if (IsInRepairWithoutVolHeld()) { - ThrowFatalForSelf(ResultInRepairWithoutVolHeld()); + R_DISCARD(ThrowFatalForSelf(ResultInRepairWithoutVolHeld())); } if (IsInRepairWithoutTimeReviserCartridge()) { - ThrowFatalForSelf(ResultInRepairWithoutTimeReviserCartridge()); + R_DISCARD(ThrowFatalForSelf(ResultInRepairWithoutTimeReviserCartridge())); } } diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index cac9db288..9e69c79f3 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -24,7 +24,7 @@ namespace ams::fatal::srv { /* Helpers. */ void TryEnsureReportDirectories() { - fs::EnsureDirectory("sdmc:/atmosphere/fatal_reports/dumps"); + R_DISCARD(fs::EnsureDirectory("sdmc:/atmosphere/fatal_reports/dumps")); } bool TryGetCurrentTimestamp(u64 *out) { diff --git a/stratosphere/htc/source/htc_main.cpp b/stratosphere/htc/source/htc_main.cpp index 5477bc113..5c54d5f3e 100644 --- a/stratosphere/htc/source/htc_main.cpp +++ b/stratosphere/htc/source/htc_main.cpp @@ -177,7 +177,7 @@ namespace ams { /* Create the htc misc ipc thread. */ os::ThreadType htc_ipc_thread; - os::CreateThread(std::addressof(htc_ipc_thread), htc::HtcIpcThreadFunction, nullptr, htc::g_htc_ipc_thread_stack, sizeof(htc::g_htc_ipc_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcIpc)); + R_DISCARD(os::CreateThread(std::addressof(htc_ipc_thread), htc::HtcIpcThreadFunction, nullptr, htc::g_htc_ipc_thread_stack, sizeof(htc::g_htc_ipc_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcIpc))); os::SetThreadNamePointer(std::addressof(htc_ipc_thread), AMS_GET_SYSTEM_THREAD_NAME(htc, HtcIpc)); /* Initialize the htcfs server. */ @@ -186,7 +186,7 @@ namespace ams { /* Create the htcfs ipc thread. */ os::ThreadType htcfs_ipc_thread; - os::CreateThread(std::addressof(htcfs_ipc_thread), htc::HtcfsIpcThreadFunction, nullptr, htc::g_htcfs_ipc_thread_stack, sizeof(htc::g_htcfs_ipc_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcfsIpc)); + R_DISCARD(os::CreateThread(std::addressof(htcfs_ipc_thread), htc::HtcfsIpcThreadFunction, nullptr, htc::g_htcfs_ipc_thread_stack, sizeof(htc::g_htcfs_ipc_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcfsIpc))); os::SetThreadNamePointer(std::addressof(htcfs_ipc_thread), AMS_GET_SYSTEM_THREAD_NAME(htc, HtcfsIpc)); /* Initialize the htcs server. */ @@ -196,7 +196,7 @@ namespace ams { /* Create the htcs ipc threads. */ os::ThreadType htcs_ipc_threads[htc::NumHtcsIpcThreads]; for (size_t i = 0; i < htc::NumHtcsIpcThreads; ++i) { - os::CreateThread(std::addressof(htcs_ipc_threads[i]), htc::HtcsIpcThreadFunction, nullptr, htc::g_htcs_ipc_thread_stack[i], sizeof(htc::g_htcs_ipc_thread_stack[i]), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcsIpc)); + R_DISCARD(os::CreateThread(std::addressof(htcs_ipc_threads[i]), htc::HtcsIpcThreadFunction, nullptr, htc::g_htcs_ipc_thread_stack[i], sizeof(htc::g_htcs_ipc_thread_stack[i]), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcsIpc))); os::SetThreadNamePointer(std::addressof(htcs_ipc_threads[i]), AMS_GET_SYSTEM_THREAD_NAME(htc, HtcsIpc)); } diff --git a/stratosphere/loader/source/ldr_argument_store.hpp b/stratosphere/loader/source/ldr_argument_store.hpp index cc7bee4b8..6a417971c 100644 --- a/stratosphere/loader/source/ldr_argument_store.hpp +++ b/stratosphere/loader/source/ldr_argument_store.hpp @@ -33,7 +33,7 @@ namespace ams::ldr { Entry m_argument_map[ArgumentMapCount]; public: constexpr ArgumentStore() : m_argument_map{} { - this->Flush(); + R_DISCARD(this->Flush()); } public: const Entry *Get(ncm::ProgramId program_id); diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 9b8386081..8ba4fac2a 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -812,7 +812,7 @@ namespace ams::ldr { /* Set the output handle, and ensure that if we fail after this point we clean it up. */ out->process_handle = process_handle; out->code_address = param.code_address; - ON_RESULT_FAILURE { svc::CloseHandle(process_handle); }; + ON_RESULT_FAILURE { R_DISCARD(svc::CloseHandle(process_handle)); }; /* Load all auto load modules. */ R_RETURN(LoadAutoLoadModules(out, ctx, argument)); @@ -882,7 +882,7 @@ namespace ams::ldr { /* If we're overriding for HBL, perform HTML document redirection. */ if (override_status.IsHbl()) { /* Don't validate result, failure is okay. */ - RedirectHtmlDocumentPathForHbl(loc); + R_DISCARD(RedirectHtmlDocumentPathForHbl(loc)); } /* Clear the external code for the program. */ diff --git a/stratosphere/pm/source/impl/pm_process_info.cpp b/stratosphere/pm/source/impl/pm_process_info.cpp index d472803dc..1c51e3f10 100644 --- a/stratosphere/pm/source/impl/pm_process_info.cpp +++ b/stratosphere/pm/source/impl/pm_process_info.cpp @@ -89,8 +89,8 @@ namespace ams::pm::impl { if (m_handle != os::InvalidNativeHandle) { /* Unregister the process. */ fsprUnregisterProgram(m_process_id.value); - sm::manager::UnregisterProcess(m_process_id); - ldr::pm::UnpinProgram(m_pin_id); + R_DISCARD(sm::manager::UnregisterProcess(m_process_id)); + R_DISCARD(ldr::pm::UnpinProgram(m_pin_id)); /* Close the process's handle. */ os::CloseNativeHandle(m_handle); diff --git a/stratosphere/pm/source/impl/pm_process_manager.cpp b/stratosphere/pm/source/impl/pm_process_manager.cpp index 95922c979..5bd14732c 100644 --- a/stratosphere/pm/source/impl/pm_process_manager.cpp +++ b/stratosphere/pm/source/impl/pm_process_manager.cpp @@ -142,7 +142,7 @@ namespace ams::pm::impl { R_TRY(ldr::pm::AtmospherePinProgram(std::addressof(pin_id), fixed_location, override_status)); /* If we fail after now, unpin. */ - ON_RESULT_FAILURE { ldr::pm::UnpinProgram(pin_id); }; + ON_RESULT_FAILURE { R_DISCARD(ldr::pm::UnpinProgram(pin_id)); }; /* Ensure we can talk to mitm services. */ { @@ -486,7 +486,7 @@ namespace ams::pm::impl { /* NOTE: Nintendo does not check the result of this. */ if (spl::IsDisabledProgramVerification()) { if (hos::GetVersion() >= hos::Version_10_0_0) { - ldr::pm::SetEnabledProgramVerification(false); + R_DISCARD(ldr::pm::SetEnabledProgramVerification(false)); } else { fsprSetEnabledProgramVerification(false); } diff --git a/stratosphere/pm/source/impl/pm_process_tracker.cpp b/stratosphere/pm/source/impl/pm_process_tracker.cpp index 5d1c3b418..8f436f00f 100644 --- a/stratosphere/pm/source/impl/pm_process_tracker.cpp +++ b/stratosphere/pm/source/impl/pm_process_tracker.cpp @@ -94,7 +94,7 @@ namespace ams::pm::impl { auto list = GetProcessList(); /* Reset the process's signal. */ - svc::ResetSignal(process_info->GetHandle()); + R_DISCARD(svc::ResetSignal(process_info->GetHandle())); /* Update the process's state. */ const svc::ProcessState old_state = process_info->GetState(); diff --git a/stratosphere/pm/source/pm_main.cpp b/stratosphere/pm/source/pm_main.cpp index 5bef871c7..a4925ef67 100644 --- a/stratosphere/pm/source/pm_main.cpp +++ b/stratosphere/pm/source/pm_main.cpp @@ -54,8 +54,8 @@ namespace ams { void RegisterPrivilegedProcess(os::ProcessId process_id, ncm::ProgramId program_id) { fsprUnregisterProgram(process_id.value); fsprRegisterProgram(process_id.value, process_id.value, NcmStorageId_BuiltInSystem, PrivilegedFileAccessHeader, sizeof(PrivilegedFileAccessHeader), PrivilegedFileAccessControl, sizeof(PrivilegedFileAccessControl), 0); - sm::manager::UnregisterProcess(process_id); - sm::manager::RegisterProcess(process_id, program_id, cfg::OverrideStatus{}, PrivilegedServiceAccessControl, sizeof(PrivilegedServiceAccessControl), PrivilegedServiceAccessControl, sizeof(PrivilegedServiceAccessControl)); + R_DISCARD(sm::manager::UnregisterProcess(process_id)); + R_DISCARD(sm::manager::RegisterProcess(process_id, program_id, cfg::OverrideStatus{}, PrivilegedServiceAccessControl, sizeof(PrivilegedServiceAccessControl), PrivilegedServiceAccessControl, sizeof(PrivilegedServiceAccessControl))); } void RegisterPrivilegedProcesses() { diff --git a/stratosphere/ro/source/impl/ro_service_impl.cpp b/stratosphere/ro/source/impl/ro_service_impl.cpp index 6beff3c8f..a10c81b93 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.cpp +++ b/stratosphere/ro/source/impl/ro_service_impl.cpp @@ -116,7 +116,7 @@ namespace ams::ro::impl { if (m_process_handle != os::InvalidNativeHandle) { for (size_t i = 0; i < MaxNrrInfos; i++) { if (m_nrr_in_use[i]) { - UnmapNrr(m_process_handle, m_nrr_infos[i].mapped_header, m_nrr_infos[i].nrr_heap_address, m_nrr_infos[i].nrr_heap_size, m_nrr_infos[i].mapped_code_address); + R_DISCARD(UnmapNrr(m_process_handle, m_nrr_infos[i].mapped_header, m_nrr_infos[i].nrr_heap_address, m_nrr_infos[i].nrr_heap_size, m_nrr_infos[i].mapped_code_address)); } } os::CloseNativeHandle(m_process_handle); @@ -659,7 +659,7 @@ namespace ams::ro::impl { /* Map the NRO. */ R_TRY(MapNro(std::addressof(nro_info->base_address), context->GetProcessHandle(), nro_address, nro_size, bss_address, bss_size)); - ON_RESULT_FAILURE { UnmapNro(context->GetProcessHandle(), nro_info->base_address, nro_address, nro_size, bss_address, bss_size); }; + ON_RESULT_FAILURE { R_DISCARD(UnmapNro(context->GetProcessHandle(), nro_info->base_address, nro_address, nro_size, bss_address, bss_size)); }; /* Parse the NRO. */ u64 rx_size = 0, ro_size = 0, rw_size = 0; diff --git a/stratosphere/spl/source/spl_main.cpp b/stratosphere/spl/source/spl_main.cpp index a6e1134a1..b9d2491d5 100644 --- a/stratosphere/spl/source/spl_main.cpp +++ b/stratosphere/spl/source/spl_main.cpp @@ -147,7 +147,7 @@ namespace ams { R_ABORT_UNLESS(g_server_manager.RegisterServer(PortIndex_Ssl, SslServiceName, SslMaxSessions)); R_ABORT_UNLESS(g_server_manager.RegisterServer(PortIndex_Es, EsServiceName, EsMaxSessions)); if (fw_ver >= hos::Version_5_0_0) { - g_server_manager.RegisterServer(PortIndex_Manu, ManuServiceName, ManuMaxSessions); + R_DISCARD(g_server_manager.RegisterServer(PortIndex_Manu, ManuServiceName, ManuMaxSessions)); } } diff --git a/stratosphere/spl/source/spl_secure_monitor_manager.cpp b/stratosphere/spl/source/spl_secure_monitor_manager.cpp index c31bae8bf..39ed37b3e 100644 --- a/stratosphere/spl/source/spl_secure_monitor_manager.cpp +++ b/stratosphere/spl/source/spl_secure_monitor_manager.cpp @@ -164,7 +164,7 @@ namespace ams::spl { for (auto i = 0; i < impl::AesKeySlotCount; ++i) { if (m_aes_keyslot_owners[i] == owner) { m_aes_keyslot_owners[i] = nullptr; - impl::DeallocateAesKeySlot(impl::AesKeySlotMin + i); + R_DISCARD(impl::DeallocateAesKeySlot(impl::AesKeySlotMin + i)); } } } diff --git a/troposphere/haze/include/haze/console_main_loop.hpp b/troposphere/haze/include/haze/console_main_loop.hpp index 184c36fc6..ce54bad69 100644 --- a/troposphere/haze/include/haze/console_main_loop.hpp +++ b/troposphere/haze/include/haze/console_main_loop.hpp @@ -214,8 +214,8 @@ namespace haze { event_reactor.SetResult(ResultSuccess()); /* Configure the PTP responder and console main loop. */ - ptp_responder.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap)); - console_main_loop.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap)); + R_DISCARD(ptp_responder.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap))); + R_DISCARD(console_main_loop.Initialize(std::addressof(event_reactor), std::addressof(ptp_object_heap))); /* Ensure we maintain a clean state on exit. */ ON_SCOPE_EXIT {