diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp index 2bad23b3d..04e53ed5f 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp @@ -27,7 +27,7 @@ void BpcMitmService::PostProcess(IMitmServiceObject *obj, IpcResponseContext *ct Result BpcMitmService::ShutdownSystem() { /* Use exosphere + reboot to perform real shutdown, instead of fake shutdown. */ PerformShutdownSmc(); - return 0; + return ResultSuccess; } Result BpcMitmService::RebootSystem() { diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_reboot_manager.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_reboot_manager.cpp index a8b526731..33eafb941 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_reboot_manager.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_reboot_manager.cpp @@ -92,10 +92,10 @@ Result BpcRebootManager::PerformReboot() { return ResultAtmosphereMitmShouldForwardToSession; case BpcRebootType::ToRcm: RebootToRcm(); - return 0; + return ResultSuccess; case BpcRebootType::ToPayload: default: DoRebootToPayload(); - return 0; + return ResultSuccess; } } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp index a59d31fb4..58a727aeb 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.cpp @@ -61,7 +61,7 @@ Result FsDirUtils::CopyFile(IFileSystem *dst_fs, IFileSystem *src_fs, const FsPa offset += read_size; } - return 0; + return ResultSuccess; } Result FsDirUtils::CopyDirectoryRecursively(IFileSystem *dst_fs, IFileSystem *src_fs, const FsPath &dst_path, const FsPath &src_path, void *work_buf, size_t work_buf_size) { @@ -88,7 +88,7 @@ Result FsDirUtils::CopyDirectoryRecursively(IFileSystem *dst_fs, IFileSystem *sr } p[1] = 0; - return 0; + return ResultSuccess; }, [&](const FsPath &path, const FsDirectoryEntry *dir_ent) -> Result { /* On File */ /* Just copy the file to the new fs. */ diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.hpp index 76ce21be7..3656c7348 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_dir_utils.hpp @@ -84,7 +84,7 @@ class FsDirUtils { work_path.str[parent_len] = 0; } - return 0; + return ResultSuccess; } public: @@ -137,7 +137,7 @@ class FsDirUtils { template static Result RetryUntilTargetNotLocked(F f) { const size_t MaxRetries = 10; - Result rc = 0; + Result rc = ResultSuccess; for (size_t i = 0; i < MaxRetries; i++) { rc = f(); diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_directory_savedata_filesystem.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_directory_savedata_filesystem.cpp index 62e46f700..8ea14b87b 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_directory_savedata_filesystem.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_directory_savedata_filesystem.cpp @@ -129,7 +129,7 @@ Result DirectorySaveDataFileSystem::AllocateWorkBuffer(void **out_buf, size_t *o if (buf != nullptr) { *out_buf = buf; *out_size = try_size; - return 0; + return ResultSuccess; } /* Divide size by two. */ @@ -303,7 +303,7 @@ Result DirectorySaveDataFileSystem::OpenFileImpl(std::unique_ptr &out_fil this->open_writable_files++; } - return 0; + return ResultSuccess; } Result DirectorySaveDataFileSystem::OpenDirectoryImpl(std::unique_ptr &out_dir, const FsPath &path, DirectoryOpenMode mode) { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp index 98f009329..29f9c6ce6 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_idirectory.hpp @@ -33,7 +33,7 @@ class IDirectory { } if (max_entries == 0) { *out_count = 0; - return 0; + return ResultSuccess; } if (out_entries == nullptr) { return ResultFsNullptrArgument; diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp index 1e1e26ab2..0c9351354 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_ifile.hpp @@ -40,7 +40,7 @@ class IFile { } if (size == 0) { *out = 0; - return 0; + return ResultSuccess; } if (buffer == nullptr) { return ResultFsNullptrArgument; @@ -65,7 +65,7 @@ class IFile { Result Write(uint64_t offset, void *buffer, uint64_t size, uint32_t flags) { if (size == 0) { - return 0; + return ResultSuccess; } if (buffer == nullptr) { return ResultFsNullptrArgument; @@ -76,7 +76,7 @@ class IFile { Result Write(uint64_t offset, void *buffer, uint64_t size, bool flush = false) { if (size == 0) { - return 0; + return ResultSuccess; } if (buffer == nullptr) { return ResultFsNullptrArgument; diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp index ace095de5..dafece254 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_istorage.hpp @@ -102,7 +102,7 @@ class IROStorage : public IStorage { return ResultFsUnsupportedOperation; }; virtual Result Flush() final { - return 0x0; + return ResultSuccess; }; virtual Result SetSize(u64 size) final { (void)(size); diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp index 1bd2b3597..5f31bdbfa 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_path_utils.cpp @@ -28,7 +28,7 @@ Result FsPathUtils::VerifyPath(const char *path, size_t max_path_len, size_t max const char c = *(cur++); /* If terminated, we're done. */ if (c == 0) { - return 0; + return ResultSuccess; } /* TODO: Nintendo converts the path from utf-8 to utf-32, one character at a time. */ @@ -110,7 +110,7 @@ Result FsPathUtils::IsNormalized(bool *out, const char *path) { /* It is unclear why first separator and separator are separate states... */ if (c == '/') { *out = false; - return 0; + return ResultSuccess; } else if (c == '.') { state = PathState::CurrentDir; } else { @@ -120,7 +120,7 @@ Result FsPathUtils::IsNormalized(bool *out, const char *path) { case PathState::CurrentDir: if (c == '/') { *out = false; - return 0; + return ResultSuccess; } else if (c == '.') { state = PathState::ParentDir; } else { @@ -130,7 +130,7 @@ Result FsPathUtils::IsNormalized(bool *out, const char *path) { case PathState::ParentDir: if (c == '/') { *out = false; - return 0; + return ResultSuccess; } else { state = PathState::Normal; } @@ -138,7 +138,7 @@ Result FsPathUtils::IsNormalized(bool *out, const char *path) { case PathState::WindowsDriveLetter: if (c == ':') { *out = true; - return 0; + return ResultSuccess; } else { return ResultFsInvalidPathFormat; } @@ -161,7 +161,7 @@ Result FsPathUtils::IsNormalized(bool *out, const char *path) { break; } - return 0; + return ResultSuccess; } Result FsPathUtils::Normalize(char *out, size_t max_out_size, const char *src, size_t *out_len) { @@ -264,5 +264,5 @@ Result FsPathUtils::Normalize(char *out, size_t max_out_size, const char *src, s std::abort(); } - return 0; + return ResultSuccess; } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_subdirectory_filesystem.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_subdirectory_filesystem.cpp index 88622e814..e0137ed2e 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_subdirectory_filesystem.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_subdirectory_filesystem.cpp @@ -55,7 +55,7 @@ Result SubDirectoryFileSystem::Initialize(const char *bp) { std::strncpy(this->base_path, normal_path, this->base_path_len); this->base_path[this->base_path_len-1] = 0; - return 0; + return ResultSuccess; } Result SubDirectoryFileSystem::GetFullPath(char *out, size_t out_size, const char *relative_path) { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp index 4aa43ccdd..f0ad46dfc 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp @@ -36,7 +36,7 @@ Result Boot0Storage::Read(void *_buffer, size_t size, u64 offset) { Result Boot0Storage::Write(void *_buffer, size_t size, u64 offset) { std::scoped_lock lk{g_boot0_mutex}; - Result rc = 0; + Result rc = ResultSuccess; u8 *buffer = static_cast(_buffer); /* Protect the keyblob region from writes. */ @@ -61,7 +61,7 @@ Result Boot0Storage::Write(void *_buffer, size_t size, u64 offset) { if (offset < EksEnd) { if (offset + size < EksEnd) { /* Ignore writes falling strictly within the region. */ - return 0; + return ResultSuccess; } else { /* Only write past the end of the keyblob region. */ buffer = buffer + (EksEnd - offset); @@ -74,7 +74,7 @@ Result Boot0Storage::Write(void *_buffer, size_t size, u64 offset) { } if (size == 0) { - return 0; + return ResultSuccess; } /* We care about protecting autorcm from NS. */ diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp index b86791ff8..29fbaed7b 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp @@ -39,7 +39,7 @@ class SectoredProxyStorage : public ProxyStorage { SectoredProxyStorage(FsStorage s) : ProxyStorage(s) { } public: virtual Result Read(void *_buffer, size_t size, u64 offset) override { - Result rc = 0; + Result rc = ResultSuccess; u8 *buffer = static_cast(_buffer); this->Seek(offset); @@ -82,7 +82,7 @@ class SectoredProxyStorage : public ProxyStorage { return rc; }; virtual Result Write(void *_buffer, size_t size, u64 offset) override { - Result rc = 0; + Result rc = ResultSuccess; u8 *buffer = static_cast(_buffer); this->Seek(offset); diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp index b225bb4b2..a67932bf6 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layeredrom.cpp @@ -48,7 +48,7 @@ LayeredRomFS::LayeredRomFS(std::shared_ptr s_r, std::shared Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) { /* Size zero reads should always succeed. */ if (size == 0) { - return 0; + return ResultSuccess; } /* Validate size. */ @@ -158,16 +158,16 @@ Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) { } } - return 0; + return ResultSuccess; } Result LayeredRomFS::GetSize(u64 *out_size) { *out_size = (*this->p_source_infos)[this->p_source_infos->size() - 1].virtual_offset + (*this->p_source_infos)[this->p_source_infos->size() - 1].size; - return 0x0; + return ResultSuccess; } Result LayeredRomFS::OperateRange(u32 operation_type, u64 offset, u64 size, FsRangeInfo *out_range_info) { /* TODO: How should I implement this for a virtual romfs? */ if (operation_type == 3) { *out_range_info = {0}; } - return 0; + return ResultSuccess; } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_service.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_service.cpp index 8155f7db6..e52940b05 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_service.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_service.cpp @@ -86,7 +86,7 @@ void FsMitmService::PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx Result FsMitmService::OpenHblWebContentFileSystem(Out> &out_fs) { std::shared_ptr fs = nullptr; u32 out_domain_id = 0; - Result rc = 0; + Result rc = ResultSuccess; ON_SCOPE_EXIT { if (R_SUCCEEDED(rc)) { @@ -162,7 +162,7 @@ Result FsMitmService::OpenFileSystemWithId(Out> out_storage, u32 bis_partition_id) { std::shared_ptr storage = nullptr; u32 out_domain_id = 0; - Result rc = 0; + Result rc = ResultSuccess; ON_SCOPE_EXIT { if (R_SUCCEEDED(rc)) { @@ -219,7 +219,7 @@ Result FsMitmService::OpenBisStorage(Out> out Result FsMitmService::OpenDataStorageByCurrentProcess(Out> out_storage) { std::shared_ptr storage = nullptr; u32 out_domain_id = 0; - Result rc = 0; + Result rc = ResultSuccess; if (!this->should_override_contents) { return ResultAtmosphereMitmShouldForwardToSession; @@ -249,7 +249,7 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out storage = nullptr; u32 out_domain_id = 0; - Result rc = 0; + Result rc = ResultSuccess; bool has_cache = StorageCacheGetEntry(data_id, &storage); @@ -320,7 +320,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out> out_intf) { std::shared_ptr intf = nullptr; u32 out_domain_id = 0; - Result rc = 0; + Result rc = ResultSuccess; ON_SCOPE_EXIT { if (R_SUCCEEDED(rc)) { diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_firmware_version.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_firmware_version.cpp index 9d39f0bd5..dd3f48504 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_firmware_version.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_firmware_version.cpp @@ -81,5 +81,5 @@ Result VersionManager::GetFirmwareVersion(u64 title_id, SetSysFirmwareVersion *o *out = g_fw_version; } - return 0; + return ResultSuccess; } \ No newline at end of file diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp index 3df268b14..800bce844 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp @@ -87,7 +87,7 @@ Result SettingsItemManager::ValidateName(const char *name, size_t max_size) { return 0x20A69; } - return 0x0; + return ResultSuccess; } Result SettingsItemManager::ValidateName(const char *name) { @@ -110,7 +110,7 @@ Result SettingsItemManager::ValidateKey(const char *key, size_t max_size) { return 0x20C69; } - return 0x0; + return ResultSuccess; } Result SettingsItemManager::ValidateKey(const char *key) { @@ -222,7 +222,7 @@ static Result ParseValue(const char *name, const char *key, const char *val_tup) } g_settings_items[kv] = value; - return 0x0; + return ResultSuccess; } static int SettingsItemIniHandler(void *user, const char *name, const char *key, const char *value) { @@ -287,7 +287,7 @@ Result SettingsItemManager::GetValueSize(const char *name, const char *key, u64 } *out_size = it->second.size; - return 0x0; + return ResultSuccess; } Result SettingsItemManager::GetValue(const char *name, const char *key, void *out, size_t max_size, u64 *out_size) { @@ -305,5 +305,5 @@ Result SettingsItemManager::GetValue(const char *name, const char *key, void *ou *out_size = copy_size; memcpy(out, it->second.data, copy_size); - return 0x0; + return ResultSuccess; } diff --git a/stratosphere/ams_mitm/source/utils.cpp b/stratosphere/ams_mitm/source/utils.cpp index cd5cbf9d7..36364c263 100644 --- a/stratosphere/ams_mitm/source/utils.cpp +++ b/stratosphere/ams_mitm/source/utils.cpp @@ -343,7 +343,7 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data, return ResultFsSdCardNotPresent; } - Result rc = 0; + Result rc = ResultSuccess; char path[FS_MAX_PATH]; if (*fn == '/') { @@ -458,7 +458,7 @@ Result Utils::GetKeysHeld(u64 *keys) { hidScanInput(); *keys = hidKeysHeld(CONTROLLER_P1_AUTO); - return 0x0; + return ResultSuccess; } static bool HasOverrideKey(OverrideKey *cfg) { diff --git a/stratosphere/boot/source/boot_main.cpp b/stratosphere/boot/source/boot_main.cpp index 5759fb966..2d587aa35 100644 --- a/stratosphere/boot/source/boot_main.cpp +++ b/stratosphere/boot/source/boot_main.cpp @@ -1934,7 +1934,7 @@ static int pmc_init_wake_events(u64 pmc_base_vaddr, bool is_blink) { pmc_dpd_pads_oride_val = *((u32 *)pmc_base_vaddr + 0x1C); } - rc = 0; + rc = ResultSuccess; return rc; } @@ -2217,7 +2217,7 @@ static int pmc_set_wake_event_level(u64 pmc_base_vaddr, unsigned int wake_pin_id /* Invalid */ } - rc = 0; + rc = ResultSuccess; return rc; } @@ -2279,7 +2279,7 @@ static int pmc_set_wake_event_enabled(u64 pmc_base_vaddr, unsigned int wake_pin_ pmc_wake_mask_val = *((u32 *)pmc_base_vaddr + pmc_wake_mask_reg_offset); } - rc = 0; + rc = ResultSuccess; return rc; } @@ -2535,6 +2535,6 @@ int main(int argc, char **argv) /* pmshellNotifyBootFinished(); */ - rc = 0; + rc = ResultSuccess; return rc; } diff --git a/stratosphere/dmnt/source/dmnt_cheat_manager.cpp b/stratosphere/dmnt/source/dmnt_cheat_manager.cpp index fd7234d4b..5ac9ad753 100644 --- a/stratosphere/dmnt/source/dmnt_cheat_manager.cpp +++ b/stratosphere/dmnt/source/dmnt_cheat_manager.cpp @@ -190,7 +190,7 @@ Result DmntCheatManager::GetCheatProcessMappingCount(u64 *out_count) { address = mem_info.addr + mem_info.size; } while (address != 0); - return 0; + return ResultSuccess; } Result DmntCheatManager::GetCheatProcessMappings(MemoryInfo *mappings, size_t max_count, u64 *out_count, u64 offset) { @@ -221,7 +221,7 @@ Result DmntCheatManager::GetCheatProcessMappings(MemoryInfo *mappings, size_t ma address = mem_info.addr + mem_info.size; } while (address != 0 && *out_count < max_count); - return 0; + return ResultSuccess; } Result DmntCheatManager::ReadCheatProcessMemory(u64 proc_addr, void *out_data, size_t size) { @@ -601,7 +601,7 @@ Result DmntCheatManager::GetCheatCount(u64 *out_count) { } } - return 0; + return ResultSuccess; } Result DmntCheatManager::GetCheats(CheatEntry *cheats, size_t max_count, u64 *out_count, u64 offset) { @@ -622,7 +622,7 @@ Result DmntCheatManager::GetCheats(CheatEntry *cheats, size_t max_count, u64 *ou } } - return 0; + return ResultSuccess; } Result DmntCheatManager::GetCheatById(CheatEntry *out_cheat, u32 cheat_id) { @@ -638,7 +638,7 @@ Result DmntCheatManager::GetCheatById(CheatEntry *out_cheat, u32 cheat_id) { } *out_cheat = *entry; - return 0; + return ResultSuccess; } Result DmntCheatManager::ToggleCheat(u32 cheat_id) { @@ -661,7 +661,7 @@ Result DmntCheatManager::ToggleCheat(u32 cheat_id) { /* Trigger a VM reload. */ g_needs_reload_vm_program = true; - return 0; + return ResultSuccess; } Result DmntCheatManager::AddCheat(u32 *out_id, CheatDefinition *def, bool enabled) { @@ -685,7 +685,7 @@ Result DmntCheatManager::AddCheat(u32 *out_id, CheatDefinition *def, bool enable /* Trigger a VM reload. */ g_needs_reload_vm_program = true; - return 0; + return ResultSuccess; } Result DmntCheatManager::RemoveCheat(u32 cheat_id) { @@ -703,7 +703,7 @@ Result DmntCheatManager::RemoveCheat(u32 cheat_id) { /* Trigger a VM reload. */ g_needs_reload_vm_program = true; - return 0; + return ResultSuccess; } Result DmntCheatManager::GetFrozenAddressCount(u64 *out_count) { @@ -714,7 +714,7 @@ Result DmntCheatManager::GetFrozenAddressCount(u64 *out_count) { } *out_count = g_frozen_addresses_map.size(); - return 0; + return ResultSuccess; } Result DmntCheatManager::GetFrozenAddresses(FrozenAddressEntry *frz_addrs, size_t max_count, u64 *out_count, u64 offset) { @@ -739,7 +739,7 @@ Result DmntCheatManager::GetFrozenAddresses(FrozenAddressEntry *frz_addrs, size_ } } - return 0; + return ResultSuccess; } Result DmntCheatManager::GetFrozenAddress(FrozenAddressEntry *frz_addr, u64 address) { @@ -756,7 +756,7 @@ Result DmntCheatManager::GetFrozenAddress(FrozenAddressEntry *frz_addr, u64 add frz_addr->address = it->first; frz_addr->value = it->second; - return 0; + return ResultSuccess; } Result DmntCheatManager::EnableFrozenAddress(u64 *out_value, u64 address, u64 width) { @@ -784,7 +784,7 @@ Result DmntCheatManager::EnableFrozenAddress(u64 *out_value, u64 address, u64 wi g_frozen_addresses_map[address] = value; *out_value = value.value; - return 0; + return ResultSuccess; } Result DmntCheatManager::DisableFrozenAddress(u64 address) { @@ -800,7 +800,7 @@ Result DmntCheatManager::DisableFrozenAddress(u64 address) { } g_frozen_addresses_map.erase(address); - return 0; + return ResultSuccess; } Handle DmntCheatManager::PrepareDebugNextApplication() { @@ -842,7 +842,7 @@ Result DmntCheatManager::ForceOpenCheatProcess() { std::scoped_lock lk(g_cheat_lock); if (HasActiveCheatProcess()) { - return 0; + return ResultSuccess; } /* Close the current application, if it's open. */ @@ -1031,7 +1031,7 @@ void DmntCheatManager::DetectThread(void *arg) { /* Setup detection for the next application, and close the duplicate handle. */ svcCloseHandle(PrepareDebugNextApplication()); - return 0x0; + return ResultSuccess; }, true)); waiter->Process(); @@ -1099,7 +1099,7 @@ Result DmntCheatManager::GetCheatProcessMetadata(CheatProcessMetadata *out) { if (HasActiveCheatProcess()) { *out = g_cheat_process_metadata; - return 0; + return ResultSuccess; } return ResultDmntCheatNotAttached; diff --git a/stratosphere/dmnt/source/dmnt_hid.cpp b/stratosphere/dmnt/source/dmnt_hid.cpp index 1f09d0edd..957174c23 100644 --- a/stratosphere/dmnt/source/dmnt_hid.cpp +++ b/stratosphere/dmnt/source/dmnt_hid.cpp @@ -28,5 +28,5 @@ Result HidManagement::GetKeysDown(u64 *keys) { hidScanInput(); *keys = hidKeysHeld(CONTROLLER_P1_AUTO); - return 0x0; + return ResultSuccess; } \ No newline at end of file diff --git a/stratosphere/dmnt/source/dmnt_service_target_io.cpp b/stratosphere/dmnt/source/dmnt_service_target_io.cpp index 540e555a8..9a0bfd01d 100644 --- a/stratosphere/dmnt/source/dmnt_service_target_io.cpp +++ b/stratosphere/dmnt/source/dmnt_service_target_io.cpp @@ -38,7 +38,7 @@ static std::unordered_map g_file_handles; static Result EnsureSdInitialized() { std::scoped_lock lk(g_sd_lock); if (g_sd_initialized) { - return 0; + return ResultSuccess; } Result rc = fsMountSdcard(&g_sd_fs); @@ -60,7 +60,7 @@ static Result GetFileByHandle(FsFile *out, u64 handle) { std::scoped_lock lk(g_file_handle_lock); if (g_file_handles.find(handle) != g_file_handles.end()) { *out = g_file_handles[handle]; - return 0; + return ResultSuccess; } return ResultFsInvalidArgument; } @@ -70,7 +70,7 @@ static Result CloseFileByHandle(u64 handle) { if (g_file_handles.find(handle) != g_file_handles.end()) { fsFileClose(&g_file_handles[handle]); g_file_handles.erase(handle); - return 0; + return ResultSuccess; } return ResultFsInvalidArgument; } @@ -199,8 +199,8 @@ Result DebugMonitorService::TargetIO_FileWrite(InBuffer hnd, InBuffer path, InBuffer attributes) { /* I don't really know why this command exists, Horizon doesn't allow you to set any attributes. */ - /* N just returns 0x0 unconditionally here. */ - return 0x0; + /* N just returns ResultSuccess unconditionally here. */ + return ResultSuccess; } Result DebugMonitorService::TargetIO_FileGetInformation(InBuffer path, OutBuffer out_info, Out is_directory) { @@ -245,7 +245,7 @@ Result DebugMonitorService::TargetIO_FileGetInformation(InBuffer path, Out Result DebugMonitorService::TargetIO_FileSetTime(InBuffer path, u64 create, u64 access, u64 modify) { /* This is another function that doesn't really need to exist, because Horizon doesn't let you set anything. */ - return 0x0; + return ResultSuccess; } Result DebugMonitorService::TargetIO_FileSetSize(InBuffer input, u64 size) { diff --git a/stratosphere/fatal/source/fatal_config.cpp b/stratosphere/fatal/source/fatal_config.cpp index 9cc7d91fc..858ca3bdb 100644 --- a/stratosphere/fatal/source/fatal_config.cpp +++ b/stratosphere/fatal/source/fatal_config.cpp @@ -41,7 +41,7 @@ IEvent *GetFatalSettingsEvent() { if (R_SUCCEEDED(setsysGetFatalDirtyFlags(&flags_0, &flags_1)) && (flags_0 & 1)) { UpdateLanguageCode(); } - return 0; + return ResultSuccess; }, true); } diff --git a/stratosphere/fatal/source/fatal_event_manager.cpp b/stratosphere/fatal/source/fatal_event_manager.cpp index db941f71f..c928cb80b 100644 --- a/stratosphere/fatal/source/fatal_event_manager.cpp +++ b/stratosphere/fatal/source/fatal_event_manager.cpp @@ -42,7 +42,7 @@ Result FatalEventManager::GetEvent(Handle *out) { } *out = this->events[this->events_gotten++].revent; - return 0; + return ResultSuccess; } void FatalEventManager::SignalEvents() { diff --git a/stratosphere/fatal/source/fatal_task_clock.cpp b/stratosphere/fatal/source/fatal_task_clock.cpp index fe1bf93d7..dff39695a 100644 --- a/stratosphere/fatal/source/fatal_task_clock.cpp +++ b/stratosphere/fatal/source/fatal_task_clock.cpp @@ -23,7 +23,7 @@ Result AdjustClockTask::AdjustClock() { constexpr u32 CPU_CLOCK_1020MHZ = 0x3CCBF700L; constexpr u32 GPU_CLOCK_307MHZ = 0x124F8000L; constexpr u32 EMC_CLOCK_1331MHZ = 0x4F588000L; - Result rc = 0; + Result rc = ResultSuccess; if (R_FAILED((rc = pcvSetClockRate(PcvModule_Cpu, CPU_CLOCK_1020MHZ)))) { return rc; diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index bd75e641c..27afbb956 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -136,5 +136,5 @@ Result ErrorReportTask::Run() { eventFire(this->erpt_event); - return 0; + return ResultSuccess; } \ No newline at end of file diff --git a/stratosphere/fatal/source/fatal_task_power.cpp b/stratosphere/fatal/source/fatal_task_power.cpp index 44e5b9f2e..39c7f757c 100644 --- a/stratosphere/fatal/source/fatal_task_power.cpp +++ b/stratosphere/fatal/source/fatal_task_power.cpp @@ -120,7 +120,7 @@ void PowerButtonObserveTask::WaitForPowerButton() { BpcSleepButtonState state; GpioValue val; while (true) { - Result rc = 0; + Result rc = ResultSuccess; if (check_vol_up && R_SUCCEEDED((rc = gpioPadGetValue(&vol_up_btn, &val))) && val == GpioValue_Low) { bpcRebootSystem(); @@ -142,16 +142,16 @@ void PowerButtonObserveTask::WaitForPowerButton() { Result PowerControlTask::Run() { MonitorBatteryState(); - return 0; + return ResultSuccess; } Result PowerButtonObserveTask::Run() { WaitForPowerButton(); - return 0; + return ResultSuccess; } Result StateTransitionStopTask::Run() { /* Nintendo ignores the output of this call... */ spsmPutErrorState(); - return 0; + return ResultSuccess; } diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index 673d3309c..f5d7fea94 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -48,7 +48,7 @@ Result ShowFatalTask::SetupDisplayInternal() { /* Try to open the display. */ if (R_FAILED((rc = viOpenDisplay("Internal", &display)))) { if (rc == ResultViNotFound) { - return 0; + return ResultSuccess; } else { return rc; } @@ -75,7 +75,7 @@ Result ShowFatalTask::SetupDisplayExternal() { /* Try to open the display. */ if (R_FAILED((rc = viOpenDisplay("External", &display)))) { if (rc == ResultViNotFound) { - return 0; + return ResultSuccess; } else { return rc; } @@ -92,7 +92,7 @@ Result ShowFatalTask::SetupDisplayExternal() { } Result ShowFatalTask::PrepareScreenForDrawing() { - Result rc = 0; + Result rc = ResultSuccess; /* Connect to vi. */ if (R_FAILED((rc = viInitialize(ViServiceType_Manager)))) { @@ -175,7 +175,7 @@ Result ShowFatalTask::PrepareScreenForDrawing() { } Result ShowFatalTask::ShowFatal() { - Result rc = 0; + Result rc = ResultSuccess; const FatalConfig *config = GetFatalConfig(); if (R_FAILED((rc = PrepareScreenForDrawing()))) { @@ -420,5 +420,5 @@ void BacklightControlTask::TurnOnBacklight() { Result BacklightControlTask::Run() { TurnOnBacklight(); - return 0; + return ResultSuccess; } diff --git a/stratosphere/fatal/source/fatal_task_sound.cpp b/stratosphere/fatal/source/fatal_task_sound.cpp index 2588b0ade..12f2f91a7 100644 --- a/stratosphere/fatal/source/fatal_task_sound.cpp +++ b/stratosphere/fatal/source/fatal_task_sound.cpp @@ -69,5 +69,5 @@ void StopSoundTask::StopSound() { Result StopSoundTask::Run() { StopSound(); - return 0; + return ResultSuccess; } diff --git a/stratosphere/fatal/source/fatal_throw.cpp b/stratosphere/fatal/source/fatal_throw.cpp index ad060c34f..eac1ef23f 100644 --- a/stratosphere/fatal/source/fatal_throw.cpp +++ b/stratosphere/fatal/source/fatal_throw.cpp @@ -30,7 +30,7 @@ static Result SetThrown() { } g_thrown = true; - return 0; + return ResultSuccess; } Result ThrowFatalForSelf(u32 error) { @@ -41,7 +41,7 @@ Result ThrowFatalForSelf(u32 error) { } Result ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCpuContext *cpu_ctx) { - Result rc = 0; + Result rc = ResultSuccess; FatalThrowContext ctx = {0}; ctx.error_code = error; if (cpu_ctx != nullptr) { @@ -102,7 +102,7 @@ Result ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCpuContext *cpu RunFatalTasks(&ctx, title_id, policy == FatalType_ErrorReportAndErrorScreen, &erpt_event, &battery_event); } else { /* If flag is not set, don't show the fatal screen. */ - return 0; + return ResultSuccess; } } @@ -112,5 +112,5 @@ Result ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCpuContext *cpu std::abort(); } - return 0; + return ResultSuccess; } diff --git a/stratosphere/libstratosphere b/stratosphere/libstratosphere index 5fcc1469c..1034e0744 160000 --- a/stratosphere/libstratosphere +++ b/stratosphere/libstratosphere @@ -1 +1 @@ -Subproject commit 5fcc1469c7c514ed4b2e40a4f8128a19b26df9ae +Subproject commit 1034e0744afcdaecaeb4ab6cb05c6011c75bfb3e diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index 2589c2958..ae64d9918 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -79,7 +79,7 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) { } if (ShouldOverrideContentsWithSD(tid) && R_SUCCEEDED(MountCodeNspOnSd(tid))) { - return 0x0; + return ResultSuccess; } if (R_FAILED(rc = ResolveContentPath(path, tid, sid))) { @@ -116,7 +116,7 @@ Result ContentManagement::UnmountCode() { g_mounted_hbl_nsp = false; } fsdevUnmountDevice("code"); - return 0; + return ResultSuccess; } @@ -469,7 +469,7 @@ Result ContentManagement::SetExternalContentSource(u64 tid, FsFileSystem filesys std::make_tuple(tid), std::make_tuple(tid, mountpoint)); - return 0; + return ResultSuccess; } void ContentManagement::ClearExternalContentSource(u64 tid) { diff --git a/stratosphere/loader/source/ldr_hid.cpp b/stratosphere/loader/source/ldr_hid.cpp index 1fc0ff00c..a4f9aa32d 100644 --- a/stratosphere/loader/source/ldr_hid.cpp +++ b/stratosphere/loader/source/ldr_hid.cpp @@ -32,5 +32,5 @@ Result HidManagement::GetKeysHeld(u64 *keys) { hidScanInput(); *keys = hidKeysHeld(CONTROLLER_P1_AUTO); - return 0x0; + return ResultSuccess; } diff --git a/stratosphere/loader/source/ldr_launch_queue.cpp b/stratosphere/loader/source/ldr_launch_queue.cpp index 4567566f5..dc81be361 100644 --- a/stratosphere/loader/source/ldr_launch_queue.cpp +++ b/stratosphere/loader/source/ldr_launch_queue.cpp @@ -38,13 +38,13 @@ Result LaunchQueue::Add(u64 tid, const char *args, u64 arg_size) { g_launch_queue[idx].arg_size = arg_size; std::copy(args, args + arg_size, g_launch_queue[idx].args); - return 0x0; + return ResultSuccess; } Result LaunchQueue::AddCopy(u64 tid_base, u64 tid) { int idx = GetIndex(tid_base); if (idx == LAUNCH_QUEUE_FULL) { - return 0x0; + return ResultSuccess; } return Add(tid, g_launch_queue[idx].args, g_launch_queue[idx].arg_size); @@ -62,7 +62,7 @@ Result LaunchQueue::AddItem(const LaunchItem *item) { } g_launch_queue[idx] = *item; - return 0x0; + return ResultSuccess; } int LaunchQueue::GetIndex(u64 tid) { diff --git a/stratosphere/loader/source/ldr_map.cpp b/stratosphere/loader/source/ldr_map.cpp index e94090ec7..b496cb855 100644 --- a/stratosphere/loader/source/ldr_map.cpp +++ b/stratosphere/loader/source/ldr_map.cpp @@ -75,7 +75,7 @@ Result MapUtils::LocateSpaceForMapModern(u64 *out, u64 out_size) { } if (mem_info.type == 0 && mem_info.addr - cur_base + mem_info.size >= out_size) { *out = cur_base; - return 0x0; + return ResultSuccess; } if (mem_info.addr + mem_info.size <= cur_base) { return rc; @@ -110,7 +110,7 @@ Result MapUtils::LocateSpaceForMapDeprecated(u64 *out, u64 out_size) { } if (mem_info.type == 0 && mem_info.addr - cur_base + mem_info.size >= out_size) { *out = cur_base; - return 0x0; + return ResultSuccess; } u64 mem_end = mem_info.addr + mem_info.size; if (mem_end < cur_base) { @@ -214,5 +214,5 @@ Result MapUtils::GetAddressSpaceInfo(AddressSpaceInfo *out, Handle process_h) { out->heap_end = out->heap_base + out->heap_size; out->map_end = out->map_base + out->map_size; out->addspace_end = out->addspace_base + out->addspace_size; - return 0; + return ResultSuccess; } \ No newline at end of file diff --git a/stratosphere/loader/source/ldr_map.hpp b/stratosphere/loader/source/ldr_map.hpp index 27c35a8b0..8af62f60f 100644 --- a/stratosphere/loader/source/ldr_map.hpp +++ b/stratosphere/loader/source/ldr_map.hpp @@ -72,7 +72,7 @@ class AutoCloseMap { this->process_handle = process_h; this->base_address = address; this->size = size; - return 0; + return ResultSuccess; } void Close() { @@ -153,7 +153,7 @@ struct MappedCodeMemory { } Result Unmap() { - Result rc = 0; + Result rc = ResultSuccess; if (this->IsMapped()) { if (R_FAILED((rc = svcUnmapProcessMemory(this->mapped_address, this->process_handle, this->code_memory_address, this->size)))) { /* TODO: panic(). */ diff --git a/stratosphere/loader/source/ldr_npdm.cpp b/stratosphere/loader/source/ldr_npdm.cpp index 6214d5a16..c3f2e4886 100644 --- a/stratosphere/loader/source/ldr_npdm.cpp +++ b/stratosphere/loader/source/ldr_npdm.cpp @@ -30,7 +30,7 @@ Result NpdmUtils::LoadNpdmFromCache(u64 tid, NpdmInfo *out) { return LoadNpdm(tid, out); } *out = g_npdm_cache.info; - return 0; + return ResultSuccess; } FILE *NpdmUtils::OpenNpdmFromECS(ContentManagement::ExternalContentSource *ecs) { @@ -179,7 +179,7 @@ Result NpdmUtils::LoadNpdmInternal(FILE *f_npdm, NpdmUtils::NpdmCache *cache) { info->acid_kac = (void *)((uintptr_t)info->acid + info->acid->kac_offset); - rc = 0; + rc = ResultSuccess; return rc; } @@ -223,13 +223,13 @@ Result NpdmUtils::LoadNpdm(u64 tid, NpdmInfo *out) { /* We validated! */ info->title_id = tid; *out = *info; - rc = 0; + rc = ResultSuccess; return rc; } Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size_t num_restrict_caps, u32 *&cur_cap, size_t &caps_remaining) { - Result rc = 0; + Result rc = ResultSuccess; u32 desc = *cur_cap++; caps_remaining--; unsigned int low_bits = 0; @@ -278,7 +278,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size break; } /* Valid! */ - rc = 0; + rc = ResultSuccess; break; } } @@ -299,7 +299,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size break; } /* Valid! */ - rc = 0; + rc = ResultSuccess; break; } } @@ -353,7 +353,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size continue; } /* Valid! */ - rc = 0; + rc = ResultSuccess; break; } } @@ -368,13 +368,13 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size continue; } /* Valid! */ - rc = 0; + rc = ResultSuccess; break; } } break; case 11: /* IRQ Pair. */ - rc = 0x0; + rc = ResultSuccess; for (unsigned int irq_i = 0; irq_i < 2; irq_i++) { u32 irq = desc & 0x3FF; desc >>= 10; @@ -411,7 +411,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size } if (desc == r_desc) { /* Valid! */ - rc = 0; + rc = ResultSuccess; } break; case 14: /* Kernel Release Version. */ @@ -428,7 +428,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size } if (desc == r_desc) { /* Valid! */ - rc = 0; + rc = ResultSuccess; } break; case 15: /* Handle Table Size. */ @@ -442,7 +442,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size break; } /* Valid! */ - rc = 0; + rc = ResultSuccess; break; } } @@ -461,11 +461,11 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size } if ((desc & ~r_desc) == 0) { /* Valid! */ - rc = 0; + rc = ResultSuccess; } break; case 32: /* Empty Descriptor. */ - rc = 0; + rc = ResultSuccess; break; default: /* Unrecognized Descriptor. */ rc = ResultLoaderUnknownCapability; @@ -475,7 +475,7 @@ Result NpdmUtils::ValidateCapabilityAgainstRestrictions(u32 *restrict_caps, size } Result NpdmUtils::ValidateCapabilities(u32 *acid_caps, size_t num_acid_caps, u32 *aci0_caps, size_t num_aci0_caps) { - Result rc = 0; + Result rc = ResultSuccess; size_t remaining = num_aci0_caps; u32 *cur_cap = aci0_caps; while (remaining) { diff --git a/stratosphere/loader/source/ldr_nro.cpp b/stratosphere/loader/source/ldr_nro.cpp index e3b4b5770..66408698b 100644 --- a/stratosphere/loader/source/ldr_nro.cpp +++ b/stratosphere/loader/source/ldr_nro.cpp @@ -43,7 +43,7 @@ Result NroUtils::ValidateNrrHeader(NrrHeader *header, u64 size, u64 title_id_min return ResultLoaderInvalidNrr; } - return 0x0; + return ResultSuccess; } Result NroUtils::LoadNro(Registration::Process *target_proc, Handle process_h, u64 nro_heap_address, u64 nro_heap_size, u64 bss_heap_address, u64 bss_heap_size, u64 *out_address) { @@ -51,7 +51,7 @@ Result NroUtils::LoadNro(Registration::Process *target_proc, Handle process_h, u MappedCodeMemory mcm_nro = {0}; MappedCodeMemory mcm_bss = {0}; unsigned int i; - Result rc = 0; + Result rc = ResultSuccess; u8 nro_hash[0x20]; struct sha256_state sha_ctx; @@ -143,7 +143,7 @@ Result NroUtils::LoadNro(Registration::Process *target_proc, Handle process_h, u Registration::AddNroToProcess(target_proc->index, &mcm_nro, &mcm_bss, nro_hdr.text_size, nro_hdr.ro_size, nro_hdr.rw_size, nro_hdr.build_id); *out_address = mcm_nro.code_memory_address; - rc = 0x0; + rc = ResultSuccess; return rc; } diff --git a/stratosphere/loader/source/ldr_nso.cpp b/stratosphere/loader/source/ldr_nso.cpp index a4968772b..f2746ff2f 100644 --- a/stratosphere/loader/source/ldr_nso.cpp +++ b/stratosphere/loader/source/ldr_nso.cpp @@ -127,7 +127,7 @@ Result NsoUtils::LoadNsoHeaders(u64 title_id) { } } - return 0x0; + return ResultSuccess; } Result NsoUtils::ValidateNsoLoadSet() { @@ -157,7 +157,7 @@ Result NsoUtils::ValidateNsoLoadSet() { } } - return 0x0; + return ResultSuccess; } @@ -239,7 +239,7 @@ Result NsoUtils::CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLo extents->args_address += extents->base_address; } - return 0x0; + return ResultSuccess; } @@ -286,7 +286,7 @@ Result NsoUtils::LoadNsoSegment(u64 title_id, unsigned int index, unsigned int s } } - return 0x0; + return ResultSuccess; } Result NsoUtils::LoadNsosIntoProcessMemory(Handle process_h, u64 title_id, NsoLoadExtents *extents, u8 *args, u32 args_size) { diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index e2e3ca0b1..ad4cdf9d4 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -107,7 +107,7 @@ Result ProcessCreation::InitializeProcessInfo(NpdmUtils::NpdmInfo *npdm, Handle } } - return 0x0; + return ResultSuccess; } Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nca_path, LaunchQueue::LaunchItem *launch_item, u64 arg_flags, Handle reslimit_h) { @@ -221,7 +221,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc /* Send the pid/tid pair to anyone interested in man-in-the-middle-attacking it. */ Registration::AssociatePidTidForMitM(index); - rc = 0; + rc = ResultSuccess; /* If HBL, override HTML document path. */ if (ContentManagement::ShouldOverrideContentsWithHBL(target_process->tid_sid.title_id)) { diff --git a/stratosphere/loader/source/ldr_process_manager.cpp b/stratosphere/loader/source/ldr_process_manager.cpp index 31482e155..532c200e2 100644 --- a/stratosphere/loader/source/ldr_process_manager.cpp +++ b/stratosphere/loader/source/ldr_process_manager.cpp @@ -150,7 +150,7 @@ Result ProcessManagerService::PopulateProgramInfoBuffer(ProcessManagerService::P out->aci0_fah_size = info.aci0->fah_size; std::memcpy(out->ac_buffer + offset, info.aci0_fah, out->aci0_fah_size); offset += out->aci0_fah_size; - rc = 0; + rc = ResultSuccess; } } } diff --git a/stratosphere/loader/source/ldr_registration.cpp b/stratosphere/loader/source/ldr_registration.cpp index 62bc8b1dd..d33b091e5 100644 --- a/stratosphere/loader/source/ldr_registration.cpp +++ b/stratosphere/loader/source/ldr_registration.cpp @@ -95,7 +95,7 @@ Result Registration::GetRegisteredTidSid(u64 index, Registration::TidSid *out) { *out = target_process->tid_sid; - return 0; + return ResultSuccess; } void Registration::SetProcessIdTidAndIs64BitAddressSpace(u64 index, u64 process_id, u64 tid, bool is_64_bit_addspace) { @@ -149,7 +149,7 @@ Result Registration::AddNrrInfo(u64 index, MappedCodeMemory *nrr_info) { return ResultLoaderInsufficientNrrRegistrations; } *nrr_info_it = *nrr_info; - return 0; + return ResultSuccess; } Result Registration::RemoveNrrInfo(u64 index, u64 base_address) { @@ -162,7 +162,7 @@ Result Registration::RemoveNrrInfo(u64 index, u64 base_address) { for (unsigned int i = 0; i < NRR_INFO_MAX; i++) { if (target_process->nrr_infos[i].IsActive() && target_process->nrr_infos[i].base_address == base_address) { target_process->nrr_infos[i].Close(); - return 0; + return ResultSuccess; } } return ResultLoaderNotRegistered; @@ -273,7 +273,7 @@ Result Registration::GetNsoInfosForProcessId(Registration::NsoInfo *out, u32 max *num_written = cur; - return 0; + return ResultSuccess; } void Registration::AssociatePidTidForMitM(u64 index) { diff --git a/stratosphere/loader/source/ldr_ro_service.cpp b/stratosphere/loader/source/ldr_ro_service.cpp index e90fbb06c..fd1f59e24 100644 --- a/stratosphere/loader/source/ldr_ro_service.cpp +++ b/stratosphere/loader/source/ldr_ro_service.cpp @@ -70,7 +70,7 @@ Result RelocatableObjectsService::UnloadNro(PidDescriptor pid_desc, u64 nro_addr } Result RelocatableObjectsService::LoadNrr(PidDescriptor pid_desc, u64 nrr_address, u64 nrr_size) { - Result rc = 0; + Result rc = ResultSuccess; Registration::Process *target_proc = NULL; MappedCodeMemory nrr_info = {0}; ON_SCOPE_EXIT { @@ -142,7 +142,7 @@ Result RelocatableObjectsService::Initialize(PidDescriptor pid_desc, CopiedHandl this->process_handle = process_h.handle; this->process_id = handle_pid; this->has_initialized = true; - return 0; + return ResultSuccess; } return ResultLoaderInvalidProcess; } diff --git a/stratosphere/loader/source/ldr_shell.cpp b/stratosphere/loader/source/ldr_shell.cpp index a359db5b2..ea6b98919 100644 --- a/stratosphere/loader/source/ldr_shell.cpp +++ b/stratosphere/loader/source/ldr_shell.cpp @@ -43,7 +43,7 @@ Result ShellService::SetExternalContentSource(Out out, u64 tid) { serviceCreate(&service, client_h); ContentManagement::SetExternalContentSource(tid, FsFileSystem {service}); out.SetValue(server_h); - return 0; + return ResultSuccess; } void ShellService::ClearExternalContentSource(u64 tid) { diff --git a/stratosphere/pm/source/pm_debug_monitor.cpp b/stratosphere/pm/source/pm_debug_monitor.cpp index 831dc6693..49fc7c84a 100644 --- a/stratosphere/pm/source/pm_debug_monitor.cpp +++ b/stratosphere/pm/source/pm_debug_monitor.cpp @@ -27,7 +27,7 @@ Result DebugMonitorService::GetUnknownStub(Out count, OutBuffer out_buf return ResultPmInvalidSize; } count.SetValue(0); - return 0x0; + return ResultSuccess; } Result DebugMonitorService::GetDebugProcessIds(Out count, OutBuffer out_pids) { @@ -47,7 +47,7 @@ Result DebugMonitorService::GetTitleProcessId(Out pid, u64 tid) { std::shared_ptr proc = Registration::GetProcessByTitleId(tid); if (proc != nullptr) { pid.SetValue(proc->pid); - return 0; + return ResultSuccess; } return ResultPmProcessNotFound; } @@ -62,7 +62,7 @@ Result DebugMonitorService::GetApplicationProcessId(Out pid) { std::shared_ptr app_proc; if (Registration::HasApplicationProcess(&app_proc)) { pid.SetValue(app_proc->pid); - return 0x0; + return ResultSuccess; } return ResultPmProcessNotFound; } @@ -81,7 +81,7 @@ Result DebugMonitorService::AtmosphereGetProcessInfo(Out proc_hand if (proc != nullptr) { proc_hand.SetValue(proc->handle); tid_sid.SetValue(proc->tid_sid); - return 0; + return ResultSuccess; } return ResultPmProcessNotFound; } @@ -104,5 +104,5 @@ Result DebugMonitorService::AtmosphereGetCurrentLimitInfo(Out cur_val, Out< return rc; } - return 0; + return ResultSuccess; } diff --git a/stratosphere/pm/source/pm_info.cpp b/stratosphere/pm/source/pm_info.cpp index 6c1c2c42b..752ff0bb0 100644 --- a/stratosphere/pm/source/pm_info.cpp +++ b/stratosphere/pm/source/pm_info.cpp @@ -24,7 +24,7 @@ Result InformationService::GetTitleId(Out tid, u64 pid) { std::shared_ptr proc = Registration::GetProcess(pid); if (proc != NULL) { tid.SetValue(proc->tid_sid.title_id); - return 0; + return ResultSuccess; } return ResultPmProcessNotFound; } diff --git a/stratosphere/pm/source/pm_registration.cpp b/stratosphere/pm/source/pm_registration.cpp index 06fd4b01f..7a8ad0764 100644 --- a/stratosphere/pm/source/pm_registration.cpp +++ b/stratosphere/pm/source/pm_registration.cpp @@ -56,7 +56,7 @@ void Registration::InitializeSystemResources() { Result Registration::ProcessLaunchStartCallback(u64 timeout) { g_process_launch_start_event->Clear(); Registration::HandleProcessLaunch(); - return 0; + return ResultSuccess; } IWaitable *Registration::GetProcessLaunchStartEvent() { @@ -137,13 +137,13 @@ void Registration::HandleProcessLaunch() { if (new_process.tid_sid.title_id == g_debug_on_launch_tid.load()) { g_debug_title_event->Signal(); g_debug_on_launch_tid = 0; - rc = 0; + rc = ResultSuccess; } else if ((new_process.flags & PROCESSFLAGS_APPLICATION) && g_debug_next_application.load()) { g_debug_application_event->Signal(); g_debug_next_application = false; - rc = 0; + rc = ResultSuccess; } else if (LAUNCHFLAGS_STARTSUSPENDED(launch_flags)) { - rc = 0; + rc = ResultSuccess; } else { rc = svcStartProcess(new_process.handle, program_info.main_thread_priority, program_info.default_cpu_id, program_info.main_thread_stack_size); @@ -283,7 +283,7 @@ Result Registration::HandleSignaledProcess(std::shared_ptr process) { @@ -414,7 +414,7 @@ Result Registration::GetDebugProcessIds(u64 *out_pids, u32 max_out, u32 *num_out } *num_out = num; - return 0; + return ResultSuccess; } Handle Registration::GetProcessEventHandle() { @@ -483,13 +483,13 @@ Result Registration::EnableDebugForTitleId(u64 tid, Handle *out) { return ResultPmDebugHookInUse; } *out = g_debug_title_event->GetHandle(); - return 0x0; + return ResultSuccess; } Result Registration::EnableDebugForApplication(Handle *out) { g_debug_next_application = true; *out = g_debug_application_event->GetHandle(); - return 0; + return ResultSuccess; } Result Registration::DisableDebug(u32 which) { @@ -499,5 +499,5 @@ Result Registration::DisableDebug(u32 which) { if (which & 2) { g_debug_next_application = false; } - return 0; + return ResultSuccess; } diff --git a/stratosphere/pm/source/pm_resource_limits.cpp b/stratosphere/pm/source/pm_resource_limits.cpp index 28513a4f9..c5861bc1e 100644 --- a/stratosphere/pm/source/pm_resource_limits.cpp +++ b/stratosphere/pm/source/pm_resource_limits.cpp @@ -72,7 +72,7 @@ static u64 g_system_boost_size = 0; /* Tries to set Resource limits for a category. */ static Result SetResourceLimits(ResourceLimitUtils::ResourceLimitCategory category, u64 new_memory_size) { - Result rc = 0; + Result rc = ResultSuccess; u64 old_memory_size = g_resource_limits[category][LimitableResource_Memory]; g_resource_limits[category][LimitableResource_Memory] = new_memory_size; for (unsigned int r = 0; r < 5; r++) { @@ -86,7 +86,7 @@ static Result SetResourceLimits(ResourceLimitUtils::ResourceLimitCategory catego static Result SetNewMemoryResourceLimit(ResourceLimitUtils::ResourceLimitCategory category, u64 new_memory_size) { - Result rc = 0; + Result rc = ResultSuccess; u64 old_memory_size = g_resource_limits[category][LimitableResource_Memory]; g_resource_limits[category][LimitableResource_Memory] = new_memory_size; if (R_FAILED((rc = svcSetResourceLimitLimitValue(g_resource_limit_handles[category], LimitableResource_Memory, g_resource_limits[category][LimitableResource_Memory])))) { @@ -237,7 +237,7 @@ Handle ResourceLimitUtils::GetResourceLimitHandleByCategory(ResourceLimitCategor } Result ResourceLimitUtils::BoostSystemMemoryResourceLimit(u64 boost_size) { - Result rc = 0; + Result rc = ResultSuccess; if (boost_size > g_memory_resource_limits[g_memory_limit_type][ResourceLimitCategory_Application]) { return ResultPmInvalidSize; } diff --git a/stratosphere/pm/source/pm_shell.cpp b/stratosphere/pm/source/pm_shell.cpp index c9ce75dc7..69f91718b 100644 --- a/stratosphere/pm/source/pm_shell.cpp +++ b/stratosphere/pm/source/pm_shell.cpp @@ -67,7 +67,7 @@ Result ShellService::FinalizeExitedProcess(u64 pid) { return ResultPmNotExited; } else { Registration::FinalizeExitedProcess(proc); - return 0x0; + return ResultSuccess; } } @@ -77,7 +77,7 @@ Result ShellService::ClearProcessNotificationFlag(u64 pid) { auto proc = Registration::GetProcess(pid); if (proc != NULL) { proc->flags &= ~PROCESSFLAGS_CRASHED; - return 0x0; + return ResultSuccess; } else { return ResultPmProcessNotFound; } @@ -96,7 +96,7 @@ Result ShellService::GetApplicationProcessId(Out pid) { std::shared_ptr app_proc; if (Registration::HasApplicationProcess(&app_proc)) { pid.SetValue(app_proc->pid); - return 0; + return ResultSuccess; } return ResultPmProcessNotFound; } @@ -109,5 +109,5 @@ Result ShellService::BoostSystemThreadsResourceLimit() { /* Starting in 7.0.0, Nintendo reduces the number of system threads from 0x260 to 0x60, */ /* Until this command is called to double that amount to 0xC0. */ /* We will simply not reduce the number of system threads available for no reason. */ - return 0x0; + return ResultSuccess; } diff --git a/stratosphere/sm/source/sm_registration.cpp b/stratosphere/sm/source/sm_registration.cpp index dfda9ac9d..f4da0e576 100644 --- a/stratosphere/sm/source/sm_registration.cpp +++ b/stratosphere/sm/source/sm_registration.cpp @@ -204,7 +204,7 @@ Result Registration::RegisterProcess(u64 pid, u8 *acid_sac, size_t acid_sac_size proc->pid = pid; proc->sac_size = aci0_sac_size; std::copy(aci0_sac, aci0_sac + aci0_sac_size, proc->sac); - return 0; + return ResultSuccess; } Result Registration::UnregisterProcess(u64 pid) { @@ -214,7 +214,7 @@ Result Registration::UnregisterProcess(u64 pid) { } proc->pid = 0; - return 0; + return ResultSuccess; } /* Service management. */ @@ -436,7 +436,7 @@ Result Registration::UnregisterServiceForPid(u64 pid, u64 service) { svcCloseHandle(target_service->mitm_port_h); svcCloseHandle(target_service->mitm_query_h); *target_service = (const Registration::Service){0}; - return 0; + return ResultSuccess; } @@ -510,7 +510,7 @@ Result Registration::UninstallMitmForPid(u64 pid, u64 service) { svcCloseHandle(target_service->mitm_port_h); svcCloseHandle(target_service->mitm_query_h); target_service->mitm_pid = 0; - return 0; + return ResultSuccess; } Result Registration::AcknowledgeMitmSessionForPid(u64 pid, u64 service, Handle *out, u64 *out_pid) { @@ -539,7 +539,7 @@ Result Registration::AcknowledgeMitmSessionForPid(u64 pid, u64 service, Handle * target_service->mitm_fwd_sess_h = 0; target_service->mitm_waiting_ack_pid = 0; target_service->mitm_waiting_ack = false; - return 0; + return ResultSuccess; } Result Registration::AssociatePidTidForMitm(u64 pid, u64 tid) { @@ -560,7 +560,7 @@ Result Registration::AssociatePidTidForMitm(u64 pid, u64 tid) { ipcDispatch(service.mitm_query_h); } } - return 0x0; + return ResultSuccess; } void Registration::ConvertServiceToRecord(Registration::Service *service, SmServiceRecord *record) { @@ -591,7 +591,7 @@ Result Registration::GetServiceRecord(u64 service, SmServiceRecord *out) { } ConvertServiceToRecord(target_service, out); - return 0x0; + return ResultSuccess; } void Registration::ListServiceRecords(u64 offset, u64 max_out, SmServiceRecord *out, u64 *out_count) { diff --git a/stratosphere/sm/source/sm_user_service.cpp b/stratosphere/sm/source/sm_user_service.cpp index 4963902bf..9965f36cb 100644 --- a/stratosphere/sm/source/sm_user_service.cpp +++ b/stratosphere/sm/source/sm_user_service.cpp @@ -22,7 +22,7 @@ Result UserService::Initialize(PidDescriptor pid) { this->pid = pid.pid; this->has_initialized = true; - return 0; + return ResultSuccess; } Result UserService::GetService(Out out_h, SmServiceName service) {