ams: use R_DISCARD everywhere
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
|
||||
Result SetMitmService::GetLanguageCode(sf::Out<settings::LanguageCode> 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<settings::RegionCode> 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)) {
|
||||
|
||||
Reference in New Issue
Block a user