From dd78ede99f4735a4dc8e99369f693adce78bf928 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 26 Mar 2022 00:14:36 -0700 Subject: [PATCH] ams: use R_SUCCEED, R_THROW globally --- .../source/fatal_save_context.cpp | 2 +- exosphere/mariko_fatal/source/fatal_sdmmc.cpp | 6 +- .../mariko_fatal/source/fs/fatal_fs_api.cpp | 56 ++++++------ fusee/program/source/fs/fusee_fs_api.cpp | 64 +++++++------- .../source/fs/fusee_fs_file_storage.cpp | 2 +- fusee/program/source/fs/fusee_fs_storage.hpp | 8 +- fusee/program/source/fusee_emummc.cpp | 26 +++--- fusee/program/source/fusee_fatal.cpp | 2 +- fusee/program/source/fusee_mmc.cpp | 2 +- .../stratosphere/ddsf/ddsf_i_device.hpp | 2 +- .../common/fs_dbm_rom_key_value_storage.hpp | 24 ++--- .../include/stratosphere/fs/fs_istorage.hpp | 4 +- .../stratosphere/fs/fs_memory_storage.hpp | 16 ++-- .../fs/fs_read_only_filesystem.hpp | 34 +++---- .../stratosphere/fs/fs_remote_filesystem.hpp | 4 +- .../stratosphere/fs/fs_remote_storage.hpp | 2 +- .../include/stratosphere/fs/fs_substorage.hpp | 4 +- .../stratosphere/fs/fsa/fs_idirectory.hpp | 2 +- .../fs/impl/fs_priority_utils.hpp | 8 +- .../buffers/fssystem_buffer_manager_utils.hpp | 12 +-- .../fssystem_file_system_buffer_manager.hpp | 10 +-- .../fssystem_alignment_matching_storage.hpp | 6 +- .../fssystem/fssystem_allocator_utility.hpp | 2 +- .../fssystem/fssystem_asynchronous_access.hpp | 4 +- .../fssystem_bucket_tree_template_impl.hpp | 2 +- ...ssystem_indirect_storage_template_impl.hpp | 2 +- ...ssystem_integrity_verification_storage.hpp | 2 +- .../i2c/i2c_register_accessor.hpp | 4 +- .../stratosphere/kvdb/kvdb_auto_buffer.hpp | 4 +- .../kvdb/kvdb_file_key_value_cache.hpp | 22 ++--- .../kvdb/kvdb_file_key_value_store.hpp | 2 +- .../kvdb/kvdb_memory_key_value_store.hpp | 28 +++--- .../stratosphere/ncm/ncm_auto_buffer.hpp | 4 +- .../ncm/ncm_content_meta_database.hpp | 4 +- .../ncm/ncm_install_task_base.hpp | 8 +- .../stratosphere/pgl/pgl_event_observer.hpp | 4 +- .../sf/hipc/sf_hipc_server_manager.hpp | 4 +- .../sf/impl/sf_impl_command_serialization.hpp | 22 ++--- .../impl/tipc_autogen_interface_macros.hpp | 2 +- .../impl/tipc_impl_command_serialization.hpp | 6 +- .../stratosphere/tipc/tipc_object_manager.hpp | 2 +- .../stratosphere/tipc/tipc_server_manager.hpp | 6 +- .../source/cal/cal_battery_api.cpp | 4 +- .../source/cal/cal_crc_utils.cpp | 2 +- .../source/cal/cal_fs_utils.cpp | 2 +- .../capsrv/capsrv_screen_shot_control_api.cpp | 4 +- .../server/capsrv_server_decoder_api.cpp | 2 +- ...odersrv_decoder_control_server_manager.cpp | 2 +- .../decodersrv_decoder_control_service.cpp | 2 +- .../jpeg/capsrv_server_jpeg_error_handler.hpp | 4 +- .../jpeg/decodersrv_software_jpeg_decoder.cpp | 6 +- .../source/dd/dd_device_address_space.cpp | 2 +- ...d_device_address_space_impl.os.horizon.cpp | 8 +- .../ddsf/ddsf_device_code_entry_manager.cpp | 10 +-- .../source/ddsf/ddsf_session_api.cpp | 2 +- .../source/erpt/srv/erpt_srv_attachment.cpp | 6 +- .../erpt/srv/erpt_srv_attachment_impl.cpp | 4 +- .../source/erpt/srv/erpt_srv_context.cpp | 10 +-- .../source/erpt/srv/erpt_srv_context_impl.cpp | 20 ++--- .../erpt/srv/erpt_srv_context_record.cpp | 14 +-- .../erpt/srv/erpt_srv_forced_shutdown.cpp | 10 +-- .../source/erpt/srv/erpt_srv_formatter.hpp | 22 ++--- .../source/erpt/srv/erpt_srv_journal.cpp | 4 +- .../srv/erpt_srv_journal_for_attachments.cpp | 16 ++-- .../erpt/srv/erpt_srv_journal_for_meta.cpp | 2 +- .../erpt/srv/erpt_srv_journal_for_reports.cpp | 16 ++-- .../source/erpt/srv/erpt_srv_main.cpp | 14 +-- .../source/erpt/srv/erpt_srv_manager_impl.cpp | 6 +- .../source/erpt/srv/erpt_srv_report.cpp | 6 +- .../source/erpt/srv/erpt_srv_report_impl.cpp | 4 +- .../source/erpt/srv/erpt_srv_reporter.cpp | 20 ++--- .../source/erpt/srv/erpt_srv_reporter.hpp | 2 +- .../source/erpt/srv/erpt_srv_service.cpp | 4 +- .../source/erpt/srv/erpt_srv_session_impl.cpp | 2 +- .../source/erpt/srv/erpt_srv_stream.cpp | 10 +-- .../fs_dbm_hierarchical_rom_file_table.cpp | 38 ++++---- .../source/fs/common/fs_dbm_rom_path_tool.cpp | 10 +-- .../source/fs/common/fs_file_storage.cpp | 8 +- .../libstratosphere/source/fs/fs_bis.cpp | 2 +- .../source/fs/fs_content_storage.cpp | 2 +- .../libstratosphere/source/fs/fs_data.cpp | 4 +- .../source/fs/fs_game_card.cpp | 2 +- .../source/fs/fs_memory_management.cpp | 2 +- .../libstratosphere/source/fs/fs_priority.cpp | 8 +- .../source/fs/fs_romfs_filesystem.cpp | 72 +++++++-------- .../source/fs/fs_save_data_management.cpp | 8 +- .../libstratosphere/source/fs/fs_sd_card.cpp | 4 +- .../source/fs/fsa/fs_file_accessor.cpp | 6 +- .../source/fs/fsa/fs_mount_table.cpp | 6 +- .../source/fs/fsa/fs_mount_utils.cpp | 8 +- .../source/fs/fsa/fs_user_directory.cpp | 4 +- .../source/fs/fsa/fs_user_file.cpp | 20 ++--- .../source/fs/fsa/fs_user_filesystem.cpp | 30 +++---- .../fs/fsa/fs_user_filesystem_for_debug.cpp | 2 +- ..._event_notifier_service_object_adapter.hpp | 2 +- .../fssrv_partition_file_system_creator.cpp | 2 +- .../fssrv_rom_file_system_creator.cpp | 2 +- .../fssrv_storage_on_nca_creator.cpp | 10 +-- .../fssrv/fssrv_file_system_proxy_api.cpp | 4 +- .../fssrv/fssrv_program_registry_impl.cpp | 2 +- .../impl/fssrv_program_registry_manager.cpp | 16 ++-- .../fssystem_file_system_buddy_heap.cpp | 2 +- .../fssystem_file_system_buffer_manager.cpp | 2 +- ...ystem_aes_ctr_counter_extended_storage.cpp | 16 ++-- .../fssystem/fssystem_aes_ctr_storage.cpp | 10 +-- ...system_alignment_matching_storage_impl.cpp | 8 +- .../source/fssystem/fssystem_bucket_tree.cpp | 22 ++--- .../fssystem/fssystem_buffered_storage.cpp | 34 +++---- .../fssystem_compression_configuration.cpp | 2 +- .../fssystem/fssystem_external_code.cpp | 2 +- .../fssystem_hierarchical_sha256_storage.cpp | 6 +- .../fssystem_hierarchical_sha256_storage.hpp | 2 +- .../fssystem/fssystem_indirect_storage.cpp | 2 +- .../fssystem/fssystem_key_slot_cache.hpp | 6 +- .../source/fssystem/fssystem_nca_reader.cpp | 6 +- .../fssystem_partition_file_system_meta.cpp | 6 +- .../fssystem/fssystem_pooled_buffer.cpp | 4 +- ...fssystem_read_only_block_cache_storage.hpp | 12 +-- .../fssystem/fssystem_sparse_storage.cpp | 4 +- .../nintendo/nx/impl/gpio_driver_impl.cpp | 14 +-- .../source/gpio/driver/gpio_pad_api.cpp | 12 +-- .../gpio/driver/impl/gpio_driver_core.cpp | 6 +- .../driver/impl/gpio_pad_session_impl.cpp | 8 +- .../source/gpio/gpio_client_api.cpp | 6 +- .../source/gpio/gpio_remote_manager_impl.cpp | 4 +- .../gpio/gpio_remote_pad_session_impl.hpp | 2 +- .../gpio/server/gpio_server_manager_impl.cpp | 2 +- .../server/gpio_server_pad_session_impl.hpp | 10 +-- .../libstratosphere/source/hid/hid_api.cpp | 4 +- .../source/hos/hos_version_api.cpp | 4 +- .../htc/server/driver/htc_htclow_driver.cpp | 8 +- .../htc/server/htc_htc_service_object.cpp | 10 +-- .../source/htc/server/htc_htcmisc_impl.cpp | 8 +- .../source/htc/server/htc_observer.cpp | 2 +- .../htc/server/rpc/htc_htcmisc_rpc_server.cpp | 8 +- .../htc/server/rpc/htc_htcmisc_rpc_tasks.cpp | 24 ++--- .../source/htc/server/rpc/htc_rpc_client.cpp | 12 +-- .../source/htc/server/rpc/htc_rpc_client.hpp | 28 +++--- .../server/rpc/htc_rpc_task_id_free_list.hpp | 2 +- .../htc/server/rpc/htc_rpc_task_queue.hpp | 2 +- .../source/htc/server/rpc/htc_rpc_tasks.hpp | 8 +- .../htc/tenv/htc_tenv_service_manager.cpp | 2 +- .../source/htcfs/htcfs_client_impl.cpp | 84 +++++++++--------- .../htcfs_file_system_service_object.cpp | 8 +- .../source/htcfs/htcfs_result.hpp | 14 +-- .../htclow/ctrl/htclow_ctrl_service.cpp | 24 ++--- .../htclow/ctrl/htclow_ctrl_state_machine.cpp | 2 +- .../htclow/driver/htclow_driver_manager.cpp | 6 +- .../htclow_socket_discovery_manager.cpp | 2 +- .../htclow/driver/htclow_socket_driver.cpp | 12 +-- .../htclow/driver/htclow_usb_driver.cpp | 6 +- .../source/htclow/driver/htclow_usb_impl.cpp | 18 ++-- .../source/htclow/htclow_channel.cpp | 8 +- .../source/htclow/htclow_manager_impl.cpp | 4 +- .../source/htclow/htclow_worker.cpp | 6 +- .../source/htclow/mux/htclow_mux.cpp | 20 ++--- .../htclow/mux/htclow_mux_channel_impl.cpp | 30 +++---- .../mux/htclow_mux_channel_impl_map.cpp | 4 +- .../mux/htclow_mux_global_send_buffer.cpp | 2 +- .../htclow/mux/htclow_mux_ring_buffer.cpp | 8 +- .../htclow/mux/htclow_mux_task_manager.cpp | 2 +- .../htcs/client/htcs_session.os.horizon.cpp | 20 ++--- .../source/htcs/impl/htcs_manager.cpp | 6 +- .../source/htcs/impl/htcs_manager_impl.cpp | 2 +- .../source/htcs/impl/htcs_service.cpp | 48 +++++----- .../impl/rpc/htcs_data_channel_manager.cpp | 4 +- .../htcs/impl/rpc/htcs_rpc_accept_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_bind_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_close_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_connect_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_fcntl_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_listen_task.cpp | 8 +- .../impl/rpc/htcs_rpc_receive_small_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_receive_task.cpp | 10 +-- .../htcs/impl/rpc/htcs_rpc_select_task.cpp | 8 +- .../impl/rpc/htcs_rpc_send_small_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_send_task.cpp | 12 +-- .../htcs/impl/rpc/htcs_rpc_shutdown_task.cpp | 8 +- .../htcs/impl/rpc/htcs_rpc_socket_task.cpp | 8 +- .../server/htcs_manager_service_object.cpp | 12 +-- .../server/htcs_socket_service_object.cpp | 44 +++++----- .../nintendo/nx/impl/i2c_bus_accessor.cpp | 12 +-- .../nintendo/nx/impl/i2c_bus_accessor.hpp | 2 +- .../source/i2c/driver/i2c_driver_bus_api.cpp | 4 +- .../i2c/driver/impl/i2c_driver_core.cpp | 6 +- .../i2c/driver/impl/i2c_i2c_session_impl.cpp | 14 +-- .../source/i2c/i2c_client_api.cpp | 2 +- .../source/i2c/i2c_command_list_formatter.cpp | 8 +- .../i2c/server/i2c_server_manager_impl.cpp | 2 +- .../i2c/server/i2c_server_session_impl.hpp | 2 +- .../source/kvdb/kvdb_archive.cpp | 16 ++-- .../source/kvdb/kvdb_file_key_value_store.cpp | 18 ++-- .../source/ldr/ldr_shell_api.os.horizon.cpp | 2 +- .../source/lm/lm_remote_log_service.cpp | 2 +- .../source/lm/srv/lm_log_getter.cpp | 6 +- .../source/lm/srv/lm_log_service_impl.cpp | 2 +- .../source/lm/srv/lm_logger_impl.cpp | 4 +- .../source/lm/srv/lm_sd_card_logger.cpp | 4 +- ..._add_on_content_location_resolver_impl.cpp | 12 +-- .../lr/lr_content_location_resolver_impl.cpp | 52 +++++------ .../lr/lr_location_resolver_manager_impl.cpp | 8 +- ...r_redirect_only_location_resolver_impl.cpp | 52 +++++------ .../lr_registered_location_resolver_impl.cpp | 28 +++--- .../libstratosphere/source/ncm/ncm_api.cpp | 4 +- .../source/ncm/ncm_content_info_utils.cpp | 6 +- .../ncm/ncm_content_management_utils.cpp | 8 +- .../source/ncm/ncm_content_manager_impl.cpp | 62 ++++++------- .../source/ncm/ncm_content_meta.cpp | 8 +- .../ncm/ncm_content_meta_database_impl.cpp | 42 ++++----- .../ncm_content_meta_database_impl_base.hpp | 4 +- .../source/ncm/ncm_content_meta_utils.cpp | 4 +- .../source/ncm/ncm_content_storage_impl.cpp | 88 +++++++++---------- .../ncm/ncm_content_storage_impl_base.hpp | 4 +- .../source/ncm/ncm_fs_utils.cpp | 2 +- .../ncm/ncm_host_content_storage_impl.cpp | 64 +++++++------- .../ncm/ncm_host_content_storage_impl.hpp | 4 +- .../source/ncm/ncm_install_task_base.cpp | 70 +++++++-------- .../source/ncm/ncm_install_task_data.cpp | 38 ++++---- ...m_on_memory_content_meta_database_impl.cpp | 8 +- .../source/ncm/ncm_package_install_task.cpp | 4 +- .../ncm/ncm_package_install_task_base.cpp | 6 +- .../ncm/ncm_package_system_downgrade_task.cpp | 2 +- .../ncm/ncm_package_system_update_task.cpp | 8 +- .../source/ncm/ncm_placeholder_accessor.cpp | 8 +- .../ncm_read_only_content_storage_impl.cpp | 68 +++++++------- .../ncm/ncm_registered_host_content.cpp | 8 +- .../ncm/ncm_remote_content_manager_impl.hpp | 4 +- .../ncm/ncm_remote_content_storage_impl.hpp | 8 +- .../source/ncm/ncm_storage_utils.cpp | 6 +- .../ncm_submission_package_install_task.cpp | 4 +- .../os/impl/os_aslr_space_manager_types.hpp | 4 +- .../source/os/impl/os_inter_process_event.cpp | 2 +- ...os_inter_process_event_impl.os.horizon.cpp | 2 +- .../os/impl/os_io_region_impl.os.horizon.cpp | 6 +- ...s_multiple_wait_target_impl.os.horizon.cpp | 10 +-- .../impl/os_shared_memory_impl.os.horizon.cpp | 6 +- .../os_thread_manager_impl.os.horizon.cpp | 4 +- .../os_transfer_memory_impl.os.horizon.cpp | 6 +- .../source/os/os_io_region.cpp | 4 +- .../source/os/os_shared_memory.cpp | 2 +- .../source/os/os_system_event.cpp | 2 +- .../source/os/os_thread_local_storage_api.cpp | 2 +- .../source/os/os_transfer_memory.cpp | 4 +- .../impl/osdbg_thread_info.os.horizon.cpp | 8 +- .../osdbg_thread_local_region.os.horizon.cpp | 4 +- .../source/pgl/pgl_remote_event_observer.hpp | 4 +- .../source/pgl/pgl_shell_api.cpp | 2 +- .../source/pgl/srv/pgl_srv_api.cpp | 2 +- .../source/pgl/srv/pgl_srv_shell.cpp | 6 +- .../pgl/srv/pgl_srv_shell_event_observer.cpp | 6 +- .../pgl/srv/pgl_srv_shell_host_utils.cpp | 24 ++--- .../pgl/srv/pgl_srv_shell_interface.cpp | 12 +-- .../libstratosphere/source/pm/pm_dmnt_api.cpp | 2 +- .../libstratosphere/source/pm/pm_info_api.cpp | 2 +- .../source/pm/pm_info_api_weak.cpp | 2 +- .../source/pm/pm_shell_api.cpp | 2 +- .../nintendo/nx/powctl_battery_driver.cpp | 66 +++++++------- .../nintendo/nx/powctl_battery_driver.hpp | 44 +++++----- .../nintendo/nx/powctl_bq24193_driver.cpp | 20 ++--- .../nintendo/nx/powctl_charger_driver.cpp | 50 +++++------ .../nintendo/nx/powctl_charger_driver.hpp | 62 ++++++------- .../nintendo/nx/powctl_max17050_driver.cpp | 48 +++++----- .../powctl/impl/powctl_device_management.cpp | 4 +- .../source/powctl/powctl_session_api.cpp | 2 +- .../source/psc/psc_pm_module.os.horizon.cpp | 4 +- .../nx/impl/pwm_impl_pwm_driver_api.cpp | 2 +- .../nintendo/nx/impl/pwm_pwm_driver_impl.cpp | 16 ++-- .../driver/impl/pwm_channel_session_impl.cpp | 2 +- .../pwm/driver/impl/pwm_driver_core.cpp | 6 +- .../pwm/driver/pwm_driver_channel_api.cpp | 4 +- .../libstratosphere/source/pwm/pwm_api.cpp | 2 +- .../pwm_server_channel_session_impl.hpp | 18 ++-- .../pwm/server/pwm_server_manager_impl.cpp | 2 +- .../libstratosphere/source/scs/scs_shell.cpp | 6 +- .../impl/settings_key_value_store.cpp | 64 +++++++------- .../settings/impl/settings_system_data.cpp | 2 +- .../impl/settings_system_save_data.cpp | 20 ++--- .../source/sf/cmif/sf_cmif_domain_manager.cpp | 2 +- .../sf/cmif/sf_cmif_domain_service_object.cpp | 6 +- .../sf/cmif/sf_cmif_service_dispatch.cpp | 4 +- .../source/sf/hipc/sf_hipc_api.os.horizon.cpp | 12 +-- .../sf_hipc_server_domain_session_manager.cpp | 8 +- .../source/sf/hipc/sf_hipc_server_manager.cpp | 4 +- .../hipc/sf_hipc_server_session_manager.cpp | 26 +++--- .../libstratosphere/source/sm/sm_api.cpp | 4 +- .../socket/impl/socket_api.os.horizon.cpp | 6 +- .../source/spl/impl/spl_api_impl.cpp | 40 ++++----- .../source/spl/spl_api.os.horizon.cpp | 4 +- ...ofile_srv_profile_update_observer_impl.cpp | 2 +- ...ofile_srv_profile_update_observer_impl.hpp | 8 +- .../srv/sprofile_srv_service_for_bg_agent.cpp | 6 +- ...profile_srv_service_for_system_process.cpp | 4 +- .../time/impl/util/time_impl_util_api.cpp | 2 +- .../libstratosphere/source/time/time_api.cpp | 6 +- .../source/updater/updater_api.cpp | 24 ++--- .../source/updater/updater_bis_management.cpp | 16 ++-- .../source/updater/updater_bis_management.hpp | 2 +- .../source/updater/updater_bis_save.cpp | 2 +- .../source/updater/updater_files.cpp | 2 +- .../libstratosphere/source/usb/usb_device.cpp | 54 ++++++------ .../source/usb/usb_remote_ds_endpoint.cpp | 2 +- .../source/usb/usb_remote_ds_interface.cpp | 8 +- .../source/usb/usb_remote_ds_root_session.cpp | 2 +- .../source/usb/usb_remote_ds_service.cpp | 6 +- .../sdmmc/impl/sdmmc_base_device_accessor.cpp | 34 +++---- .../sdmmc/impl/sdmmc_base_device_accessor.hpp | 4 +- .../impl/sdmmc_gc_asic_device_accessor.cpp | 28 +++--- .../impl/sdmmc_io_impl.board.nintendo_nx.cpp | 4 +- .../sdmmc/impl/sdmmc_mmc_device_accessor.cpp | 54 ++++++------ .../impl/sdmmc_sd_card_device_accessor.cpp | 68 +++++++------- .../sdmmc_sd_host_standard_controller.cpp | 48 +++++----- .../sdmmc_sd_host_standard_controller.hpp | 2 +- ...mmc_sdmmc_controller.board.nintendo_nx.cpp | 42 ++++----- ...mmc_sdmmc_controller.board.nintendo_nx.hpp | 2 +- .../ams_mitm/source/amsmitm_fs_utils.cpp | 6 +- .../source/bpc_mitm/bpc_ams_power_utils.cpp | 4 +- .../source/bpc_mitm/bpc_mitm_service.cpp | 4 +- .../source/dns_mitm/dnsmitm_resolver_impl.cpp | 10 +-- .../source/fs_mitm/fs_mitm_service.cpp | 18 ++-- .../source/fs_mitm/fsmitm_boot0storage.hpp | 8 +- .../fs_mitm/fsmitm_layered_romfs_storage.cpp | 12 +-- .../fsmitm_readonly_layered_filesystem.hpp | 2 +- .../source/fs_mitm/fsmitm_save_utils.cpp | 10 +-- .../source/ns_mitm/ns_am_mitm_service.cpp | 2 +- .../source/ns_mitm/ns_web_mitm_service.cpp | 4 +- .../source/set_mitm/set_mitm_service.cpp | 8 +- .../source/set_mitm/setsys_mitm_service.cpp | 10 +-- .../source/set_mitm/settings_sd_kvs.cpp | 32 +++---- .../sysupdater/sysupdater_apply_manager.cpp | 8 +- .../sysupdater/sysupdater_async_impl.cpp | 4 +- .../sysupdater/sysupdater_async_impl.hpp | 12 +-- .../source/sysupdater/sysupdater_fs_utils.cpp | 14 +-- .../source/sysupdater/sysupdater_service.cpp | 38 ++++---- .../sysupdater_thread_allocator.cpp | 4 +- ..._clkrst_api_for_boot.board.nintendo_nx.cpp | 8 +- .../api_overrides/regulator_api_for_boot.cpp | 6 +- .../boot/source/boot_battery_driver.hpp | 2 +- .../boot/source/boot_charger_driver.hpp | 4 +- stratosphere/boot/source/boot_pmic_driver.cpp | 4 +- .../source/dmnt2_breakpoint_manager_base.cpp | 2 +- .../dmnt.gen2/source/dmnt2_debug_process.cpp | 30 +++---- .../source/dmnt2_gdb_server_impl.cpp | 2 +- .../source/dmnt2_hardware_breakpoint.cpp | 4 +- .../source/dmnt2_hardware_watchpoint.cpp | 6 +- .../dmnt/source/cheat/dmnt_cheat_service.cpp | 2 +- .../dmnt/source/cheat/impl/dmnt_cheat_api.cpp | 46 +++++----- .../impl/dmnt_cheat_debug_events_manager.cpp | 2 +- .../fatal/source/fatal_event_manager.cpp | 2 +- stratosphere/fatal/source/fatal_font.cpp | 2 +- .../fatal/source/fatal_task_clock.cpp | 4 +- .../fatal/source/fatal_task_error_report.cpp | 2 +- .../fatal/source/fatal_task_power.cpp | 6 +- .../fatal/source/fatal_task_screen.cpp | 12 +-- .../fatal/source/fatal_task_sound.cpp | 2 +- .../loader/source/ldr_argument_store.cpp | 2 +- .../loader/source/ldr_argument_store.hpp | 2 +- .../loader/source/ldr_capabilities.cpp | 2 +- .../loader/source/ldr_content_management.cpp | 12 +-- .../loader/source/ldr_launch_record.cpp | 2 +- .../loader/source/ldr_loader_service.cpp | 4 +- stratosphere/loader/source/ldr_meta.cpp | 18 ++-- .../loader/source/ldr_process_creation.cpp | 38 ++++---- stratosphere/ncm/source/ncm_main.cpp | 4 +- stratosphere/ro/source/impl/ro_map_utils.cpp | 2 +- stratosphere/ro/source/impl/ro_nro_utils.cpp | 6 +- stratosphere/ro/source/impl/ro_nrr_utils.cpp | 12 +-- .../ro/source/impl/ro_service_impl.cpp | 38 ++++---- .../spl/source/spl_crypto_service.hpp | 2 +- .../spl/source/spl_deprecated_service.hpp | 2 +- .../spl/source/spl_secure_monitor_manager.cpp | 4 +- 370 files changed, 2107 insertions(+), 2107 deletions(-) diff --git a/exosphere/mariko_fatal/source/fatal_save_context.cpp b/exosphere/mariko_fatal/source/fatal_save_context.cpp index c60edf3ea..7c2eed141 100644 --- a/exosphere/mariko_fatal/source/fatal_save_context.cpp +++ b/exosphere/mariko_fatal/source/fatal_save_context.cpp @@ -62,7 +62,7 @@ namespace ams::secmon::fatal { /* Write the context to the file. */ R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/exosphere/mariko_fatal/source/fatal_sdmmc.cpp b/exosphere/mariko_fatal/source/fatal_sdmmc.cpp index 70fdfcc19..98cee3b70 100644 --- a/exosphere/mariko_fatal/source/fatal_sdmmc.cpp +++ b/exosphere/mariko_fatal/source/fatal_sdmmc.cpp @@ -48,7 +48,7 @@ namespace ams::secmon::fatal { //sdmmc::Deactivate(Port); R_TRY(sdmmc::Activate(Port)); - return ResultSuccess(); + R_SUCCEED(); } Result CheckSdCardConnection(sdmmc::SpeedMode *out_sm, sdmmc::BusWidth *out_bw) { @@ -78,7 +78,7 @@ namespace ams::secmon::fatal { sector_count -= cur_sectors; } - return ResultSuccess(); + R_SUCCEED(); } Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) { @@ -104,7 +104,7 @@ namespace ams::secmon::fatal { sector_count -= cur_sectors; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/exosphere/mariko_fatal/source/fs/fatal_fs_api.cpp b/exosphere/mariko_fatal/source/fs/fatal_fs_api.cpp index dfb7ddb93..b0b812961 100644 --- a/exosphere/mariko_fatal/source/fs/fatal_fs_api.cpp +++ b/exosphere/mariko_fatal/source/fs/fatal_fs_api.cpp @@ -34,45 +34,45 @@ namespace ams::fs { Result TranslateFatFsError(FRESULT res) { switch (res) { case FR_OK: - return ResultSuccess(); + R_SUCCEED(); case FR_DISK_ERR: - return fs::ResultMmcAccessFailed(); + R_THROW(fs::ResultMmcAccessFailed()); case FR_INT_ERR: - return fs::ResultPreconditionViolation(); + R_THROW(fs::ResultPreconditionViolation()); case FR_NOT_READY: - return fs::ResultMmcAccessFailed(); + R_THROW(fs::ResultMmcAccessFailed()); case FR_NO_FILE: - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); case FR_NO_PATH: - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); case FR_INVALID_NAME: - return fs::ResultInvalidPath(); + R_THROW(fs::ResultInvalidPath()); case FR_DENIED: - return fs::ResultPermissionDenied(); + R_THROW(fs::ResultPermissionDenied()); case FR_EXIST: - return fs::ResultPathAlreadyExists(); + R_THROW(fs::ResultPathAlreadyExists()); case FR_INVALID_OBJECT: - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); case FR_WRITE_PROTECTED: - return fs::ResultWriteNotPermitted(); + R_THROW(fs::ResultWriteNotPermitted()); case FR_INVALID_DRIVE: - return fs::ResultInvalidMountName(); + R_THROW(fs::ResultInvalidMountName()); case FR_NOT_ENABLED: - return fs::ResultInvalidMountName(); /* BAD/TODO */ + R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */ case FR_NO_FILESYSTEM: - return fs::ResultInvalidMountName(); /* BAD/TODO */ + R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */ case FR_TIMEOUT: - return fs::ResultTargetLocked(); /* BAD/TODO */ + R_THROW(fs::ResultTargetLocked()); /* BAD/TODO */ case FR_LOCKED: - return fs::ResultTargetLocked(); + R_THROW(fs::ResultTargetLocked()); case FR_NOT_ENOUGH_CORE: - return fs::ResultPreconditionViolation(); /* BAD/TODO */ + R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */ case FR_TOO_MANY_OPEN_FILES: - return fs::ResultPreconditionViolation(); /* BAD/TODO */ + R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */ case FR_INVALID_PARAMETER: - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); default: - return fs::ResultInternal(); + R_THROW(fs::ResultInternal()); } } @@ -125,7 +125,7 @@ namespace ams::fs { /* Expand the file. */ R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1))); - return ResultSuccess(); + R_SUCCEED(); } Result CreateDirectory(const char *path) { @@ -144,10 +144,10 @@ namespace ams::fs { out_file->_handle = fp; g_files_opened[i] = true; g_open_modes[i] = mode; - return ResultSuccess(); + R_SUCCEED(); } } - return fs::ResultOpenCountLimit(); + R_THROW(fs::ResultOpenCountLimit()); } Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) { @@ -164,7 +164,7 @@ namespace ams::fs { /* Check that we read the correct amount. */ R_UNLESS(br == size, fs::ResultOutOfRange()); - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) { @@ -185,7 +185,7 @@ namespace ams::fs { /* Set the output size. */ *out = br; - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) { @@ -195,7 +195,7 @@ namespace ams::fs { Result GetFileSize(s64 *out, FileHandle handle) { FIL *fp = GetInternalFile(handle); *out = f_size(fp); - return ResultSuccess(); + R_SUCCEED(); } Result FlushFile(FileHandle handle) { @@ -218,7 +218,7 @@ namespace ams::fs { R_TRY(FlushFile(handle)); } - return ResultSuccess(); + R_SUCCEED(); } Result SetFileSize(FileHandle handle, s64 size) { @@ -242,7 +242,7 @@ namespace ams::fs { /* Check that our expansion succeeded. */ AMS_ASSERT(f_size(fp) == static_cast(size)); - return ResultSuccess(); + R_SUCCEED(); } int GetFileOpenMode(FileHandle handle) { diff --git a/fusee/program/source/fs/fusee_fs_api.cpp b/fusee/program/source/fs/fusee_fs_api.cpp index 132f6b0dd..0af1a68fd 100644 --- a/fusee/program/source/fs/fusee_fs_api.cpp +++ b/fusee/program/source/fs/fusee_fs_api.cpp @@ -39,45 +39,45 @@ namespace ams::fs { Result TranslateFatFsError(FRESULT res) { switch (res) { case FR_OK: - return ResultSuccess(); + R_SUCCEED(); case FR_DISK_ERR: - return fs::ResultMmcAccessFailed(); + R_THROW(fs::ResultMmcAccessFailed()); case FR_INT_ERR: - return fs::ResultPreconditionViolation(); + R_THROW(fs::ResultPreconditionViolation()); case FR_NOT_READY: - return fs::ResultMmcAccessFailed(); + R_THROW(fs::ResultMmcAccessFailed()); case FR_NO_FILE: - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); case FR_NO_PATH: - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); case FR_INVALID_NAME: - return fs::ResultInvalidPath(); + R_THROW(fs::ResultInvalidPath()); case FR_DENIED: - return fs::ResultPermissionDenied(); + R_THROW(fs::ResultPermissionDenied()); case FR_EXIST: - return fs::ResultPathAlreadyExists(); + R_THROW(fs::ResultPathAlreadyExists()); case FR_INVALID_OBJECT: - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); case FR_WRITE_PROTECTED: - return fs::ResultWriteNotPermitted(); + R_THROW(fs::ResultWriteNotPermitted()); case FR_INVALID_DRIVE: - return fs::ResultInvalidMountName(); + R_THROW(fs::ResultInvalidMountName()); case FR_NOT_ENABLED: - return fs::ResultInvalidMountName(); /* BAD/TODO */ + R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */ case FR_NO_FILESYSTEM: - return fs::ResultInvalidMountName(); /* BAD/TODO */ + R_THROW(fs::ResultInvalidMountName()); /* BAD/TODO */ case FR_TIMEOUT: - return fs::ResultTargetLocked(); /* BAD/TODO */ + R_THROW(fs::ResultTargetLocked()); /* BAD/TODO */ case FR_LOCKED: - return fs::ResultTargetLocked(); + R_THROW(fs::ResultTargetLocked()); case FR_NOT_ENOUGH_CORE: - return fs::ResultPreconditionViolation(); /* BAD/TODO */ + R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */ case FR_TOO_MANY_OPEN_FILES: - return fs::ResultPreconditionViolation(); /* BAD/TODO */ + R_THROW(fs::ResultPreconditionViolation()); /* BAD/TODO */ case FR_INVALID_PARAMETER: - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); default: - return fs::ResultInternal(); + R_THROW(fs::ResultInternal()); } } @@ -138,7 +138,7 @@ namespace ams::fs { *out_entry_type = (info.fattrib & AM_DIR) ? DirectoryEntryType_Directory : DirectoryEntryType_File; *out_archive = (info.fattrib & AM_ARC); - return ResultSuccess(); + R_SUCCEED(); } Result CreateFile(const char *path, s64 size) { @@ -152,7 +152,7 @@ namespace ams::fs { /* Expand the file. */ R_TRY(TranslateFatFsError(f_expand(std::addressof(fp), size, 1))); - return ResultSuccess(); + R_SUCCEED(); } Result CreateDirectory(const char *path) { @@ -171,10 +171,10 @@ namespace ams::fs { out_file->_handle = fp; g_files_opened[i] = true; g_open_modes[i] = mode; - return ResultSuccess(); + R_SUCCEED(); } } - return fs::ResultOpenCountLimit(); + R_THROW(fs::ResultOpenCountLimit()); } Result OpenDirectory(DirectoryHandle *out_dir, const char *path) { @@ -188,10 +188,10 @@ namespace ams::fs { /* Set the output. */ out_dir->_handle = dp; g_dirs_opened[i] = true; - return ResultSuccess(); + R_SUCCEED(); } } - return fs::ResultOpenCountLimit(); + R_THROW(fs::ResultOpenCountLimit()); } Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) { @@ -209,7 +209,7 @@ namespace ams::fs { } *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } void CloseDirectory(DirectoryHandle handle) { @@ -232,7 +232,7 @@ namespace ams::fs { /* Check that we read the correct amount. */ R_UNLESS(br == size, fs::ResultOutOfRange()); - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) { @@ -253,7 +253,7 @@ namespace ams::fs { /* Set the output size. */ *out = br; - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) { @@ -263,7 +263,7 @@ namespace ams::fs { Result GetFileSize(s64 *out, FileHandle handle) { FIL *fp = GetInternalFile(handle); *out = f_size(fp); - return ResultSuccess(); + R_SUCCEED(); } Result FlushFile(FileHandle handle) { @@ -286,7 +286,7 @@ namespace ams::fs { R_TRY(FlushFile(handle)); } - return ResultSuccess(); + R_SUCCEED(); } Result SetFileSize(FileHandle handle, s64 size) { @@ -310,7 +310,7 @@ namespace ams::fs { /* Check that our expansion succeeded. */ AMS_ASSERT(f_size(fp) == static_cast(size)); - return ResultSuccess(); + R_SUCCEED(); } int GetFileOpenMode(FileHandle handle) { diff --git a/fusee/program/source/fs/fusee_fs_file_storage.cpp b/fusee/program/source/fs/fusee_fs_file_storage.cpp index 4de557c4f..630b61570 100644 --- a/fusee/program/source/fs/fusee_fs_file_storage.cpp +++ b/fusee/program/source/fs/fusee_fs_file_storage.cpp @@ -62,7 +62,7 @@ namespace ams::fs { Result FileHandleStorage::GetSize(s64 *out_size) { R_TRY(this->UpdateSize()); *out_size = m_size; - return ResultSuccess(); + R_SUCCEED(); } Result FileHandleStorage::SetSize(s64 size) { diff --git a/fusee/program/source/fs/fusee_fs_storage.hpp b/fusee/program/source/fs/fusee_fs_storage.hpp index 58f8693ea..4e389749c 100644 --- a/fusee/program/source/fs/fusee_fs_storage.hpp +++ b/fusee/program/source/fs/fusee_fs_storage.hpp @@ -85,11 +85,11 @@ namespace ams::fs { } virtual Result Write(s64 offset, const void *buffer, size_t size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result SetSize(s64 size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } }; @@ -127,11 +127,11 @@ namespace ams::fs { virtual Result GetSize(s64 *out) override { *out = m_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result SetSize(s64 size) override { - return fs::ResultUnsupportedSetSizeForNotResizableSubStorage(); + R_THROW(fs::ResultUnsupportedSetSizeForNotResizableSubStorage()); } }; diff --git a/fusee/program/source/fusee_emummc.cpp b/fusee/program/source/fusee_emummc.cpp index 2bc820a4f..7aed8822c 100644 --- a/fusee/program/source/fusee_emummc.cpp +++ b/fusee/program/source/fusee_emummc.cpp @@ -37,7 +37,7 @@ namespace ams::nxboot { } virtual Result Flush() override { - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetSize(s64 *out) override { @@ -45,15 +45,15 @@ namespace ams::nxboot { R_TRY(GetSdCardMemoryCapacity(std::addressof(num_sectors))); *out = static_cast(num_sectors) * static_cast(sdmmc::SectorSize); - return ResultSuccess(); + R_SUCCEED(); } virtual Result Write(s64 offset, const void *buffer, size_t size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result SetSize(s64 size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } }; @@ -71,7 +71,7 @@ namespace ams::nxboot { } virtual Result Flush() override { - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetSize(s64 *out) override { @@ -79,15 +79,15 @@ namespace ams::nxboot { R_TRY(GetMmcMemoryCapacity(std::addressof(num_sectors), Partition)); *out = num_sectors * sdmmc::SectorSize; - return ResultSuccess(); + R_SUCCEED(); } virtual Result Write(s64 offset, const void *buffer, size_t size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result SetSize(s64 size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } }; @@ -153,23 +153,23 @@ namespace ams::nxboot { subofs = 0; } - return ResultSuccess(); + R_SUCCEED(); } virtual Result Flush() override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result GetSize(s64 *out) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result Write(s64 offset, const void *buffer, size_t size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result SetSize(s64 size) override { - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } }; diff --git a/fusee/program/source/fusee_fatal.cpp b/fusee/program/source/fusee_fatal.cpp index 9e02e78ed..843b1c236 100644 --- a/fusee/program/source/fusee_fatal.cpp +++ b/fusee/program/source/fusee_fatal.cpp @@ -45,7 +45,7 @@ namespace ams::nxboot { /* Write the context to the file. */ R_TRY(fs::WriteFile(file, 0, ctx, sizeof(*ctx), fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/fusee/program/source/fusee_mmc.cpp b/fusee/program/source/fusee_mmc.cpp index fd3e3a56e..be35f051e 100644 --- a/fusee/program/source/fusee_mmc.cpp +++ b/fusee/program/source/fusee_mmc.cpp @@ -34,7 +34,7 @@ namespace ams::nxboot { g_mmc_partition = partition; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/ddsf/ddsf_i_device.hpp b/libraries/libstratosphere/include/stratosphere/ddsf/ddsf_i_device.hpp index 62812b07b..c32010fe0 100644 --- a/libraries/libstratosphere/include/stratosphere/ddsf/ddsf_i_device.hpp +++ b/libraries/libstratosphere/include/stratosphere/ddsf/ddsf_i_device.hpp @@ -55,7 +55,7 @@ namespace ams::ddsf { /* Attach the session. */ m_session_list.push_back(*session); - return ResultSuccess(); + R_SUCCEED(); } void DetachSession(ISession *session) { diff --git a/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp index 6e8afb1d6..3b827ff50 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/common/fs_dbm_rom_key_value_storage.hpp @@ -67,7 +67,7 @@ namespace ams::fs { for (s64 i = 0; i < count; i++) { R_TRY(bucket.Write(i * sizeof(pos), std::addressof(pos), sizeof(pos))); } - return ResultSuccess(); + R_SUCCEED(); } public: KeyValueRomStorageTemplate() : m_bucket_count(), m_bucket_storage(), m_kv_storage(), m_total_entry_size(), m_entry_count() { /* ... */ } @@ -77,7 +77,7 @@ namespace ams::fs { m_bucket_storage = bucket; m_bucket_count = count; m_kv_storage = kv; - return ResultSuccess(); + R_SUCCEED(); } void Finalize() { @@ -95,7 +95,7 @@ namespace ams::fs { s64 kv_size = 0; R_TRY(m_kv_storage.GetSize(std::addressof(kv_size))); *out = kv_size - m_total_entry_size; - return ResultSuccess(); + R_SUCCEED(); } constexpr u32 GetEntryCount() const { @@ -128,7 +128,7 @@ namespace ams::fs { *out = pos; m_entry_count++; - return ResultSuccess(); + R_SUCCEED(); } Result GetInternal(Position *out_pos, Value *out_val, const Key &key, u32 hash_key, const void *aux, size_t aux_size) { @@ -142,7 +142,7 @@ namespace ams::fs { *out_pos = pos; *out_val = elem.value; - return ResultSuccess(); + R_SUCCEED(); } Result GetByPosition(Key *out_key, Value *out_val, Position pos) { @@ -154,7 +154,7 @@ namespace ams::fs { *out_key = elem.key; *out_val = elem.value; - return ResultSuccess(); + R_SUCCEED(); } Result GetByPosition(Key *out_key, Value *out_val, void *out_aux, size_t *out_aux_size, Position pos) { @@ -168,7 +168,7 @@ namespace ams::fs { *out_key = elem.key; *out_val = elem.value; - return ResultSuccess(); + R_SUCCEED(); } Result SetByPosition(Position pos, const Value &value) { @@ -213,7 +213,7 @@ namespace ams::fs { if (key.IsEqual(out_elem->key, aux, aux_size, buf, cur_aux_size)) { *out_pos = cur; - return ResultSuccess(); + R_SUCCEED(); } *out_prev = cur; @@ -233,7 +233,7 @@ namespace ams::fs { *out = static_cast(m_total_entry_size); m_total_entry_size = util::AlignUp(static_cast(end_pos), alignof(Position)); - return ResultSuccess(); + R_SUCCEED(); } Result LinkEntry(Position *out, Position pos, u32 hash_key) { @@ -251,7 +251,7 @@ namespace ams::fs { R_TRY(this->WriteBucket(pos, ind)); *out = next; - return ResultSuccess(); + R_SUCCEED(); } Result ReadBucket(Position *out, BucketIndex ind) { @@ -291,7 +291,7 @@ namespace ams::fs { R_TRY(m_kv_storage.Read(pos + sizeof(*out), out_aux, out->size)); } - return ResultSuccess(); + R_SUCCEED(); } Result WriteKeyValue(const Element *elem, Position pos, const void *aux, size_t aux_size) { @@ -308,7 +308,7 @@ namespace ams::fs { R_TRY(m_kv_storage.Write(pos + sizeof(*elem), aux, aux_size)); } - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp index a9c39c3c2..a430f736b 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_istorage.hpp @@ -113,13 +113,13 @@ namespace ams::fs { virtual Result Write(s64 offset, const void *buffer, size_t size) override { /* TODO: Better result? Is it possible to get a more specific one? */ AMS_UNUSED(offset, buffer, size); - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } virtual Result SetSize(s64 size) override { /* TODO: Better result? Is it possible to get a more specific one? */ AMS_UNUSED(size); - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp index 3a31f9422..8f17a0474 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_storage.hpp @@ -38,7 +38,7 @@ namespace ams::fs { /* Copy from memory. */ std::memcpy(buffer, m_buf + offset, size); - return ResultSuccess(); + R_SUCCEED(); } virtual Result Write(s64 offset, const void *buffer, size_t size) override { @@ -51,21 +51,21 @@ namespace ams::fs { /* Copy to memory. */ std::memcpy(m_buf + offset, buffer, size); - return ResultSuccess(); + R_SUCCEED(); } virtual Result Flush() override { - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetSize(s64 *out) override { *out = m_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result SetSize(s64 size) override { AMS_UNUSED(size); - return fs::ResultUnsupportedSetSizeForMemoryStorage(); + R_THROW(fs::ResultUnsupportedSetSizeForMemoryStorage()); } virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { @@ -73,14 +73,14 @@ namespace ams::fs { switch (op_id) { case OperationId::Invalidate: - return ResultSuccess(); + R_SUCCEED(); case OperationId::QueryRange: R_UNLESS(dst != nullptr, fs::ResultNullptrArgument()); R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize()); reinterpret_cast(dst)->Clear(); - return ResultSuccess(); + R_SUCCEED(); default: - return fs::ResultUnsupportedOperateRangeForMemoryStorage(); + R_THROW(fs::ResultUnsupportedOperateRangeForMemoryStorage()); } } }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp index 43e3e9570..f66ba0979 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_read_only_filesystem.hpp @@ -44,7 +44,7 @@ namespace ams::fs { } virtual Result DoFlush() override final { - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override final { @@ -54,12 +54,12 @@ namespace ams::fs { AMS_ASSERT(!need_append); AMS_UNUSED(buffer); - return fs::ResultUnsupportedWriteForReadOnlyFile(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFile()); } virtual Result DoSetSize(s64 size) override final { R_TRY(this->DrySetSize(size, fs::OpenMode_Read)); - return fs::ResultUnsupportedWriteForReadOnlyFile(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFile()); } virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final { @@ -68,7 +68,7 @@ namespace ams::fs { case OperationId::QueryRange: return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size); default: - return fs::ResultUnsupportedOperateRangeForReadOnlyFile(); + R_THROW(fs::ResultUnsupportedOperateRangeForReadOnlyFile()); } } public: @@ -100,7 +100,7 @@ namespace ams::fs { R_UNLESS(read_only_file != nullptr, fs::ResultAllocationMemoryFailedInReadOnlyFileSystemA()); *out_file = std::move(read_only_file); - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoOpenDirectory(std::unique_ptr *out_dir, const fs::Path &path, OpenDirectoryMode mode) override final { @@ -112,62 +112,62 @@ namespace ams::fs { } virtual Result DoCommit() override final { - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) override final { AMS_UNUSED(path, size, flags); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoDeleteFile(const fs::Path &path) override final { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoCreateDirectory(const fs::Path &path) override final { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoDeleteDirectory(const fs::Path &path) override final { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) override final { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) override final { AMS_UNUSED(old_path, new_path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) override final { AMS_UNUSED(old_path, new_path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoCleanDirectoryRecursively(const fs::Path &path) override final { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyFileSystem()); } virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) override final { AMS_UNUSED(out, path); - return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem()); } virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) override final { AMS_UNUSED(out, path); - return fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedCommitProvisionallyForReadOnlyFileSystem()); } virtual Result DoCommitProvisionally(s64 counter) override final { AMS_UNUSED(counter); - return fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem(); + R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForReadOnlyFileSystem()); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp index 0bf3e17fe..1033e675e 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_filesystem.hpp @@ -181,7 +181,7 @@ namespace ams::fs { R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedNew()); *out_file = std::move(file); - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoOpenDirectory(std::unique_ptr *out_dir, const fs::Path &path, OpenDirectoryMode mode) override final { @@ -195,7 +195,7 @@ namespace ams::fs { R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedNew()); *out_dir = std::move(dir); - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoCommit() override final { diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp index 7a9490f25..a8de4d779 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_remote_storage.hpp @@ -54,7 +54,7 @@ namespace ams::fs { virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { /* TODO: How to deal with this? */ AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size); - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); }; }; #endif diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_substorage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_substorage.hpp index edfcca6a3..52959ed8d 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_substorage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_substorage.hpp @@ -121,7 +121,7 @@ namespace ams::fs { R_TRY(m_base_storage->SetSize(m_offset + size)); m_size = size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetSize(s64 *out) override { @@ -129,7 +129,7 @@ namespace ams::fs { R_UNLESS(this->IsValid(), fs::ResultNotInitialized()); *out = m_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { diff --git a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_idirectory.hpp b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_idirectory.hpp index 2ad2012b3..8550b43a8 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_idirectory.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_idirectory.hpp @@ -29,7 +29,7 @@ namespace ams::fs::fsa { R_UNLESS(out_count != nullptr, fs::ResultNullptrArgument()); if (max_entries == 0) { *out_count = 0; - return ResultSuccess(); + R_SUCCEED(); } R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument()); R_UNLESS(max_entries > 0, fs::ResultInvalidArgument()); diff --git a/libraries/libstratosphere/include/stratosphere/fs/impl/fs_priority_utils.hpp b/libraries/libstratosphere/include/stratosphere/fs/impl/fs_priority_utils.hpp index 7a99b8607..82b7f666d 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/impl/fs_priority_utils.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/impl/fs_priority_utils.hpp @@ -44,10 +44,10 @@ namespace ams::fs::impl { case PriorityRaw_Realtime: *out = TlsIoPriority_Realtime; break; case PriorityRaw_Low: *out = TlsIoPriority_Low; break; case PriorityRaw_Background: *out = TlsIoPriority_Background; break; - default: return fs::ResultInvalidArgument(); + default: R_THROW(fs::ResultInvalidArgument()); } - return ResultSuccess(); + R_SUCCEED(); } constexpr inline Result ConvertTlsIoPriorityToFsPriority(PriorityRaw *out, u8 tls_io) { @@ -58,10 +58,10 @@ namespace ams::fs::impl { case TlsIoPriority_Realtime: *out = PriorityRaw_Realtime; break; case TlsIoPriority_Low: *out = PriorityRaw_Low; break; case TlsIoPriority_Background: *out = PriorityRaw_Background; break; - default: return fs::ResultInvalidArgument(); + default: R_THROW(fs::ResultInvalidArgument()); } - return ResultSuccess(); + R_SUCCEED(); } inline u8 GetTlsIoPriority(os::ThreadType *thread) { diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_buffer_manager_utils.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_buffer_manager_utils.hpp index 10eb99111..eaafa007a 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_buffer_manager_utils.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_buffer_manager_utils.hpp @@ -46,14 +46,14 @@ namespace ams::fssystem::buffers { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } template Result DoContinuouslyUntilBufferIsAllocated(F f, const char *function_name) { - R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { return ResultSuccess(); }, function_name)); - return ResultSuccess(); + R_TRY(DoContinuouslyUntilBufferIsAllocated(f, []() ALWAYS_INLINE_LAMBDA { R_SUCCEED(); }, function_name)); + R_SUCCEED(); } /* ACCURATE_TO_VERSION: Unknown */ @@ -110,10 +110,10 @@ namespace ams::fssystem::buffers { if (buffer.first != 0) { buffer_manager->DeallocateBuffer(buffer.first, buffer.second); } - return fs::ResultBufferAllocationFailed(); + R_THROW(fs::ResultBufferAllocationFailed()); } *out = buffer; - return ResultSuccess(); + R_SUCCEED(); }; if (context == nullptr || !context->IsNeedBlocking()) { @@ -125,7 +125,7 @@ namespace ams::fssystem::buffers { } AMS_ASSERT(out->first != 0); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp index f07b74a12..1d81ca07b 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buffer_manager.hpp @@ -155,7 +155,7 @@ namespace ams::fssystem { m_external_attr_info_buffer = reinterpret_cast(aligned_attr_info_buf); m_external_attr_info_count = static_cast((work_end - aligned_attr_info_buf) / sizeof(AttrInfo)); - return ResultSuccess(); + R_SUCCEED(); } void Finalize(); @@ -216,7 +216,7 @@ namespace ams::fssystem { m_peak_free_size = m_total_size; m_peak_total_allocatable_size = m_total_size; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, s32 max_order) { @@ -228,7 +228,7 @@ namespace ams::fssystem { m_peak_free_size = m_total_size; m_peak_total_allocatable_size = m_total_size; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, void *work, size_t work_size) { @@ -245,7 +245,7 @@ namespace ams::fssystem { m_peak_free_size = m_total_size; m_peak_total_allocatable_size = m_total_size; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(s32 max_cache_count, uintptr_t address, size_t buffer_size, size_t block_size, s32 max_order, void *work, size_t work_size) { @@ -262,7 +262,7 @@ namespace ams::fssystem { m_peak_free_size = m_total_size; m_peak_total_allocatable_size = m_total_size; - return ResultSuccess(); + R_SUCCEED(); } void Finalize() { diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_alignment_matching_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_alignment_matching_storage.hpp index b1d276579..7f18beed8 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_alignment_matching_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_alignment_matching_storage.hpp @@ -106,7 +106,7 @@ namespace ams::fssystem { } *out = m_base_storage_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { @@ -208,7 +208,7 @@ namespace ams::fssystem { } *out = m_base_storage_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { @@ -295,7 +295,7 @@ namespace ams::fssystem { } *out = m_base_storage_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_allocator_utility.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_allocator_utility.hpp index 2e797e894..297b320ea 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_allocator_utility.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_allocator_utility.hpp @@ -110,7 +110,7 @@ namespace ams::fssystem { /* Return the allocated object. */ *out = std::move(p); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_asynchronous_access.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_asynchronous_access.hpp index 627c9e3f5..8294fb3ea 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_asynchronous_access.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_asynchronous_access.hpp @@ -40,13 +40,13 @@ namespace ams::fssystem { virtual Result QueryAppropriateOffset(s64 *out, s64 offset, s64 access_size, s64 alignment_size) override { /* Align the access. */ *out = util::AlignDown(offset + access_size, alignment_size); - return ResultSuccess(); + R_SUCCEED(); } virtual Result QueryInvocationCount(s64 *out, s64 start_offset, s64 end_offset, s64 access_size, s64 alignment_size) override { /* Determine aligned access count. */ *out = util::DivideUp(end_offset - util::AlignDown(start_offset, alignment_size), access_size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_bucket_tree_template_impl.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_bucket_tree_template_impl.hpp index 630b69787..646af2b49 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_bucket_tree_template_impl.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_bucket_tree_template_impl.hpp @@ -150,7 +150,7 @@ namespace ams::fssystem { } out_info->SetSkipCount(entry_index - param.entry_index); - return ResultSuccess(); + R_SUCCEED(); } template diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage_template_impl.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage_template_impl.hpp index 91f5e887b..9eb25d7bd 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage_template_impl.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_indirect_storage_template_impl.hpp @@ -144,7 +144,7 @@ namespace ams::fssystem { cur_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_verification_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_verification_storage.hpp index b1c0d305a..b90e87e69 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_verification_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_integrity_verification_storage.hpp @@ -58,7 +58,7 @@ namespace ams::fssystem { virtual Result Read(s64 offset, void *buffer, size_t size) override; virtual Result Write(s64 offset, const void *buffer, size_t size) override; - virtual Result SetSize(s64 size) override { AMS_UNUSED(size); return fs::ResultUnsupportedSetSizeForIntegrityVerificationStorage(); } + virtual Result SetSize(s64 size) override { AMS_UNUSED(size); R_THROW(fs::ResultUnsupportedSetSizeForIntegrityVerificationStorage()); } virtual Result GetSize(s64 *out) override; virtual Result Flush() override; diff --git a/libraries/libstratosphere/include/stratosphere/i2c/i2c_register_accessor.hpp b/libraries/libstratosphere/include/stratosphere/i2c/i2c_register_accessor.hpp index 8adb09025..70d709500 100644 --- a/libraries/libstratosphere/include/stratosphere/i2c/i2c_register_accessor.hpp +++ b/libraries/libstratosphere/include/stratosphere/i2c/i2c_register_accessor.hpp @@ -37,7 +37,7 @@ namespace ams::i2c { R_TRY(i2c::ExecuteCommandList(out, sizeof(*out), session, cmd_list, formatter.GetCurrentLength())); - return ResultSuccess(); + R_SUCCEED(); } template requires std::unsigned_integral @@ -50,7 +50,7 @@ namespace ams::i2c { constexpr i2c::TransactionOption StopOption = static_cast(i2c::TransactionOption_StartCondition | i2c::TransactionOption_StopCondition); R_TRY(i2c::Send(session, buf, sizeof(buf), StopOption)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp index e3304db45..84b03120c 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp @@ -72,7 +72,7 @@ namespace ams::kvdb { R_UNLESS(m_buffer != nullptr, kvdb::ResultAllocationFailed()); m_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(const void *buf, size_t size) { @@ -82,7 +82,7 @@ namespace ams::kvdb { /* Copy the input data in. */ std::memcpy(m_buffer, buf, size); - return ResultSuccess(); + R_SUCCEED(); } }; } \ No newline at end of file diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index 9cd6fed6b..2a95dbece 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp @@ -51,7 +51,7 @@ namespace ams::kvdb { LruHeader new_header = { .entry_count = 0, }; R_TRY(fs::WriteFile(file, 0, std::addressof(new_header), sizeof(new_header), fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } private: void RemoveIndex(size_t i) { @@ -91,7 +91,7 @@ namespace ams::kvdb { /* Read entries. */ R_TRY(fs::ReadFile(file, sizeof(m_header), m_keys, BufferSize)); - return ResultSuccess(); + R_SUCCEED(); } Result Save() { @@ -109,7 +109,7 @@ namespace ams::kvdb { /* Flush. */ R_TRY(fs::FlushFile(file)); - return ResultSuccess(); + R_SUCCEED(); } size_t GetCount() const { @@ -223,7 +223,7 @@ namespace ams::kvdb { /* The entry exists and is the correct type. */ *out = true; - return ResultSuccess(); + R_SUCCEED(); } static Result DirectoryExists(bool *out, const char *path) { @@ -239,7 +239,7 @@ namespace ams::kvdb { R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir))); R_TRY(fs::CreateDirectory(dir)); - return ResultSuccess(); + R_SUCCEED(); } static Result ValidateExistingCache(const char *dir) { @@ -254,7 +254,7 @@ namespace ams::kvdb { /* If one exists but not the other, we have an invalid state. */ R_UNLESS(has_lru && has_kvs, kvdb::ResultInvalidFilesystemState()); - return ResultSuccess(); + R_SUCCEED(); } private: void RemoveOldestKey() { @@ -276,7 +276,7 @@ namespace ams::kvdb { /* layout it can't really be fixed without breaking existing devices... */ R_TRY(m_kvs.Initialize(dir)); - return ResultSuccess(); + R_SUCCEED(); } size_t GetCount() const { @@ -335,7 +335,7 @@ namespace ams::kvdb { if (m_lru_list.GetCount() == 1) { m_lru_list.Pop(); R_TRY(m_lru_list.Save()); - return fs::ResultNotEnoughFreeSpace(); + R_THROW(fs::ResultNotEnoughFreeSpace()); } /* Otherwise, remove the oldest element from the cache and try again. */ @@ -351,7 +351,7 @@ namespace ams::kvdb { /* Save the list. */ R_TRY(m_lru_list.Save()); - return ResultSuccess(); + R_SUCCEED(); } template @@ -365,7 +365,7 @@ namespace ams::kvdb { R_TRY(m_kvs.Remove(key)); R_TRY(m_lru_list.Save()); - return ResultSuccess(); + R_SUCCEED(); } Result RemoveAll() { @@ -375,7 +375,7 @@ namespace ams::kvdb { } R_TRY(m_lru_list.Save()); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp index f2bd37148..b5131a464 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp @@ -93,7 +93,7 @@ namespace ams::kvdb { size_t size = 0; R_TRY(this->Get(std::addressof(size), out_value, sizeof(Value), key)); AMS_ABORT_UNLESS(size >= sizeof(Value)); - return ResultSuccess(); + R_SUCCEED(); } template 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 9498e9037..7d550cd6f 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 @@ -125,7 +125,7 @@ namespace ams::kvdb { R_UNLESS(m_entries != nullptr, kvdb::ResultAllocationFailed()); m_capacity = capacity; m_memory_resource = mr; - return ResultSuccess(); + R_SUCCEED(); } Result Set(const Key &key, const void *value, size_t value_size) { @@ -148,14 +148,14 @@ namespace ams::kvdb { /* Save the new Entry in the map. */ *it = Entry(key, new_value, value_size); - return ResultSuccess(); + R_SUCCEED(); } Result AddUnsafe(const Key &key, void *value, size_t value_size) { R_UNLESS(m_count < m_capacity, kvdb::ResultOutOfKeyResource()); m_entries[m_count++] = Entry(key, value, value_size); - return ResultSuccess(); + R_SUCCEED(); } Result Remove(const Key &key) { @@ -167,7 +167,7 @@ namespace ams::kvdb { m_memory_resource->Deallocate(it->GetValuePointer(), it->GetValueSize()); std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1))); m_count--; - return ResultSuccess(); + R_SUCCEED(); } Entry *begin() { @@ -276,7 +276,7 @@ namespace ams::kvdb { R_TRY(m_index.Initialize(capacity, mr)); m_memory_resource = mr; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(size_t capacity, MemoryResource *mr) { @@ -288,7 +288,7 @@ namespace ams::kvdb { /* Initialize our index. */ R_TRY(m_index.Initialize(capacity, mr)); m_memory_resource = mr; - return ResultSuccess(); + R_SUCCEED(); } size_t GetCount() const { @@ -384,7 +384,7 @@ namespace ams::kvdb { size_t size = std::min(max_out_size, it->GetValueSize()); std::memcpy(out_value, it->GetValuePointer(), size); *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } template @@ -394,7 +394,7 @@ namespace ams::kvdb { R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound()); *out_value = it->template GetValuePointer(); - return ResultSuccess(); + R_SUCCEED(); } template @@ -404,7 +404,7 @@ namespace ams::kvdb { R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound()); *out_value = it->template GetValuePointer(); - return ResultSuccess(); + R_SUCCEED(); } template @@ -414,7 +414,7 @@ namespace ams::kvdb { R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound()); *out_value = it->template GetValue(); - return ResultSuccess(); + R_SUCCEED(); } Result GetValueSize(size_t *out_size, const Key &key) const { @@ -423,7 +423,7 @@ namespace ams::kvdb { R_UNLESS(it != this->end(), kvdb::ResultKeyNotFound()); *out_size = it->GetValueSize(); - return ResultSuccess(); + R_SUCCEED(); } Result Remove(const Key &key) { @@ -485,7 +485,7 @@ namespace ams::kvdb { R_TRY(fs::WriteFile(file, 0, buf, size, fs::WriteOption::Flush)); } - return ResultSuccess(); + R_SUCCEED(); } Result Commit(const AutoBuffer &buffer, bool destructive) { @@ -503,7 +503,7 @@ namespace ams::kvdb { R_TRY(fs::RenameFile(m_temp_path.Get(), m_path.Get())); } - return ResultSuccess(); + R_SUCCEED(); } size_t GetArchiveSize() const { @@ -530,7 +530,7 @@ namespace ams::kvdb { R_TRY(dst->Initialize(static_cast(archive_size))); R_TRY(fs::ReadFile(file, 0, dst->Get(), dst->GetSize())); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_auto_buffer.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_auto_buffer.hpp index f74c5f921..20c298a4b 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_auto_buffer.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_auto_buffer.hpp @@ -72,7 +72,7 @@ namespace ams::ncm { R_UNLESS(m_buffer != nullptr, ncm::ResultAllocationFailed()); m_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result Initialize(const void *buf, size_t size) { @@ -82,7 +82,7 @@ namespace ams::ncm { /* Copy the input data in. */ std::memcpy(m_buffer, buf, size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp index 8bfb99e4b..c09e2c404 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp @@ -55,7 +55,7 @@ namespace ams::ncm { R_TRY(m_interface->Get(std::addressof(size), key, sf::OutBuffer(dst, dst_size))); *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } #define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \ @@ -152,7 +152,7 @@ namespace ams::ncm { R_TRY(m_interface->GetSize(std::addressof(size), key)); *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result GetRequiredSystemVersion(u32 *out_version, const ContentMetaKey &key) { diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp index 2ce0b2e3a..df3e5b6ef 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_install_task_base.hpp @@ -149,7 +149,7 @@ namespace ams::ncm { StorageId GetInstallStorage() const { return m_install_storage; } - virtual Result OnPrepareComplete() { return ResultSuccess(); } + virtual Result OnPrepareComplete() { R_SUCCEED(); } Result GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out); @@ -164,9 +164,9 @@ namespace ams::ncm { Result VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys); virtual Result PrepareInstallContentMetaData() = 0; - virtual Result GetLatestVersion(util::optional *out_version, u64 id) { AMS_UNUSED(out_version, id); return ncm::ResultContentMetaNotFound(); } + virtual Result GetLatestVersion(util::optional *out_version, u64 id) { AMS_UNUSED(out_version, id); R_THROW(ncm::ResultContentMetaNotFound()); } - virtual Result OnExecuteComplete() { return ResultSuccess(); } + virtual Result OnExecuteComplete() { R_SUCCEED(); } Result WritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info); virtual Result OnWritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info) = 0; @@ -194,7 +194,7 @@ namespace ams::ncm { Result ReadContentMetaInfoList(s32 *out_count, std::unique_ptr *out_meta_infos, const ContentMetaKey &key); Result ListRightsIdsByInstallContentMeta(s32 *out_count, Span out_span, const InstallContentMeta &content_meta, s32 offset); public: - virtual Result CheckInstallable() { return ResultSuccess(); } + virtual Result CheckInstallable() { R_SUCCEED(); } void SetFirmwareVariationId(FirmwareVariationId id) { m_firmware_variation_id = id; } Result ListRightsIds(s32 *out_count, Span out_span, const ContentMetaKey &key, s32 offset); diff --git a/libraries/libstratosphere/include/stratosphere/pgl/pgl_event_observer.hpp b/libraries/libstratosphere/include/stratosphere/pgl/pgl_event_observer.hpp index a0ad49e91..9ac7ed2c8 100644 --- a/libraries/libstratosphere/include/stratosphere/pgl/pgl_event_observer.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl/pgl_event_observer.hpp @@ -52,7 +52,7 @@ namespace ams::pgl { os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear); handle.Detach(); - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override { @@ -74,7 +74,7 @@ namespace ams::pgl { os::NativeHandle handle; R_TRY(m_tipc_interface.GetProcessEventHandle(std::addressof(handle))); os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear); - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override { diff --git a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index 27355dec8..9c4e5293b 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp @@ -174,7 +174,7 @@ namespace ams::sf::hipc { this->RegisterServerImpl(server, port_handle, false); - return ResultSuccess(); + R_SUCCEED(); } #if AMS_SF_MITM_SUPPORTED @@ -220,7 +220,7 @@ namespace ams::sf::hipc { this->RegisterServerImpl(server, port_handle, true); - return ResultSuccess(); + R_SUCCEED(); } #endif public: diff --git a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp index 3fdbcbb79..d5e7c5308 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp @@ -52,14 +52,14 @@ namespace ams::sf { constexpr inline Result MarshalProcessId(ClientProcessId &client, const os::ProcessId &client_process_id) { client.SetValue(client_process_id); - return ResultSuccess(); + R_SUCCEED(); } constexpr inline Result MarshalProcessId(ClientAppletResourceUserId &client, const os::ProcessId &client_process_id) { if (client.GetValue() != client_process_id && client.GetValue() != os::ProcessId{}) { - return sf::ResultPreconditionViolation(); + R_THROW(sf::ResultPreconditionViolation()); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -727,7 +727,7 @@ namespace ams::sf::impl { if constexpr (NumInObjects > 0) { R_TRY(processor->GetInObjects(m_in_object_holders.data())); } - return ResultSuccess(); + R_SUCCEED(); } template @@ -749,7 +749,7 @@ namespace ams::sf::impl { _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(6); _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT(7); #undef _SF_IN_OUT_HOLDER_VALIDATE_IN_OBJECT - return ResultSuccess(); + R_SUCCEED(); } template @@ -792,7 +792,7 @@ namespace ams::sf::impl { virtual Result GetInObjects(cmif::ServiceObjectHolder *in_objects) const override final { /* By default, InObjects aren't supported. */ AMS_UNUSED(in_objects); - return sf::ResultNotSupported(); + R_THROW(sf::ResultNotSupported()); } }; @@ -820,7 +820,7 @@ namespace ams::sf::impl { is_request_valid &= meta_raw_size >= command_raw_size; R_UNLESS(is_request_valid, sf::hipc::ResultInvalidCmifRequest()); - return ResultSuccess(); + R_SUCCEED(); } virtual HipcRequest PrepareForReply(const cmif::ServiceDispatchContext &ctx, cmif::PointerAndSize &out_raw_data, const cmif::ServerMessageRuntimeMetadata runtime_metadata) override final { @@ -1022,7 +1022,7 @@ namespace ams::sf::impl { if constexpr (CommandMeta::NumOutHipcPointerBuffers > 0) { R_UNLESS(pointer_buffer_tail <= pointer_buffer_head, sf::hipc::ResultPointerBufferTooSmall()); } - return ResultSuccess(); + R_SUCCEED(); } NX_CONSTEXPR void SetOutBuffers(const HipcRequest &response, const BufferArrayType &buffers, const std::array &is_buffer_map_alias) { @@ -1122,7 +1122,7 @@ namespace ams::sf::impl { R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize()); out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header)); *out_header_ptr = header; - return ResultSuccess(); + R_SUCCEED(); } template @@ -1242,7 +1242,7 @@ namespace ams::sf::impl { #undef _SF_IMPL_PROCESSOR_MARSHAL_OUT_OBJECT in_out_objects_holder.SetOutObjects(ctx, response); - return ResultSuccess(); + R_SUCCEED(); } template @@ -1259,7 +1259,7 @@ namespace ams::sf::impl { return (static_cast(srv_obj)->*ServiceCommandImpl)(std::forward(args)...); } else { (static_cast(srv_obj)->*ServiceCommandImpl)(std::forward(args)...); - return ResultSuccess(); + R_SUCCEED(); } }); } diff --git a/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_autogen_interface_macros.hpp b/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_autogen_interface_macros.hpp index 39de5e0be..ebdd45b63 100644 --- a/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_autogen_interface_macros.hpp +++ b/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_autogen_interface_macros.hpp @@ -135,7 +135,7 @@ namespace ams::tipc::impl { if constexpr (HasDefaultServiceCommandProcessor) { \ return impl->ProcessDefaultServiceCommand(message_buffer); \ } else { \ - return tipc::ResultInvalidMethod(); \ + R_THROW(tipc::ResultInvalidMethod()); \ } \ } \ \ diff --git a/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp b/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp index aba8cb160..63a4dd0f7 100644 --- a/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp +++ b/libraries/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp @@ -572,7 +572,7 @@ namespace ams::tipc::impl { R_UNLESS(message_buffer.Get32(SpecialHeaderIndex) == ExpectedSpecialHeader, tipc::ResultInvalidMessageFormat()); } - return ResultSuccess(); + R_SUCCEED(); } template @@ -631,14 +631,14 @@ namespace ams::tipc::impl { return (object->*ServiceCommandImpl)(Processor::template DeserializeArgument(message_buffer, out_raw_holder, out_handles_holder)...); } else { (object->*ServiceCommandImpl)(Processor::template DeserializeArgument(message_buffer, out_raw_holder, out_handles_holder)...); - return ResultSuccess(); + R_SUCCEED(); } }(std::make_index_sequence::value>()); /* Serialize output. */ Processor::SerializeResults(message_buffer, command_result, out_raw_holder, out_handles_holder); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp b/libraries/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp index eecd375af..6c393ab64 100644 --- a/libraries/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp @@ -122,7 +122,7 @@ namespace ams::tipc { return result; } else { - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp b/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp index 7566b6a40..f5f7b2c99 100644 --- a/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp @@ -319,7 +319,7 @@ namespace ams::tipc { const Result method_result = message_buffer.GetRaw(raw_data_offset); /* Check that the result is the special deferral result. */ - return tipc::ResultRequestDeferred::Includes(method_result); + R_THROW(tipc::ResultRequestDeferred::Includes(method_result)); } else { /* If deferral isn't supported, requests are never deferred. */ return false; @@ -501,7 +501,7 @@ namespace ams::tipc { /* Add the session to the least burdened manager. */ best_manager->AddSession(session_handle, object); - return ResultSuccess(); + R_SUCCEED(); } private: template requires (Ix < NumPorts) @@ -795,7 +795,7 @@ namespace ams::tipc { /* Add the session to our manager. */ m_port_manager.AddSession(session_handle, object); - return ResultSuccess(); + R_SUCCEED(); } private: void LoopProcess(PortManagerBase &port_manager) { diff --git a/libraries/libstratosphere/source/cal/cal_battery_api.cpp b/libraries/libstratosphere/source/cal/cal_battery_api.cpp index 7c2e57717..decad7226 100644 --- a/libraries/libstratosphere/source/cal/cal_battery_api.cpp +++ b/libraries/libstratosphere/source/cal/cal_battery_api.cpp @@ -37,7 +37,7 @@ namespace ams::cal { /* Write the output. */ *out = battery_version[0]; - return ResultSuccess(); + R_SUCCEED(); } Result GetBatteryVendor(size_t *out_vendor_size, void *dst, size_t dst_size) { @@ -47,7 +47,7 @@ namespace ams::cal { /* Copy output. */ *out_vendor_size = static_cast(util::Strlcpy(static_cast(dst), battery_lot, std::min(dst_size, BatteryVendorSizeMax))); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/cal/cal_crc_utils.cpp b/libraries/libstratosphere/source/cal/cal_crc_utils.cpp index 531aa577d..6d9d19d6d 100644 --- a/libraries/libstratosphere/source/cal/cal_crc_utils.cpp +++ b/libraries/libstratosphere/source/cal/cal_crc_utils.cpp @@ -47,7 +47,7 @@ namespace ams::cal::impl { const u16 crc = *reinterpret_cast(reinterpret_cast(data) + size - sizeof(u16)); R_UNLESS(CalculateCrc16(data, size - sizeof(u16)) == crc, cal::ResultCalibrationDataCrcError()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/cal/cal_fs_utils.cpp b/libraries/libstratosphere/source/cal/cal_fs_utils.cpp index 827b762b4..2b449930f 100644 --- a/libraries/libstratosphere/source/cal/cal_fs_utils.cpp +++ b/libraries/libstratosphere/source/cal/cal_fs_utils.cpp @@ -30,7 +30,7 @@ namespace ams::cal::impl { /* Validate the crc. */ R_TRY(ValidateCalibrationCrc(dst, block_size)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/capsrv/capsrv_screen_shot_control_api.cpp b/libraries/libstratosphere/source/capsrv/capsrv_screen_shot_control_api.cpp index 5af5ff69a..5a0f29989 100644 --- a/libraries/libstratosphere/source/capsrv/capsrv_screen_shot_control_api.cpp +++ b/libraries/libstratosphere/source/capsrv/capsrv_screen_shot_control_api.cpp @@ -51,7 +51,7 @@ namespace ams::capsrv { *out_width = static_cast(width); *out_height = static_cast(height); - return ResultSuccess(); + R_SUCCEED(); #else AMS_UNUSED(out_data_size, out_width, out_height, layer_stack, timeout); AMS_ABORT("TODO"); @@ -64,7 +64,7 @@ namespace ams::capsrv { R_TRY(::capsscReadRawScreenShotReadStream(std::addressof(read_size), dst, dst_size, static_cast(offset))); *out_read_size = static_cast(read_size); - return ResultSuccess(); + R_SUCCEED(); #else AMS_UNUSED(out_read_size, dst, dst_size, offset); AMS_ABORT("TODO"); diff --git a/libraries/libstratosphere/source/capsrv/server/capsrv_server_decoder_api.cpp b/libraries/libstratosphere/source/capsrv/server/capsrv_server_decoder_api.cpp index 1d70c9004..20214c2be 100644 --- a/libraries/libstratosphere/source/capsrv/server/capsrv_server_decoder_api.cpp +++ b/libraries/libstratosphere/source/capsrv/server/capsrv_server_decoder_api.cpp @@ -39,7 +39,7 @@ namespace ams::capsrv::server { /* We're initialized. */ g_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } void FinalizeForDecoderServer() { diff --git a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_server_manager.cpp b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_server_manager.cpp index db40a8dae..7f799fed8 100644 --- a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_server_manager.cpp +++ b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_server_manager.cpp @@ -29,7 +29,7 @@ namespace ams::capsrv::server { /* Initialize the idle event, we're idle initially. */ os::InitializeEvent(std::addressof(m_idle_event), true, os::EventClearMode_ManualClear); - return ResultSuccess(); + R_SUCCEED(); } void DecoderControlServerManager::Finalize() { diff --git a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_service.cpp b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_service.cpp index 328eb5bc3..d4682ece6 100644 --- a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_service.cpp +++ b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_control_service.cpp @@ -64,7 +64,7 @@ namespace ams::capsrv::server { /* We succeeded, so we shouldn't clear the output memory. */ clear_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/capsrv/server/jpeg/capsrv_server_jpeg_error_handler.hpp b/libraries/libstratosphere/source/capsrv/server/jpeg/capsrv_server_jpeg_error_handler.hpp index 164aaaa14..04f276f6d 100644 --- a/libraries/libstratosphere/source/capsrv/server/jpeg/capsrv_server_jpeg_error_handler.hpp +++ b/libraries/libstratosphere/source/capsrv/server/jpeg/capsrv_server_jpeg_error_handler.hpp @@ -49,9 +49,9 @@ namespace ams::capsrv::server::jpeg { case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_READ: case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_SEEK: case JpegLibraryType::J_MESSAGE_CODE::JERR_TFILE_WRITE: - return capsrv::ResultInternalJpegWorkMemoryShortage(); + R_THROW(capsrv::ResultInternalJpegWorkMemoryShortage()); default: - return capsrv::ResultInternalJpegEncoderError(); + R_THROW(capsrv::ResultInternalJpegEncoderError()); } } }; diff --git a/libraries/libstratosphere/source/capsrv/server/jpeg/decodersrv_software_jpeg_decoder.cpp b/libraries/libstratosphere/source/capsrv/server/jpeg/decodersrv_software_jpeg_decoder.cpp index 3631a3643..e76f33314 100644 --- a/libraries/libstratosphere/source/capsrv/server/jpeg/decodersrv_software_jpeg_decoder.cpp +++ b/libraries/libstratosphere/source/capsrv/server/jpeg/decodersrv_software_jpeg_decoder.cpp @@ -51,7 +51,7 @@ namespace ams::capsrv::server::jpeg { /* Return the output to the caller. */ *out_size = rgb_size; *out_stride = rgb_stride; - return ResultSuccess(); + R_SUCCEED(); } } @@ -172,14 +172,14 @@ namespace ams::capsrv::server::jpeg { R_UNLESS(jpeg_finish_decompress(std::addressof(cinfo)) == TRUE, capsrv::ResultAlbumInvalidFileData()); } else { /* Some unknown error was caught by our handler. */ - return capsrv::ResultAlbumInvalidFileData(); + R_THROW(capsrv::ResultAlbumInvalidFileData()); } /* Write the size we decoded to output. */ *output.out_width = static_cast(cinfo.output_width); *output.out_width = static_cast(cinfo.output_height); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/dd/dd_device_address_space.cpp b/libraries/libstratosphere/source/dd/dd_device_address_space.cpp index 49c0ecbae..1e41fce60 100644 --- a/libraries/libstratosphere/source/dd/dd_device_address_space.cpp +++ b/libraries/libstratosphere/source/dd/dd_device_address_space.cpp @@ -38,7 +38,7 @@ namespace ams::dd { /* We succeeded. */ state_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result CreateDeviceAddressSpace(DeviceAddressSpaceType *das, u64 size) { diff --git a/libraries/libstratosphere/source/dd/impl/dd_device_address_space_impl.os.horizon.cpp b/libraries/libstratosphere/source/dd/impl/dd_device_address_space_impl.os.horizon.cpp index 3b0dd9cf2..255ed85da 100644 --- a/libraries/libstratosphere/source/dd/impl/dd_device_address_space_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/dd/impl/dd_device_address_space_impl.os.horizon.cpp @@ -32,7 +32,7 @@ namespace ams::dd::impl { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = static_cast(handle); - return ResultSuccess(); + R_SUCCEED(); } void DeviceAddressSpaceImplByHorizon::Close(DeviceAddressSpaceHandle handle) { @@ -55,7 +55,7 @@ namespace ams::dd::impl { R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); } Result DeviceAddressSpaceImplByHorizon::MapNotAligned(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address, dd::MemoryPermission device_perm) { @@ -66,7 +66,7 @@ namespace ams::dd::impl { R_CONVERT(svc::ResultInvalidCurrentMemory, dd::ResultInvalidMemoryState()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); } void DeviceAddressSpaceImplByHorizon::Unmap(DeviceAddressSpaceHandle handle, ProcessHandle process_handle, u64 process_address, size_t process_size, DeviceVirtualAddress device_address) { @@ -78,7 +78,7 @@ namespace ams::dd::impl { R_CONVERT(svc::ResultOutOfMemory, dd::ResultOutOfMemory()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); } void DeviceAddressSpaceImplByHorizon::Detach(DeviceAddressSpaceType *das, DeviceName device_name) { diff --git a/libraries/libstratosphere/source/ddsf/ddsf_device_code_entry_manager.cpp b/libraries/libstratosphere/source/ddsf/ddsf_device_code_entry_manager.cpp index f20485e32..f0aad97a0 100644 --- a/libraries/libstratosphere/source/ddsf/ddsf_device_code_entry_manager.cpp +++ b/libraries/libstratosphere/source/ddsf/ddsf_device_code_entry_manager.cpp @@ -43,7 +43,7 @@ namespace ams::ddsf { /* Link the new holder. */ holder->AddTo(m_entry_list); - return ResultSuccess(); + R_SUCCEED(); } bool DeviceCodeEntryManager::Remove(DeviceCode device_code) { @@ -90,7 +90,7 @@ namespace ams::ddsf { /* Check that we found the device. */ R_UNLESS(found, ddsf::ResultDeviceCodeNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result DeviceCodeEntryManager::FindDeviceCodeEntry(const DeviceCodeEntry **out, DeviceCode device_code) const { @@ -112,7 +112,7 @@ namespace ams::ddsf { /* Check that we found the device. */ R_UNLESS(found, ddsf::ResultDeviceCodeNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result DeviceCodeEntryManager::FindDevice(IDevice **out, DeviceCode device_code) { @@ -128,7 +128,7 @@ namespace ams::ddsf { *out = std::addressof(entry->GetDevice()); } - return ResultSuccess(); + R_SUCCEED(); } Result DeviceCodeEntryManager::FindDevice(const IDevice **out, DeviceCode device_code) const { @@ -144,7 +144,7 @@ namespace ams::ddsf { *out = std::addressof(entry->GetDevice()); } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ddsf/ddsf_session_api.cpp b/libraries/libstratosphere/source/ddsf/ddsf_session_api.cpp index 0e1ff6745..d801380e7 100644 --- a/libraries/libstratosphere/source/ddsf/ddsf_session_api.cpp +++ b/libraries/libstratosphere/source/ddsf/ddsf_session_api.cpp @@ -32,7 +32,7 @@ namespace ams::ddsf { /* We succeeded. */ session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(ISession *session) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment.cpp index 371a7a6f8..f9087de2f 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment.cpp @@ -48,7 +48,7 @@ namespace ams::erpt::srv { switch (type) { case AttachmentOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, AttachmentStreamBufferSize); case AttachmentOpenType_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, AttachmentStreamBufferSize); - default: return erpt::ResultInvalidArgument(); + default: R_THROW(erpt::ResultInvalidArgument()); } } @@ -66,7 +66,7 @@ namespace ams::erpt::srv { Result Attachment::GetFlags(AttachmentFlagSet *out) const { *out = m_record->m_info.flags; - return ResultSuccess(); + R_SUCCEED(); } Result Attachment::SetFlags(AttachmentFlagSet flags) { @@ -74,7 +74,7 @@ namespace ams::erpt::srv { m_record->m_info.flags |= flags; return Journal::Commit(); } - return ResultSuccess(); + R_SUCCEED(); } Result Attachment::GetSize(s64 *out) const { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment_impl.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment_impl.cpp index 8309a7be2..3f161bed1 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment_impl.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_attachment_impl.cpp @@ -40,7 +40,7 @@ namespace ams::erpt::srv { R_TRY(m_attachment->Open(AttachmentOpenType_Read)); attachment_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result AttachmentImpl::Read(ams::sf::Out out_count, const ams::sf::OutBuffer &out_buffer) { @@ -67,7 +67,7 @@ namespace ams::erpt::srv { delete m_attachment; m_attachment = nullptr; } - return ResultSuccess(); + R_SUCCEED(); } Result AttachmentImpl::GetSize(ams::sf::Out out) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context.cpp index 5ce9d071d..25a41a4e5 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context.cpp @@ -62,12 +62,12 @@ namespace ams::erpt::srv { case FieldType_I8Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s8 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s8))); break; case FieldType_I32Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s32 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s32))); break; case FieldType_I64Array: R_TRY(Cipher::AddField(report, field->id, reinterpret_cast< s64 *>(arr_buf + field->value_array.start_idx), field->value_array.size / sizeof(s64))); break; - default: return erpt::ResultInvalidArgument(); + default: R_THROW(erpt::ResultInvalidArgument()); } } } - return ResultSuccess(); + R_SUCCEED(); } Result Context::AddContextToCategory(const ContextEntry *entry, const u8 *data, u32 data_size) { @@ -77,7 +77,7 @@ namespace ams::erpt::srv { R_TRY(record->Initialize(entry, data, data_size)); this->AddContextRecordToCategory(std::move(record)); - return ResultSuccess(); + R_SUCCEED(); } Result Context::AddContextRecordToCategory(std::unique_ptr record) { @@ -91,7 +91,7 @@ namespace ams::erpt::srv { delete back; } - return ResultSuccess(); + R_SUCCEED(); } Result Context::SubmitContext(const ContextEntry *entry, const u8 *data, u32 data_size) { @@ -123,7 +123,7 @@ namespace ams::erpt::srv { Cipher::End(report); report->Close(); - return ResultSuccess(); + R_SUCCEED(); } Result Context::ClearContext(CategoryId cat) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_impl.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_impl.cpp index 410c65934..a661f7a22 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_impl.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_impl.cpp @@ -54,7 +54,7 @@ namespace ams::erpt::srv { ManagerImpl::NotifyAll(); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::CreateReportV0(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) { @@ -63,22 +63,22 @@ namespace ams::erpt::srv { Result ContextImpl::SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) { Reporter::SetInitialLaunchSettingsCompletionTime(time_point); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::ClearInitialLaunchSettingsCompletionTime() { Reporter::ClearInitialLaunchSettingsCompletionTime(); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::UpdatePowerOnTime() { /* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */ - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::UpdateAwakeTime() { /* NOTE: Prior to 12.0.0, this set the power on time, but now erpt does it during initialization. */ - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) { @@ -107,17 +107,17 @@ namespace ams::erpt::srv { total_arr_count += ctx_entry.array_buf_counts[i]; } - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::UpdateApplicationLaunchTime() { Reporter::UpdateApplicationLaunchTime(); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::ClearApplicationLaunchTime() { Reporter::ClearApplicationLaunchTime(); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::SubmitAttachment(ams::sf::Out out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data) { @@ -154,7 +154,7 @@ namespace ams::erpt::srv { ManagerImpl::NotifyAll(); - return ResultSuccess(); + R_SUCCEED(); } Result ContextImpl::CreateReportWithAttachmentsDeprecated(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer) { @@ -176,7 +176,7 @@ namespace ams::erpt::srv { Result ContextImpl::InvalidateForcedShutdownDetection() { /* NOTE: Nintendo does not check the result here. */ erpt::srv::InvalidateForcedShutdownDetection(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_record.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_record.cpp index 95d243ed2..f1a4148f2 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_record.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_context_record.cpp @@ -106,7 +106,7 @@ namespace ams::erpt::srv { guard.Cancel(); s_record_count += m_ctx.field_count; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, bool value_bool) { @@ -120,7 +120,7 @@ namespace ams::erpt::srv { field.value_bool = value_bool; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, u32 value_u32) { @@ -134,7 +134,7 @@ namespace ams::erpt::srv { field.value_u32 = value_u32; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, u64 value_u64) { @@ -148,7 +148,7 @@ namespace ams::erpt::srv { field.value_u64 = value_u64; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, s32 value_i32) { @@ -162,7 +162,7 @@ namespace ams::erpt::srv { field.value_i32 = value_i32; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, s64 value_i64) { @@ -176,7 +176,7 @@ namespace ams::erpt::srv { field.value_i64 = value_i64; - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, const void *arr, u32 size, FieldType type) { @@ -198,7 +198,7 @@ namespace ams::erpt::srv { }; std::memcpy(m_ctx.array_buffer + start_idx, arr, size); - return ResultSuccess(); + R_SUCCEED(); } Result ContextRecord::Add(FieldId field_id, const char *str, u32 str_size) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_forced_shutdown.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_forced_shutdown.cpp index 41be2e7f2..a6a622f71 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_forced_shutdown.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_forced_shutdown.cpp @@ -70,7 +70,7 @@ namespace ams::erpt::srv { /* Commit the context. */ R_TRY(Stream::CommitStream()); - return ResultSuccess(); + R_SUCCEED(); } Result CreateReportForForcedShutdown() { @@ -88,7 +88,7 @@ namespace ams::erpt::srv { /* Create report. */ R_TRY(Reporter::CreateReport(ReportType_Invisible, ResultSuccess(), std::move(record), nullptr, nullptr, 0)); - return ResultSuccess(); + R_SUCCEED(); } Result LoadForcedShutdownContext() { @@ -162,7 +162,7 @@ namespace ams::erpt::srv { R_TRY(Context::SubmitContextRecord(std::move(record))); } - return ResultSuccess(); + R_SUCCEED(); } u32 GetForcedShutdownContextCount() { @@ -215,7 +215,7 @@ namespace ams::erpt::srv { /* Commit the context. */ R_TRY(Stream::CommitStream()); - return ResultSuccess(); + R_SUCCEED(); } } @@ -324,7 +324,7 @@ namespace ams::erpt::srv { /* Commit the deletion. */ R_TRY(Stream::CommitStream()); - return ResultSuccess(); + R_SUCCEED(); } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_formatter.hpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_formatter.hpp index ef10226c4..639ea4fd9 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_formatter.hpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_formatter.hpp @@ -56,7 +56,7 @@ namespace ams::erpt::srv { R_TRY(report->Write(str, str_len)); - return ResultSuccess(); + R_SUCCEED(); } static Result AddId(Report *report, FieldId field_id) { @@ -64,7 +64,7 @@ namespace ams::erpt::srv { R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize))); - return ResultSuccess(); + R_SUCCEED(); } template @@ -77,7 +77,7 @@ namespace ams::erpt::srv { R_TRY(report->Write(tag)); R_TRY(report->Write(reinterpret_cast(std::addressof(big_endian_value)), sizeof(big_endian_value))); - return ResultSuccess(); + R_SUCCEED(); } template @@ -98,21 +98,21 @@ namespace ams::erpt::srv { R_TRY(AddValue(report, arr[i])); } - return ResultSuccess(); + R_SUCCEED(); } template static Result AddIdValuePair(Report *report, FieldId field_id, T value) { R_TRY(AddId(report, field_id)); R_TRY(AddValue(report, value)); - return ResultSuccess(); + R_SUCCEED(); } template static Result AddIdValueArray(Report *report, FieldId field_id, T *arr, u32 arr_size) { R_TRY(AddId(report, field_id)); R_TRY(AddValueArray(report, arr, arr_size)); - return ResultSuccess(); + R_SUCCEED(); } public: static Result Begin(Report *report, u32 record_count) { @@ -128,12 +128,12 @@ namespace ams::erpt::srv { R_TRY(report->Write(be_count)); } - return ResultSuccess(); + R_SUCCEED(); } static Result End(Report *report) { AMS_UNUSED(report); - return ResultSuccess(); + R_SUCCEED(); } template @@ -149,7 +149,7 @@ namespace ams::erpt::srv { static Result AddField(Report *report, FieldId field_id, bool value) { R_TRY(AddId(report, field_id)); R_TRY(report->Write(static_cast(value ? ValueTypeTag::True : ValueTypeTag::False))); - return ResultSuccess(); + R_SUCCEED(); } static Result AddField(Report *report, FieldId field_id, char *str, u32 len) { @@ -157,7 +157,7 @@ namespace ams::erpt::srv { R_TRY(AddStringValue(report, str, len)); - return ResultSuccess(); + R_SUCCEED(); } static Result AddField(Report *report, FieldId field_id, u8 *bin, u32 len) { @@ -177,7 +177,7 @@ namespace ams::erpt::srv { R_TRY(report->Write(bin, len)); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal.cpp index 5e1e59f0a..51dc62db1 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal.cpp @@ -44,7 +44,7 @@ namespace ams::erpt::srv { stream.CloseStream(); stream.CommitStream(); - return ResultSuccess(); + R_SUCCEED(); } Result Journal::Delete(ReportId report_id) { @@ -97,7 +97,7 @@ namespace ams::erpt::srv { /* Restore the attachments. */ R_TRY(JournalForAttachments::RestoreJournal(std::addressof(stream))); - return ResultSuccess(); + R_SUCCEED(); } JournalRecord *Journal::Retrieve(ReportId report_id) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp index 25c303f85..4a7c75570 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp @@ -50,7 +50,7 @@ namespace ams::erpt::srv { for (auto it = s_attachment_list.crbegin(); it != s_attachment_list.crend(); it++) { R_TRY(stream->WriteStream(reinterpret_cast(std::addressof(it->m_info)), sizeof(it->m_info))); } - return ResultSuccess(); + R_SUCCEED(); } Result JournalForAttachments::DeleteAttachments(ReportId report_id) { @@ -74,7 +74,7 @@ namespace ams::erpt::srv { it++; } } - return ResultSuccess(); + R_SUCCEED(); } Result JournalForAttachments::GetAttachmentList(AttachmentList *out, ReportId report_id) { @@ -85,7 +85,7 @@ namespace ams::erpt::srv { } } out->attachment_count = count; - return ResultSuccess(); + R_SUCCEED(); } u32 JournalForAttachments::GetUsedStorage() { @@ -133,7 +133,7 @@ namespace ams::erpt::srv { } cleanup_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } JournalRecord *JournalForAttachments::RetrieveRecord(AttachmentId attachment_id) { @@ -153,10 +153,10 @@ namespace ams::erpt::srv { record->m_info.owner_report_id = report_id; record->m_info.flags.Set(); - return ResultSuccess(); + R_SUCCEED(); } } - return erpt::ResultInvalidArgument(); + R_THROW(erpt::ResultInvalidArgument()); } Result JournalForAttachments::StoreRecord(JournalRecord *record) { @@ -173,7 +173,7 @@ namespace ams::erpt::srv { s_attachment_count++; s_used_storage += static_cast(record->m_info.attachment_size); - return ResultSuccess(); + R_SUCCEED(); } Result JournalForAttachments::SubmitAttachment(AttachmentId *out, char *name, const u8 *data, u32 data_size) { @@ -217,7 +217,7 @@ namespace ams::erpt::srv { *out = info.attachment_id; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_meta.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_meta.cpp index 254c3abd9..368d97953 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_meta.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_meta.cpp @@ -35,7 +35,7 @@ namespace ams::erpt::srv { if (R_FAILED(stream->ReadStream(std::addressof(size), reinterpret_cast(std::addressof(s_journal_meta)), sizeof(s_journal_meta))) || size != sizeof(s_journal_meta)) { InitializeJournal(); } - return ResultSuccess(); + R_SUCCEED(); } u32 JournalForMeta::GetTransmittedCount(ReportType type) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_reports.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_reports.cpp index 6840d997c..87c7f8d71 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_reports.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_reports.cpp @@ -46,7 +46,7 @@ namespace ams::erpt::srv { for (auto it = s_record_list.crbegin(); it != s_record_list.crend(); it++) { R_TRY(stream->WriteStream(reinterpret_cast(std::addressof(it->m_info)), sizeof(it->m_info))); } - return ResultSuccess(); + R_SUCCEED(); } void JournalForReports::EraseReportImpl(JournalRecord *record, bool increment_count, bool force_delete_attachments) { @@ -80,10 +80,10 @@ namespace ams::erpt::srv { auto *record = std::addressof(*it); if (record->m_info.id == report_id) { EraseReportImpl(record, false, false); - return ResultSuccess(); + R_SUCCEED(); } } - return erpt::ResultInvalidArgument(); + R_THROW(erpt::ResultInvalidArgument()); } Result JournalForReports::DeleteReportWithAttachments() { @@ -91,10 +91,10 @@ namespace ams::erpt::srv { auto *record = std::addressof(*it); if (record->m_info.flags.Test()) { EraseReportImpl(record, true, true); - return ResultSuccess(); + R_SUCCEED(); } } - return erpt::ResultNotFound(); + R_THROW(erpt::ResultNotFound()); } s64 JournalForReports::GetMaxReportSize() { @@ -113,7 +113,7 @@ namespace ams::erpt::srv { } } out->report_count = count; - return ResultSuccess(); + R_SUCCEED(); } u32 JournalForReports::GetStoredReportCount(ReportType type) { @@ -169,7 +169,7 @@ namespace ams::erpt::srv { } cleanup_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } JournalRecord *JournalForReports::RetrieveRecord(ReportId report_id) { @@ -222,7 +222,7 @@ namespace ams::erpt::srv { s_record_count_by_type[record->m_info.type]++; s_used_storage += static_cast(record->m_info.report_size); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp index 2ad3d8005..6bdf937e2 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_main.cpp @@ -49,7 +49,7 @@ namespace ams::erpt::srv { } } - return ResultSuccess(); + R_SUCCEED(); } Result MountSystemSaveData() { @@ -66,7 +66,7 @@ namespace ams::erpt::srv { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } @@ -115,7 +115,7 @@ namespace ams::erpt::srv { Reporter::UpdatePowerOnTime(); Reporter::UpdateAwakeTime(); - return ResultSuccess(); + R_SUCCEED(); } Result InitializeAndStartService() { @@ -138,7 +138,7 @@ namespace ams::erpt::srv { R_TRY(record->Add(FieldId_ProductModel, model, model_len)); R_TRY(Context::SubmitContextRecord(std::move(record))); - return ResultSuccess(); + R_SUCCEED(); } Result SetRegionSetting(const char *region, u32 region_len) { @@ -149,17 +149,17 @@ namespace ams::erpt::srv { R_TRY(record->Add(FieldId_RegionSetting, region, region_len)); R_TRY(Context::SubmitContextRecord(std::move(record))); - return ResultSuccess(); + R_SUCCEED(); } Result SetRedirectNewReportsToSdCard(bool redirect) { Reporter::SetRedirectNewReportsToSdCard(redirect); - return ResultSuccess(); + R_SUCCEED(); } Result SetEnabledAutomaticReportCleanup(bool en) { g_automatic_report_cleanup_enabled = en; - return ResultSuccess(); + R_SUCCEED(); } void Wait() { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_manager_impl.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_manager_impl.cpp index daab91319..d726e8f7b 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_manager_impl.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_manager_impl.cpp @@ -43,7 +43,7 @@ namespace ams::erpt::srv { for (auto &manager : g_manager_list) { manager.NotifyOne(); } - return ResultSuccess(); + R_SUCCEED(); } Result ManagerImpl::GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) { @@ -54,7 +54,7 @@ namespace ams::erpt::srv { Result ManagerImpl::GetEvent(ams::sf::OutCopyHandle out) { out.SetValue(m_system_event.GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerImpl::CleanupReports() { @@ -83,7 +83,7 @@ namespace ams::erpt::srv { } out.SetValue(stats); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerImpl::GetAttachmentList(const ams::sf::OutBuffer &out_list, const ReportId &report_id) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_report.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_report.cpp index 7aa56300a..c52952a8e 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_report.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_report.cpp @@ -54,7 +54,7 @@ namespace ams::erpt::srv { switch (type) { case ReportOpenType_Create: return this->OpenStream(this->FileName().name, StreamMode_Write, ReportStreamBufferSize); case ReportOpenType_Read: return this->OpenStream(this->FileName().name, StreamMode_Read, ReportStreamBufferSize); - default: return erpt::ResultInvalidArgument(); + default: R_THROW(erpt::ResultInvalidArgument()); } } @@ -72,7 +72,7 @@ namespace ams::erpt::srv { Result Report::GetFlags(ReportFlagSet *out) const { *out = m_record->m_info.flags; - return ResultSuccess(); + R_SUCCEED(); } Result Report::SetFlags(ReportFlagSet flags) { @@ -80,7 +80,7 @@ namespace ams::erpt::srv { m_record->m_info.flags |= flags; return Journal::Commit(); } - return ResultSuccess(); + R_SUCCEED(); } Result Report::GetSize(s64 *out) const { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_report_impl.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_report_impl.cpp index f3926f2d6..0a670ffa8 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_report_impl.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_report_impl.cpp @@ -40,7 +40,7 @@ namespace ams::erpt::srv { R_TRY(m_report->Open(ReportOpenType_Read)); report_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result ReportImpl::Read(ams::sf::Out out_count, const ams::sf::OutBuffer &out_buffer) { @@ -67,7 +67,7 @@ namespace ams::erpt::srv { delete m_report; m_report = nullptr; } - return ResultSuccess(); + R_SUCCEED(); } Result ReportImpl::GetSize(ams::sf::Out out) { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.cpp index 1cd23a0c8..42a2a1150 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.cpp @@ -96,7 +96,7 @@ namespace ams::erpt::srv { *out_total_size = total_size; *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } void SubmitErrorContext(ContextRecord *record, Result result) { @@ -238,7 +238,7 @@ namespace ams::erpt::srv { }); R_UNLESS(found_error_code, erpt::ResultRequiredFieldMissing()); - return ResultSuccess(); + R_SUCCEED(); } Result SubmitReportDefaults(const ContextEntry *ctx) { @@ -270,7 +270,7 @@ namespace ams::erpt::srv { R_TRY(Context::SubmitContextRecord(std::move(record))); - return ResultSuccess(); + R_SUCCEED(); } void SaveSyslogReportIfRequired(const ContextEntry *ctx, const ReportId &report_id) { @@ -342,7 +342,7 @@ namespace ams::erpt::srv { for (u32 i = 0; i < num_attachments; i++) { R_TRY(JournalForAttachments::SetOwner(attachments[i], report_id)); } - return ResultSuccess(); + R_SUCCEED(); } Result CreateReportFile(const ReportId &report_id, ReportType type, const ReportMetaData *meta, u32 num_attachments, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network, bool redirect_new_reports) { @@ -393,24 +393,24 @@ namespace ams::erpt::srv { R_TRY(Journal::Commit()); report_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } Result Reporter::RegisterRunningApplet(ncm::ProgramId program_id) { g_applet_active_time_info_list.Register(program_id); - return ResultSuccess(); + R_SUCCEED(); } Result Reporter::UnregisterRunningApplet(ncm::ProgramId program_id) { g_applet_active_time_info_list.Unregister(program_id); - return ResultSuccess(); + R_SUCCEED(); } Result Reporter::UpdateAppletSuspendedDuration(ncm::ProgramId program_id, TimeSpan duration) { g_applet_active_time_info_list.UpdateSuspendedDuration(program_id, duration); - return ResultSuccess(); + R_SUCCEED(); } Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) { @@ -465,7 +465,7 @@ namespace ams::erpt::srv { /* Create the report file. */ R_TRY(CreateReportFile(report_id, type, meta, num_attachments, timestamp_user, timestamp_network, s_redirect_new_reports)); - return ResultSuccess(); + R_SUCCEED(); } Result Reporter::SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr record, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network) { @@ -530,7 +530,7 @@ namespace ams::erpt::srv { SubmitResourceLimitContexts(); #endif - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.hpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.hpp index 0228ffbb0..ca6fd256e 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.hpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_reporter.hpp @@ -47,7 +47,7 @@ namespace ams::erpt::srv { std::memcpy(s_serial_number, sn, sn_len); std::memcpy(s_os_version, os, os_len); std::memcpy(s_private_os_version, os_priv, os_priv_len); - return ResultSuccess(); + R_SUCCEED(); } static Result RegisterRunningApplet(ncm::ProgramId program_id); diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_service.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_service.cpp index df52d8e3c..e87334702 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_service.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_service.cpp @@ -71,7 +71,7 @@ namespace ams::erpt::srv { case PortIndex_Context: return AcceptImpl(server, m_context_session_object.GetShared()); default: - return erpt::ResultNotSupported(); + R_THROW(erpt::ResultNotSupported()); } } public: @@ -86,7 +86,7 @@ namespace ams::erpt::srv { os::StartThread(std::addressof(m_thread)); - return ResultSuccess(); + R_SUCCEED(); } void Wait() { diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_session_impl.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_session_impl.cpp index 7a88d0380..06c655a95 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_session_impl.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_session_impl.cpp @@ -33,7 +33,7 @@ namespace ams::erpt::srv { /* Return it. */ out.SetValue(intf); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_stream.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_stream.cpp index 1ac43a0d8..d329b4557 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_stream.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_stream.cpp @@ -37,7 +37,7 @@ namespace ams::erpt::srv { std::scoped_lock lk(s_fs_commit_mutex); fs::CommitSaveData(ReportStoragePath); - return ResultSuccess(); + R_SUCCEED(); } Result Stream::GetStreamSize(s64 *out, const char *path) { @@ -109,7 +109,7 @@ namespace ams::erpt::srv { file_guard.Cancel(); lock_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result Stream::ReadStream(u32 *out, u8 *dst, u32 dst_size) { @@ -153,7 +153,7 @@ namespace ams::erpt::srv { read_count = static_cast(fs_read_size); } - return ResultSuccess(); + R_SUCCEED(); } Result Stream::WriteStream(const u8 *src, u32 src_size) { @@ -180,7 +180,7 @@ namespace ams::erpt::srv { m_file_position += src_size; } - return ResultSuccess(); + R_SUCCEED(); } void Stream::CloseStream() { @@ -217,7 +217,7 @@ namespace ams::erpt::srv { m_file_position += m_buffer_count; m_buffer_count = 0; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/common/fs_dbm_hierarchical_rom_file_table.cpp b/libraries/libstratosphere/source/fs/common/fs_dbm_hierarchical_rom_file_table.cpp index d0df24ccd..3e3767563 100644 --- a/libraries/libstratosphere/source/fs/common/fs_dbm_hierarchical_rom_file_table.cpp +++ b/libraries/libstratosphere/source/fs/common/fs_dbm_hierarchical_rom_file_table.cpp @@ -42,7 +42,7 @@ namespace ams::fs { R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size))); R_TRY(FileEntryMapTable::Format(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size))); - return ResultSuccess(); + R_SUCCEED(); } HierarchicalRomFileTable::HierarchicalRomFileTable() { /* ... */ } @@ -56,7 +56,7 @@ namespace ams::fs { R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size))); R_TRY(m_file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry)); - return ResultSuccess(); + R_SUCCEED(); } void HierarchicalRomFileTable::Finalize() { @@ -123,7 +123,7 @@ namespace ams::fs { } } - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::CreateFile(RomFileId *out, const RomPathChar *path, const FileInfo &info) { @@ -170,7 +170,7 @@ namespace ams::fs { } } - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::ConvertPathToDirectoryId(RomDirectoryId *out, const RomPathChar *path) { @@ -186,7 +186,7 @@ namespace ams::fs { R_TRY(this->GetDirectoryEntry(std::addressof(pos), std::addressof(entry), key)); *out = PositionToDirectoryId(pos); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::ConvertPathToFileId(RomFileId *out, const RomPathChar *path) { @@ -202,7 +202,7 @@ namespace ams::fs { R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key)); *out = PositionToFileId(pos); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::GetDirectoryInformation(DirectoryInfo *out, const RomPathChar *path) { @@ -224,7 +224,7 @@ namespace ams::fs { AMS_UNUSED(out); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const RomPathChar *path) { @@ -245,7 +245,7 @@ namespace ams::fs { R_TRY(this->GetFileEntry(std::addressof(entry), id)); *out = entry.info; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const RomPathChar *path) { @@ -271,7 +271,7 @@ namespace ams::fs { out->next_dir = entry.dir; out->next_file = entry.file; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindNextDirectory(RomPathChar *out, FindPosition *find, size_t length) { @@ -291,7 +291,7 @@ namespace ams::fs { out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator; find->next_dir = entry.next; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindNextFile(RomPathChar *out, FindPosition *find, size_t length) { @@ -311,7 +311,7 @@ namespace ams::fs { out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator; find->next_file = entry.next; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::QueryRomFileSystemSize(s64 *out_dir_entry_size, s64 *out_file_entry_size) { @@ -320,7 +320,7 @@ namespace ams::fs { *out_dir_entry_size = m_dir_table.GetTotalEntrySize(); *out_file_entry_size = m_file_table.GetTotalEntrySize(); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::GetGrandParent(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, Position pos, RomPathTool::RomEntryName name, const RomPathChar *path) { @@ -338,7 +338,7 @@ namespace ams::fs { R_TRY(this->GetDirectoryEntry(out_pos, out_dir_entry, *out_dir_key)); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindParentDirectoryRecursive(Position *out_pos, EntryKey *out_dir_key, RomDirectoryEntry *out_dir_entry, RomPathTool::PathParser *parser, const RomPathChar *path) { @@ -382,7 +382,7 @@ namespace ams::fs { *out_pos = parent_pos; *out_dir_key = dir_key; *out_dir_entry = dir_entry; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindPathRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, bool is_dir, const RomPathChar *path) { @@ -434,7 +434,7 @@ namespace ams::fs { R_TRY(parser.GetAsFileName(std::addressof(out_key->name))); } - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindDirectoryRecursive(EntryKey *out_key, RomDirectoryEntry *out_dir_entry, const RomPathChar *path) { @@ -475,7 +475,7 @@ namespace ams::fs { return if_exists; } } - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::GetDirectoryEntry(Position *out_pos, RomDirectoryEntry *out_entry, const EntryKey &key) { @@ -551,7 +551,7 @@ namespace ams::fs { AMS_UNUSED(out); - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::OpenFile(FileInfo *out, const EntryKey &key) { @@ -562,7 +562,7 @@ namespace ams::fs { R_TRY(this->GetFileEntry(std::addressof(pos), std::addressof(entry), key)); *out = entry.info; - return ResultSuccess(); + R_SUCCEED(); } Result HierarchicalRomFileTable::FindOpen(FindPosition *out, const EntryKey &key) { @@ -578,7 +578,7 @@ namespace ams::fs { out->next_dir = entry.dir; out->next_file = entry.file; - return ResultSuccess(); + R_SUCCEED(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/fs/common/fs_dbm_rom_path_tool.cpp b/libraries/libstratosphere/source/fs/common/fs_dbm_rom_path_tool.cpp index d665d4afe..8f4a45d0f 100644 --- a/libraries/libstratosphere/source/fs/common/fs_dbm_rom_path_tool.cpp +++ b/libraries/libstratosphere/source/fs/common/fs_dbm_rom_path_tool.cpp @@ -32,7 +32,7 @@ namespace ams::fs::RomPathTool { /* ... */ } - return ResultSuccess(); + R_SUCCEED(); } void PathParser::Finalize() { @@ -97,7 +97,7 @@ namespace ams::fs::RomPathTool { } } - return ResultSuccess(); + R_SUCCEED(); } Result PathParser::GetAsDirectoryName(RomEntryName *out) const { @@ -111,7 +111,7 @@ namespace ams::fs::RomPathTool { out->length = len; out->path = m_prev_path_start; - return ResultSuccess(); + R_SUCCEED(); } Result PathParser::GetAsFileName(RomEntryName *out) const { @@ -125,7 +125,7 @@ namespace ams::fs::RomPathTool { out->length = len; out->path = m_prev_path_start; - return ResultSuccess(); + R_SUCCEED(); } Result GetParentDirectoryName(RomEntryName *out, const RomEntryName &cur, const RomPathChar *p) { @@ -186,7 +186,7 @@ namespace ams::fs::RomPathTool { out->length = end - start + 1; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/common/fs_file_storage.cpp b/libraries/libstratosphere/source/fs/common/fs_file_storage.cpp index 904969d17..c96531416 100644 --- a/libraries/libstratosphere/source/fs/common/fs_file_storage.cpp +++ b/libraries/libstratosphere/source/fs/common/fs_file_storage.cpp @@ -62,7 +62,7 @@ namespace ams::fs { Result FileStorage::GetSize(s64 *out_size) { R_TRY(this->UpdateSize()); *out_size = m_size; - return ResultSuccess(); + R_SUCCEED(); } Result FileStorage::SetSize(s64 size) { @@ -100,7 +100,7 @@ namespace ams::fs { this->SetFile(std::move(base_file)); m_base_file_system = std::move(base_file_system); - return ResultSuccess(); + R_SUCCEED(); } Result FileHandleStorage::UpdateSize() { @@ -153,7 +153,7 @@ namespace ams::fs { Result FileHandleStorage::GetSize(s64 *out_size) { R_TRY(this->UpdateSize()); *out_size = m_size; - return ResultSuccess(); + R_SUCCEED(); } Result FileHandleStorage::SetSize(s64 size) { @@ -172,7 +172,7 @@ namespace ams::fs { return QueryRange(static_cast(dst), m_handle, offset, size); default: - return fs::ResultUnsupportedOperateRangeForFileHandleStorage(); + R_THROW(fs::ResultUnsupportedOperateRangeForFileHandleStorage()); } } diff --git a/libraries/libstratosphere/source/fs/fs_bis.cpp b/libraries/libstratosphere/source/fs/fs_bis.cpp index 25e210867..bea6b875a 100644 --- a/libraries/libstratosphere/source/fs/fs_bis.cpp +++ b/libraries/libstratosphere/source/fs/fs_bis.cpp @@ -40,7 +40,7 @@ namespace ams::fs { AMS_ASSERT(static_cast(size) == needed_size - 1); AMS_UNUSED(size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/fs/fs_content_storage.cpp b/libraries/libstratosphere/source/fs/fs_content_storage.cpp index be89a7041..d9722fab6 100644 --- a/libraries/libstratosphere/source/fs/fs_content_storage.cpp +++ b/libraries/libstratosphere/source/fs/fs_content_storage.cpp @@ -38,7 +38,7 @@ namespace ams::fs { AMS_ASSERT(static_cast(size) == needed_size - 1); AMS_UNUSED(size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/fs/fs_data.cpp b/libraries/libstratosphere/source/fs/fs_data.cpp index 17f7be663..44382e3dc 100644 --- a/libraries/libstratosphere/source/fs/fs_data.cpp +++ b/libraries/libstratosphere/source/fs/fs_data.cpp @@ -39,7 +39,7 @@ namespace ams::fs::impl { R_UNLESS(storage != nullptr, fs::ResultAllocationMemoryFailedInDataA()); *out = std::move(storage); - return ResultSuccess(); + R_SUCCEED(); } Result MountDataImpl(const char *name, ncm::DataId data_id, ncm::StorageId storage_id, void *cache_buffer, size_t cache_size, bool use_cache, bool use_data_cache, bool use_path_cache) { @@ -66,7 +66,7 @@ namespace ams::fs::impl { constexpr size_t MinimumCacheSize = 32; *out = std::max(size, MinimumCacheSize); - return ResultSuccess(); + R_SUCCEED(); } Result MountData(const char *name, ncm::DataId data_id, ncm::StorageId storage_id) { diff --git a/libraries/libstratosphere/source/fs/fs_game_card.cpp b/libraries/libstratosphere/source/fs/fs_game_card.cpp index ab55e3020..023185c62 100644 --- a/libraries/libstratosphere/source/fs/fs_game_card.cpp +++ b/libraries/libstratosphere/source/fs/fs_game_card.cpp @@ -48,7 +48,7 @@ namespace ams::fs { AMS_ASSERT(static_cast(size) == needed_size - 1); AMS_UNUSED(size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/fs/fs_memory_management.cpp b/libraries/libstratosphere/source/fs/fs_memory_management.cpp index d73b91850..05140b5c6 100644 --- a/libraries/libstratosphere/source/fs/fs_memory_management.cpp +++ b/libraries/libstratosphere/source/fs/fs_memory_management.cpp @@ -48,7 +48,7 @@ namespace ams::fs { /* Set allocators. */ g_allocate_func = allocator; g_deallocate_func = deallocator; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/fs_priority.cpp b/libraries/libstratosphere/source/fs/fs_priority.cpp index 9fe88a96f..c53ffab82 100644 --- a/libraries/libstratosphere/source/fs/fs_priority.cpp +++ b/libraries/libstratosphere/source/fs/fs_priority.cpp @@ -64,7 +64,7 @@ namespace ams::fs { /* Set output. */ *out = priority_raw; - return ResultSuccess(); + R_SUCCEED(); } Result GetPriorityImpl(fs::Priority *out, os::ThreadType *thread) { @@ -77,7 +77,7 @@ namespace ams::fs { /* Set output. */ *out = ConvertPriorityRawToPriority(priority_raw); - return ResultSuccess(); + R_SUCCEED(); } Result SetPriorityRawImpl(os::ThreadType *thread, fs::PriorityRaw priority_raw) { @@ -91,7 +91,7 @@ namespace ams::fs { /* Update the priority. */ UpdateTlsIoPriority(thread, tls_io); - return ResultSuccess(); + R_SUCCEED(); } Result SetPriorityImpl(os::ThreadType *thread, fs::Priority priority) { @@ -105,7 +105,7 @@ namespace ams::fs { /* Update the priority. */ UpdateTlsIoPriority(thread, tls_io); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp b/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp index 417fdb119..85e7c6bba 100644 --- a/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp +++ b/libraries/libstratosphere/source/fs/fs_romfs_filesystem.cpp @@ -43,7 +43,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultNcaCorrupted(); + R_THROW(fs::ResultNcaCorrupted()); } Result ConvertIntegrityVerificationStorageCorruptedResult(Result res) { @@ -60,7 +60,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultIntegrityVerificationStorageCorrupted(); + R_THROW(fs::ResultIntegrityVerificationStorageCorrupted()); } Result ConvertBuiltInStorageCorruptedResult(Result res) { @@ -72,7 +72,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultBuiltInStorageCorrupted(); + R_THROW(fs::ResultBuiltInStorageCorrupted()); } Result ConvertPartitionFileSystemCorruptedResult(Result res) { @@ -89,7 +89,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultPartitionFileSystemCorrupted(); + R_THROW(fs::ResultPartitionFileSystemCorrupted()); } Result ConvertFatFileSystemCorruptedResult(Result res) { @@ -110,7 +110,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultHostFileSystemCorrupted(); + R_THROW(fs::ResultHostFileSystemCorrupted()); } Result ConvertDatabaseCorruptedResult(Result res) { @@ -123,7 +123,7 @@ namespace ams::fs { } R_END_TRY_CATCH; AMS_ASSERT(false); - return fs::ResultDatabaseCorrupted(); + R_THROW(fs::ResultDatabaseCorrupted()); } Result ConvertRomFsResult(Result res) { @@ -141,7 +141,7 @@ namespace ams::fs { R_CONVERT(fs::ResultIncompatiblePath, fs::ResultPathNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(IStorage *storage, s64 offset, void *buffer, size_t size) { @@ -181,7 +181,7 @@ namespace ams::fs { AMS_ASSERT(buf != nullptr || size == 0); AMS_UNUSED(buf); - return ResultSuccess(); + R_SUCCEED(); } Result ConvertResult(Result res) const { @@ -207,26 +207,26 @@ namespace ams::fs { R_TRY(this->ConvertResult(this->GetStorage()->Read(offset + m_start, buffer, size))); *out = read_size; - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoGetSize(s64 *out) override { *out = this->GetSize(); - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoFlush() override { - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) override { AMS_UNUSED(offset, buffer, size, option); - return fs::ResultUnsupportedWriteForRomFsFile(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFile()); } virtual Result DoSetSize(s64 size) override { AMS_UNUSED(size); - return fs::ResultUnsupportedWriteForRomFsFile(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFile()); } virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override { @@ -245,7 +245,7 @@ namespace ams::fs { return this->GetStorage()->OperateRange(dst, dst_size, op_id, m_start + offset, operate_size, src, src_size); } default: - return fs::ResultUnsupportedOperateRangeForRomFsFile(); + R_THROW(fs::ResultUnsupportedOperateRangeForRomFsFile()); } } public: @@ -330,7 +330,7 @@ namespace ams::fs { } *out_count = i; - return ResultSuccess(); + R_SUCCEED(); } public: virtual sf::cmif::DomainObjectId GetDomainObjectId() const override { @@ -354,7 +354,7 @@ namespace ams::fs { R_TRY(ReadFileHeader(storage, std::addressof(header))); *out = CalculateRequiredWorkingMemorySize(header); - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::Initialize(IStorage *base, void *work, size_t work_size, bool use_cache) { @@ -411,7 +411,7 @@ namespace ams::fs { /* Set members. */ m_entry_size = header.body_offset; m_base_storage = base; - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::Initialize(std::unique_ptr&& base, void *work, size_t work_size, bool use_cache) { @@ -424,7 +424,7 @@ namespace ams::fs { R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound()); R_CONVERT(fs::ResultDbmInvalidOperation, fs::ResultPathNotFound()); } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } IStorage *RomFsFileSystem::GetBaseStorage() { @@ -442,42 +442,42 @@ namespace ams::fs { RomFileTable::FileInfo info; R_TRY(this->GetFileInfo(std::addressof(info), path)); *out = m_entry_size + info.offset.Get(); - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoCreateFile(const fs::Path &path, s64 size, int flags) { AMS_UNUSED(path, size, flags); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoDeleteFile(const fs::Path &path) { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoCreateDirectory(const fs::Path &path) { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoDeleteDirectory(const fs::Path &path) { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoDeleteDirectoryRecursively(const fs::Path &path) { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) { AMS_UNUSED(old_path, new_path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) { AMS_UNUSED(old_path, new_path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) { @@ -488,12 +488,12 @@ namespace ams::fs { RomFileTable::FileInfo file_info; R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString())); *out = fs::DirectoryEntryType_File; - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; *out = fs::DirectoryEntryType_Directory; - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoOpenFile(std::unique_ptr *out_file, const fs::Path &path, fs::OpenMode mode) { @@ -508,7 +508,7 @@ namespace ams::fs { R_UNLESS(file != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemB()); *out_file = std::move(file); - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoOpenDirectory(std::unique_ptr *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) { @@ -524,36 +524,36 @@ namespace ams::fs { R_UNLESS(dir != nullptr, fs::ResultAllocationMemoryFailedInRomFsFileSystemC()); *out_dir = std::move(dir); - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoCommit() { - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoGetFreeSpaceSize(s64 *out, const fs::Path &path) { AMS_UNUSED(path); *out = 0; - return ResultSuccess(); + R_SUCCEED(); } Result RomFsFileSystem::DoGetTotalSpaceSize(s64 *out, const fs::Path &path) { AMS_UNUSED(out, path); - return fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedGetTotalSpaceSizeForRomFsFileSystem()); } Result RomFsFileSystem::DoCleanDirectoryRecursively(const fs::Path &path) { AMS_UNUSED(path); - return fs::ResultUnsupportedWriteForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedWriteForRomFsFileSystem()); } Result RomFsFileSystem::DoCommitProvisionally(s64 counter) { AMS_UNUSED(counter); - return fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem(); + R_THROW(fs::ResultUnsupportedCommitProvisionallyForRomFsFileSystem()); } Result RomFsFileSystem::DoRollback() { - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/fs_save_data_management.cpp b/libraries/libstratosphere/source/fs/fs_save_data_management.cpp index 51ff1d14d..ce8f7f79f 100644 --- a/libraries/libstratosphere/source/fs/fs_save_data_management.cpp +++ b/libraries/libstratosphere/source/fs/fs_save_data_management.cpp @@ -124,7 +124,7 @@ namespace ams::fs { R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id)); *out = extra_data.flags; - return ResultSuccess(); + R_SUCCEED(); } Result GetSaveDataFlags(u32 *out, SaveDataSpaceId space_id, SaveDataId id) { @@ -132,7 +132,7 @@ namespace ams::fs { R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), space_id, id)); *out = extra_data.flags; - return ResultSuccess(); + R_SUCCEED(); } Result SetSaveDataFlags(SaveDataId id, SaveDataSpaceId space_id, u32 flags) { @@ -147,7 +147,7 @@ namespace ams::fs { R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id)); *out = extra_data.available_size; - return ResultSuccess(); + R_SUCCEED(); } Result GetSaveDataJournalSize(s64 *out, SaveDataId id) { @@ -155,7 +155,7 @@ namespace ams::fs { R_TRY(impl::ReadSaveDataFileSystemExtraData(std::addressof(extra_data), id)); *out = extra_data.journal_size; - return ResultSuccess(); + R_SUCCEED(); } Result ExtendSaveData(SaveDataSpaceId space_id, SaveDataId id, s64 available_size, s64 journal_size) { diff --git a/libraries/libstratosphere/source/fs/fs_sd_card.cpp b/libraries/libstratosphere/source/fs/fs_sd_card.cpp index 17051630a..a4dd456cb 100644 --- a/libraries/libstratosphere/source/fs/fs_sd_card.cpp +++ b/libraries/libstratosphere/source/fs/fs_sd_card.cpp @@ -41,7 +41,7 @@ namespace ams::fs { AMS_ASSERT(static_cast(size) == needed_size - 1); AMS_UNUSED(size); - return ResultSuccess(); + R_SUCCEED(); } }; @@ -107,7 +107,7 @@ namespace ams::fs { AMS_FS_R_UNLESS(adapter != nullptr, fs::ResultAllocationMemoryFailedInSdCardB()); *out = std::move(adapter); - return ResultSuccess(); + R_SUCCEED(); } bool IsSdCardInserted() { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_file_accessor.cpp b/libraries/libstratosphere/source/fs/fsa/fs_file_accessor.cpp index 6647d2d57..a5148796d 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_file_accessor.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_file_accessor.cpp @@ -82,7 +82,7 @@ namespace ams::fs::impl { setter.Set(option.HasFlushFlag() ? WriteState::None : WriteState::NeedsFlush); - return ResultSuccess(); + R_SUCCEED(); } Result FileAccessor::Flush() { @@ -93,7 +93,7 @@ namespace ams::fs::impl { R_TRY(this->UpdateLastResult(m_impl->Flush())); setter.Set(WriteState::None); - return ResultSuccess(); + R_SUCCEED(); } Result FileAccessor::SetSize(s64 size) { @@ -110,7 +110,7 @@ namespace ams::fs::impl { } setter.Set(old_write_state); - return ResultSuccess(); + R_SUCCEED(); } Result FileAccessor::GetSize(s64 *out) { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_mount_table.cpp b/libraries/libstratosphere/source/fs/fsa/fs_mount_table.cpp index 1325192fc..83f138764 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_mount_table.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_mount_table.cpp @@ -41,7 +41,7 @@ namespace ams::fs::impl { R_UNLESS(this->CanAcceptMountName(fs->GetName()), fs::ResultMountNameAlreadyExists()); m_fs_list.push_back(*fs.release()); - return ResultSuccess(); + R_SUCCEED(); } Result MountTable::Find(FileSystemAccessor **out, const char *name) { @@ -50,11 +50,11 @@ namespace ams::fs::impl { for (auto &fs : m_fs_list) { if (MatchesName(fs, name)) { *out = std::addressof(fs); - return ResultSuccess(); + R_SUCCEED(); } } - return fs::ResultNotMounted(); + R_THROW(fs::ResultNotMounted()); } void MountTable::Unmount(const char *name) { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_mount_utils.cpp b/libraries/libstratosphere/source/fs/fsa/fs_mount_utils.cpp index 6937ac7f0..747f2d49a 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_mount_utils.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_mount_utils.cpp @@ -106,13 +106,13 @@ namespace ams::fs::impl { Result CheckMountName(const char *name) { R_TRY(CheckMountNameAllowingReserved(name)); R_UNLESS(!impl::IsReservedMountName(name), fs::ResultInvalidMountName()); - return ResultSuccess(); + R_SUCCEED(); } Result CheckMountNameAllowingReserved(const char *name) { R_UNLESS(name != nullptr, fs::ResultInvalidMountName()); R_UNLESS(impl::IsValidMountName(name), fs::ResultInvalidMountName()); - return ResultSuccess(); + R_SUCCEED(); } Result FindFileSystem(FileSystemAccessor **out_accessor, const char **out_sub_path, const char *path) { @@ -137,7 +137,7 @@ namespace ams::fs::impl { } impl::Unregister(name); - return ResultSuccess(); + R_SUCCEED(); } } @@ -162,7 +162,7 @@ namespace ams::fs { const auto common_path_len = util::SNPrintf(dst + mount_name_len, dst_size - mount_name_len, "%s", sub_path); AMS_FS_R_UNLESS(static_cast(common_path_len) < dst_size - mount_name_len, fs::ResultTooLongPath()); - return ResultSuccess(); + R_SUCCEED(); } void Unmount(const char *mount_name) { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_user_directory.cpp b/libraries/libstratosphere/source/fs/fsa/fs_user_directory.cpp index 6b1ec2c11..f5e8cbc46 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_user_directory.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_user_directory.cpp @@ -29,12 +29,12 @@ namespace ams::fs { Result ReadDirectory(s64 *out_count, DirectoryEntry *out_entries, DirectoryHandle handle, s64 max_entries) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Read(out_count, out_entries, max_entries), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_DIRECTORY(out_count, max_entries))); - return ResultSuccess(); + R_SUCCEED(); } Result GetDirectoryEntryCount(s64 *out, DirectoryHandle handle) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetEntryCount(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_DIRECTORY_ENTRY_COUNT(out))); - return ResultSuccess(); + R_SUCCEED(); } void CloseDirectory(DirectoryHandle handle) { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_user_file.cpp b/libraries/libstratosphere/source/fs/fsa/fs_user_file.cpp index 79746bd74..6b6ec66d5 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_user_file.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_user_file.cpp @@ -27,7 +27,7 @@ namespace ams::fs { Result ReadFileImpl(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) { R_TRY(Get(handle)->Read(out, offset, buffer, size, option)); - return ResultSuccess(); + R_SUCCEED(); } } @@ -36,44 +36,44 @@ namespace ams::fs { size_t read_size; AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, option)); AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange()); - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(FileHandle handle, s64 offset, void *buffer, size_t size) { size_t read_size; AMS_FS_R_TRY(ReadFileImpl(std::addressof(read_size), handle, offset, buffer, size, ReadOption())); AMS_FS_R_UNLESS(read_size == size, fs::ResultOutOfRange()); - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) { AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, option)); - return ResultSuccess(); + R_SUCCEED(); } Result ReadFile(size_t *out, FileHandle handle, s64 offset, void *buffer, size_t size) { AMS_FS_R_TRY(ReadFileImpl(out, handle, offset, buffer, size, ReadOption())); - return ResultSuccess(); + R_SUCCEED(); } Result GetFileSize(s64 *out, FileHandle handle) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->GetSize(out), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_FILE_SIZE(out))); - return ResultSuccess(); + R_SUCCEED(); } Result FlushFile(FileHandle handle) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Flush(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE)); - return ResultSuccess(); + R_SUCCEED(); } Result WriteFile(FileHandle handle, s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->Write(offset, buffer, size, option), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_WRITE_FILE(option), offset, size)); - return ResultSuccess(); + R_SUCCEED(); } Result SetFileSize(FileHandle handle, s64 size) { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG(Get(handle)->SetSize(size), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_SIZE, size)); - return ResultSuccess(); + R_SUCCEED(); } int GetFileOpenMode(FileHandle handle) { @@ -88,7 +88,7 @@ namespace ams::fs { Result QueryRange(QueryRangeInfo *out, FileHandle handle, s64 offset, s64 size) { AMS_FS_R_TRY(Get(handle)->OperateRange(out, sizeof(*out), OperationId::QueryRange, offset, size, nullptr, 0)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp index cec042a60..34b72ac46 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem.cpp @@ -32,7 +32,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateFile(sub_path, size, option), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_SIZE, path, size)); - return ResultSuccess(); + R_SUCCEED(); } Result DeleteFile(const char *path) { @@ -41,7 +41,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteFile(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); - return ResultSuccess(); + R_SUCCEED(); } Result CreateDirectory(const char *path) { @@ -50,7 +50,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CreateDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); - return ResultSuccess(); + R_SUCCEED(); } Result DeleteDirectory(const char *path) { @@ -59,7 +59,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectory(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); - return ResultSuccess(); + R_SUCCEED(); } Result DeleteDirectoryRecursively(const char *path) { @@ -68,7 +68,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->DeleteDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); - return ResultSuccess(); + R_SUCCEED(); } Result RenameFile(const char *old_path, const char *new_path) { @@ -82,11 +82,11 @@ namespace ams::fs { auto rename_impl = [=]() -> Result { R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem()); R_TRY(old_accessor->RenameFile(old_sub_path, new_sub_path)); - return ResultSuccess(); + R_SUCCEED(); }; AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path)); - return ResultSuccess(); + R_SUCCEED(); } Result RenameDirectory(const char *old_path, const char *new_path) { @@ -100,11 +100,11 @@ namespace ams::fs { auto rename_impl = [=]() -> Result { R_UNLESS(old_accessor == new_accessor, fs::ResultRenameToOtherFileSystem()); R_TRY(old_accessor->RenameDirectory(old_sub_path, new_sub_path)); - return ResultSuccess(); + R_SUCCEED(); }; AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(rename_impl(), nullptr, old_accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_RENAME, old_path, new_path)); - return ResultSuccess(); + R_SUCCEED(); } Result GetEntryType(DirectoryEntryType *out, const char *path) { @@ -113,7 +113,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->GetEntryType(out, sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_GET_ENTRY_TYPE(out, path))); - return ResultSuccess(); + R_SUCCEED(); } Result OpenFile(FileHandle *out_file, const char *path, int mode) { @@ -126,13 +126,13 @@ namespace ams::fs { auto open_impl = [&]() -> Result { R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument()); R_TRY(accessor->OpenFile(std::addressof(file_accessor), sub_path, static_cast(mode))); - return ResultSuccess(); + R_SUCCEED(); }; AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast(mode))); out_file->handle = file_accessor.release(); - return ResultSuccess(); + R_SUCCEED(); } Result OpenDirectory(DirectoryHandle *out_dir, const char *path, int mode) { @@ -145,13 +145,13 @@ namespace ams::fs { auto open_impl = [&]() -> Result { R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument()); R_TRY(accessor->OpenDirectory(std::addressof(dir_accessor), sub_path, static_cast(mode))); - return ResultSuccess(); + R_SUCCEED(); }; AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(open_impl(), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH_AND_OPEN_MODE, path, static_cast(mode))); out_dir->handle = dir_accessor.release(); - return ResultSuccess(); + R_SUCCEED(); } Result CleanDirectoryRecursively(const char *path) { @@ -160,7 +160,7 @@ namespace ams::fs { AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::FindFileSystem(std::addressof(accessor), std::addressof(sub_path), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM(accessor->CleanDirectoryRecursively(sub_path), nullptr, accessor, AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path)); - return ResultSuccess(); + R_SUCCEED(); } Result GetFreeSpaceSize(s64 *out, const char *path) { diff --git a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem_for_debug.cpp b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem_for_debug.cpp index 81640e2a8..7c52c83d1 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem_for_debug.cpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_user_filesystem_for_debug.cpp @@ -31,7 +31,7 @@ namespace ams::fs { R_TRY(accessor->GetFileTimeStampRaw(out, sub_path)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fs/impl/fs_event_notifier_service_object_adapter.hpp b/libraries/libstratosphere/source/fs/impl/fs_event_notifier_service_object_adapter.hpp index 364a4586a..8ed9d9a1c 100644 --- a/libraries/libstratosphere/source/fs/impl/fs_event_notifier_service_object_adapter.hpp +++ b/libraries/libstratosphere/source/fs/impl/fs_event_notifier_service_object_adapter.hpp @@ -34,7 +34,7 @@ namespace ams::fs::impl { os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), clear_mode); handle.Detach(); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp index 1c19c6986..25855b5ba 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_partition_file_system_creator.cpp @@ -27,7 +27,7 @@ namespace ams::fssrv::fscreator { /* Set the output. */ *out = std::move(fs); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp index 59ed7a60c..1abe1dff4 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_rom_file_system_creator.cpp @@ -64,7 +64,7 @@ namespace ams::fssrv::fscreator { /* Set the output. */ *out = std::move(fs); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp index f2b2cd3bc..f6fcd730b 100644 --- a/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp +++ b/libraries/libstratosphere/source/fssrv/fscreator/fssrv_storage_on_nca_creator.cpp @@ -29,7 +29,7 @@ namespace ams::fssrv::fscreator { /* Set the out storage. */ *out = std::move(storage); *out_splitter = std::move(splitter); - return ResultSuccess(); + R_SUCCEED(); } Result StorageOnNcaCreator::CreateWithPatch(std::shared_ptr *out, std::shared_ptr *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, std::shared_ptr original_nca_reader, std::shared_ptr current_nca_reader, s32 index) { @@ -44,7 +44,7 @@ namespace ams::fssrv::fscreator { /* Set the out storage. */ *out = std::move(storage); *out_splitter = std::move(splitter); - return ResultSuccess(); + R_SUCCEED(); } Result StorageOnNcaCreator::CreateNcaReader(std::shared_ptr *out, std::shared_ptr storage) { @@ -57,7 +57,7 @@ namespace ams::fssrv::fscreator { /* Set the output. */ *out = std::move(reader); - return ResultSuccess(); + R_SUCCEED(); } #if !defined(ATMOSPHERE_BOARD_NINTENDO_NX) @@ -73,7 +73,7 @@ namespace ams::fssrv::fscreator { /* Set the out storage. */ *out = std::move(storage); *out_splitter = std::move(splitter); - return ResultSuccess(); + R_SUCCEED(); } Result StorageOnNcaCreator::CreateWithPatchWithContext(std::shared_ptr *out, std::shared_ptr *out_splitter, fssystem::NcaFsHeaderReader *out_header_reader, void *ctx, std::shared_ptr original_nca_reader, std::shared_ptr current_nca_reader, s32 index) { @@ -88,7 +88,7 @@ namespace ams::fssrv::fscreator { /* Set the out storage. */ *out = std::move(storage); *out_splitter = std::move(splitter); - return ResultSuccess(); + R_SUCCEED(); } Result StorageOnNcaCreator::CreateByRawStorage(std::shared_ptr *out, std::shared_ptr *out_splitter, const fssystem::NcaFsHeaderReader *header_reader, std::shared_ptr raw_storage, void *ctx, std::shared_ptr nca_reader) { diff --git a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_api.cpp b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_api.cpp index f7f3f1ab7..030d5760d 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_api.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_file_system_proxy_api.cpp @@ -66,7 +66,7 @@ namespace ams::fssrv { R_TRY(this->AcceptImpl(server, impl::GetInvalidProgramRegistryServiceObject())); } - return ResultSuccess(); + R_SUCCEED(); } break; case PortIndex_FileSystemProxyForLoader: @@ -81,7 +81,7 @@ namespace ams::fssrv { R_TRY(this->AcceptImpl(server, impl::GetInvalidFileSystemProxyForLoaderServiceObject())); } - return ResultSuccess(); + R_SUCCEED(); } break; AMS_UNREACHABLE_DEFAULT_CASE(); diff --git a/libraries/libstratosphere/source/fssrv/fssrv_program_registry_impl.cpp b/libraries/libstratosphere/source/fssrv/fssrv_program_registry_impl.cpp index aeb96cd00..32dea0cf2 100644 --- a/libraries/libstratosphere/source/fssrv/fssrv_program_registry_impl.cpp +++ b/libraries/libstratosphere/source/fssrv/fssrv_program_registry_impl.cpp @@ -71,7 +71,7 @@ namespace ams::fssrv { /* Set our process id. */ m_process_id = client_pid.GetValue().value; - return ResultSuccess(); + R_SUCCEED(); } Result ProgramRegistryImpl::SetEnabledProgramVerification(bool en) { diff --git a/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp b/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp index 29d0d0a55..6d268d2ac 100644 --- a/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp +++ b/libraries/libstratosphere/source/fssrv/impl/fssrv_program_registry_manager.cpp @@ -44,7 +44,7 @@ namespace ams::fssrv::impl { /* Add the node to the registry. */ m_program_info_list.push_back(*new_node.release()); - return ResultSuccess(); + R_SUCCEED(); } Result ProgramRegistryManager::UnregisterProgram(u64 process_id) { @@ -56,12 +56,12 @@ namespace ams::fssrv::impl { if (node.program_info->Contains(process_id)) { m_program_info_list.erase(m_program_info_list.iterator_to(node)); delete std::addressof(node); - return ResultSuccess(); + R_SUCCEED(); } } /* We couldn't find/unregister the process's node. */ - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); } Result ProgramRegistryManager::GetProgramInfo(std::shared_ptr *out, u64 process_id) { @@ -71,19 +71,19 @@ namespace ams::fssrv::impl { /* Check if we're getting permissions for an initial program. */ if (IsInitialProgram(process_id)) { *out = ProgramInfo::GetProgramInfoForInitialProcess(); - return ResultSuccess(); + R_SUCCEED(); } /* Find a matching node. */ for (const auto &node : m_program_info_list) { if (node.program_info->Contains(process_id)) { *out = node.program_info; - return ResultSuccess(); + R_SUCCEED(); } } /* We didn't find the program info. */ - return fs::ResultProgramInfoNotFound(); + R_THROW(fs::ResultProgramInfoNotFound()); } Result ProgramRegistryManager::GetProgramInfoByProgramId(std::shared_ptr *out, u64 program_id) { @@ -94,12 +94,12 @@ namespace ams::fssrv::impl { for (const auto &node : m_program_info_list) { if (node.program_info->GetProgramIdValue() == program_id) { *out = node.program_info; - return ResultSuccess(); + R_SUCCEED(); } } /* We didn't find the program info. */ - return fs::ResultProgramInfoNotFound(); + R_THROW(fs::ResultProgramInfoNotFound()); } } diff --git a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp index eef9ddbf4..047baba1f 100644 --- a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp +++ b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buddy_heap.cpp @@ -176,7 +176,7 @@ namespace ams::fssystem { } while (m_block_size <= remaining); } - return ResultSuccess(); + R_SUCCEED(); } void FileSystemBuddyHeap::Finalize() { diff --git a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp index 9796397c7..f4d222135 100644 --- a/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp +++ b/libraries/libstratosphere/source/fssystem/buffers/fssystem_file_system_buffer_manager.cpp @@ -40,7 +40,7 @@ namespace ams::fssystem { m_cache_count_min = max_cache_count / 16; m_cache_size_min = m_cache_count_min * 0x100; - return ResultSuccess(); + R_SUCCEED(); } void FileSystemBufferManager::CacheHandleTable::Finalize() { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp index bf8a63156..a31f0c5be 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp @@ -49,14 +49,14 @@ namespace ams::fssystem { std::unique_ptr decryptor = std::make_unique(func, key_index, key_generation); R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA()); *out = std::move(decryptor); - return ResultSuccess(); + R_SUCCEED(); } Result AesCtrCounterExtendedStorage::CreateSoftwareDecryptor(std::unique_ptr *out) { std::unique_ptr decryptor = std::make_unique(); R_UNLESS(decryptor != nullptr, fs::ResultAllocationMemoryFailedInAesCtrCounterExtendedStorageA()); *out = std::move(decryptor); - return ResultSuccess(); + R_SUCCEED(); } Result AesCtrCounterExtendedStorage::Initialize(IAllocator *allocator, const void *key, size_t key_size, u32 secure_value, fs::SubStorage data_storage, fs::SubStorage table_storage) { @@ -96,7 +96,7 @@ namespace ams::fssystem { m_counter_offset = counter_offset; m_decryptor = std::move(decryptor); - return ResultSuccess(); + R_SUCCEED(); } void AesCtrCounterExtendedStorage::Finalize() { @@ -189,7 +189,7 @@ namespace ams::fssystem { cur_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } Result AesCtrCounterExtendedStorage::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { @@ -205,7 +205,7 @@ namespace ams::fssystem { /* Operate on our data storage. */ R_TRY(m_data_storage.OperateRange(fs::OperationId::Invalidate, 0, std::numeric_limits::max())); - return ResultSuccess(); + R_SUCCEED(); } case fs::OperationId::QueryRange: { @@ -220,7 +220,7 @@ namespace ams::fssystem { /* Succeed if there's nothing to operate on. */ if (size == 0) { reinterpret_cast(dst)->Clear(); - return ResultSuccess(); + R_SUCCEED(); } /* Validate arguments. */ @@ -243,10 +243,10 @@ namespace ams::fssystem { /* Merge in the new info. */ reinterpret_cast(dst)->Merge(new_info); - return ResultSuccess(); + R_SUCCEED(); } default: - return fs::ResultUnsupportedOperateRangeForAesCtrCounterExtendedStorage(); + R_THROW(fs::ResultUnsupportedOperateRangeForAesCtrCounterExtendedStorage()); } } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp index b078c73c8..1d03def5f 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp @@ -70,7 +70,7 @@ namespace ams::fssystem { auto dec_size = crypto::DecryptAes128Ctr(buffer, size, m_key, KeySize, ctr, IvSize, buffer, size); R_UNLESS(size == dec_size, fs::ResultUnexpectedInAesCtrStorageA()); - return ResultSuccess(); + R_SUCCEED(); } template @@ -124,7 +124,7 @@ namespace ams::fssystem { } } - return ResultSuccess(); + R_SUCCEED(); } template @@ -135,7 +135,7 @@ namespace ams::fssystem { template Result AesCtrStorage::SetSize(s64 size) { AMS_UNUSED(size); - return fs::ResultUnsupportedSetSizeForAesCtrStorage(); + R_THROW(fs::ResultUnsupportedSetSizeForAesCtrStorage()); } template @@ -154,7 +154,7 @@ namespace ams::fssystem { reinterpret_cast(dst)->Clear(); } - return ResultSuccess(); + R_SUCCEED(); } /* Ensure alignment. */ @@ -183,7 +183,7 @@ namespace ams::fssystem { break; } - return ResultSuccess(); + R_SUCCEED(); } template class AesCtrStorage; diff --git a/libraries/libstratosphere/source/fssystem/fssystem_alignment_matching_storage_impl.cpp b/libraries/libstratosphere/source/fssystem/fssystem_alignment_matching_storage_impl.cpp index 95d1c9bba..61f72e0aa 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_alignment_matching_storage_impl.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_alignment_matching_storage_impl.cpp @@ -115,7 +115,7 @@ namespace ams::fssystem { tail_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } Result AlignmentMatchingStorageImpl::Write(fs::IStorage *base_storage, char *work_buf, size_t work_buf_size, size_t data_alignment, size_t buffer_alignment, s64 offset, const char *buffer, size_t size) { @@ -186,7 +186,7 @@ namespace ams::fssystem { tail_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } template<> @@ -216,7 +216,7 @@ namespace ams::fssystem { if (aligned_size <= pooled_buffer.GetSize()) { R_TRY(m_base_storage->Read(aligned_offset, pooled_buffer.GetBuffer(), aligned_size)); std::memcpy(buffer, pooled_buffer.GetBuffer() + (offset - aligned_offset), size); - return ResultSuccess(); + R_SUCCEED(); } else { pooled_buffer.Shrink(m_data_align); } @@ -255,7 +255,7 @@ namespace ams::fssystem { std::memcpy(tail_buffer, pooled_buffer.GetBuffer(), tail_size); } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_bucket_tree.cpp b/libraries/libstratosphere/source/fssystem/fssystem_bucket_tree.cpp index 89d30c78b..4280f0563 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_bucket_tree.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_bucket_tree.cpp @@ -107,7 +107,7 @@ namespace ams::fssystem { } m_index = static_cast(pos - m_start) - 1; - return ResultSuccess(); + R_SUCCEED(); } }; @@ -126,7 +126,7 @@ namespace ams::fssystem { R_UNLESS(this->magic == Magic, fs::ResultInvalidBucketTreeSignature()); R_UNLESS(this->entry_count >= 0, fs::ResultInvalidBucketTreeEntryCount()); R_UNLESS(this->version <= Version, fs::ResultUnsupportedVersion()); - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::NodeHeader::Verify(s32 node_index, size_t node_size, size_t entry_size) const { @@ -137,7 +137,7 @@ namespace ams::fssystem { R_UNLESS(this->count > 0 && static_cast(this->count) <= max_entry_count, fs::ResultInvalidBucketTreeNodeEntryCount()); R_UNLESS(this->offset >= 0, fs::ResultInvalidBucketTreeNodeOffset()); - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Initialize(IAllocator *allocator, fs::SubStorage node_storage, fs::SubStorage entry_storage, size_t node_size, size_t entry_size, s32 entry_count) { @@ -300,7 +300,7 @@ namespace ams::fssystem { m_offsets = offsets; } - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::MoveNext() { @@ -336,7 +336,7 @@ namespace ams::fssystem { /* Note that we changed index. */ m_entry_index = entry_index; - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::MovePrevious() { @@ -374,7 +374,7 @@ namespace ams::fssystem { /* Note that we changed index. */ m_entry_index = entry_index; - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::Find(s64 virtual_address) { @@ -421,7 +421,7 @@ namespace ams::fssystem { /* Set count. */ m_entry_set_count = m_tree->m_entry_set_count; - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::FindEntrySet(s32 *out_index, s64 virtual_address, s32 node_index) { @@ -457,7 +457,7 @@ namespace ams::fssystem { /* Return the index. */ *out_index = m_tree->GetEntrySetIndex(header.index, node.GetIndex()); - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::FindEntrySetWithoutBuffer(s32 *out_index, s64 virtual_address, s32 node_index) { @@ -478,7 +478,7 @@ namespace ams::fssystem { /* Return the index. */ *out_index = m_tree->GetEntrySetIndex(header.index, node.GetIndex()); - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::FindEntry(s64 virtual_address, s32 entry_set_index) { @@ -522,7 +522,7 @@ namespace ams::fssystem { m_entry_set = entry_set; m_entry_index = entry_index; - return ResultSuccess(); + R_SUCCEED(); } Result BucketTree::Visitor::FindEntryWithoutBuffer(s64 virtual_address, s32 entry_set_index) { @@ -551,7 +551,7 @@ namespace ams::fssystem { m_entry_set = entry_set; m_entry_index = entry_index; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp index 51e1c5512..b392a6bc9 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_buffered_storage.cpp @@ -238,7 +238,7 @@ namespace ams::fssystem { buffers::EnableBlockingBufferManagerAllocation(); } - return ResultSuccess(); + R_SUCCEED(); } const std::pair PrepareFetch() { @@ -295,7 +295,7 @@ namespace ams::fssystem { m_offset = fetch_param.offset; AMS_ASSERT(this->Hits(offset, 1)); - return ResultSuccess(); + R_SUCCEED(); } Result FetchFromBuffer(s64 offset, const void *buffer, size_t buffer_size) { @@ -321,7 +321,7 @@ namespace ams::fssystem { m_offset = fetch_param.offset; AMS_ASSERT(this->Hits(offset, 1)); - return ResultSuccess(); + R_SUCCEED(); } bool TryAcquireCache() { @@ -369,7 +369,7 @@ namespace ams::fssystem { }, AMS_CURRENT_FUNCTION_NAME)); range_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void CalcFetchParameter(FetchParameter *out, s64 offset) const { @@ -579,7 +579,7 @@ namespace ams::fssystem { Result FetchFromBuffer(s64 offset, const void *buffer, size_t buffer_size) { AMS_ASSERT(m_cache != nullptr); R_TRY(m_cache->FetchFromBuffer(offset, buffer, buffer_size)); - return ResultSuccess(); + R_SUCCEED(); } }; @@ -616,7 +616,7 @@ namespace ams::fssystem { } m_next_acquire_cache = std::addressof(m_caches[0]); - return ResultSuccess(); + R_SUCCEED(); } void BufferedStorage::Finalize() { @@ -638,7 +638,7 @@ namespace ams::fssystem { /* Do the read. */ R_TRY(this->ReadCore(offset, buffer, size)); - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::Write(s64 offset, const void *buffer, size_t size) { @@ -652,7 +652,7 @@ namespace ams::fssystem { /* Do the write. */ R_TRY(this->WriteCore(offset, buffer, size)); - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::GetSize(s64 *out) { @@ -660,7 +660,7 @@ namespace ams::fssystem { AMS_ASSERT(this->IsInitialized()); *out = m_base_storage_size; - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::SetSize(s64 size) { @@ -700,7 +700,7 @@ namespace ams::fssystem { R_TRY(m_base_storage.GetSize(std::addressof(new_size))); m_base_storage_size = new_size; - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::Flush() { @@ -714,7 +714,7 @@ namespace ams::fssystem { /* Flush the base storage. */ R_TRY(m_base_storage.Flush()); - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { @@ -745,7 +745,7 @@ namespace ams::fssystem { if (m_buffer_manager->GetTotalAllocatableSize() < flush_threshold) { R_TRY(this->Flush()); } - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::ControlDirtiness() { @@ -760,7 +760,7 @@ namespace ams::fssystem { } } } - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::ReadCore(s64 offset, void *buffer, size_t size) { @@ -800,7 +800,7 @@ namespace ams::fssystem { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } while(0); } } @@ -854,7 +854,7 @@ namespace ams::fssystem { buf_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } bool BufferedStorage::ReadHeadCache(s64 *offset, void *buffer, size_t *size, s64 *buffer_offset) { @@ -1007,7 +1007,7 @@ namespace ams::fssystem { R_TRY(this->ControlDirtiness()); } - return ResultSuccess(); + R_SUCCEED(); } Result BufferedStorage::WriteCore(s64 offset, const void *buffer, size_t size) { @@ -1079,7 +1079,7 @@ namespace ams::fssystem { buf_offset += cur_size; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_compression_configuration.cpp b/libraries/libstratosphere/source/fssystem/fssystem_compression_configuration.cpp index e6bbfb67e..9f8a7fab9 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_compression_configuration.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_compression_configuration.cpp @@ -22,7 +22,7 @@ namespace ams::fssystem { Result DecompressLz4(void *dst, size_t dst_size, const void *src, size_t src_size) { R_UNLESS(util::DecompressLZ4(dst, dst_size, src, src_size) == static_cast(dst_size), fs::ResultUnexpectedInCompressedStorageC()); - return ResultSuccess(); + R_SUCCEED(); } constexpr DecompressorFunction GetNcaDecompressorFunction(CompressionType type) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_external_code.cpp b/libraries/libstratosphere/source/fssystem/fssystem_external_code.cpp index 566776579..2f9078399 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_external_code.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_external_code.cpp @@ -62,7 +62,7 @@ namespace ams::fssystem { g_hnd_map.Emplace(program_id, client); *out = server; - return ResultSuccess(); + R_SUCCEED(); } void DestroyExternalCode(ncm::ProgramId program_id) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.cpp index d74fd031a..ae1541e19 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.cpp @@ -78,7 +78,7 @@ namespace ams::fssystem { m_hash_generator_factory->GenerateHash(calc_hash, sizeof(calc_hash), m_hash_buffer, static_cast(hash_storage_size)); R_UNLESS(crypto::IsSameBytes(master_hash, calc_hash, HashSize), fs::ResultHierarchicalSha256HashVerificationFailed()); - return ResultSuccess(); + R_SUCCEED(); } template @@ -126,7 +126,7 @@ namespace ams::fssystem { remaining_size -= cur_size; } - return ResultSuccess(); + R_SUCCEED(); } template @@ -169,7 +169,7 @@ namespace ams::fssystem { remaining_size -= cur_size; } - return ResultSuccess(); + R_SUCCEED(); } template diff --git a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.hpp b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.hpp index afa473289..0ef09a1c6 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.hpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_sha256_storage.hpp @@ -53,7 +53,7 @@ namespace ams::fssystem { virtual Result SetSize(s64 size) override { AMS_UNUSED(size); - return fs::ResultUnsupportedSetSizeForHierarchicalSha256Storage(); + R_THROW(fs::ResultUnsupportedSetSizeForHierarchicalSha256Storage()); } }; diff --git a/libraries/libstratosphere/source/fssystem/fssystem_indirect_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_indirect_storage.cpp index 710aa68b4..94fbc6609 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_indirect_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_indirect_storage.cpp @@ -171,7 +171,7 @@ namespace ams::fssystem { R_SUCCEED(); } default: - return fs::ResultUnsupportedOperateRangeForIndirectStorage(); + R_THROW(fs::ResultUnsupportedOperateRangeForIndirectStorage()); } R_SUCCEED(); diff --git a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp index a442a0017..eec8d3d0f 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp @@ -93,12 +93,12 @@ namespace ams::fssystem { *out = std::move(accessor); this->UpdateMru(list, it); - return ResultSuccess(); + R_SUCCEED(); } } } - return fs::ResultTargetNotFound(); + R_THROW(fs::ResultTargetNotFound()); } void AddEntry(KeySlotCacheEntry *entry) { @@ -122,7 +122,7 @@ namespace ams::fssystem { src_list.pop_back(); dst_list.push_front(*entry); - return ResultSuccess(); + R_SUCCEED(); } void UpdateMru(KeySlotCacheEntryList *list, KeySlotCacheEntryList::iterator it) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp b/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp index 6cb9f3f9d..91e875911 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_nca_reader.cpp @@ -30,7 +30,7 @@ namespace ams::fssystem { /* Verify the magic is the current one. */ R_UNLESS(magic == NcaHeader::Magic3, fs::ResultInvalidNcaSignature()); - return ResultSuccess(); + R_SUCCEED(); } } @@ -176,7 +176,7 @@ namespace ams::fssystem { m_header_storage = std::move(work_header_storage); m_body_storage = std::move(base_storage); - return ResultSuccess(); + R_SUCCEED(); } std::shared_ptr NcaReader::GetSharedBodyStorage() { @@ -435,7 +435,7 @@ namespace ams::fssystem { /* Set our index. */ m_fs_index = index; - return ResultSuccess(); + R_SUCCEED(); } void NcaFsHeaderReader::GetRawData(void *dst, size_t dst_size) const { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp index 52f81f9d4..6d1d41052 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp @@ -75,7 +75,7 @@ namespace ams::fssystem { /* Mark as initialized. */ m_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } template @@ -156,7 +156,7 @@ namespace ams::fssystem { /* Output size. */ *out_size = sizeof(PartitionFileSystemHeader) + header.entry_count * sizeof(typename Format::PartitionEntry) + header.name_table_size; - return ResultSuccess(); + R_SUCCEED(); } template class PartitionFileSystemMetaCore; @@ -213,7 +213,7 @@ namespace ams::fssystem { /* We initialized. */ m_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp b/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp index fdd94a5ae..b260bac94 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_pooled_buffer.cpp @@ -210,7 +210,7 @@ namespace ams::fssystem { g_heap_size = size; g_heap_free_size_peak = size; - return ResultSuccess(); + R_SUCCEED(); } Result InitializeBufferPool(char *buffer, size_t size, char *work, size_t work_size) { @@ -227,7 +227,7 @@ namespace ams::fssystem { g_heap_size = size; g_heap_free_size_peak = size; - return ResultSuccess(); + R_SUCCEED(); } bool IsPooledBuffer(const void *buffer) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_read_only_block_cache_storage.hpp b/libraries/libstratosphere/source/fssystem/fssystem_read_only_block_cache_storage.hpp index 3cd2e7342..926b7c4d5 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_read_only_block_cache_storage.hpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_read_only_block_cache_storage.hpp @@ -67,7 +67,7 @@ namespace ams::fssystem { bool found = m_block_cache.FindValueAndUpdateMru(std::addressof(cached_buffer), offset / m_block_size); if (found) { std::memcpy(buffer, cached_buffer, size); - return ResultSuccess(); + R_SUCCEED(); } } @@ -82,7 +82,7 @@ namespace ams::fssystem { m_block_cache.PushMruNode(std::move(lru), offset / m_block_size); } - return ResultSuccess(); + R_SUCCEED(); } else { return m_base_storage->Read(offset, buffer, size); } @@ -98,7 +98,7 @@ namespace ams::fssystem { m_block_cache.PushMruNode(std::move(lru), -1); } - return ResultSuccess(); + R_SUCCEED(); } else { /* Validate preconditions. */ AMS_ASSERT(util::IsAligned(offset, m_block_size)); @@ -114,17 +114,17 @@ namespace ams::fssystem { } virtual Result Flush() override { - return ResultSuccess(); + R_SUCCEED(); } virtual Result Write(s64 offset, const void *buffer, size_t size) override { AMS_UNUSED(offset, buffer, size); - return fs::ResultUnsupportedWriteForReadOnlyBlockCacheStorage(); + R_THROW(fs::ResultUnsupportedWriteForReadOnlyBlockCacheStorage()); } virtual Result SetSize(s64 size) override { AMS_UNUSED(size); - return fs::ResultUnsupportedSetSizeForReadOnlyBlockCacheStorage(); + R_THROW(fs::ResultUnsupportedSetSizeForReadOnlyBlockCacheStorage()); } }; diff --git a/libraries/libstratosphere/source/fssystem/fssystem_sparse_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_sparse_storage.cpp index 482b56531..3c23f0814 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_sparse_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_sparse_storage.cpp @@ -38,11 +38,11 @@ namespace ams::fssystem { } else { R_TRY((this->OperatePerEntry(offset, size, [=](fs::IStorage *storage, s64 data_offset, s64 cur_offset, s64 cur_size) -> Result { R_TRY(storage->Read(data_offset, reinterpret_cast(buffer) + (cur_offset - offset), static_cast(cur_size))); - return ResultSuccess(); + R_SUCCEED(); }))); } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/gpio/driver/board/nintendo/nx/impl/gpio_driver_impl.cpp b/libraries/libstratosphere/source/gpio/driver/board/nintendo/nx/impl/gpio_driver_impl.cpp index a452ce875..2cd07b927 100644 --- a/libraries/libstratosphere/source/gpio/driver/board/nintendo/nx/impl/gpio_driver_impl.cpp +++ b/libraries/libstratosphere/source/gpio/driver/board/nintendo/nx/impl/gpio_driver_impl.cpp @@ -114,7 +114,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { /* Read the pad address to make sure our configuration takes. */ reg::Read(pad_address); - return ResultSuccess(); + R_SUCCEED(); } void DriverImpl::FinalizePad(Pad *pad) { @@ -143,7 +143,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { *out = Direction_Input; } - return ResultSuccess(); + R_SUCCEED(); } @@ -162,7 +162,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { /* Read the pad address to make sure our configuration takes. */ reg::Read(pad_address); - return ResultSuccess(); + R_SUCCEED(); } Result DriverImpl::GetValue(GpioValue *out, Pad *pad) const { @@ -183,7 +183,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { *out = GpioValue_Low; } - return ResultSuccess(); + R_SUCCEED(); } Result DriverImpl::SetValue(Pad *pad, GpioValue value) { @@ -201,7 +201,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { /* Read the pad address to make sure our configuration takes. */ reg::Read(pad_address); - return ResultSuccess(); + R_SUCCEED(); } Result DriverImpl::GetInterruptMode(InterruptMode *out, Pad *pad) const { @@ -225,7 +225,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } Result DriverImpl::SetInterruptMode(Pad *pad, InterruptMode mode) { @@ -251,7 +251,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl { /* Read the pad address to make sure our configuration takes. */ reg::Read(pad_address); - return ResultSuccess(); + R_SUCCEED(); } Result DriverImpl::SetInterruptEnabled(Pad *pad, bool en) { diff --git a/libraries/libstratosphere/source/gpio/driver/gpio_pad_api.cpp b/libraries/libstratosphere/source/gpio/driver/gpio_pad_api.cpp index c03434b7b..9a076fb03 100644 --- a/libraries/libstratosphere/source/gpio/driver/gpio_pad_api.cpp +++ b/libraries/libstratosphere/source/gpio/driver/gpio_pad_api.cpp @@ -30,7 +30,7 @@ namespace ams::gpio::driver { R_TRY(session->Open(pad, access_mode)); session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } @@ -54,7 +54,7 @@ namespace ams::gpio::driver { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(GpioPadSession *session) { @@ -77,7 +77,7 @@ namespace ams::gpio::driver { /* Perform the call. */ R_TRY(pad.GetDriver().SafeCastTo().SetDirection(std::addressof(pad), direction)); - return ResultSuccess(); + R_SUCCEED(); } Result GetDirection(gpio::Direction *out, GpioPadSession *session) { @@ -95,7 +95,7 @@ namespace ams::gpio::driver { /* Perform the call. */ R_TRY(pad.GetDriver().SafeCastTo().GetDirection(out, std::addressof(pad))); - return ResultSuccess(); + R_SUCCEED(); } Result SetValue(GpioPadSession *session, gpio::GpioValue value) { @@ -113,7 +113,7 @@ namespace ams::gpio::driver { /* Perform the call. */ R_TRY(pad.GetDriver().SafeCastTo().SetValue(std::addressof(pad), value)); - return ResultSuccess(); + R_SUCCEED(); } Result GetValue(gpio::GpioValue *out, GpioPadSession *session) { @@ -131,7 +131,7 @@ namespace ams::gpio::driver { /* Perform the call. */ R_TRY(pad.GetDriver().SafeCastTo().GetValue(out, std::addressof(pad))); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/gpio/driver/impl/gpio_driver_core.cpp b/libraries/libstratosphere/source/gpio/driver/impl/gpio_driver_core.cpp index a3bf7c080..7ef9a15f4 100644 --- a/libraries/libstratosphere/source/gpio/driver/impl/gpio_driver_core.cpp +++ b/libraries/libstratosphere/source/gpio/driver/impl/gpio_driver_core.cpp @@ -93,7 +93,7 @@ namespace ams::gpio::driver::impl { Result RegisterDeviceCode(DeviceCode device_code, Pad *pad) { AMS_ASSERT(pad != nullptr); R_TRY(GetDeviceCodeEntryManager().Add(device_code, pad)); - return ResultSuccess(); + R_SUCCEED(); } bool UnregisterDeviceCode(DeviceCode device_code) { @@ -120,7 +120,7 @@ namespace ams::gpio::driver::impl { /* Set output. */ *out = device->SafeCastToPointer(); - return ResultSuccess(); + R_SUCCEED(); } Result FindPadByNumber(Pad **out, int pad_number) { @@ -145,7 +145,7 @@ namespace ams::gpio::driver::impl { /* Check that we found the pad. */ R_UNLESS(found, ddsf::ResultDeviceCodeNotFound()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/gpio/driver/impl/gpio_pad_session_impl.cpp b/libraries/libstratosphere/source/gpio/driver/impl/gpio_pad_session_impl.cpp index 47b686f9b..0d1571e40 100644 --- a/libraries/libstratosphere/source/gpio/driver/impl/gpio_pad_session_impl.cpp +++ b/libraries/libstratosphere/source/gpio/driver/impl/gpio_pad_session_impl.cpp @@ -32,7 +32,7 @@ namespace ams::gpio::driver::impl { /* We opened successfully. */ pad_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void PadSessionImpl::Close() { @@ -82,7 +82,7 @@ namespace ams::gpio::driver::impl { /* We succeeded. */ hl_guard.Cancel(); ev_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void PadSessionImpl::UnbindInterrupt() { @@ -115,7 +115,7 @@ namespace ams::gpio::driver::impl { Result PadSessionImpl::GetInterruptEnabled(bool *out) const { *out = this->GetDevice().SafeCastTo().IsInterruptEnabled(); - return ResultSuccess(); + R_SUCCEED(); } Result PadSessionImpl::SetInterruptEnabled(bool en) { @@ -133,7 +133,7 @@ namespace ams::gpio::driver::impl { R_TRY(this->UpdateDriverInterruptEnabled()); pad_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void PadSessionImpl::SignalInterruptBoundEvent() { diff --git a/libraries/libstratosphere/source/gpio/gpio_client_api.cpp b/libraries/libstratosphere/source/gpio/gpio_client_api.cpp index 714e5d201..ce51b8cef 100644 --- a/libraries/libstratosphere/source/gpio/gpio_client_api.cpp +++ b/libraries/libstratosphere/source/gpio/gpio_client_api.cpp @@ -92,7 +92,7 @@ namespace ams::gpio { out_session->_event = nullptr; /* We succeeded. */ - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(GpioPadSession *session) { @@ -115,7 +115,7 @@ namespace ams::gpio { R_TRY(g_manager->IsWakeEventActive(out_is_active, ConvertToGpioPadName(device_code))); } - return ResultSuccess(); + R_SUCCEED(); } Direction GetDirection(GpioPadSession *session) { @@ -198,7 +198,7 @@ namespace ams::gpio { handle.Detach(); session->_event = event; - return ResultSuccess(); + R_SUCCEED(); } void UnbindInterrupt(GpioPadSession *session) { diff --git a/libraries/libstratosphere/source/gpio/gpio_remote_manager_impl.cpp b/libraries/libstratosphere/source/gpio/gpio_remote_manager_impl.cpp index 351bfbbdc..72da31d0e 100644 --- a/libraries/libstratosphere/source/gpio/gpio_remote_manager_impl.cpp +++ b/libraries/libstratosphere/source/gpio/gpio_remote_manager_impl.cpp @@ -39,7 +39,7 @@ namespace ams::gpio { R_TRY(::gpioOpenSession(std::addressof(p), static_cast<::GpioPadName>(static_cast(pad_name)))); out.SetValue(RemoteObjectFactory::CreateSharedEmplaced(p)); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteManagerImpl::OpenSession2(ams::sf::Out> out, DeviceCode device_code, ddsf::AccessMode access_mode) { @@ -47,7 +47,7 @@ namespace ams::gpio { R_TRY(::gpioOpenSession2(std::addressof(p), device_code.GetInternalValue(), access_mode)); out.SetValue(RemoteObjectFactory::CreateSharedEmplaced(p)); - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/gpio/gpio_remote_pad_session_impl.hpp b/libraries/libstratosphere/source/gpio/gpio_remote_pad_session_impl.hpp index f4931aa18..e72c4e4f9 100644 --- a/libraries/libstratosphere/source/gpio/gpio_remote_pad_session_impl.hpp +++ b/libraries/libstratosphere/source/gpio/gpio_remote_pad_session_impl.hpp @@ -76,7 +76,7 @@ namespace ams::gpio { ::Event ev; R_TRY(::gpioPadBindInterrupt(std::addressof(m_srv), std::addressof(ev))); out.SetValue(ev.revent, true); - return ResultSuccess(); + R_SUCCEED(); } Result UnbindInterrupt() { diff --git a/libraries/libstratosphere/source/gpio/server/gpio_server_manager_impl.cpp b/libraries/libstratosphere/source/gpio/server/gpio_server_manager_impl.cpp index 0622a4d86..b828f3e55 100644 --- a/libraries/libstratosphere/source/gpio/server/gpio_server_manager_impl.cpp +++ b/libraries/libstratosphere/source/gpio/server/gpio_server_manager_impl.cpp @@ -76,7 +76,7 @@ namespace ams::gpio::server { /* We succeeded. */ *out = std::move(session); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerImpl::IsWakeEventActive2(ams::sf::Out out, DeviceCode device_code) { diff --git a/libraries/libstratosphere/source/gpio/server/gpio_server_pad_session_impl.hpp b/libraries/libstratosphere/source/gpio/server/gpio_server_pad_session_impl.hpp index fee914e1c..a1ce1e6a5 100644 --- a/libraries/libstratosphere/source/gpio/server/gpio_server_pad_session_impl.hpp +++ b/libraries/libstratosphere/source/gpio/server/gpio_server_pad_session_impl.hpp @@ -40,7 +40,7 @@ namespace ams::gpio::server { R_TRY(gpio::driver::OpenSession(std::addressof(m_internal_pad_session), device_code, access_mode)); m_has_session = true; - return ResultSuccess(); + R_SUCCEED(); } public: /* Actual commands. */ @@ -54,7 +54,7 @@ namespace ams::gpio::server { /* Invoke the driver library. */ R_TRY(gpio::driver::SetDirection(std::addressof(m_internal_pad_session), direction)); - return ResultSuccess(); + R_SUCCEED(); } Result GetDirection(ams::sf::Out out) { @@ -64,7 +64,7 @@ namespace ams::gpio::server { /* Invoke the driver library. */ R_TRY(gpio::driver::GetDirection(out.GetPointer(), std::addressof(m_internal_pad_session))); - return ResultSuccess(); + R_SUCCEED(); } Result SetInterruptMode(gpio::InterruptMode mode) { @@ -130,7 +130,7 @@ namespace ams::gpio::server { /* Invoke the driver library. */ R_TRY(gpio::driver::SetValue(std::addressof(m_internal_pad_session), value)); - return ResultSuccess(); + R_SUCCEED(); } Result GetValue(ams::sf::Out out) { @@ -140,7 +140,7 @@ namespace ams::gpio::server { /* Invoke the driver library. */ R_TRY(gpio::driver::GetValue(out.GetPointer(), std::addressof(m_internal_pad_session))); - return ResultSuccess(); + R_SUCCEED(); } Result BindInterrupt(ams::sf::OutCopyHandle out) { diff --git a/libraries/libstratosphere/source/hid/hid_api.cpp b/libraries/libstratosphere/source/hid/hid_api.cpp index b038acf0e..d12f10e54 100644 --- a/libraries/libstratosphere/source/hid/hid_api.cpp +++ b/libraries/libstratosphere/source/hid/hid_api.cpp @@ -59,7 +59,7 @@ namespace ams::hid { g_initialized_hid = true; } - return ResultSuccess(); + R_SUCCEED(); } u64 ReadHidNpad(HidNpadIdType id) { @@ -86,7 +86,7 @@ namespace ams::hid { *out |= ReadHidNpad(static_cast(controller)); } - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/hos/hos_version_api.cpp b/libraries/libstratosphere/source/hos/hos_version_api.cpp index 128025352..db3d6f623 100644 --- a/libraries/libstratosphere/source/hos/hos_version_api.cpp +++ b/libraries/libstratosphere/source/hos/hos_version_api.cpp @@ -30,7 +30,7 @@ namespace ams::hos { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = { exosphere_cfg }; - return ResultSuccess(); + R_SUCCEED(); } #if defined(ATMOSPHERE_OS_HORIZON) @@ -42,7 +42,7 @@ namespace ams::hos { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = { exosphere_cfg }; - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/htc/server/driver/htc_htclow_driver.cpp b/libraries/libstratosphere/source/htc/server/driver/htc_htclow_driver.cpp index fb8209916..98ced63e2 100644 --- a/libraries/libstratosphere/source/htc/server/driver/htc_htclow_driver.cpp +++ b/libraries/libstratosphere/source/htc/server/driver/htc_htclow_driver.cpp @@ -61,7 +61,7 @@ namespace ams::htc::server::driver { m_manager->SetReceiveBuffer(GetHtclowChannel(channel, m_module_id), receive_buffer, receive_buffer_size); m_manager->SetSendBuffer(GetHtclowChannel(channel, m_module_id), send_buffer, send_buffer_size); - return ResultSuccess(); + R_SUCCEED(); } void HtclowDriver::Close(htclow::ChannelId channel) { @@ -84,7 +84,7 @@ namespace ams::htc::server::driver { /* Finish connecting. */ R_TRY(m_manager->ConnectEnd(GetHtclowChannel(channel, m_module_id), task_id)); - return ResultSuccess(); + R_SUCCEED(); } void HtclowDriver::Shutdown(htclow::ChannelId channel) { @@ -117,7 +117,7 @@ namespace ams::htc::server::driver { /* Set the output sent size. */ *out = static_cast(sent); - return ResultSuccess(); + R_SUCCEED(); } Result HtclowDriver::ReceiveInternal(size_t *out, void *dst, size_t dst_size, htclow::ChannelId channel, htclow::ReceiveOption option) { @@ -173,7 +173,7 @@ namespace ams::htc::server::driver { /* Set the output received size. */ *out = static_cast(received); - return ResultSuccess(); + R_SUCCEED(); } htclow::ChannelState HtclowDriver::GetChannelState(htclow::ChannelId channel) { diff --git a/libraries/libstratosphere/source/htc/server/htc_htc_service_object.cpp b/libraries/libstratosphere/source/htc/server/htc_htc_service_object.cpp index 6664724aa..19d4cc583 100644 --- a/libraries/libstratosphere/source/htc/server/htc_htc_service_object.cpp +++ b/libraries/libstratosphere/source/htc/server/htc_htc_service_object.cpp @@ -39,7 +39,7 @@ namespace ams::htc::server { /* Set the output size. */ *out_size = static_cast(var_size); - return ResultSuccess(); + R_SUCCEED(); } Result HtcServiceObject::GetEnvironmentVariableLength(sf::Out out_size, const sf::InBuffer &name) { @@ -52,19 +52,19 @@ namespace ams::htc::server { /* Set the output size. */ *out_size = static_cast(var_size); - return ResultSuccess(); + R_SUCCEED(); } Result HtcServiceObject::GetHostConnectionEvent(sf::OutCopyHandle out) { /* Set the output handle. */ out.SetValue(m_observer.GetConnectEvent()->GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } Result HtcServiceObject::GetHostDisconnectionEvent(sf::OutCopyHandle out) { /* Set the output handle. */ out.SetValue(m_observer.GetDisconnectEvent()->GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } Result HtcServiceObject::GetHostConnectionEventForSystem(sf::OutCopyHandle out) { @@ -100,7 +100,7 @@ namespace ams::htc::server { /* Set the output event. */ out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result HtcServiceObject::RunOnHostResults(sf::Out out_result, u32 id) { diff --git a/libraries/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp b/libraries/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp index 1923c7151..eeb5dd32c 100644 --- a/libraries/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp +++ b/libraries/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp @@ -91,7 +91,7 @@ namespace ams::htc::server { /* Finish the task. */ R_TRY(m_rpc_client.End(task_id, out_size, dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } Result HtcmiscImpl::GetEnvironmentVariableLength(size_t *out_size, const char *name, size_t name_size) { @@ -105,7 +105,7 @@ namespace ams::htc::server { /* Finish the task. */ R_TRY(m_rpc_client.End(task_id, out_size)); - return ResultSuccess(); + R_SUCCEED(); } Result HtcmiscImpl::RunOnHostBegin(u32 *out_task_id, os::NativeHandle *out_event, const char *args, size_t args_size) { @@ -117,7 +117,7 @@ namespace ams::htc::server { *out_task_id = task_id; *out_event = m_rpc_client.DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcmiscImpl::RunOnHostEnd(s32 *out_result, u32 task_id) { @@ -128,7 +128,7 @@ namespace ams::htc::server { /* Set output. */ *out_result = res; - return ResultSuccess(); + R_SUCCEED(); } void HtcmiscImpl::ClientThread() { diff --git a/libraries/libstratosphere/source/htc/server/htc_observer.cpp b/libraries/libstratosphere/source/htc/server/htc_observer.cpp index 15c8d2530..a80708d88 100644 --- a/libraries/libstratosphere/source/htc/server/htc_observer.cpp +++ b/libraries/libstratosphere/source/htc/server/htc_observer.cpp @@ -56,7 +56,7 @@ namespace ams::htc::server { /* Start our thread. */ os::StartThread(std::addressof(m_observer_thread)); - return ResultSuccess(); + R_SUCCEED(); } void Observer::UpdateEvent() { diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_server.cpp b/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_server.cpp index 48a11b5a2..a3d05ef7f 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_server.cpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_server.cpp @@ -62,7 +62,7 @@ namespace ams::htc::server::rpc { m_cancelled = false; m_thread_running = true; - return ResultSuccess(); + R_SUCCEED(); } void HtcmiscRpcServer::Cancel() { @@ -147,7 +147,7 @@ namespace ams::htc::server::rpc { /* Check size. */ R_UNLESS(static_cast(received) == sizeof(*header), htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } Result HtcmiscRpcServer::ReceiveBody(char *dst, size_t size) { @@ -158,7 +158,7 @@ namespace ams::htc::server::rpc { /* Check size. */ R_UNLESS(static_cast(received) == size, htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } Result HtcmiscRpcServer::SendRequest(const char *src, size_t size) { @@ -172,7 +172,7 @@ namespace ams::htc::server::rpc { /* Check that we sent the right amount. */ R_UNLESS(sent == static_cast(size), htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_tasks.cpp b/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_tasks.cpp index 504ac89b2..e31c432f9 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_tasks.cpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_htcmisc_rpc_tasks.cpp @@ -27,7 +27,7 @@ namespace ams::htc::server::rpc { R_UNLESS(size == copied || size == copied + 1, htc::ResultUnknown()); - return ResultSuccess(); + R_SUCCEED(); } void GetEnvironmentVariableTask::Complete(HtcmiscResult result, const char *data, size_t size) { @@ -78,7 +78,7 @@ namespace ams::htc::server::rpc { /* Set the output size. */ *out = m_value_size; - return ResultSuccess(); + R_SUCCEED(); } Result GetEnvironmentVariableTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -106,7 +106,7 @@ namespace ams::htc::server::rpc { /* Set the output size. */ *out = sizeof(*packet) + this->GetNameSize(); - return ResultSuccess(); + R_SUCCEED(); } Result GetEnvironmentVariableTask::ProcessResponse(const char *data, size_t size) { @@ -119,7 +119,7 @@ namespace ams::htc::server::rpc { /* Complete the task. */ Task::Complete(); - return ResultSuccess(); + R_SUCCEED(); } Result GetEnvironmentVariableLengthTask::SetArguments(const char *args, size_t size) { @@ -131,7 +131,7 @@ namespace ams::htc::server::rpc { R_UNLESS(size == copied || size == copied + 1, htc::ResultUnknown()); - return ResultSuccess(); + R_SUCCEED(); } void GetEnvironmentVariableLengthTask::Complete(HtcmiscResult result, const char *data, size_t size) { @@ -177,7 +177,7 @@ namespace ams::htc::server::rpc { /* Set the output size. */ *out = m_value_size; - return ResultSuccess(); + R_SUCCEED(); } Result GetEnvironmentVariableLengthTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -205,7 +205,7 @@ namespace ams::htc::server::rpc { /* Set the output size. */ *out = sizeof(*packet) + this->GetNameSize(); - return ResultSuccess(); + R_SUCCEED(); } Result GetEnvironmentVariableLengthTask::ProcessResponse(const char *data, size_t size) { @@ -218,7 +218,7 @@ namespace ams::htc::server::rpc { /* Complete the task. */ Task::Complete(); - return ResultSuccess(); + R_SUCCEED(); } Result RunOnHostTask::SetArguments(const char *args, size_t size) { @@ -229,7 +229,7 @@ namespace ams::htc::server::rpc { std::memcpy(m_command, args, size); m_command_size = size; - return ResultSuccess(); + R_SUCCEED(); } void RunOnHostTask::Complete(int host_result) { @@ -245,7 +245,7 @@ namespace ams::htc::server::rpc { Result RunOnHostTask::GetResult(int *out) const { *out = m_host_result; - return ResultSuccess(); + R_SUCCEED(); } void RunOnHostTask::Cancel(RpcTaskCancelReason reason) { @@ -281,7 +281,7 @@ namespace ams::htc::server::rpc { /* Set the output size. */ *out = sizeof(*packet) + this->GetCommandSize(); - return ResultSuccess(); + R_SUCCEED(); } Result RunOnHostTask::ProcessResponse(const char *data, size_t size) { @@ -290,7 +290,7 @@ namespace ams::htc::server::rpc { AMS_UNUSED(size); this->Complete(reinterpret_cast(data)->params[0]); - return ResultSuccess(); + R_SUCCEED(); } os::SystemEventType *RunOnHostTask::GetSystemEvent() { diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp index b50846016..19d29b03b 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.cpp @@ -139,7 +139,7 @@ namespace ams::htc::server::rpc { os::ClearEvent(std::addressof(m_send_buffer_available_events[i])); } - return ResultSuccess(); + R_SUCCEED(); } void RpcClient::Cancel() { @@ -251,7 +251,7 @@ namespace ams::htc::server::rpc { R_TRY(task->ProcessNotification(m_receive_buffer, received)); break; default: - return htc::ResultInvalidCategory(); + R_THROW(htc::ResultInvalidCategory()); } /* If we used the receive buffer, signal that we're done with it. */ @@ -269,7 +269,7 @@ namespace ams::htc::server::rpc { /* Check size. */ R_UNLESS(static_cast(received) == sizeof(*header), htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } Result RpcClient::ReceiveBody(char *dst, size_t size) { @@ -280,7 +280,7 @@ namespace ams::htc::server::rpc { /* Check size. */ R_UNLESS(static_cast(received) == size, htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } Result RpcClient::SendThread() { @@ -325,7 +325,7 @@ namespace ams::htc::server::rpc { R_TRY(this->SendRequest(m_send_buffer, packet_size)); } - return htc::ResultCancelled(); + R_THROW(htc::ResultCancelled()); } Result RpcClient::SendRequest(const char *src, size_t size) { @@ -339,7 +339,7 @@ namespace ams::htc::server::rpc { /* Check that we sent the right amount. */ R_UNLESS(sent == static_cast(size), htc::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } void RpcClient::CancelBySocket(s32 handle) { diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp index 8c3d35b75..3a943fb4c 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp @@ -147,7 +147,7 @@ namespace ams::htc::server::rpc { /* We succeeded. */ task_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } template requires (IsRpcTask && sizeof...(Args) == std::tuple_size>::value) @@ -165,7 +165,7 @@ namespace ams::htc::server::rpc { /* Get the task's result. */ R_TRY(task->GetResult(std::forward(args)...)); - return ResultSuccess(); + R_SUCCEED(); } template requires (IsRpcTask && sizeof...(Args) == std::tuple_size>::value) @@ -190,11 +190,11 @@ namespace ams::htc::server::rpc { switch (task->GetTaskCancelReason()) { case RpcTaskCancelReason::BySocket: task_guard.Cancel(); - return htc::ResultTaskCancelled(); + R_THROW(htc::ResultTaskCancelled()); case RpcTaskCancelReason::ClientFinalized: - return htc::ResultCancelled(); + R_THROW(htc::ResultCancelled()); case RpcTaskCancelReason::QueueNotAvailable: - return htc::ResultTaskQueueNotAvailable(); + R_THROW(htc::ResultTaskQueueNotAvailable()); AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -202,7 +202,7 @@ namespace ams::htc::server::rpc { /* Get the task's result. */ R_TRY(task->GetResult(std::forward(args)...)); - return ResultSuccess(); + R_SUCCEED(); } template requires IsRpcTask @@ -217,7 +217,7 @@ namespace ams::htc::server::rpc { /* Check the task handle. */ R_UNLESS(task->GetHandle() == handle, htc::ResultInvalidTaskId()); - return ResultSuccess(); + R_SUCCEED(); } template requires IsRpcTask @@ -235,7 +235,7 @@ namespace ams::htc::server::rpc { /* Add notification to our queue. */ m_task_queue.Add(task_id, PacketCategory::Notification); - return ResultSuccess(); + R_SUCCEED(); } template requires IsRpcTask @@ -291,9 +291,9 @@ namespace ams::htc::server::rpc { if (task->GetTaskState() == RpcTaskState::Cancelled) { switch (task->GetTaskCancelReason()) { case RpcTaskCancelReason::QueueNotAvailable: - return htc::ResultTaskQueueNotAvailable(); + R_THROW(htc::ResultTaskQueueNotAvailable()); default: - return htc::ResultTaskCancelled(); + R_THROW(htc::ResultTaskCancelled()); } } @@ -303,7 +303,7 @@ namespace ams::htc::server::rpc { os::SignalEvent(std::addressof(m_send_buffer_available_events[task_id])); } - return ResultSuccess(); + R_SUCCEED(); } template requires IsRpcTask @@ -323,9 +323,9 @@ namespace ams::htc::server::rpc { if (task->GetTaskState() == RpcTaskState::Cancelled) { switch (task->GetTaskCancelReason()) { case RpcTaskCancelReason::QueueNotAvailable: - return htc::ResultTaskQueueNotAvailable(); + R_THROW(htc::ResultTaskQueueNotAvailable()); default: - return htc::ResultTaskCancelled(); + R_THROW(htc::ResultTaskCancelled()); } } @@ -349,7 +349,7 @@ namespace ams::htc::server::rpc { std::memcpy(buffer, result_buffer, result_size); - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_id_free_list.hpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_id_free_list.hpp index 747b16160..b89368747 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_id_free_list.hpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_id_free_list.hpp @@ -43,7 +43,7 @@ namespace ams::htc::server::rpc { /* Get the task id. */ *out = m_task_ids[index]; - return ResultSuccess(); + R_SUCCEED(); } void Free(u32 task_id) { diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_queue.hpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_queue.hpp index 51ca64671..183328158 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_queue.hpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_queue.hpp @@ -96,7 +96,7 @@ namespace ams::htc::server::rpc { /* Return the task info. */ *out_id = m_task_ids[index]; *out_category = m_task_categories[index]; - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_tasks.hpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_tasks.hpp index 817072b67..0b4ae63ac 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_tasks.hpp +++ b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_tasks.hpp @@ -89,22 +89,22 @@ namespace ams::htc::server::rpc { virtual Result ProcessResponse(const char *data, size_t size) { AMS_UNUSED(data, size); - return ResultSuccess(); + R_SUCCEED(); } virtual Result CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { AMS_UNUSED(out, data, size, task_id); - return ResultSuccess(); + R_SUCCEED(); } virtual Result ProcessNotification(const char *data, size_t size) { AMS_UNUSED(data, size); - return ResultSuccess(); + R_SUCCEED(); } virtual Result CreateNotification(size_t *out, char *data, size_t size, u32 task_id) { AMS_UNUSED(out, data, size, task_id); - return ResultSuccess(); + R_SUCCEED(); } virtual bool IsReceiveBufferRequired() { diff --git a/libraries/libstratosphere/source/htc/tenv/htc_tenv_service_manager.cpp b/libraries/libstratosphere/source/htc/tenv/htc_tenv_service_manager.cpp index 107c06b4f..ba9ecdf7a 100644 --- a/libraries/libstratosphere/source/htc/tenv/htc_tenv_service_manager.cpp +++ b/libraries/libstratosphere/source/htc/tenv/htc_tenv_service_manager.cpp @@ -21,7 +21,7 @@ namespace ams::htc::tenv { Result ServiceManager::GetServiceInterface(sf::Out> out, const sf::ClientProcessId &process_id) { *out = impl::SfObjectFactory::CreateSharedEmplaced(process_id.GetValue()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp b/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp index ebf9bb1db..e36050831 100644 --- a/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp +++ b/libraries/libstratosphere/source/htcfs/htcfs_client_impl.cpp @@ -172,7 +172,7 @@ namespace ams::htcfs { /* Set the version in our header factory. */ m_header_factory.SetVersion(use_version); - return ResultSuccess(); + R_SUCCEED(); } void ClientImpl::TearDownProtocol() { @@ -190,7 +190,7 @@ namespace ams::htcfs { /* Check the type. */ R_UNLESS(response.packet_type == packet_type, htcfs::ResultUnexpectedResponsePacketType()); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CheckResponseHeader(const Header &response, PacketType packet_type) { @@ -200,7 +200,7 @@ namespace ams::htcfs { /* Check the version. */ R_UNLESS(response.version == m_header_factory.GetVersion(), htcfs::ResultUnexpectedResponseProtocolVersion()); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CheckResponseHeader(const Header &response, PacketType packet_type, s64 body_size) { @@ -210,7 +210,7 @@ namespace ams::htcfs { /* Check the body size. */ R_UNLESS(response.body_size == body_size, htcfs::ResultUnexpectedResponseBodySize()); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetMaxProtocolVersion(s16 *out) { @@ -235,7 +235,7 @@ namespace ams::htcfs { /* Set the maximum protocol version. */ *out = response.params[1]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::SetProtocolVersion(s16 version) { @@ -257,7 +257,7 @@ namespace ams::htcfs { /* Check that we succeeded. */ R_TRY(ConvertHtcfsResult(response.params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::SendToRpcChannel(const void *src, s64 size) { @@ -293,7 +293,7 @@ namespace ams::htcfs { /* Flush. */ R_TRY(channel->Flush()); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::ReceiveFromHtclow(void *dst, s64 size, htclow::Channel *channel) { @@ -313,7 +313,7 @@ namespace ams::htcfs { /* Flush. */ R_TRY(channel->Flush()); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::InitializeRpcChannel() { @@ -323,7 +323,7 @@ namespace ams::htcfs { /* Check that we're connected. */ R_UNLESS(m_connected, htcfs::ResultConnectionFailure()); - return ResultSuccess(); + R_SUCCEED(); } void ClientImpl::InitializeDataChannelForReceive(void *dst, size_t size) { @@ -399,7 +399,7 @@ namespace ams::htcfs { } } - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::OpenFile(s32 *out_handle, const char *path, fs::OpenMode mode, bool case_sensitive) { @@ -451,7 +451,7 @@ namespace ams::htcfs { m_cache_manager.Record(response.params[4], m_packet_buffer, response.params[2], response.body_size); } - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::FileExists(bool *out, const char *path, bool case_sensitive) { @@ -486,7 +486,7 @@ namespace ams::htcfs { /* Set the output. */ *out = response.params[2] != 0; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::DeleteFile(const char *path, bool case_sensitive) { @@ -518,7 +518,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::RenameFile(const char *old_path, const char *new_path, bool case_sensitive) { @@ -551,7 +551,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetEntryType(fs::DirectoryEntryType *out, const char *path, bool case_sensitive) { @@ -586,7 +586,7 @@ namespace ams::htcfs { /* Set the output. */ *out = static_cast(response.params[2]); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::OpenDirectory(s32 *out_handle, const char *path, fs::OpenDirectoryMode mode, bool case_sensitive) { @@ -621,7 +621,7 @@ namespace ams::htcfs { /* Set the output handle. */ *out_handle = static_cast(response.params[2]); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::DirectoryExists(bool *out, const char *path, bool case_sensitive) { @@ -656,7 +656,7 @@ namespace ams::htcfs { /* Set the output. */ *out = response.params[2] != 0; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CreateDirectory(const char *path, bool case_sensitive) { @@ -688,7 +688,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::DeleteDirectory(const char *path, bool recursively, bool case_sensitive) { @@ -720,7 +720,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::RenameDirectory(const char *old_path, const char *new_path, bool case_sensitive) { @@ -753,7 +753,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CreateFile(const char *path, s64 size, bool case_sensitive) { @@ -785,7 +785,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetFileTimeStamp(u64 *out_create, u64 *out_access, u64 *out_modify, const char *path, bool case_sensitive) { @@ -822,7 +822,7 @@ namespace ams::htcfs { *out_access = static_cast(response.params[3]); *out_modify = static_cast(response.params[4]); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetCaseSensitivePath(char *dst, size_t dst_size, const char *path) { @@ -875,7 +875,7 @@ namespace ams::htcfs { /* Null-terminate the output path. */ dst[response.body_size] = '\x00'; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetDiskFreeSpace(s64 *out_free, s64 *out_total, s64 *out_total_free, const char *path) { @@ -912,7 +912,7 @@ namespace ams::htcfs { *out_total = response.params[3]; *out_total_free = response.params[4]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CloseDirectory(s32 handle) { @@ -943,7 +943,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetEntryCount(s64 *out, s32 handle) { @@ -977,7 +977,7 @@ namespace ams::htcfs { /* Set the output count. */ *out = response.params[2]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::ReadDirectory(s64 *out, fs::DirectoryEntry *out_entries, size_t max_out_entries, s32 handle) { @@ -1073,7 +1073,7 @@ namespace ams::htcfs { /* Set the number of output entries. */ *out = response.params[2]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetPriorityForDirectory(s32 *out, s32 handle) { @@ -1104,7 +1104,7 @@ namespace ams::htcfs { /* Set the output. */ *out = static_cast(response.params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::SetPriorityForDirectory(s32 priority, s32 handle) { @@ -1132,7 +1132,7 @@ namespace ams::htcfs { /* Check that we succeeded. */ R_TRY(ConvertHtcfsResult(response.params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::CloseFile(s32 handle) { @@ -1166,7 +1166,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::ReadFile(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { @@ -1185,7 +1185,7 @@ namespace ams::htcfs { AMS_ASSERT(util::IsIntValueRepresentable(read_size)); *out = static_cast(read_size); - return ResultSuccess(); + R_SUCCEED(); } } @@ -1227,7 +1227,7 @@ namespace ams::htcfs { /* Set the output size. */ *out = response.body_size; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::ReadFileLarge(s64 *out, void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::ReadOption option) { @@ -1284,7 +1284,7 @@ namespace ams::htcfs { /* Set the number of output entries. */ *out = response.params[2]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::WriteFile(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { @@ -1318,7 +1318,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::WriteFileLarge(const void *buffer, s32 handle, s64 offset, s64 buffer_size, fs::WriteOption option) { @@ -1379,7 +1379,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(write_resp.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetFileSize(s64 *out, s32 handle) { @@ -1416,7 +1416,7 @@ namespace ams::htcfs { /* Set the output. */ *out = response.params[2]; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::SetFileSize(s64 size, s32 handle) { @@ -1450,7 +1450,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::FlushFile(s32 handle) { @@ -1481,7 +1481,7 @@ namespace ams::htcfs { /* Check our operation's result. */ R_TRY(ConvertNativeResult(response.params[1])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetPriorityForFile(s32 *out, s32 handle) { @@ -1512,7 +1512,7 @@ namespace ams::htcfs { /* Set the output. */ *out = static_cast(response.params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::SetPriorityForFile(s32 priority, s32 handle) { @@ -1540,7 +1540,7 @@ namespace ams::htcfs { /* Check that we succeeded. */ R_TRY(ConvertHtcfsResult(response.params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetWorkingDirectory(char *dst, size_t dst_size) { @@ -1581,7 +1581,7 @@ namespace ams::htcfs { /* Null-terminate the response body. */ dst[response.body_size] = '\x00'; - return ResultSuccess(); + R_SUCCEED(); } Result ClientImpl::GetWorkingDirectorySize(s32 *out) { @@ -1619,7 +1619,7 @@ namespace ams::htcfs { /* Set the output size. */ *out = static_cast(response.params[1]); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcfs/htcfs_file_system_service_object.cpp b/libraries/libstratosphere/source/htcfs/htcfs_file_system_service_object.cpp index 18bde1fd6..bf04ce941 100644 --- a/libraries/libstratosphere/source/htcfs/htcfs_file_system_service_object.cpp +++ b/libraries/libstratosphere/source/htcfs/htcfs_file_system_service_object.cpp @@ -56,10 +56,10 @@ namespace ams::htcfs { *out = static_cast(fs::OpenMode_ReadWrite | fs::OpenMode_AllowAppend); break; default: - return htcfs::ResultInvalidArgument(); + R_THROW(htcfs::ResultInvalidArgument()); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -78,7 +78,7 @@ namespace ams::htcfs { /* Set the output file. */ *out = FileServiceObjectFactory::CreateSharedEmplaced(handle); - return ResultSuccess(); + R_SUCCEED(); } Result FileSystemServiceObject::FileExists(sf::Out out, const tma::Path &path, bool case_sensitive) { @@ -125,7 +125,7 @@ namespace ams::htcfs { /* Set the output directory. */ *out = DirectoryServiceObjectFactory::CreateSharedEmplaced(handle); - return ResultSuccess(); + R_SUCCEED(); } Result FileSystemServiceObject::DirectoryExists(sf::Out out, const tma::Path &path, bool case_sensitive) { diff --git a/libraries/libstratosphere/source/htcfs/htcfs_result.hpp b/libraries/libstratosphere/source/htcfs/htcfs_result.hpp index de76d16c7..1104f3588 100644 --- a/libraries/libstratosphere/source/htcfs/htcfs_result.hpp +++ b/libraries/libstratosphere/source/htcfs/htcfs_result.hpp @@ -32,19 +32,19 @@ namespace ams::htcfs { inline Result ConvertHtcfsResult(HtcfsResult result) { switch (result) { case HtcfsResult::Success: - return ResultSuccess(); + R_SUCCEED(); case HtcfsResult::UnknownError: - return htcfs::ResultUnknownError(); + R_THROW(htcfs::ResultUnknownError()); case HtcfsResult::UnsupportedProtocolVersion: - return htcfs::ResultUnsupportedProtocolVersion(); + R_THROW(htcfs::ResultUnsupportedProtocolVersion()); case HtcfsResult::InvalidRequest: - return htcfs::ResultInvalidRequest(); + R_THROW(htcfs::ResultInvalidRequest()); case HtcfsResult::InvalidHandle: - return htcfs::ResultInvalidHandle(); + R_THROW(htcfs::ResultInvalidHandle()); case HtcfsResult::OutOfHandle: - return htcfs::ResultOutOfHandle(); + R_THROW(htcfs::ResultOutOfHandle()); default: - return htcfs::ResultUnknownError(); + R_THROW(htcfs::ResultUnknownError()); } } diff --git a/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_service.cpp b/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_service.cpp index e270cfdc6..4f1356e87 100644 --- a/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_service.cpp +++ b/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_service.cpp @@ -110,10 +110,10 @@ namespace ams::htclow::ctrl { R_UNLESS(header.body_size <= sizeof(HtcctrlPacketBody), htclow::ResultProtocolError()); break; default: - return htclow::ResultProtocolError(); + R_THROW(htclow::ResultProtocolError()); } - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceivePacket(const HtcctrlPacketHeader &header, const void *body, size_t body_size) { @@ -151,7 +151,7 @@ namespace ams::htclow::ctrl { /* Signal our event. */ m_event.Signal(); - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveReadyPacket(const void *body, size_t body_size) { @@ -174,7 +174,7 @@ namespace ams::htclow::ctrl { /* Ready ourselves. */ this->TryReadyInternal(); - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveSuspendPacket() { @@ -184,7 +184,7 @@ namespace ams::htclow::ctrl { return this->ProcessReceiveUnexpectedPacket(); } - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveResumePacket() { @@ -194,14 +194,14 @@ namespace ams::htclow::ctrl { return this->ProcessReceiveUnexpectedPacket(); } - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveDisconnectPacket() { /* Set our state. */ R_TRY(this->SetState(HtcctrlState_Disconnected)); - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveBeaconQueryPacket() { @@ -211,7 +211,7 @@ namespace ams::htclow::ctrl { /* Signal our event. */ m_event.Signal(); - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::ProcessReceiveUnexpectedPacket() { @@ -225,7 +225,7 @@ namespace ams::htclow::ctrl { m_event.Signal(); /* Return unexpected packet error. */ - return htclow::ResultHtcctrlReceiveUnexpectedPacket(); + R_THROW(htclow::ResultHtcctrlReceiveUnexpectedPacket()); } void HtcctrlService::ProcessSendConnectPacket() { @@ -446,7 +446,7 @@ namespace ams::htclow::ctrl { R_TRY(this->SetState(HtcctrlState_DriverConnected)); } - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::NotifyDriverDisconnected() { @@ -459,7 +459,7 @@ namespace ams::htclow::ctrl { R_TRY(this->SetState(HtcctrlState_DriverDisconnected)); } - return ResultSuccess(); + R_SUCCEED(); } Result HtcctrlService::SetState(HtcctrlState state) { @@ -472,7 +472,7 @@ namespace ams::htclow::ctrl { this->ReflectState(); } - return ResultSuccess(); + R_SUCCEED(); } void HtcctrlService::ReflectState() { diff --git a/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp b/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp index 3cb4fc093..dc7727709 100644 --- a/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp +++ b/libraries/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp @@ -54,7 +54,7 @@ namespace ams::htclow::ctrl { /* Note whether we transitioned. */ *out_transitioned = state != old_state; - return ResultSuccess(); + R_SUCCEED(); } bool HtcctrlStateMachine::IsInformationNeeded() { diff --git a/libraries/libstratosphere/source/htclow/driver/htclow_driver_manager.cpp b/libraries/libstratosphere/source/htclow/driver/htclow_driver_manager.cpp index b24bead13..5167925ab 100644 --- a/libraries/libstratosphere/source/htclow/driver/htclow_driver_manager.cpp +++ b/libraries/libstratosphere/source/htclow/driver/htclow_driver_manager.cpp @@ -43,15 +43,15 @@ namespace ams::htclow::driver { //m_plain_channel_driver.Open(); //m_open_driver = std::addressof(m_plain_channel_driver); //break; - return htclow::ResultUnknownDriverType(); + R_THROW(htclow::ResultUnknownDriverType()); default: - return htclow::ResultUnknownDriverType(); + R_THROW(htclow::ResultUnknownDriverType()); } /* Set the driver type. */ m_driver_type = driver_type; - return ResultSuccess(); + R_SUCCEED(); } void DriverManager::CloseDriver() { diff --git a/libraries/libstratosphere/source/htclow/driver/htclow_socket_discovery_manager.cpp b/libraries/libstratosphere/source/htclow/driver/htclow_socket_discovery_manager.cpp index 481616538..5cb90ee7a 100644 --- a/libraries/libstratosphere/source/htclow/driver/htclow_socket_discovery_manager.cpp +++ b/libraries/libstratosphere/source/htclow/driver/htclow_socket_discovery_manager.cpp @@ -145,7 +145,7 @@ namespace ams::htclow::driver { /* This can never happen, as the above loop should be infinite, but completion logic is here for posterity. */ socket_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htclow/driver/htclow_socket_driver.cpp b/libraries/libstratosphere/source/htclow/driver/htclow_socket_driver.cpp index 2a5e178bb..2b68ec389 100644 --- a/libraries/libstratosphere/source/htclow/driver/htclow_socket_driver.cpp +++ b/libraries/libstratosphere/source/htclow/driver/htclow_socket_driver.cpp @@ -44,7 +44,7 @@ namespace ams::htclow::driver { /* Setup client socket. */ R_TRY(this->SetupClientSocket(client_desc)); - return ResultSuccess(); + R_SUCCEED(); } Result SocketDriver::CreateServerSocket() { @@ -86,7 +86,7 @@ namespace ams::htclow::driver { m_server_socket = desc; m_server_socket_valid = true; - return ResultSuccess(); + R_SUCCEED(); } void SocketDriver::DestroyServerSocket() { @@ -116,7 +116,7 @@ namespace ams::htclow::driver { m_client_socket = desc; m_client_socket_valid = true; - return ResultSuccess(); + R_SUCCEED(); } bool SocketDriver::IsAutoConnectReserved() { @@ -180,7 +180,7 @@ namespace ams::htclow::driver { Result SocketDriver::Open() { m_discovery_manager.OnDriverOpen(); - return ResultSuccess(); + R_SUCCEED(); } void SocketDriver::Close() { @@ -251,7 +251,7 @@ namespace ams::htclow::driver { R_UNLESS(cur_sent > 0, htclow::ResultSocketSendError()); } - return ResultSuccess(); + R_SUCCEED(); } Result SocketDriver::Receive(void *dst, int dst_size) { @@ -265,7 +265,7 @@ namespace ams::htclow::driver { R_UNLESS(cur_recv > 0, htclow::ResultSocketReceiveError()); } - return ResultSuccess(); + R_SUCCEED(); } void SocketDriver::CancelSendReceive() { diff --git a/libraries/libstratosphere/source/htclow/driver/htclow_usb_driver.cpp b/libraries/libstratosphere/source/htclow/driver/htclow_usb_driver.cpp index 0a88b9e23..cbea212ef 100644 --- a/libraries/libstratosphere/source/htclow/driver/htclow_usb_driver.cpp +++ b/libraries/libstratosphere/source/htclow/driver/htclow_usb_driver.cpp @@ -69,7 +69,7 @@ namespace ams::htclow::driver { /* We're connected. */ m_connected = true; - return ResultSuccess(); + R_SUCCEED(); } void UsbDriver::Shutdown() { @@ -92,7 +92,7 @@ namespace ams::htclow::driver { transferred += cur; } - return ResultSuccess(); + R_SUCCEED(); } Result UsbDriver::Receive(void *dst, int dst_size) { @@ -107,7 +107,7 @@ namespace ams::htclow::driver { transferred += cur; } - return ResultSuccess(); + R_SUCCEED(); } void UsbDriver::CancelSendReceive() { diff --git a/libraries/libstratosphere/source/htclow/driver/htclow_usb_impl.cpp b/libraries/libstratosphere/source/htclow/driver/htclow_usb_impl.cpp index 4ed2b0864..da3bf7973 100644 --- a/libraries/libstratosphere/source/htclow/driver/htclow_usb_impl.cpp +++ b/libraries/libstratosphere/source/htclow/driver/htclow_usb_impl.cpp @@ -207,11 +207,11 @@ namespace ams::htclow::driver { Result ConvertUsbDriverResult(Result result) { if (result.GetModule() == R_NAMESPACE_MODULE_ID(usb)) { if (usb::ResultResourceBusy::Includes(result)) { - return htclow::ResultUsbDriverBusyError(); + R_THROW(htclow::ResultUsbDriverBusyError()); } else if (usb::ResultMemAllocFailure::Includes(result)) { - return htclow::ResultOutOfMemory(); + R_THROW(htclow::ResultOutOfMemory()); } else { - return htclow::ResultUsbDriverUnknownError(); + R_THROW(htclow::ResultUsbDriverUnknownError()); } } else { return result; @@ -241,7 +241,7 @@ namespace ams::htclow::driver { /* Set binary object store. */ R_TRY(g_ds_client.SetBinaryObjectStore(BinaryObjectStore, sizeof(BinaryObjectStore))); - return ResultSuccess(); + R_SUCCEED(); } Result InitializeDsInterface() { @@ -263,13 +263,13 @@ namespace ams::htclow::driver { R_TRY(g_ds_interface.AppendConfigurationData(usb::UsbDeviceSpeed_Super, std::addressof(UsbEndpointDescriptorsSuperSpeed[1]), sizeof(usb::UsbEndpointDescriptor))); R_TRY(g_ds_interface.AppendConfigurationData(usb::UsbDeviceSpeed_Super, std::addressof(UsbEndpointCompanionDescriptor), sizeof(usb::UsbEndpointCompanionDescriptor))); - return ResultSuccess(); + R_SUCCEED(); } Result InitializeDsEndpoints() { R_TRY(g_ds_endpoints[0].Initialize(std::addressof(g_ds_interface), 0x81)); R_TRY(g_ds_endpoints[1].Initialize(std::addressof(g_ds_interface), 0x01)); - return ResultSuccess(); + R_SUCCEED(); } void UsbIndicationThreadFunction(void *) { @@ -400,7 +400,7 @@ namespace ams::htclow::driver { /* We succeeded! */ init_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void FinalizeUsbInterface() { @@ -432,7 +432,7 @@ namespace ams::htclow::driver { /* Set output transferred size. */ *out_transferred = src_size; - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveUsb(int *out_transferred, void *dst, int dst_size) { @@ -449,7 +449,7 @@ namespace ams::htclow::driver { /* Set output transferred size. */ *out_transferred = dst_size; - return ResultSuccess(); + R_SUCCEED(); } void CancelUsbSendReceive() { diff --git a/libraries/libstratosphere/source/htclow/htclow_channel.cpp b/libraries/libstratosphere/source/htclow/htclow_channel.cpp index 1069ce88c..e38767fea 100644 --- a/libraries/libstratosphere/source/htclow/htclow_channel.cpp +++ b/libraries/libstratosphere/source/htclow/htclow_channel.cpp @@ -111,7 +111,7 @@ namespace ams::htclow { AMS_ASSERT(received <= size); *out = received; - return ResultSuccess(); + R_SUCCEED(); } Result Channel::Send(s64 *out, const void *src, s64 size) { @@ -149,7 +149,7 @@ namespace ams::htclow { AMS_ASSERT(total_sent <= size); *out = total_sent; - return ResultSuccess(); + R_SUCCEED(); } void Channel::SetConfig(const ChannelConfig &config) { @@ -207,7 +207,7 @@ namespace ams::htclow { AMS_ASSERT(util::IsIntValueRepresentable(received)); *out = static_cast(received); - return ResultSuccess(); + R_SUCCEED(); } Result Channel::WaitReceiveInternal(s64 size, os::EventType *event) { @@ -222,7 +222,7 @@ namespace ams::htclow { if (event != nullptr) { if (os::WaitAny(event, m_manager->GetTaskEvent(task_id)) == 0) { m_manager->WaitReceiveEnd(task_id); - return htclow::ResultChannelWaitCancelled(); + R_THROW(htclow::ResultChannelWaitCancelled()); } } else { this->WaitEvent(m_manager->GetTaskEvent(task_id), false); diff --git a/libraries/libstratosphere/source/htclow/htclow_manager_impl.cpp b/libraries/libstratosphere/source/htclow/htclow_manager_impl.cpp index cc25ec547..4ec8fdc5d 100644 --- a/libraries/libstratosphere/source/htclow/htclow_manager_impl.cpp +++ b/libraries/libstratosphere/source/htclow/htclow_manager_impl.cpp @@ -50,7 +50,7 @@ namespace ams::htclow { m_is_driver_open = true; drv_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void HtclowManagerImpl::CloseDriver() { @@ -114,7 +114,7 @@ namespace ams::htclow { /* Try to ready ourselves. */ m_ctrl_service.TryReady(); - return ResultSuccess(); + R_SUCCEED(); } Result HtclowManagerImpl::ConnectEnd(impl::ChannelInternalType channel, u32 task_id) { diff --git a/libraries/libstratosphere/source/htclow/htclow_worker.cpp b/libraries/libstratosphere/source/htclow/htclow_worker.cpp index 69fb9a158..4e725e2ee 100644 --- a/libraries/libstratosphere/source/htclow/htclow_worker.cpp +++ b/libraries/libstratosphere/source/htclow/htclow_worker.cpp @@ -116,7 +116,7 @@ namespace ams::htclow { /* Process the received packet. */ m_service->ProcessReceivePacket(header, m_receive_packet_body, header.body_size); - return ResultSuccess(); + R_SUCCEED(); } Result Worker::ProcessReceive(const PacketHeader &header) { @@ -131,7 +131,7 @@ namespace ams::htclow { /* Process the received packet. */ m_mux->ProcessReceivePacket(header, m_receive_packet_body, header.body_size); - return ResultSuccess(); + R_SUCCEED(); } Result Worker::ProcessSend() { @@ -171,7 +171,7 @@ namespace ams::htclow { /* Check if we're cancelled. */ if (m_cancelled) { - return htclow::ResultCancelled(); + R_THROW(htclow::ResultCancelled()); } } } diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux.cpp index 76795c0d3..d8be2e0b8 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux.cpp @@ -59,7 +59,7 @@ namespace ams::htclow::mux { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } Result Mux::ProcessReceivePacket(const PacketHeader &header, const void *body, size_t body_size) { @@ -73,7 +73,7 @@ namespace ams::htclow::mux { if (header.packet_type == PacketType_Data || header.packet_type == PacketType_MaxData) { this->SendErrorPacket(header.channel); } - return htclow::ResultChannelNotExist(); + R_THROW(htclow::ResultChannelNotExist()); } } @@ -143,7 +143,7 @@ namespace ams::htclow::mux { Result Mux::CheckChannelExist(impl::ChannelInternalType channel) { R_UNLESS(m_channel_impl_map.Exists(channel), htclow::ResultChannelNotExist()); - return ResultSuccess(); + R_SUCCEED(); } Result Mux::SendErrorPacket(impl::ChannelInternalType channel) { @@ -153,7 +153,7 @@ namespace ams::htclow::mux { /* Signal our event. */ m_event.Signal(); - return ResultSuccess(); + R_SUCCEED(); } bool Mux::IsSendable(PacketType packet_type) const { @@ -181,7 +181,7 @@ namespace ams::htclow::mux { /* Set the channel version. */ m_channel_impl_map.GetChannelImpl(channel).SetVersion(m_version); - return ResultSuccess(); + R_SUCCEED(); } Result Mux::Close(impl::ChannelInternalType channel) { @@ -197,7 +197,7 @@ namespace ams::htclow::mux { R_ABORT_UNLESS(m_channel_impl_map.RemoveChannel(channel)); } - return ResultSuccess(); + R_SUCCEED(); } Result Mux::ConnectBegin(u32 *out_task_id, impl::ChannelInternalType channel) { @@ -272,7 +272,7 @@ namespace ams::htclow::mux { /* Check that we didn't hit a disconnect. */ R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected()); - return ResultSuccess(); + R_SUCCEED(); } os::EventType *Mux::GetTaskEvent(u32 task_id) { @@ -311,7 +311,7 @@ namespace ams::htclow::mux { return m_channel_impl_map[it->second].DoReceiveEnd(out, dst, dst_size); } else { *out = 0; - return ResultSuccess(); + R_SUCCEED(); } } @@ -340,7 +340,7 @@ namespace ams::htclow::mux { /* Check that we didn't hit a disconnect. */ R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected()); - return ResultSuccess(); + R_SUCCEED(); } Result Mux::WaitReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) { @@ -360,7 +360,7 @@ namespace ams::htclow::mux { /* Check that we didn't hit a disconnect. */ R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected()); - return ResultSuccess(); + R_SUCCEED(); } void Mux::SetConfig(impl::ChannelInternalType channel, const ChannelConfig &config) { diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp index e1fa8ab65..c6dd66d39 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl.cpp @@ -52,15 +52,15 @@ namespace ams::htclow::mux { /* Otherwise, return appropriate failure error. */ if (m_state == ChannelState_Disconnected) { - return htclow::ResultInvalidChannelStateDisconnected(); + R_THROW(htclow::ResultInvalidChannelStateDisconnected()); } else { - return htclow::ResultInvalidChannelState(); + R_THROW(htclow::ResultInvalidChannelState()); } } Result ChannelImpl::CheckPacketVersion(s16 version) const { R_UNLESS(version == m_version, htclow::ResultChannelVersionNotMatched()); - return ResultSuccess(); + R_SUCCEED(); } @@ -73,7 +73,7 @@ namespace ams::htclow::mux { case PacketType_Error: return this->ProcessReceiveErrorPacket(); default: - return htclow::ResultProtocolError(); + R_THROW(htclow::ResultProtocolError()); } } @@ -110,7 +110,7 @@ namespace ams::htclow::mux { /* Notify the data was received. */ m_task_manager->NotifyReceiveData(m_channel, m_receive_buffer.GetDataSize()); - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::ProcessReceiveMaxDataPacket(s16 version, u64 share) { @@ -134,14 +134,14 @@ namespace ams::htclow::mux { this->SignalSendPacketEvent(); } - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::ProcessReceiveErrorPacket() { if (m_state == ChannelState_Connected || m_state == ChannelState_Disconnected) { this->ShutdownForce(); } - return ResultSuccess(); + R_SUCCEED(); } bool ChannelImpl::QuerySendPacket(PacketHeader *header, PacketBody *body, int *out_body_size) { @@ -250,7 +250,7 @@ namespace ams::htclow::mux { /* Set the output task id. */ *out_task_id = task_id; - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoConnectEnd() { @@ -287,7 +287,7 @@ namespace ams::htclow::mux { /* Set our state as connected. */ this->SetState(ChannelState_Connected); - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoFlush(u32 *out_task_id) { @@ -308,7 +308,7 @@ namespace ams::htclow::mux { /* Set the output task id. */ *out_task_id = task_id; - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoReceiveBegin(u32 *out_task_id, size_t size) { @@ -331,7 +331,7 @@ namespace ams::htclow::mux { /* Set the output task id. */ *out_task_id = task_id; - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoReceiveEnd(size_t *out, void *dst, size_t dst_size) { @@ -341,7 +341,7 @@ namespace ams::htclow::mux { /* If we have nowhere to receive, we're done. */ if (dst_size == 0) { *out = 0; - return ResultSuccess(); + R_SUCCEED(); } /* Get the amount of receivable data. */ @@ -381,7 +381,7 @@ namespace ams::htclow::mux { /* Set the output size. */ *out = received; - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoSend(u32 *out_task_id, size_t *out, const void *src, size_t src_size) { @@ -413,7 +413,7 @@ namespace ams::htclow::mux { *out_task_id = task_id; *out = sent; - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImpl::DoShutdown() { @@ -422,7 +422,7 @@ namespace ams::htclow::mux { /* Set our state. */ this->SetState(ChannelState_Disconnected); - return ResultSuccess(); + R_SUCCEED(); } void ChannelImpl::SetConfig(const ChannelConfig &config) { diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl_map.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl_map.cpp index 318b1029e..3090d966d 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl_map.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_channel_impl_map.cpp @@ -64,7 +64,7 @@ namespace ams::htclow::mux { /* Insert into our map. */ m_map.insert(std::pair{channel, idx}); - return ResultSuccess(); + R_SUCCEED(); } Result ChannelImplMap::RemoveChannel(impl::ChannelInternalType channel) { @@ -88,7 +88,7 @@ namespace ams::htclow::mux { /* Destroy the channel. */ std::destroy_at(channel_impl); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_global_send_buffer.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_global_send_buffer.cpp index 3f567efd6..fe2076803 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_global_send_buffer.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_global_send_buffer.cpp @@ -39,7 +39,7 @@ namespace ams::htclow::mux { /* We don't, so push back a new one. */ m_packet_list.push_back(*(ptr.release())); - return ResultSuccess(); + R_SUCCEED(); } void GlobalSendBuffer::RemovePacket() { diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_ring_buffer.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_ring_buffer.cpp index 31f7bc986..f47813b93 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_ring_buffer.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_ring_buffer.cpp @@ -54,7 +54,7 @@ namespace ams::htclow::mux { /* Discard. */ R_TRY(this->Discard(size)); - return ResultSuccess(); + R_SUCCEED(); } Result RingBuffer::Write(const void *data, size_t size) { @@ -81,7 +81,7 @@ namespace ams::htclow::mux { /* Update our data size. */ m_data_size += size; - return ResultSuccess(); + R_SUCCEED(); } Result RingBuffer::Copy(void *dst, size_t size) { @@ -108,7 +108,7 @@ namespace ams::htclow::mux { /* Mark that we can discard. */ m_can_discard = true; - return ResultSuccess(); + R_SUCCEED(); } Result RingBuffer::Discard(size_t size) { @@ -127,7 +127,7 @@ namespace ams::htclow::mux { m_data_size -= size; m_can_discard = false; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htclow/mux/htclow_mux_task_manager.cpp b/libraries/libstratosphere/source/htclow/mux/htclow_mux_task_manager.cpp index 10d4e8036..4d62d0a99 100644 --- a/libraries/libstratosphere/source/htclow/mux/htclow_mux_task_manager.cpp +++ b/libraries/libstratosphere/source/htclow/mux/htclow_mux_task_manager.cpp @@ -56,7 +56,7 @@ namespace ams::htclow::mux { /* Return the task id. */ *out_task_id = task_id; - return ResultSuccess(); + R_SUCCEED(); } void TaskManager::FreeTask(u32 task_id) { diff --git a/libraries/libstratosphere/source/htcs/client/htcs_session.os.horizon.cpp b/libraries/libstratosphere/source/htcs/client/htcs_session.os.horizon.cpp index 37e30c1b6..6a267bf14 100644 --- a/libraries/libstratosphere/source/htcs/client/htcs_session.os.horizon.cpp +++ b/libraries/libstratosphere/source/htcs/client/htcs_session.os.horizon.cpp @@ -124,19 +124,19 @@ namespace ams::htcs::client { R_SUCCEED_IF(*out_err != 0); *out = ObjectFactory::CreateSharedEmplaced(libnx_socket); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteManager::RegisterProcessId(const sf::ClientProcessId &client_pid) { /* Handled by libnx init. */ AMS_UNUSED(client_pid); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteManager::MonitorManager(const sf::ClientProcessId &client_pid) { /* Handled by libnx init. */ AMS_UNUSED(client_pid); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteManager::StartSelect(sf::Out out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray &read_handles, const sf::InMapAliasArray &write_handles, const sf::InMapAliasArray &exception_handles, s64 tv_sec, s64 tv_usec) { @@ -144,7 +144,7 @@ namespace ams::htcs::client { R_TRY(::htcsStartSelect(out_task_id.GetPointer(), std::addressof(event_handle), read_handles.GetPointer(), read_handles.GetSize(), write_handles.GetPointer(), write_handles.GetSize(), exception_handles.GetPointer(), exception_handles.GetSize(), tv_sec, tv_usec)); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteManager::EndSelect(sf::Out out_err, sf::Out out_count, const sf::OutMapAliasArray &read_handles, const sf::OutMapAliasArray &write_handles, const sf::OutMapAliasArray &exception_handles, u32 task_id) { @@ -182,7 +182,7 @@ namespace ams::htcs::client { R_TRY(::htcsSocketAcceptStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle))); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::AcceptResults(sf::Out out_err, sf::Out> out, sf::Out out_address, u32 task_id) { @@ -193,7 +193,7 @@ namespace ams::htcs::client { R_SUCCEED_IF(*out_err != 0); *out = ObjectFactory::CreateSharedEmplaced(libnx_socket); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::RecvStart(sf::Out out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags) { @@ -201,7 +201,7 @@ namespace ams::htcs::client { R_TRY(::htcsSocketRecvStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), mem_size, flags)); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::RecvResults(sf::Out out_err, sf::Out out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) { @@ -213,7 +213,7 @@ namespace ams::htcs::client { R_TRY(::htcsSocketSendStart(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), buffer.GetPointer(), buffer.GetSize(), flags)); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::SendResults(sf::Out out_err, sf::Out out_size, u32 task_id) { @@ -225,7 +225,7 @@ namespace ams::htcs::client { R_TRY(::htcsSocketStartSend(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), out_max_size.GetPointer(), size, flags)); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::ContinueSend(sf::Out out_size, sf::Out out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id) { @@ -241,7 +241,7 @@ namespace ams::htcs::client { R_TRY(::htcsSocketStartRecv(std::addressof(m_s), out_task_id.GetPointer(), std::addressof(event_handle), size, flags)); out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteSocket::EndRecv(sf::Out out_err, sf::Out out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) { diff --git a/libraries/libstratosphere/source/htcs/impl/htcs_manager.cpp b/libraries/libstratosphere/source/htcs/impl/htcs_manager.cpp index 2300ae9ea..7ec1c7099 100644 --- a/libraries/libstratosphere/source/htcs/impl/htcs_manager.cpp +++ b/libraries/libstratosphere/source/htcs/impl/htcs_manager.cpp @@ -301,7 +301,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } void HtcsManager::EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) { @@ -362,7 +362,7 @@ namespace ams::htcs::impl { R_CONVERT(htc::ResultTaskCancelled, tma::ResultUnknown()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsManager::EndSelect(s32 *out_err, s32 *out_count, Span read_handles, Span write_handles, Span exception_handles, u32 task_id) { @@ -392,7 +392,7 @@ namespace ams::htcs::impl { } } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp b/libraries/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp index 06dba184f..ed8e9c6ba 100644 --- a/libraries/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp +++ b/libraries/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp @@ -123,7 +123,7 @@ namespace ams::htcs::impl { return result; } - return ResultSuccess(); + R_SUCCEED(); } Result HtcsManagerImpl::SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) { diff --git a/libraries/libstratosphere/source/htcs/impl/htcs_service.cpp b/libraries/libstratosphere/source/htcs/impl/htcs_service.cpp index 7e5d39eea..61065da3e 100644 --- a/libraries/libstratosphere/source/htcs/impl/htcs_service.cpp +++ b/libraries/libstratosphere/source/htcs/impl/htcs_service.cpp @@ -43,7 +43,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; *out_desc = desc; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::DestroySocket(s32 desc) { @@ -61,7 +61,7 @@ namespace ams::htcs::impl { htcs::SocketError err; R_TRY(m_rpc_client->End(task_id, std::addressof(err))); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Connect(s32 *out_err, s32 desc, const SockAddrHtcs &address) { @@ -83,7 +83,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Bind(s32 *out_err, s32 desc, const SockAddrHtcs &address) { @@ -105,7 +105,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Listen(s32 *out_err, s32 desc, s32 backlog_count) { @@ -122,7 +122,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Receive(s32 *out_err, s64 *out_size, char *buffer, s64 size, s32 desc, s32 flags) { @@ -136,7 +136,7 @@ namespace ams::htcs::impl { /* Finish the task. */ R_TRY(this->ReceiveResults(out_err, out_size, buffer, size, task_id, desc)); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Send(s32 *out_err, s64 *out_size, const char *buffer, s64 size, s32 desc, s32 flags) { @@ -157,7 +157,7 @@ namespace ams::htcs::impl { /* Finish the task. */ R_TRY(this->SendResults(out_err, out_size, task_id, desc)); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Shutdown(s32 *out_err, s32 desc, s32 how) { @@ -174,7 +174,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::Fcntl(s32 *out_err, s32 *out_res, s32 desc, s32 command, s32 value) { @@ -193,7 +193,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; *out_res = res; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) { @@ -205,7 +205,7 @@ namespace ams::htcs::impl { *out_task_id = task_id; *out_handle = m_rpc_client->DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) { @@ -219,7 +219,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; *out_desc = ret_desc; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::ReceiveSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { @@ -231,7 +231,7 @@ namespace ams::htcs::impl { *out_task_id = task_id; *out_handle = m_rpc_client->DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::ReceiveSmallResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) { @@ -246,7 +246,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { @@ -258,7 +258,7 @@ namespace ams::htcs::impl { *out_task_id = task_id; *out_handle = m_rpc_client->DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendSmallContinue(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) { @@ -270,7 +270,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_size = buffer_size; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendSmallResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) { @@ -282,7 +282,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { @@ -294,7 +294,7 @@ namespace ams::htcs::impl { *out_task_id = task_id; *out_handle = m_rpc_client->DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendContinue(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) { @@ -315,7 +315,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_size = buffer_size; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) { @@ -328,7 +328,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::ReceiveStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { @@ -340,7 +340,7 @@ namespace ams::htcs::impl { *out_task_id = task_id; *out_handle = m_rpc_client->DetachReadableHandle(task_id); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::ReceiveResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) { @@ -357,7 +357,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } /* Check the size. */ @@ -380,7 +380,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SelectStart(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { @@ -395,7 +395,7 @@ namespace ams::htcs::impl { /* Check that the task isn't cancelled. */ R_UNLESS(!m_rpc_client->IsCancelled(task_id), htcs::ResultCancelled()); - return ResultSuccess(); + R_SUCCEED(); } Result HtcsService::SelectEnd(s32 *out_err, bool *out_empty, Span read_handles, Span write_handles, Span exception_handles, u32 task_id) { @@ -407,7 +407,7 @@ namespace ams::htcs::impl { /* Set output. */ *out_err = err; *out_empty = empty; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_data_channel_manager.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_data_channel_manager.cpp index 3ad4a2314..03f4decf3 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_data_channel_manager.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_data_channel_manager.cpp @@ -56,7 +56,7 @@ namespace ams::htcs::impl::rpc { /* Wait to receive the data. */ R_TRY(channel.WaitReceive(buffer_size)); - return ResultSuccess(); + R_SUCCEED(); } Result DataChannelManager::Send(const void *buffer, s64 buffer_size, u32 task_id) { @@ -92,7 +92,7 @@ namespace ams::htcs::impl::rpc { /* Wait to send the data. */ R_TRY(channel.Flush()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_accept_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_accept_task.cpp index 8782b2eba..33b7f797e 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_accept_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_accept_task.cpp @@ -25,7 +25,7 @@ namespace ams::htcs::impl::rpc { /* Set our arguments. */ m_server_handle = server_handle; - return ResultSuccess(); + R_SUCCEED(); } void AcceptTask::Complete(htcs::SocketError err, s32 desc) { @@ -48,7 +48,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_desc = m_desc; - return ResultSuccess(); + R_SUCCEED(); } Result AcceptTask::ProcessResponse(const char *data, size_t size) { @@ -60,7 +60,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result AcceptTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -83,7 +83,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_bind_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_bind_task.cpp index 27f7f6ec8..28b841f63 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_bind_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_bind_task.cpp @@ -24,7 +24,7 @@ namespace ams::htcs::impl::rpc { m_peer_name = peer_name; m_port_name = port_name; - return ResultSuccess(); + R_SUCCEED(); } void BindTask::Complete(htcs::SocketError err) { @@ -42,7 +42,7 @@ namespace ams::htcs::impl::rpc { /* Set the output. */ *out_err = m_err; - return ResultSuccess(); + R_SUCCEED(); } Result BindTask::ProcessResponse(const char *data, size_t size) { @@ -54,7 +54,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result BindTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -79,7 +79,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet) + sizeof(m_peer_name) + sizeof(m_port_name); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_close_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_close_task.cpp index 18c31db00..100e7b184 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_close_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_close_task.cpp @@ -22,7 +22,7 @@ namespace ams::htcs::impl::rpc { /* Set our arguments. */ m_handle = handle; - return ResultSuccess(); + R_SUCCEED(); } void CloseTask::Complete(htcs::SocketError err) { @@ -40,7 +40,7 @@ namespace ams::htcs::impl::rpc { /* Set the output. */ *out_err = m_err; - return ResultSuccess(); + R_SUCCEED(); } Result CloseTask::ProcessResponse(const char *data, size_t size) { @@ -52,7 +52,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result CloseTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -75,7 +75,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_connect_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_connect_task.cpp index e58682fa6..c4f59f5c3 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_connect_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_connect_task.cpp @@ -24,7 +24,7 @@ namespace ams::htcs::impl::rpc { m_peer_name = peer_name; m_port_name = port_name; - return ResultSuccess(); + R_SUCCEED(); } void ConnectTask::Complete(htcs::SocketError err) { @@ -42,7 +42,7 @@ namespace ams::htcs::impl::rpc { /* Set the output. */ *out_err = m_err; - return ResultSuccess(); + R_SUCCEED(); } Result ConnectTask::ProcessResponse(const char *data, size_t size) { @@ -54,7 +54,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ConnectTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -79,7 +79,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet) + sizeof(m_peer_name) + sizeof(m_port_name); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_fcntl_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_fcntl_task.cpp index b004042ce..d629ca970 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_fcntl_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_fcntl_task.cpp @@ -24,7 +24,7 @@ namespace ams::htcs::impl::rpc { m_command = command; m_value = value; - return ResultSuccess(); + R_SUCCEED(); } void FcntlTask::Complete(htcs::SocketError err, s32 res) { @@ -44,7 +44,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_res = m_res; - return ResultSuccess(); + R_SUCCEED(); } Result FcntlTask::ProcessResponse(const char *data, size_t size) { @@ -56,7 +56,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result FcntlTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -81,7 +81,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_listen_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_listen_task.cpp index 1f8d9be6e..d8e42808f 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_listen_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_listen_task.cpp @@ -23,7 +23,7 @@ namespace ams::htcs::impl::rpc { m_handle = handle; m_backlog = backlog; - return ResultSuccess(); + R_SUCCEED(); } void ListenTask::Complete(htcs::SocketError err) { @@ -41,7 +41,7 @@ namespace ams::htcs::impl::rpc { /* Set the output. */ *out_err = m_err; - return ResultSuccess(); + R_SUCCEED(); } Result ListenTask::ProcessResponse(const char *data, size_t size) { @@ -53,7 +53,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ListenTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -77,7 +77,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_small_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_small_task.cpp index e2c3ef9e5..a5544ac81 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_small_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_small_task.cpp @@ -27,7 +27,7 @@ namespace ams::htcs::impl::rpc { m_size = size; m_flags = flags; - return ResultSuccess(); + R_SUCCEED(); } void ReceiveSmallTask::Complete(htcs::SocketError err, s64 size) { @@ -47,7 +47,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_size = m_result_size; - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveSmallTask::ProcessResponse(const char *data, size_t size) { @@ -62,7 +62,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->body_size); - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveSmallTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -87,7 +87,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } bool ReceiveSmallTask::IsReceiveBufferRequired() { diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_task.cpp index 3f7d732c5..5eb12c2f3 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_receive_task.cpp @@ -27,7 +27,7 @@ namespace ams::htcs::impl::rpc { m_size = size; m_flags = flags; - return ResultSuccess(); + R_SUCCEED(); } void ReceiveTask::Complete(htcs::SocketError err, s64 size) { @@ -47,7 +47,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_size = m_result_size; - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveTask::ProcessResponse(const char *data, size_t size) { @@ -59,7 +59,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -85,7 +85,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } Result ReceiveTask::CreateNotification(size_t *out, char *data, size_t size, u32 task_id) { @@ -108,7 +108,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_select_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_select_task.cpp index 9872a2456..9ae737f62 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_select_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_select_task.cpp @@ -39,7 +39,7 @@ namespace ams::htcs::impl::rpc { std::memcpy(m_handles + m_read_handle_count, write_handles.data(), write_handles.size_bytes()); std::memcpy(m_handles + m_read_handle_count + m_write_handle_count, exception_handles.data(), exception_handles.size_bytes()); - return ResultSuccess(); + R_SUCCEED(); } void SelectTask::Complete(htcs::SocketError err, s32 read_handle_count, s32 write_handle_count, s32 exception_handle_count, const void *body, s64 body_size) { @@ -102,7 +102,7 @@ namespace ams::htcs::impl::rpc { std::copy(exception_start, exception_end, exception_handles.begin()); } - return ResultSuccess(); + R_SUCCEED(); } Result SelectTask::ProcessResponse(const char *data, size_t size) { @@ -114,7 +114,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1], packet->params[2], packet->params[3], packet->data, size - sizeof(*packet)); - return ResultSuccess(); + R_SUCCEED(); } Result SelectTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -149,7 +149,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet) + body_size; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_small_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_small_task.cpp index 62664ebfd..1f1f2285e 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_small_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_small_task.cpp @@ -51,7 +51,7 @@ namespace ams::htcs::impl::rpc { m_size = size; m_flags = flags; - return ResultSuccess(); + R_SUCCEED(); } void SendSmallTask::Complete(htcs::SocketError err, s64 size) { @@ -74,7 +74,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_size = m_result_size; - return ResultSuccess(); + R_SUCCEED(); } void SendSmallTask::Cancel(htc::server::rpc::RpcTaskCancelReason reason) { @@ -94,7 +94,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), this->GetSize()); - return ResultSuccess(); + R_SUCCEED(); } Result SendSmallTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -127,7 +127,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet) + this->GetSize(); - return ResultSuccess(); + R_SUCCEED(); } bool SendSmallTask::IsSendBufferRequired() { diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_task.cpp index 760af7736..94debd04a 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_send_task.cpp @@ -46,7 +46,7 @@ namespace ams::htcs::impl::rpc { m_size = size; m_flags = flags; - return ResultSuccess(); + R_SUCCEED(); } void SendTask::Complete(htcs::SocketError err, s64 size) { @@ -69,7 +69,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_size = m_result_size; - return ResultSuccess(); + R_SUCCEED(); } void SendTask::Cancel(htc::server::rpc::RpcTaskCancelReason reason) { @@ -89,7 +89,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result SendTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -115,14 +115,14 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } Result SendTask::ProcessNotification(const char *data, size_t size) { AMS_UNUSED(data, size); this->NotifyDataChannelReady(); - return ResultSuccess(); + R_SUCCEED(); } Result SendTask::CreateNotification(size_t *out, char *data, size_t size, u32 task_id) { @@ -145,7 +145,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_shutdown_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_shutdown_task.cpp index 92b2006d9..f212cc894 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_shutdown_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_shutdown_task.cpp @@ -23,7 +23,7 @@ namespace ams::htcs::impl::rpc { m_handle = handle; m_how = how; - return ResultSuccess(); + R_SUCCEED(); } void ShutdownTask::Complete(htcs::SocketError err) { @@ -41,7 +41,7 @@ namespace ams::htcs::impl::rpc { /* Set the output. */ *out_err = m_err; - return ResultSuccess(); + R_SUCCEED(); } Result ShutdownTask::ProcessResponse(const char *data, size_t size) { @@ -53,7 +53,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0])); - return ResultSuccess(); + R_SUCCEED(); } Result ShutdownTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -77,7 +77,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_socket_task.cpp b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_socket_task.cpp index 8984fc5d3..1905ac2a9 100644 --- a/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_socket_task.cpp +++ b/libraries/libstratosphere/source/htcs/impl/rpc/htcs_rpc_socket_task.cpp @@ -29,7 +29,7 @@ namespace ams::htcs::impl::rpc { } Result SocketTask::SetArguments() { - return ResultSuccess(); + R_SUCCEED(); } void SocketTask::Complete(htcs::SocketError err, s32 desc) { @@ -49,7 +49,7 @@ namespace ams::htcs::impl::rpc { *out_err = m_err; *out_desc = m_desc; - return ResultSuccess(); + R_SUCCEED(); } Result SocketTask::ProcessResponse(const char *data, size_t size) { @@ -64,7 +64,7 @@ namespace ams::htcs::impl::rpc { /* Complete the task. */ this->Complete(static_cast(packet->params[0]), packet->params[1]); - return ResultSuccess(); + R_SUCCEED(); } Result SocketTask::CreateRequest(size_t *out, char *data, size_t size, u32 task_id) { @@ -87,7 +87,7 @@ namespace ams::htcs::impl::rpc { /* Set the output size. */ *out = sizeof(*packet); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/htcs/server/htcs_manager_service_object.cpp b/libraries/libstratosphere/source/htcs/server/htcs_manager_service_object.cpp index 88aacc8cf..3fafbe4a5 100644 --- a/libraries/libstratosphere/source/htcs/server/htcs_manager_service_object.cpp +++ b/libraries/libstratosphere/source/htcs/server/htcs_manager_service_object.cpp @@ -35,12 +35,12 @@ namespace ams::htcs::server { Result ManagerServiceObject::GetPeerNameAny(sf::Out out) { *out = impl::GetPeerNameAny(); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::GetDefaultHostName(sf::Out out) { *out = impl::GetDefaultHostName(); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::CreateSocketOld(sf::Out out_err, sf::Out> out) { @@ -61,19 +61,19 @@ namespace ams::htcs::server { /* Create a new socket object. */ *out = ServiceObjectFactory::CreateSharedEmplaced(this, desc); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::RegisterProcessId(const sf::ClientProcessId &client_pid) { /* NOTE: Nintendo does nothing here. */ AMS_UNUSED(client_pid); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::MonitorManager(const sf::ClientProcessId &client_pid) { /* NOTE: Nintendo does nothing here. */ AMS_UNUSED(client_pid); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::StartSelect(sf::Out out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray &read_handles, const sf::InMapAliasArray &write_handles, const sf::InMapAliasArray &exception_handles, s64 tv_sec, s64 tv_usec) { @@ -86,7 +86,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result ManagerServiceObject::EndSelect(sf::Out out_err, sf::Out out_count, const sf::OutMapAliasArray &read_handles, const sf::OutMapAliasArray &write_handles, const sf::OutMapAliasArray &exception_handles, u32 task_id) { diff --git a/libraries/libstratosphere/source/htcs/server/htcs_socket_service_object.cpp b/libraries/libstratosphere/source/htcs/server/htcs_socket_service_object.cpp index 79948a7c5..09ff2d2ed 100644 --- a/libraries/libstratosphere/source/htcs/server/htcs_socket_service_object.cpp +++ b/libraries/libstratosphere/source/htcs/server/htcs_socket_service_object.cpp @@ -40,7 +40,7 @@ namespace ams::htcs::server { /* Close the underlying socket. */ manager->Close(out_err.GetPointer(), out_res.GetPointer(), m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Connect(sf::Out out_err, sf::Out out_res, const htcs::SockAddrHtcs &address) { @@ -50,7 +50,7 @@ namespace ams::htcs::server { /* Perform the connect. */ manager->Connect(out_err.GetPointer(), out_res.GetPointer(), address, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Bind(sf::Out out_err, sf::Out out_res, const htcs::SockAddrHtcs &address) { @@ -60,7 +60,7 @@ namespace ams::htcs::server { /* Perform the bind. */ manager->Bind(out_err.GetPointer(), out_res.GetPointer(), address, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Listen(sf::Out out_err, sf::Out out_res, s32 backlog_count) { @@ -70,7 +70,7 @@ namespace ams::htcs::server { /* Perform the listen. */ manager->Listen(out_err.GetPointer(), out_res.GetPointer(), backlog_count, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Recv(sf::Out out_err, sf::Out out_size, const sf::OutAutoSelectBuffer &buffer, s32 flags) { @@ -80,7 +80,7 @@ namespace ams::htcs::server { /* Perform the recv. */ manager->Recv(out_err.GetPointer(), out_size.GetPointer(), reinterpret_cast(buffer.GetPointer()), buffer.GetSize(), flags, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Send(sf::Out out_err, sf::Out out_size, const sf::InAutoSelectBuffer &buffer, s32 flags) { @@ -90,7 +90,7 @@ namespace ams::htcs::server { /* Perform the send. */ manager->Send(out_err.GetPointer(), out_size.GetPointer(), reinterpret_cast(buffer.GetPointer()), buffer.GetSize(), flags, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Shutdown(sf::Out out_err, sf::Out out_res, s32 how) { @@ -100,7 +100,7 @@ namespace ams::htcs::server { /* Perform the shutdown. */ manager->Shutdown(out_err.GetPointer(), out_res.GetPointer(), how, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::Fcntl(sf::Out out_err, sf::Out out_res, s32 command, s32 value) { @@ -110,7 +110,7 @@ namespace ams::htcs::server { /* Perform the fcntl. */ manager->Fcntl(out_err.GetPointer(), out_res.GetPointer(), command, value, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::AcceptStart(sf::Out out_task_id, sf::OutCopyHandle out_event) { @@ -123,7 +123,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::AcceptResults(sf::Out out_err, sf::Out> out, sf::Out out_address, u32 task_id) { @@ -140,7 +140,7 @@ namespace ams::htcs::server { /* Create a new socket object. */ *out = ServiceObjectFactory::CreateSharedEmplaced(m_manager.Get(), desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::RecvStart(sf::Out out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags) { @@ -153,7 +153,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::RecvResults(sf::Out out_err, sf::Out out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) { @@ -163,7 +163,7 @@ namespace ams::htcs::server { /* Get the recv results. */ manager->RecvResults(out_err.GetPointer(), out_size.GetPointer(), reinterpret_cast(buffer.GetPointer()), buffer.GetSize(), task_id, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::RecvLargeStart(sf::Out out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle &&mem_handle, s32 flags) { @@ -190,7 +190,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::SendStartOld(sf::Out out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags) { @@ -227,7 +227,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::SendResults(sf::Out out_err, sf::Out out_size, u32 task_id) { @@ -237,7 +237,7 @@ namespace ams::htcs::server { /* Get the send results. */ manager->SendResults(out_err.GetPointer(), out_size.GetPointer(), task_id, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::StartSend(sf::Out out_task_id, sf::OutCopyHandle out_event, sf::Out out_max_size, s64 size, s32 flags) { @@ -253,7 +253,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::ContinueSendOld(sf::Out out_size, sf::Out out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id) { @@ -267,7 +267,7 @@ namespace ams::htcs::server { /* End the send. */ manager->EndSend(out_err.GetPointer(), out_size.GetPointer(), task_id, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::StartRecv(sf::Out out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags) { @@ -280,7 +280,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::EndRecv(sf::Out out_err, sf::Out out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id) { @@ -290,7 +290,7 @@ namespace ams::htcs::server { /* End the recv. */ manager->EndRecv(out_err.GetPointer(), out_size.GetPointer(), reinterpret_cast(buffer.GetPointer()), buffer.GetSize(), task_id, m_desc); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::SendStart(sf::Out out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags) { @@ -306,7 +306,7 @@ namespace ams::htcs::server { /* Set the output event handle. */ out_event.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::ContinueSend(sf::Out out_size, sf::Out out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id) { @@ -321,13 +321,13 @@ namespace ams::htcs::server { /* We aren't doing a waiting send. */ *out_wait = false; - return ResultSuccess(); + R_SUCCEED(); } Result SocketServiceObject::GetPrimitive(sf::Out out) { /* Get our descriptor. */ *out = m_desc; - return ResultSuccess(); + R_SUCCEED(); } } 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 39de2fd41..ec47109e1 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 @@ -138,7 +138,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { } } - return ResultSuccess(); + R_SUCCEED(); } void I2cBusAccessor::FinalizeDevice(I2cDeviceProperty *device) { @@ -320,7 +320,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { /* We opened (or not). */ s_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void I2cBusAccessor::ExecuteInitialConfig() { @@ -438,7 +438,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { /* We're done. */ this->DisableInterruptMask(); - return ResultSuccess(); + R_SUCCEED(); } Result I2cBusAccessor::Receive(u8 *dst, size_t dst_size, TransactionOption option, u16 slave_address, AddressingMode addressing_mode) { @@ -504,7 +504,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { } /* We're done. */ - return ResultSuccess(); + R_SUCCEED(); } void I2cBusAccessor::WriteHeader(Xfer xfer, size_t size, TransactionOption option, u16 slave_address, AddressingMode addressing_mode) { @@ -728,7 +728,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { os::SleepThread(TimeSpan::FromMilliSeconds(1)); } - return ResultSuccess(); + R_SUCCEED(); } Result I2cBusAccessor::GetTransactionResult() const { @@ -749,7 +749,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { R_UNLESS(reg::HasValue(interrupt_status, I2C_REG_BITS_ENUM(INTERRUPT_STATUS_REGISTER_ARB_LOST, UNSET)), i2c::ResultBusBusy()); clear_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void I2cBusAccessor::HandleTransactionError(Result result) { diff --git a/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.hpp b/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.hpp index f2c4453d5..ab33ac988 100644 --- a/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.hpp +++ b/libraries/libstratosphere/source/i2c/driver/board/nintendo/nx/impl/i2c_bus_accessor.hpp @@ -107,7 +107,7 @@ namespace ams::i2c::driver::board::nintendo::nx::impl { return result; } - return ResultSuccess(); + R_SUCCEED(); } public: virtual void InitializeDriver() override; diff --git a/libraries/libstratosphere/source/i2c/driver/i2c_driver_bus_api.cpp b/libraries/libstratosphere/source/i2c/driver/i2c_driver_bus_api.cpp index e4e4fbf16..48b2cc72a 100644 --- a/libraries/libstratosphere/source/i2c/driver/i2c_driver_bus_api.cpp +++ b/libraries/libstratosphere/source/i2c/driver/i2c_driver_bus_api.cpp @@ -34,7 +34,7 @@ namespace ams::i2c::driver { /* We succeeded. */ session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } @@ -50,7 +50,7 @@ namespace ams::i2c::driver { /* Open the session. */ R_TRY(OpenSessionImpl(out, device)); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(I2cSession &session) { diff --git a/libraries/libstratosphere/source/i2c/driver/impl/i2c_driver_core.cpp b/libraries/libstratosphere/source/i2c/driver/impl/i2c_driver_core.cpp index 105aaf4f0..167b98941 100644 --- a/libraries/libstratosphere/source/i2c/driver/impl/i2c_driver_core.cpp +++ b/libraries/libstratosphere/source/i2c/driver/impl/i2c_driver_core.cpp @@ -79,7 +79,7 @@ namespace ams::i2c::driver::impl { Result RegisterDeviceCode(DeviceCode device_code, I2cDeviceProperty *device) { AMS_ASSERT(device != nullptr); R_TRY(GetDeviceCodeEntryManager().Add(device_code, device)); - return ResultSuccess(); + R_SUCCEED(); } bool UnregisterDeviceCode(DeviceCode device_code) { @@ -96,7 +96,7 @@ namespace ams::i2c::driver::impl { /* Set output. */ *out = device->SafeCastToPointer(); - return ResultSuccess(); + R_SUCCEED(); } Result FindDeviceByBusIndexAndAddress(I2cDeviceProperty **out, i2c::I2cBus bus_index, u16 slave_address) { @@ -125,7 +125,7 @@ namespace ams::i2c::driver::impl { /* Check that we found the pad. */ R_UNLESS(found, ddsf::ResultDeviceCodeNotFound()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/i2c/driver/impl/i2c_i2c_session_impl.cpp b/libraries/libstratosphere/source/i2c/driver/impl/i2c_i2c_session_impl.cpp index 2bf06ce7a..6fffcd515 100644 --- a/libraries/libstratosphere/source/i2c/driver/impl/i2c_i2c_session_impl.cpp +++ b/libraries/libstratosphere/source/i2c/driver/impl/i2c_i2c_session_impl.cpp @@ -44,7 +44,7 @@ namespace ams::i2c::driver::impl { /* We're opened. */ guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void I2cSessionImpl::Close() { @@ -83,7 +83,7 @@ namespace ams::i2c::driver::impl { /* Advance. */ *cur_cmd += size; - return ResultSuccess(); + R_SUCCEED(); } Result I2cSessionImpl::ReceiveHandler(const u8 **cur_cmd, u8 **cur_dst) { @@ -102,7 +102,7 @@ namespace ams::i2c::driver::impl { /* Advance. */ *cur_dst += size; - return ResultSuccess(); + R_SUCCEED(); } Result I2cSessionImpl::ExtensionHandler(const u8 **cur_cmd, u8 **cur_dst) { @@ -123,7 +123,7 @@ namespace ams::i2c::driver::impl { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } Result I2cSessionImpl::ExecuteTransactionWithRetry(void *dst, Command command, const void *src, size_t size, TransactionOption option) { @@ -152,7 +152,7 @@ namespace ams::i2c::driver::impl { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } @@ -193,13 +193,13 @@ namespace ams::i2c::driver::impl { } } - return ResultSuccess(); + R_SUCCEED(); } Result I2cSessionImpl::SetRetryPolicy(int mr, int interval_us) { m_max_retry_count = mr; m_retry_interval = TimeSpan::FromMicroSeconds(interval_us); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/i2c/i2c_client_api.cpp b/libraries/libstratosphere/source/i2c/i2c_client_api.cpp index c8fdf8b3f..6bd5b0d4f 100644 --- a/libraries/libstratosphere/source/i2c/i2c_client_api.cpp +++ b/libraries/libstratosphere/source/i2c/i2c_client_api.cpp @@ -118,7 +118,7 @@ namespace ams::i2c { out->_session = session.Detach(); /* We succeeded. */ - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(I2cSession &session) { diff --git a/libraries/libstratosphere/source/i2c/i2c_command_list_formatter.cpp b/libraries/libstratosphere/source/i2c/i2c_command_list_formatter.cpp index 2b2189d9d..def92cdc2 100644 --- a/libraries/libstratosphere/source/i2c/i2c_command_list_formatter.cpp +++ b/libraries/libstratosphere/source/i2c/i2c_command_list_formatter.cpp @@ -20,7 +20,7 @@ namespace ams::i2c { Result CommandListFormatter::IsEnqueueAble(size_t sz) const { R_UNLESS(m_command_list_length - m_current_index >= sz, i2c::ResultCommandListFull()); - return ResultSuccess(); + R_SUCCEED(); } Result CommandListFormatter::EnqueueReceiveCommand(i2c::TransactionOption option, size_t size) { @@ -44,7 +44,7 @@ namespace ams::i2c { header1 = {}; header1.Set(size); - return ResultSuccess(); + R_SUCCEED(); } Result CommandListFormatter::EnqueueSendCommand(i2c::TransactionOption option, const void *src, size_t size) { @@ -72,7 +72,7 @@ namespace ams::i2c { std::memcpy(cmd_list + m_current_index, src, size); m_current_index += size; - return ResultSuccess(); + R_SUCCEED(); } Result CommandListFormatter::EnqueueSleepCommand(int us) { @@ -95,7 +95,7 @@ namespace ams::i2c { header1 = {}; header1.Set(us); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/i2c/server/i2c_server_manager_impl.cpp b/libraries/libstratosphere/source/i2c/server/i2c_server_manager_impl.cpp index 98815ae0e..fc9b924b3 100644 --- a/libraries/libstratosphere/source/i2c/server/i2c_server_manager_impl.cpp +++ b/libraries/libstratosphere/source/i2c/server/i2c_server_manager_impl.cpp @@ -58,7 +58,7 @@ namespace ams::i2c::server { /* We succeeded. */ *out = std::move(session); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/i2c/server/i2c_server_session_impl.hpp b/libraries/libstratosphere/source/i2c/server/i2c_server_session_impl.hpp index 848ba6c9d..8bb0b1ab3 100644 --- a/libraries/libstratosphere/source/i2c/server/i2c_server_session_impl.hpp +++ b/libraries/libstratosphere/source/i2c/server/i2c_server_session_impl.hpp @@ -39,7 +39,7 @@ namespace ams::i2c::server { R_TRY(i2c::driver::OpenSession(std::addressof(m_internal_session), device_code)); m_has_session = true; - return ResultSuccess(); + R_SUCCEED(); } public: /* Actual commands. */ diff --git a/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp b/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp index 80e27d441..fed6a78fd 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp @@ -31,7 +31,7 @@ namespace ams::kvdb { Result Validate() const { R_UNLESS(std::memcmp(this->magic, ArchiveHeaderMagic, sizeof(ArchiveHeaderMagic)) == 0, kvdb::ResultInvalidKeyValue()); - return ResultSuccess(); + R_SUCCEED(); } static ArchiveHeader Make(size_t entry_count) { @@ -50,7 +50,7 @@ namespace ams::kvdb { Result Validate() const { R_UNLESS(std::memcmp(this->magic, ArchiveEntryMagic, sizeof(ArchiveEntryMagic)) == 0, kvdb::ResultInvalidKeyValue()); - return ResultSuccess(); + R_SUCCEED(); } static ArchiveEntryHeader Make(size_t ksz, size_t vsz) { @@ -72,13 +72,13 @@ namespace ams::kvdb { R_UNLESS(m_offset < m_offset + size, kvdb::ResultInvalidKeyValue()); std::memcpy(dst, m_buffer.Get() + m_offset, size); - return ResultSuccess(); + R_SUCCEED(); } Result ArchiveReader::Read(void *dst, size_t size) { R_TRY(this->Peek(dst, size)); m_offset += size; - return ResultSuccess(); + R_SUCCEED(); } Result ArchiveReader::ReadEntryCount(size_t *out) { @@ -91,7 +91,7 @@ namespace ams::kvdb { R_TRY(header.Validate()); *out = header.entry_count; - return ResultSuccess(); + R_SUCCEED(); } Result ArchiveReader::GetEntrySize(size_t *out_key_size, size_t *out_value_size) { @@ -105,7 +105,7 @@ namespace ams::kvdb { *out_key_size = header.key_size; *out_value_size = header.value_size; - return ResultSuccess(); + R_SUCCEED(); } Result ArchiveReader::ReadEntry(void *out_key, size_t key_size, void *out_value, size_t value_size) { @@ -123,7 +123,7 @@ namespace ams::kvdb { R_ABORT_UNLESS(this->Read(out_key, key_size)); R_ABORT_UNLESS(this->Read(out_value, value_size)); - return ResultSuccess(); + R_SUCCEED(); } /* Writer functionality. */ @@ -134,7 +134,7 @@ namespace ams::kvdb { std::memcpy(m_buffer.Get() + m_offset, src, size); m_offset += size; - return ResultSuccess(); + R_SUCCEED(); } void ArchiveWriter::WriteHeader(size_t entry_count) { 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 734c87596..7e942680d 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp @@ -40,7 +40,7 @@ namespace ams::kvdb { R_UNLESS(m_entries != nullptr, kvdb::ResultBufferInsufficient()); } - return ResultSuccess(); + R_SUCCEED(); } void FileKeyValueStore::Cache::Invalidate() { @@ -170,7 +170,7 @@ namespace ams::kvdb { } *out_size = key_size; - return ResultSuccess(); + R_SUCCEED(); } Result FileKeyValueStore::Initialize(const char *dir) { @@ -188,7 +188,7 @@ namespace ams::kvdb { /* Initialize our cache. */ R_TRY(m_cache.Initialize(cache_buffer, cache_buffer_size, cache_capacity)); - return ResultSuccess(); + R_SUCCEED(); } Result FileKeyValueStore::Get(size_t *out_size, void *out_value, size_t max_out_size, const void *key, size_t key_size) { @@ -202,7 +202,7 @@ namespace ams::kvdb { auto size = m_cache.TryGet(out_value, max_out_size, key, key_size); if (size) { *out_size = *size; - return ResultSuccess(); + R_SUCCEED(); } } @@ -227,7 +227,7 @@ namespace ams::kvdb { /* Cache the newly read value. */ m_cache.Set(key, key_size, out_value, value_size); - return ResultSuccess(); + R_SUCCEED(); } Result FileKeyValueStore::GetSize(size_t *out_size, const void *key, size_t key_size) { @@ -241,7 +241,7 @@ namespace ams::kvdb { auto size = m_cache.TryGetSize(key, key_size); if (size) { *out_size = *size; - return ResultSuccess(); + R_SUCCEED(); } } @@ -257,7 +257,7 @@ namespace ams::kvdb { R_TRY(fs::GetFileSize(std::addressof(file_size), file)); *out_size = static_cast(file_size); - return ResultSuccess(); + R_SUCCEED(); } Result FileKeyValueStore::Set(const void *key, size_t key_size, const void *value, size_t value_size) { @@ -286,7 +286,7 @@ namespace ams::kvdb { /* Write the value file and flush. */ R_TRY(fs::WriteFile(file, 0, value, value_size, fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } Result FileKeyValueStore::Remove(const void *key, size_t key_size) { @@ -305,7 +305,7 @@ namespace ams::kvdb { R_CONVERT(fs::ResultPathNotFound, kvdb::ResultKeyNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/ldr/ldr_shell_api.os.horizon.cpp b/libraries/libstratosphere/source/ldr/ldr_shell_api.os.horizon.cpp index 9202e77fe..fee8ddfe6 100644 --- a/libraries/libstratosphere/source/ldr/ldr_shell_api.os.horizon.cpp +++ b/libraries/libstratosphere/source/ldr/ldr_shell_api.os.horizon.cpp @@ -23,7 +23,7 @@ namespace ams::ldr { Result FinalizeForShell() { ::ldrShellExit(); - return ResultSuccess(); + R_SUCCEED(); } Result SetProgramArgument(ncm::ProgramId program_id, const void *arg, size_t size) { diff --git a/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp b/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp index 46a6e7ab9..614e897d9 100644 --- a/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp +++ b/libraries/libstratosphere/source/lm/lm_remote_log_service.cpp @@ -54,7 +54,7 @@ namespace ams::lm { /* Open logger. */ out.SetValue(RemoteObjectFactory::CreateSharedEmplaced<::ams::lm::ILogger, RemoteLogger>(logger_srv)); - return ResultSuccess(); + R_SUCCEED(); } sf::SharedPointer CreateLogService() { diff --git a/libraries/libstratosphere/source/lm/srv/lm_log_getter.cpp b/libraries/libstratosphere/source/lm/srv/lm_log_getter.cpp index cc74c22e7..64270d81c 100644 --- a/libraries/libstratosphere/source/lm/srv/lm_log_getter.cpp +++ b/libraries/libstratosphere/source/lm/srv/lm_log_getter.cpp @@ -23,12 +23,12 @@ namespace ams::lm::srv { Result LogGetter::StartLogging() { g_is_logging_to_custom_sink = true; - return ResultSuccess(); + R_SUCCEED(); } Result LogGetter::StopLogging() { g_is_logging_to_custom_sink = false; - return ResultSuccess(); + R_SUCCEED(); } Result LogGetter::GetLog(const sf::OutAutoSelectBuffer &message, sf::Out out_size, sf::Out out_drop_count) { @@ -40,7 +40,7 @@ namespace ams::lm::srv { *out_size = 0; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lm/srv/lm_log_service_impl.cpp b/libraries/libstratosphere/source/lm/srv/lm_log_service_impl.cpp index 5f1074176..5bd7734b2 100644 --- a/libraries/libstratosphere/source/lm/srv/lm_log_service_impl.cpp +++ b/libraries/libstratosphere/source/lm/srv/lm_log_service_impl.cpp @@ -37,7 +37,7 @@ namespace ams::lm::srv { Result LogServiceImpl::OpenLogger(sf::Out> out, const sf::ClientProcessId &client_process_id) { /* Open logger. */ out.SetValue(LoggerObjectFactory::CreateSharedEmplaced<::ams::lm::ILogger, LoggerImpl>(this, client_process_id.GetValue())); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lm/srv/lm_logger_impl.cpp b/libraries/libstratosphere/source/lm/srv/lm_logger_impl.cpp index 4eef1e785..9b5cc8b42 100644 --- a/libraries/libstratosphere/source/lm/srv/lm_logger_impl.cpp +++ b/libraries/libstratosphere/source/lm/srv/lm_logger_impl.cpp @@ -139,13 +139,13 @@ namespace ams::lm::srv { PutLogToCustomSink(message); } - return ResultSuccess(); + R_SUCCEED(); } Result LoggerImpl::SetDestination(u32 destination) { /* Set the log destination. */ g_log_destination = destination; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lm/srv/lm_sd_card_logger.cpp b/libraries/libstratosphere/source/lm/srv/lm_sd_card_logger.cpp index 21d90ba29..1d7d20ad0 100644 --- a/libraries/libstratosphere/source/lm/srv/lm_sd_card_logger.cpp +++ b/libraries/libstratosphere/source/lm/srv/lm_sd_card_logger.cpp @@ -199,7 +199,7 @@ namespace ams::lm::srv { R_TRY(fs::WriteFile(file, 0, std::addressof(header), sizeof(header), fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } bool WriteLogFileHeader(const char *path) { @@ -215,7 +215,7 @@ namespace ams::lm::srv { /* Write the data. */ R_TRY(fs::WriteFile(file, offset, data, size, fs::WriteOption::Flush)); - return ResultSuccess(); + R_SUCCEED(); } bool WriteLogFileBody(const char *path, s64 offset, const u8 *data, size_t size) { diff --git a/libraries/libstratosphere/source/lr/lr_add_on_content_location_resolver_impl.cpp b/libraries/libstratosphere/source/lr/lr_add_on_content_location_resolver_impl.cpp index a22ffd2ec..ed8f796ef 100644 --- a/libraries/libstratosphere/source/lr/lr_add_on_content_location_resolver_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_add_on_content_location_resolver_impl.cpp @@ -39,24 +39,24 @@ namespace ams::lr { static_assert(sizeof(lr::Path) == sizeof(ncm::Path)); content_storage.GetPath(reinterpret_cast(out.GetPointer()), data_content_id); - return ResultSuccess(); + R_SUCCEED(); } Result AddOnContentLocationResolverImpl::RegisterAddOnContentStorageDeprecated(ncm::DataId id, ncm::StorageId storage_id) { /* Register storage for the given program id. 2.0.0-8.1.0 did not require an owner application id. */ R_UNLESS(m_registered_storages.Register(id, storage_id, ncm::InvalidApplicationId), lr::ResultTooManyRegisteredPaths()); - return ResultSuccess(); + R_SUCCEED(); } Result AddOnContentLocationResolverImpl::RegisterAddOnContentStorage(ncm::DataId id, ncm::ApplicationId application_id, ncm::StorageId storage_id) { /* Register storage for the given program id and owner application. */ R_UNLESS(m_registered_storages.Register(id, storage_id, application_id), lr::ResultTooManyRegisteredPaths()); - return ResultSuccess(); + R_SUCCEED(); } Result AddOnContentLocationResolverImpl::UnregisterAllAddOnContentPath() { m_registered_storages.Clear(); - return ResultSuccess(); + R_SUCCEED(); } Result AddOnContentLocationResolverImpl::RefreshApplicationAddOnContent(const sf::InArray &ids) { @@ -68,13 +68,13 @@ namespace ams::lr { m_registered_storages.ClearExcluding(reinterpret_cast(ids.GetPointer()), ids.GetSize()); } - return ResultSuccess(); + R_SUCCEED(); } Result AddOnContentLocationResolverImpl::UnregisterApplicationAddOnContent(ncm::ApplicationId id) { /* Remove entries belonging to the provided application. */ m_registered_storages.UnregisterOwnerProgram(id); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lr/lr_content_location_resolver_impl.cpp b/libraries/libstratosphere/source/lr/lr_content_location_resolver_impl.cpp index f2491f188..1caa3f3cd 100644 --- a/libraries/libstratosphere/source/lr/lr_content_location_resolver_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_content_location_resolver_impl.cpp @@ -41,22 +41,22 @@ namespace ams::lr { /* Obtain the content path. */ this->GetContentStoragePath(out.GetPointer(), program_content_id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectProgramPath(const Path &path, ncm::ProgramId id) { m_program_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ResolveApplicationControlPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_app_control_redirector.FindRedirection(out.GetPointer(), id), lr::ResultControlNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ResolveApplicationHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_html_docs_redirector.FindRedirection(out.GetPointer(), id), lr::ResultHtmlDocumentNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ResolveDataPath(sf::Out out, ncm::DataId id) { @@ -67,42 +67,42 @@ namespace ams::lr { /* Obtain the content path. */ this->GetContentStoragePath(out.GetPointer(), data_content_id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) { m_app_control_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_app_control_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) { m_html_docs_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_html_docs_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ResolveApplicationLegalInformationPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_legal_info_redirector.FindRedirection(out.GetPointer(), id), lr::ResultLegalInformationNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) { m_legal_info_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_legal_info_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::Refresh() { @@ -119,47 +119,47 @@ namespace ams::lr { /* Remove any existing redirections. */ this->ClearRedirections(); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) { m_program_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_program_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ClearApplicationRedirectionDeprecated() { this->ClearRedirections(RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ClearApplicationRedirection(const sf::InArray &excluding_ids) { this->ClearRedirections(excluding_ids.GetPointer(), excluding_ids.GetSize()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::EraseProgramRedirection(ncm::ProgramId id) { m_program_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::EraseApplicationControlRedirection(ncm::ProgramId id) { m_app_control_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) { m_html_docs_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::EraseApplicationLegalInformationRedirection(ncm::ProgramId id) { m_legal_info_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::ResolveProgramPathForDebug(sf::Out out, ncm::ProgramId id) { @@ -171,27 +171,27 @@ namespace ams::lr { R_CONVERT(ResultProgramNotFound, lr::ResultDebugProgramNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) { m_debug_program_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) { m_debug_program_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_debug_program_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result ContentLocationResolverImpl::EraseProgramRedirectionForDebug(ncm::ProgramId id) { m_debug_program_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } } 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 525267bff..d49bfed94 100644 --- a/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_location_resolver_manager_impl.cpp @@ -50,7 +50,7 @@ namespace ams::lr { /* Copy the output interface. */ *out = *resolver; - return ResultSuccess(); + R_SUCCEED(); } Result LocationResolverManagerImpl::OpenRegisteredLocationResolver(sf::Out> out) { @@ -63,7 +63,7 @@ namespace ams::lr { /* Copy the output interface. */ *out = m_registered_location_resolver; - return ResultSuccess(); + R_SUCCEED(); } Result LocationResolverManagerImpl::RefreshLocationResolver(ncm::StorageId storage_id) { @@ -78,7 +78,7 @@ namespace ams::lr { (*resolver)->Refresh(); } - return ResultSuccess(); + R_SUCCEED(); } Result LocationResolverManagerImpl::OpenAddOnContentLocationResolver(sf::Out> out) { @@ -91,7 +91,7 @@ namespace ams::lr { /* Copy the output interface. */ *out = m_add_on_content_location_resolver; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lr/lr_redirect_only_location_resolver_impl.cpp b/libraries/libstratosphere/source/lr/lr_redirect_only_location_resolver_impl.cpp index c9ea4aa6e..bdbaad86f 100644 --- a/libraries/libstratosphere/source/lr/lr_redirect_only_location_resolver_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_redirect_only_location_resolver_impl.cpp @@ -25,107 +25,107 @@ namespace ams::lr { Result RedirectOnlyLocationResolverImpl::ResolveProgramPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_program_redirector.FindRedirection(out.GetPointer(), id), lr::ResultProgramNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectProgramPath(const Path &path, ncm::ProgramId id) { m_program_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ResolveApplicationControlPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_app_control_redirector.FindRedirection(out.GetPointer(), id), lr::ResultControlNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ResolveApplicationHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_html_docs_redirector.FindRedirection(out.GetPointer(), id), lr::ResultHtmlDocumentNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ResolveDataPath(sf::Out out, ncm::DataId id) { AMS_UNUSED(out, id); - return lr::ResultDataNotFound(); + R_THROW(lr::ResultDataNotFound()); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationControlPathDeprecated(const Path &path, ncm::ProgramId id) { m_app_control_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationControlPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_app_control_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) { m_html_docs_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_html_docs_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ResolveApplicationLegalInformationPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(m_legal_info_redirector.FindRedirection(out.GetPointer(), id), lr::ResultLegalInformationNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationLegalInformationPathDeprecated(const Path &path, ncm::ProgramId id) { m_legal_info_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationLegalInformationPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_legal_info_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::Refresh() { this->ClearRedirections(); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationProgramPathDeprecated(const Path &path, ncm::ProgramId id) { m_program_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_program_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ClearApplicationRedirectionDeprecated() { this->ClearRedirections(RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ClearApplicationRedirection(const sf::InArray &excluding_ids) { this->ClearRedirections(excluding_ids.GetPointer(), excluding_ids.GetSize()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::EraseProgramRedirection(ncm::ProgramId id) { m_program_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::EraseApplicationControlRedirection(ncm::ProgramId id) { m_app_control_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::EraseApplicationHtmlDocumentRedirection(ncm::ProgramId id) { m_html_docs_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::EraseApplicationLegalInformationRedirection(ncm::ProgramId id) { m_legal_info_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::ResolveProgramPathForDebug(sf::Out out, ncm::ProgramId id) { @@ -135,27 +135,27 @@ namespace ams::lr { /* Otherwise, try to find a normal program redirection. */ R_UNLESS(m_program_redirector.FindRedirection(out.GetPointer(), id), lr::ResultDebugProgramNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectProgramPathForDebug(const Path &path, ncm::ProgramId id) { m_debug_program_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationProgramPathForDebugDeprecated(const Path &path, ncm::ProgramId id) { m_debug_program_redirector.SetRedirection(id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::RedirectApplicationProgramPathForDebug(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_debug_program_redirector.SetRedirection(id, owner_id, path, RedirectionFlags_Application); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectOnlyLocationResolverImpl::EraseProgramRedirectionForDebug(ncm::ProgramId id) { m_debug_program_redirector.EraseRedirection(id); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/lr/lr_registered_location_resolver_impl.cpp b/libraries/libstratosphere/source/lr/lr_registered_location_resolver_impl.cpp index 5fbb54611..56d9d0c82 100644 --- a/libraries/libstratosphere/source/lr/lr_registered_location_resolver_impl.cpp +++ b/libraries/libstratosphere/source/lr/lr_registered_location_resolver_impl.cpp @@ -61,7 +61,7 @@ namespace ams::lr { /* On < 9.0.0, exclusion lists were not supported yet, so simply clear and return. */ if (hos::GetVersion() < hos::Version_9_0_0) { this->ClearRedirections(); - return ResultSuccess(); + R_SUCCEED(); } if (num_ids) { @@ -76,67 +76,67 @@ namespace ams::lr { /* Clear redirectors using exclusion lists. */ m_program_redirector.ClearRedirectionsExcludingOwners(excluding_ids, num_ids); m_html_docs_redirector.ClearRedirectionsExcludingOwners(excluding_ids, num_ids); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::ResolveProgramPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(ResolvePath(out.GetPointer(), m_program_redirector, m_registered_program_locations, id), lr::ResultProgramNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RegisterProgramPathDeprecated(const Path &path, ncm::ProgramId id) { RegisterPath(m_registered_program_locations, id, path, ncm::InvalidProgramId); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RegisterProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { RegisterPath(m_registered_program_locations, id, path, owner_id); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::UnregisterProgramPath(ncm::ProgramId id) { m_registered_program_locations.Unregister(id); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RedirectProgramPathDeprecated(const Path &path, ncm::ProgramId id) { m_program_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RedirectProgramPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_program_redirector.SetRedirection(id, owner_id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::ResolveHtmlDocumentPath(sf::Out out, ncm::ProgramId id) { R_UNLESS(ResolvePath(out.GetPointer(), m_html_docs_redirector, m_registered_html_docs_locations, id), lr::ResultHtmlDocumentNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RegisterHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) { RegisterPath(m_registered_html_docs_locations, id, path, ncm::InvalidProgramId); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RegisterHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { RegisterPath(m_registered_html_docs_locations, id, path, owner_id); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::UnregisterHtmlDocumentPath(ncm::ProgramId id) { m_registered_html_docs_locations.Unregister(id); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RedirectHtmlDocumentPathDeprecated(const Path &path, ncm::ProgramId id) { m_html_docs_redirector.SetRedirection(id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::RedirectHtmlDocumentPath(const Path &path, ncm::ProgramId id, ncm::ProgramId owner_id) { m_html_docs_redirector.SetRedirection(id, owner_id, path); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredLocationResolverImpl::Refresh() { diff --git a/libraries/libstratosphere/source/ncm/ncm_api.cpp b/libraries/libstratosphere/source/ncm/ncm_api.cpp index 59f5a441e..4e1403d4c 100644 --- a/libraries/libstratosphere/source/ncm/ncm_api.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_api.cpp @@ -75,7 +75,7 @@ namespace ams::ncm { R_TRY(g_content_manager->OpenContentStorage(std::addressof(content_storage), storage_id)); *out = ContentStorage(std::move(content_storage)); - return ResultSuccess(); + R_SUCCEED(); } Result OpenContentMetaDatabase(ContentMetaDatabase *out, StorageId storage_id) { @@ -83,7 +83,7 @@ namespace ams::ncm { R_TRY(g_content_manager->OpenContentMetaDatabase(std::addressof(content_db), storage_id)); *out = ContentMetaDatabase(std::move(content_db)); - return ResultSuccess(); + R_SUCCEED(); } Result CleanupContentMetaDatabase(StorageId storage_id) { diff --git a/libraries/libstratosphere/source/ncm/ncm_content_info_utils.cpp b/libraries/libstratosphere/source/ncm/ncm_content_info_utils.cpp index a18969074..24bd00304 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_info_utils.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_info_utils.cpp @@ -62,7 +62,7 @@ namespace ams::ncm { offset += count; } - return ResultSuccess(); + R_SUCCEED(); } } @@ -80,11 +80,11 @@ namespace ams::ncm { R_TRY(ForEachContentInfo(key, db, [&size](bool *out_done, const ContentInfo &info) -> Result { size += CalculateRequiredSize(info.GetSize(), MaxClusterSize); *out_done = false; - return ResultSuccess(); + R_SUCCEED(); })); *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_management_utils.cpp b/libraries/libstratosphere/source/ncm/ncm_content_management_utils.cpp index 42a087129..f1864b838 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_management_utils.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_management_utils.cpp @@ -62,7 +62,7 @@ namespace ams::ncm { R_SUCCEED_IF(done); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -83,7 +83,7 @@ namespace ams::ncm { R_TRY(m_db->Set(package_meta_reader.GetKey(), meta_reader.GetData(), meta_reader.GetSize())); /* We're done. */ - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseBuilder::BuildFromStorage(ContentStorage *storage) { @@ -198,11 +198,11 @@ namespace ams::ncm { out_ids[count++] = { key.id }; } - return ResultSuccess(); + R_SUCCEED(); })); *out_count = static_cast(count); - return ResultSuccess(); + 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 2b521bd55..d173075c7 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_manager_impl.cpp @@ -89,26 +89,26 @@ namespace ams::ncm { if (cur_flags != BuiltInSystemSaveDataFlags) { R_TRY(fs::SetSaveDataFlags(BuiltInSystemSaveDataId, fs::SaveDataSpaceId::System, BuiltInSystemSaveDataFlags)); } - return ResultSuccess(); + R_SUCCEED(); } ALWAYS_INLINE Result GetContentStorageNotActiveResult(StorageId storage_id) { switch (storage_id) { - case StorageId::GameCard: return ncm::ResultGameCardContentStorageNotActive(); - case StorageId::BuiltInSystem: return ncm::ResultBuiltInSystemContentStorageNotActive(); - case StorageId::BuiltInUser: return ncm::ResultBuiltInUserContentStorageNotActive(); - case StorageId::SdCard: return ncm::ResultSdCardContentStorageNotActive(); - default: return ncm::ResultUnknownContentStorageNotActive(); + case StorageId::GameCard: R_THROW(ncm::ResultGameCardContentStorageNotActive()); + case StorageId::BuiltInSystem: R_THROW(ncm::ResultBuiltInSystemContentStorageNotActive()); + case StorageId::BuiltInUser: R_THROW(ncm::ResultBuiltInUserContentStorageNotActive()); + case StorageId::SdCard: R_THROW(ncm::ResultSdCardContentStorageNotActive()); + default: R_THROW(ncm::ResultUnknownContentStorageNotActive()); } } ALWAYS_INLINE Result GetContentMetaDatabaseNotActiveResult(StorageId storage_id) { switch (storage_id) { - case StorageId::GameCard: return ncm::ResultGameCardContentMetaDatabaseNotActive(); - case StorageId::BuiltInSystem: return ncm::ResultBuiltInSystemContentMetaDatabaseNotActive(); - case StorageId::BuiltInUser: return ncm::ResultBuiltInUserContentMetaDatabaseNotActive(); - case StorageId::SdCard: return ncm::ResultSdCardContentMetaDatabaseNotActive(); - default: return ncm::ResultUnknownContentMetaDatabaseNotActive(); + case StorageId::GameCard: R_THROW(ncm::ResultGameCardContentMetaDatabaseNotActive()); + case StorageId::BuiltInSystem: R_THROW(ncm::ResultBuiltInSystemContentMetaDatabaseNotActive()); + case StorageId::BuiltInUser: R_THROW(ncm::ResultBuiltInUserContentMetaDatabaseNotActive()); + case StorageId::SdCard: R_THROW(ncm::ResultSdCardContentMetaDatabaseNotActive()); + default: R_THROW(ncm::ResultUnknownContentMetaDatabaseNotActive()); } } @@ -163,7 +163,7 @@ namespace ams::ncm { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::GetContentStorageRoot(ContentStorageRoot **out, StorageId id) { @@ -174,11 +174,11 @@ namespace ams::ncm { for (auto &root : m_content_storage_roots) { if (root.storage_id == id) { *out = std::addressof(root); - return ResultSuccess(); + R_SUCCEED(); } } - return ncm::ResultUnknownStorage(); + R_THROW(ncm::ResultUnknownStorage()); } Result ContentManagerImpl::GetContentMetaDatabaseRoot(ContentMetaDatabaseRoot **out, StorageId id) { @@ -189,11 +189,11 @@ namespace ams::ncm { for (auto &root : m_content_meta_database_roots) { if (root.storage_id == id) { *out = std::addressof(root); - return ResultSuccess(); + R_SUCCEED(); } } - return ncm::ResultUnknownStorage(); + R_THROW(ncm::ResultUnknownStorage()); } @@ -206,7 +206,7 @@ namespace ams::ncm { std::strcpy(out->mount_name, impl::CreateUniqueMountName().str); util::SNPrintf(out->path, sizeof(out->path), "%s:/", out->mount_name); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InitializeGameCardContentStorageRoot(ContentStorageRoot *out) { @@ -217,7 +217,7 @@ namespace ams::ncm { std::strcpy(out->mount_name, impl::CreateUniqueMountName().str); util::SNPrintf(out->path, sizeof(out->path), "%s:", out->mount_name); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InitializeContentMetaDatabaseRoot(ContentMetaDatabaseRoot *out, StorageId storage_id, const SystemSaveDataInfo &info, size_t max_content_metas, ContentMetaMemoryResource *memory_resource) { @@ -233,7 +233,7 @@ namespace ams::ncm { out->mount_name[0] = '#'; util::SNPrintf(out->path, sizeof(out->path), "%s:/meta", out->mount_name); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InitializeGameCardContentMetaDatabaseRoot(ContentMetaDatabaseRoot *out, size_t max_content_metas, ContentMetaMemoryResource *memory_resource) { @@ -243,7 +243,7 @@ namespace ams::ncm { out->content_meta_database = nullptr; out->kvs = util::nullopt; - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::ImportContentMetaDatabaseImpl(StorageId storage_id, const char *import_mount_name, const char *path) { @@ -312,7 +312,7 @@ namespace ams::ncm { R_TRY(this->ImportContentMetaDatabaseImpl(StorageId::BuiltInSystem, bis_mount_name.str, "cnmtdb.arc")); } - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::Initialize(const ContentManagerConfig &config) { @@ -380,7 +380,7 @@ namespace ams::ncm { R_TRY(this->InitializeGameCardContentMetaDatabaseRoot(std::addressof(m_content_meta_database_roots[3]), GameCardMaxContentMetaCount, std::addressof(g_gamecard_content_meta_memory_resource))); m_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::CreateContentStorage(StorageId storage_id) { @@ -463,7 +463,7 @@ namespace ams::ncm { R_TRY(fs::HasDirectory(std::addressof(has_dir), root->path)); R_UNLESS(has_dir, ncm::ResultInvalidContentMetaDatabase()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::OpenContentStorage(sf::Out> out, StorageId storage_id) { @@ -484,7 +484,7 @@ namespace ams::ncm { } *out = root->content_storage; - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::OpenContentMetaDatabase(sf::Out> out, StorageId storage_id) { @@ -505,7 +505,7 @@ namespace ams::ncm { } *out = root->content_meta_database; - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::CloseContentStorageForcibly(StorageId storage_id) { @@ -583,7 +583,7 @@ namespace ams::ncm { /* Prevent unmounting. */ mount_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InactivateContentStorage(StorageId storage_id) { @@ -606,7 +606,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::ActivateContentMetaDatabase(StorageId storage_id) { @@ -644,7 +644,7 @@ namespace ams::ncm { mount_guard.Cancel(); } - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InactivateContentMetaDatabase(StorageId storage_id) { @@ -667,12 +667,12 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::InvalidateRightsIdCache() { m_rights_id_cache.Invalidate(); - return ResultSuccess(); + R_SUCCEED(); } Result ContentManagerImpl::GetMemoryReport(sf::Out out) { @@ -704,7 +704,7 @@ namespace ams::ncm { /* Output the report. */ out.SetValue(report); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp b/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp index d2d1c2175..c505ecbd8 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp @@ -53,12 +53,12 @@ namespace ams::ncm { auto delta = reader.GetPatchDeltaHeader(i); if ((src_version == 0 || delta->delta.source_version == src_version) && delta->delta.destination_version == dst_version) { *out_index = i; - return ResultSuccess(); + R_SUCCEED(); } } /* We didn't find the delta. */ - return ncm::ResultDeltaNotFound(); + R_THROW(ncm::ResultDeltaNotFound()); } s32 CountContentExceptForMeta(const PatchMetaExtendedDataReader &reader, s32 delta_index) { @@ -219,7 +219,7 @@ namespace ams::ncm { /* Assert that we copied the right number of infos. */ AMS_ASSERT(count == fragment_count); - return ResultSuccess(); + R_SUCCEED(); } Result PackagedContentMetaReader::CalculateConvertFragmentOnlyInstallContentMetaSize(size_t *out_size, u32 source_version) const { @@ -233,7 +233,7 @@ namespace ams::ncm { /* Recalculate. */ *out_size = this->CalculateConvertFragmentOnlyInstallContentMetaSize(fragment_count); - return ResultSuccess(); + R_SUCCEED(); } void PackagedContentMetaReader::ConvertToContentMeta(void *dst, size_t size, const ContentInfo &meta) { diff --git a/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp index 4e56f9cb6..eed8f0d13 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp @@ -46,7 +46,7 @@ namespace ams::ncm { /* Save output. */ *out = content_info->content_id; - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::Set(const ContentMetaKey &key, const sf::InBuffer &value) { @@ -64,7 +64,7 @@ namespace ams::ncm { } R_END_TRY_CATCH; out_size.SetValue(size); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::Remove(const ContentMetaKey &key) { @@ -74,7 +74,7 @@ namespace ams::ncm { R_CONVERT(kvdb::ResultKeyNotFound, ncm::ResultContentMetaNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetContentIdByType(sf::Out out_content_id, const ContentMetaKey &key, ContentType type) { @@ -100,7 +100,7 @@ namespace ams::ncm { } out_count.SetValue(count); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::List(sf::Out out_entries_total, sf::Out out_entries_written, const sf::OutArray &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) { @@ -143,7 +143,7 @@ namespace ams::ncm { out_entries_total.SetValue(entries_total); out_entries_written.SetValue(entries_written); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetLatestContentMetaKey(sf::Out out_key, u64 id) { @@ -168,7 +168,7 @@ namespace ams::ncm { R_UNLESS(found_key, ncm::ResultContentMetaNotFound()); out_key.SetValue(*found_key); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::ListApplication(sf::Out out_entries_total, sf::Out out_entries_written, const sf::OutArray &out_keys, ContentMetaType type) { @@ -200,7 +200,7 @@ namespace ams::ncm { out_entries_total.SetValue(entries_total); out_entries_written.SetValue(entries_written); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::Has(sf::Out out, const ContentMetaKey &key) { @@ -215,7 +215,7 @@ namespace ams::ncm { } R_END_TRY_CATCH; *out = true; - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::HasAll(sf::Out out, const sf::InArray &keys) { @@ -233,7 +233,7 @@ namespace ams::ncm { } *out = true; - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetSize(sf::Out out_size, const ContentMetaKey &key) { @@ -244,7 +244,7 @@ namespace ams::ncm { R_TRY(this->GetContentMetaSize(&size, key)); out_size.SetValue(size); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetRequiredSystemVersion(sf::Out out_version, const ContentMetaKey &key) { @@ -272,7 +272,7 @@ namespace ams::ncm { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetPatchId(sf::Out out_patch_id, const ContentMetaKey &key) { @@ -291,12 +291,12 @@ namespace ams::ncm { /* Obtain the patch id. */ out_patch_id.SetValue(reader.GetExtendedHeader()->patch_id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::DisableForcibly() { m_disabled = true; - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::LookupOrphanContent(const sf::OutArray &out_orphaned, const sf::InArray &content_ids) { @@ -332,7 +332,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::Commit() { @@ -362,7 +362,7 @@ namespace ams::ncm { /* We didn't find a content info. */ out.SetValue(false); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, const ContentMetaKey &key, s32 offset) { @@ -385,7 +385,7 @@ namespace ams::ncm { /* Set the ouput value. */ out_entries_written.SetValue(count); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) { @@ -401,7 +401,7 @@ namespace ams::ncm { /* Set the ouput value. */ out_attributes.SetValue(reader.GetHeader()->attributes); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetRequiredApplicationVersion(sf::Out out_version, const ContentMetaKey &key) { @@ -431,7 +431,7 @@ namespace ams::ncm { /* Set the ouput value. */ out_version.SetValue(required_version); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetContentIdByTypeAndIdOffset(sf::Out out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) { @@ -441,7 +441,7 @@ namespace ams::ncm { Result ContentMetaDatabaseImpl::GetCount(sf::Out out_count) { R_TRY(this->EnsureEnabled()); out_count.SetValue(m_kvs->GetCount()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentMetaDatabaseImpl::GetOwnerApplicationId(sf::Out out_id, const ContentMetaKey &key) { @@ -453,7 +453,7 @@ namespace ams::ncm { /* Applications are their own owner. */ if (key.type == ContentMetaType::Application) { out_id.SetValue({key.id}); - return ResultSuccess(); + R_SUCCEED(); } /* Obtain the content meta for the key. */ @@ -478,7 +478,7 @@ namespace ams::ncm { /* Set the output value. */ out_id.SetValue(owner_application_id); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl_base.hpp b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl_base.hpp index ede5a1526..367a09141 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl_base.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl_base.hpp @@ -37,7 +37,7 @@ namespace ams::ncm { /* Helpers. */ Result EnsureEnabled() const { R_UNLESS(!m_disabled, ncm::ResultInvalidContentMetaDatabase()); - return ResultSuccess(); + R_SUCCEED(); } Result GetContentMetaSize(size_t *out, const ContentMetaKey &key) const { @@ -45,7 +45,7 @@ namespace ams::ncm { R_CONVERT(kvdb::ResultKeyNotFound, ncm::ResultContentMetaNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result GetContentMetaPointer(const void **out_value_ptr, size_t *out_size, const ContentMetaKey &key) const { diff --git a/libraries/libstratosphere/source/ncm/ncm_content_meta_utils.cpp b/libraries/libstratosphere/source/ncm/ncm_content_meta_utils.cpp index 8bab15042..9caf41c02 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta_utils.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta_utils.cpp @@ -185,7 +185,7 @@ namespace ams::ncm { /* Write out the buffer we've populated. */ *out_meta_infos = std::move(buffer); - return ResultSuccess(); + R_SUCCEED(); }; /* If there are no firmware variations to list, read meta infos from base. */ @@ -251,7 +251,7 @@ namespace ams::ncm { /* Output the content meta info buffer. */ *out_meta_infos = std::move(buffer); - return ResultSuccess(); + R_SUCCEED(); } void SetMountContentMetaFunction(MountContentMetaFunction func) { diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp index 608928957..8e9d4faf9 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl.cpp @@ -49,7 +49,7 @@ namespace ams::ncm { R_CONVERT(fs::ResultPathNotFound, ncm::ResultContentNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } template @@ -93,7 +93,7 @@ namespace ams::ncm { /* If the provided function wishes to terminate immediately, we should respect it. */ if (!should_continue) { *out_should_continue = false; - return ResultSuccess(); + R_SUCCEED(); } /* Mark for retry. */ @@ -108,13 +108,13 @@ namespace ams::ncm { if (!should_continue) { *out_should_continue = false; - return ResultSuccess(); + R_SUCCEED(); } } } } - return ResultSuccess(); + R_SUCCEED(); } @@ -161,7 +161,7 @@ namespace ams::ncm { R_TRY(fs::DeleteDirectoryRecursively(path)); R_TRY(fs::CreateDirectory(path)); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -184,7 +184,7 @@ namespace ams::ncm { /* Open the base directory. */ R_TRY(this->OpenCurrentDirectory()); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::ContentIterator::OpenCurrentDirectory() { @@ -197,7 +197,7 @@ namespace ams::ncm { /* Increase our depth. */ ++m_depth; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::ContentIterator::OpenDirectory(const char *dir) { @@ -217,7 +217,7 @@ namespace ams::ncm { /* If we failed to load any entries, there's nothing to get. */ if (m_entry_count <= 0) { *out = util::nullopt; - return ResultSuccess(); + R_SUCCEED(); } /* Get the next entry. */ @@ -240,12 +240,12 @@ namespace ams::ncm { case fs::DirectoryEntryType_File: /* Otherwise, if the entry is a file, return it. */ *out = entry; - return ResultSuccess(); + R_SUCCEED(); AMS_UNREACHABLE_DEFAULT_CASE(); } } - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::ContentIterator::LoadEntries() { @@ -255,7 +255,7 @@ namespace ams::ncm { /* If we have no directories open, there's nothing for us to load. */ if (m_depth == 0) { m_entry_count = 0; - return ResultSuccess(); + R_SUCCEED(); } /* Determine the maximum entries that we can load. */ @@ -275,7 +275,7 @@ namespace ams::ncm { /* Set our entry count. */ m_entry_count = num_entries; - return ResultSuccess(); + R_SUCCEED(); } /* We didn't read any entries, so we need to advance to the next directory. */ @@ -345,7 +345,7 @@ namespace ams::ncm { R_UNLESS(has_registered, ncm::ResultInvalidContentStorageBase()); R_UNLESS(has_placeholder, ncm::ResultInvalidContentStorageBase()); - return ResultSuccess(); + R_SUCCEED(); } void ContentStorageImpl::InvalidateFileCache() { @@ -373,7 +373,7 @@ namespace ams::ncm { } R_END_TRY_CATCH; m_cached_content_id = content_id; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::Initialize(const char *path, MakeContentPathFunction content_path_func, MakePlaceHolderPathFunction placeholder_path_func, bool delay_flush, RightsIdCache *rights_id_cache) { @@ -387,13 +387,13 @@ namespace ams::ncm { m_make_content_path_func = content_path_func; m_placeholder_accessor.Initialize(std::addressof(m_root_path), placeholder_path_func, delay_flush); m_rights_id_cache = rights_id_cache; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GeneratePlaceHolderId(sf::Out out) { R_TRY(this->EnsureEnabled()); out.SetValue({util::GenerateUuid()}); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) { @@ -418,7 +418,7 @@ namespace ams::ncm { bool has = false; R_TRY(fs::HasFile(std::addressof(has), placeholder_path)); out.SetValue(has); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) { @@ -446,7 +446,7 @@ namespace ams::ncm { R_CONVERT(fs::ResultPathAlreadyExists, ncm::ResultContentAlreadyExists()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::Delete(ContentId content_id) { @@ -466,7 +466,7 @@ namespace ams::ncm { bool has = false; R_TRY(fs::HasFile(std::addressof(has), content_path)); out.SetValue(has); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetPath(sf::Out out, ContentId content_id) { @@ -481,7 +481,7 @@ namespace ams::ncm { R_TRY(fs::ConvertToFsCommonPath(common_path.str, sizeof(common_path.str), content_path)); out.SetValue(common_path); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetPlaceHolderPath(sf::Out out, PlaceHolderId placeholder_id) { @@ -496,7 +496,7 @@ namespace ams::ncm { R_TRY(fs::ConvertToFsCommonPath(common_path.str, sizeof(common_path.str), placeholder_path)); out.SetValue(common_path); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::CleanupAllPlaceHolder() { @@ -511,7 +511,7 @@ namespace ams::ncm { /* Cleanup the placeholder base directory. */ CleanDirectoryRecursively(placeholder_dir); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::ListPlaceHolder(sf::Out out_count, const sf::OutArray &out_buf) { @@ -542,11 +542,11 @@ namespace ams::ncm { out_buf[entry_count++] = placeholder_id; } - return ResultSuccess(); + R_SUCCEED(); })); out_count.SetValue(static_cast(entry_count)); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetContentCount(sf::Out out_count) { @@ -571,11 +571,11 @@ namespace ams::ncm { count++; } - return ResultSuccess(); + R_SUCCEED(); })); out_count.SetValue(static_cast(count)); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::ListContentId(sf::Out out_count, const sf::OutArray &out, s32 offset) { @@ -596,7 +596,7 @@ namespace ams::ncm { /* If we run out of entries before reaching the desired offset, we're done. */ if (!dir_entry) { out_count.SetValue(0); - return ResultSuccess(); + R_SUCCEED(); } /* If the current entry is a valid content id, advance. */ @@ -631,7 +631,7 @@ namespace ams::ncm { /* Set the output count. */ *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetSizeFromContentId(sf::Out out_size, ContentId content_id) { @@ -651,14 +651,14 @@ namespace ams::ncm { R_TRY(fs::GetFileSize(std::addressof(file_size), file)); out_size.SetValue(file_size); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::DisableForcibly() { m_disabled = true; this->InvalidateFileCache(); m_placeholder_accessor.InvalidateAll(); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) { @@ -687,7 +687,7 @@ namespace ams::ncm { R_CONVERT(fs::ResultPathAlreadyExists, ncm::ResultContentAlreadyExists()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) { @@ -718,7 +718,7 @@ namespace ams::ncm { /* Output the fs rights id. */ out_rights_id.SetValue(rights_id.id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out out_rights_id, PlaceHolderId placeholder_id) { @@ -739,7 +739,7 @@ namespace ams::ncm { /* Output the fs rights id. */ out_rights_id.SetValue(rights_id.id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetRightsIdFromContentId(sf::Out out_rights_id, ContentId content_id) { @@ -747,7 +747,7 @@ namespace ams::ncm { /* Attempt to obtain the rights id from the cache. */ if (m_rights_id_cache->Find(out_rights_id.GetPointer(), content_id)) { - return ResultSuccess(); + R_SUCCEED(); } /* Get the path of the content. */ @@ -762,7 +762,7 @@ namespace ams::ncm { m_rights_id_cache->Store(content_id, rights_id); out_rights_id.SetValue(rights_id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) { @@ -799,7 +799,7 @@ namespace ams::ncm { Result ContentStorageImpl::FlushPlaceHolder() { m_placeholder_accessor.InvalidateAll(); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out out_size, PlaceHolderId placeholder_id) { @@ -813,7 +813,7 @@ namespace ams::ncm { /* Set the output if placeholder file is found. */ if (found) { out_size.SetValue(file_size); - return ResultSuccess(); + R_SUCCEED(); } /* Get the path of the placeholder. */ @@ -829,7 +829,7 @@ namespace ams::ncm { R_TRY(fs::GetFileSize(std::addressof(file_size), file)); out_size.SetValue(file_size); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::RepairInvalidFileAttribute() { @@ -850,7 +850,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); }; /* Fix content. */ @@ -872,7 +872,7 @@ namespace ams::ncm { R_TRY(TraverseDirectory(path, GetHierarchicalContentDirectoryDepth(m_make_content_path_func), fix_file_attributes)); } - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) { @@ -880,7 +880,7 @@ namespace ams::ncm { /* Attempt to find the rights id in the cache. */ if (m_rights_id_cache->Find(out_rights_id.GetPointer(), cache_content_id)) { - return ResultSuccess(); + R_SUCCEED(); } /* Get the placeholder path. */ @@ -898,16 +898,16 @@ namespace ams::ncm { /* Set output. */ out_rights_id.SetValue(rights_id); - return ResultSuccess(); + R_SUCCEED(); } Result ContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) { AMS_UNUSED(content_id, path); - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } Result ContentStorageImpl::ClearRegisteredPath() { - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp index 2fb3cbbb2..b14d3dc8f 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_storage_impl_base.hpp @@ -31,7 +31,7 @@ namespace ams::ncm { /* Helpers. */ Result EnsureEnabled() const { R_UNLESS(!m_disabled, ncm::ResultInvalidContentStorage()); - return ResultSuccess(); + R_SUCCEED(); } static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path) { @@ -41,7 +41,7 @@ namespace ams::ncm { R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str)); out_rights_id->key_generation = 0; } - return ResultSuccess(); + R_SUCCEED(); } public: /* Actual commands. */ diff --git a/libraries/libstratosphere/source/ncm/ncm_fs_utils.cpp b/libraries/libstratosphere/source/ncm/ncm_fs_utils.cpp index aab8fcf45..7a8aab32e 100644 --- a/libraries/libstratosphere/source/ncm/ncm_fs_utils.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_fs_utils.cpp @@ -84,7 +84,7 @@ namespace ams::ncm::impl { /* Flush the destination file. */ R_TRY(fs::FlushFile(dst_file)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.cpp index d2554a502..1f3b648a8 100644 --- a/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.cpp @@ -20,37 +20,37 @@ namespace ams::ncm { Result HostContentStorageImpl::GeneratePlaceHolderId(sf::Out out) { AMS_UNUSED(out); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) { AMS_UNUSED(placeholder_id, content_id, size); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) { AMS_UNUSED(placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::HasPlaceHolder(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) { AMS_UNUSED(placeholder_id, offset, data); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::Register(PlaceHolderId placeholder_id, ContentId content_id) { AMS_UNUSED(placeholder_id, content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::Delete(ContentId content_id) { AMS_UNUSED(content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::Has(sf::Out out, ContentId content_id) { @@ -62,12 +62,12 @@ namespace ams::ncm { /* The content is absent, this is fine. */ R_CATCH(ncm::ResultContentNotFound) { out.SetValue(false); - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; out.SetValue(true); - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::GetPath(sf::Out out, ContentId content_id) { @@ -77,61 +77,61 @@ namespace ams::ncm { Result HostContentStorageImpl::GetPlaceHolderPath(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::CleanupAllPlaceHolder() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::ListPlaceHolder(sf::Out out_count, const sf::OutArray &out_buf) { AMS_UNUSED(out_count, out_buf); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetContentCount(sf::Out out_count) { AMS_UNUSED(out_count); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::ListContentId(sf::Out out_count, const sf::OutArray &out_buf, s32 offset) { AMS_UNUSED(out_count, out_buf, offset); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetSizeFromContentId(sf::Out out_size, ContentId content_id) { AMS_UNUSED(out_size, content_id); - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } Result HostContentStorageImpl::DisableForcibly() { m_disabled = true; - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) { AMS_UNUSED(placeholder_id, old_content_id, new_content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) { AMS_UNUSED(placeholder_id, size); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) { AMS_UNUSED(buf, content_id, offset); - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out out_rights_id, PlaceHolderId placeholder_id) { AMS_UNUSED(out_rights_id, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out out_rights_id, PlaceHolderId placeholder_id) { AMS_UNUSED(out_rights_id, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out out_rights_id, ContentId content_id) { @@ -141,7 +141,7 @@ namespace ams::ncm { /* Output the fs rights id. */ out_rights_id.SetValue(rights_id.id); - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::GetRightsIdFromContentId(sf::Out out_rights_id, ContentId content_id) { @@ -157,46 +157,46 @@ namespace ams::ncm { /* The content is absent, output a blank rights id. */ R_CATCH(fs::ResultTargetNotFound) { out_rights_id.SetValue({}); - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; /* Output the rights id. */ out_rights_id.SetValue(rights_id); - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) { AMS_UNUSED(content_id, offset, data); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetFreeSpaceSize(sf::Out out_size) { out_size.SetValue(0); - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::GetTotalSpaceSize(sf::Out out_size) { out_size.SetValue(0); - return ResultSuccess(); + R_SUCCEED(); } Result HostContentStorageImpl::FlushPlaceHolder() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::RepairInvalidFileAttribute() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) { AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result HostContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) { @@ -207,7 +207,7 @@ namespace ams::ncm { Result HostContentStorageImpl::ClearRegisteredPath() { AMS_ABORT_UNLESS(spl::IsDevelopment()); m_registered_content->ClearPaths(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.hpp index 757ab540a..6a6b532dc 100644 --- a/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_host_content_storage_impl.hpp @@ -26,7 +26,7 @@ namespace ams::ncm { /* Helpers. */ Result EnsureEnabled() const { R_UNLESS(!m_disabled, ncm::ResultInvalidContentStorage()); - return ResultSuccess(); + R_SUCCEED(); } static Result GetRightsId(ncm::RightsId *out_rights_id, const Path &path) { @@ -36,7 +36,7 @@ namespace ams::ncm { R_TRY(fs::GetRightsId(std::addressof(out_rights_id->id), path.str)); out_rights_id->key_generation = 0; } - return ResultSuccess(); + R_SUCCEED(); } public: HostContentStorageImpl(RegisteredHostContent *registered_content) : m_registered_content(registered_content), m_disabled(false) { /* ... */ } diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp index 3fd97d8c6..57b8b5106 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task_base.cpp @@ -79,7 +79,7 @@ namespace ams::ncm { Result InstallTaskBase::Prepare() { R_TRY(this->SetLastResultOnFailure(this->PrepareImpl())); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::GetPreparedPlaceHolderPath(Path *out_path, u64 id, ContentMetaType meta_type, ContentType type) { @@ -124,7 +124,7 @@ namespace ams::ncm { /* Get the path. */ storage.GetPlaceHolderPath(out_path, *placeholder_id); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::CalculateRequiredSize(s64 *out_size) { @@ -151,7 +151,7 @@ namespace ams::ncm { } *out_size = required_size; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::PrepareImpl() { @@ -196,7 +196,7 @@ namespace ams::ncm { R_TRY(m_data->Cleanup()); this->CleanupProgress(); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::CleanupOne(const InstallContentMeta &content_meta) { @@ -219,7 +219,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ListContentMetaKey(s32 *out_keys_written, StorageContentMetaKey *out_keys, s32 out_keys_count, s32 offset, ListContentMetaKeyFilter filter) { @@ -230,7 +230,7 @@ namespace ams::ncm { /* Offset exceeds keys that can be written. */ if (count <= offset) { *out_keys_written = 0; - return ResultSuccess(); + R_SUCCEED(); } if (filter == ListContentMetaKeyFilter::All) { @@ -284,7 +284,7 @@ namespace ams::ncm { *out_keys_written = keys_written; } - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ListApplicationContentMetaKey(s32 *out_keys_written, ApplicationContentMetaKey *out_keys, s32 out_keys_count, s32 offset) { @@ -295,7 +295,7 @@ namespace ams::ncm { /* Offset exceeds keys that can be written. */ if (count <= offset) { *out_keys_written = 0; - return ResultSuccess(); + R_SUCCEED(); } /* Iterate over content meta. */ @@ -320,12 +320,12 @@ namespace ams::ncm { } *out_keys_written = keys_written; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::Execute() { R_TRY(this->SetLastResultOnFailure(this->ExecuteImpl())); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ExecuteImpl() { @@ -376,7 +376,7 @@ namespace ams::ncm { Result InstallTaskBase::PrepareAndExecute() { R_TRY(this->SetLastResultOnFailure(this->PrepareImpl())); R_TRY(this->SetLastResultOnFailure(this->ExecuteImpl())); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::VerifyAllNotCommitted(const StorageContentMetaKey *keys, s32 num_keys) { @@ -407,7 +407,7 @@ namespace ams::ncm { /* Ensure number of uncommitted keys equals the number of input keys. */ R_UNLESS(num_not_committed == num_keys, ncm::ResultListPartiallyNotCommitted()); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::CommitImpl(const StorageContentMetaKey *keys, s32 num_keys) { @@ -503,7 +503,7 @@ namespace ams::ncm { this->SetProgressState(InstallProgressState::Committed); } - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::Commit(const StorageContentMetaKey *keys, s32 num_keys) { @@ -526,12 +526,12 @@ namespace ams::ncm { /* Check if the attributes are set for including the exfat driver. */ if (content_meta.GetReader().GetHeader()->attributes & ContentMetaAttribute_IncludesExFatDriver) { *out = true; - return ResultSuccess(); + R_SUCCEED(); } } *out = false; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::WritePlaceHolderBuffer(InstallContentInfo *content_info, const void *data, size_t data_size) { @@ -553,7 +553,7 @@ namespace ams::ncm { /* Update the hash for the new data. */ m_sha256_generator.Update(data, data_size); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::WritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info) { @@ -603,7 +603,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } bool InstallTaskBase::IsNecessaryInstallTicket(const fs::RightsId &rights_id) { @@ -794,7 +794,7 @@ namespace ams::ncm { /* Push the content meta. */ m_data->Push(tmp_buffer.Get(), tmp_buffer.GetSize()); - return ResultSuccess(); + R_SUCCEED(); } void InstallTaskBase::PrepareAgain() { @@ -802,7 +802,7 @@ namespace ams::ncm { } Result InstallTaskBase::PrepareDependency() { - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::PrepareSystemUpdateDependency() { @@ -902,13 +902,13 @@ namespace ams::ncm { /* If not rebootless, a reboot is required. */ if (!(content_meta_info.attributes & ContentMetaAttribute_Rebootless)) { *out = SystemUpdateTaskApplyInfo::RequireReboot; - return ResultSuccess(); + R_SUCCEED(); } } } *out = SystemUpdateTaskApplyInfo::RequireNoReboot; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::PrepareContentMetaIfLatest(const ContentMetaKey &key) { @@ -923,7 +923,7 @@ namespace ams::ncm { R_TRY(this->PrepareContentMeta(install_content_meta_info, key, util::nullopt)); } - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::IsNewerThanInstalled(bool *out, const ContentMetaKey &key) { @@ -950,13 +950,13 @@ namespace ams::ncm { /* Check if installed key is newer. */ if (latest_key.version >= key.version) { *out = false; - return ResultSuccess(); + R_SUCCEED(); } } /* Input key is newer. */ *out = true; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::CountInstallContentMetaData(s32 *out_count) { @@ -1022,7 +1022,7 @@ namespace ams::ncm { /* Set output. */ *out = std::move(install_meta_data); - return ResultSuccess(); + R_SUCCEED(); } InstallContentInfo InstallTaskBase::MakeInstallContentInfoFrom(const InstallContentMetaInfo &info, const PlaceHolderId &placeholder_id, util::optional is_tmp) { @@ -1146,11 +1146,11 @@ namespace ams::ncm { } /* No need to look for any further keys. */ - return ResultSuccess(); + R_SUCCEED(); } *out_size = 0; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ReadContentMetaInfoList(s32 *out_count, std::unique_ptr *out_meta_infos, const ContentMetaKey &key) { @@ -1177,7 +1177,7 @@ namespace ams::ncm { /* Delete the placeholder. */ content_storage.DeletePlaceHolder(placeholder_id); - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::FindMaxRequiredApplicationVersion(u32 *out) { @@ -1206,7 +1206,7 @@ namespace ams::ncm { } *out = max_version; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ListOccupiedSize(s32 *out_written, InstallTaskOccupiedSize *out_list, s32 out_list_size, s32 offset) { @@ -1263,7 +1263,7 @@ namespace ams::ncm { /* Write the out count. */ *out_written = count; - return ResultSuccess(); + R_SUCCEED(); } void InstallTaskBase::SetProgressState(InstallProgressState state) { @@ -1306,7 +1306,7 @@ namespace ams::ncm { } *out = max_version; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::CanContinue() { @@ -1322,7 +1322,7 @@ namespace ams::ncm { break; } - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskBase::ListRightsIds(s32 *out_count, Span out_span, const ContentMetaKey &key, s32 offset) { @@ -1348,7 +1348,7 @@ namespace ams::ncm { } } - return ncm::ResultContentMetaNotFound(); + R_THROW(ncm::ResultContentMetaNotFound()); } Result InstallTaskBase::ListRightsIdsByInstallContentMeta(s32 *out_count, Span out_span, const InstallContentMeta &content_meta, s32 offset) { @@ -1356,7 +1356,7 @@ namespace ams::ncm { /* Thus, we have nothing to list. */ if (offset > 0) { *out_count = 0; - return ResultSuccess(); + R_SUCCEED(); } /* Create a reader. */ @@ -1391,6 +1391,6 @@ namespace ams::ncm { /* Sort and remove duplicate ids from the output span. */ std::sort(out_span.begin(), out_span.end()); *out_count = std::distance(out_span.begin(), std::unique(out_span.begin(), out_span.end())); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp b/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp index 101b89cbe..9b99e39d7 100644 --- a/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_install_task_data.cpp @@ -45,7 +45,7 @@ namespace ams::ncm { /* Output the buffer and size. */ out->data = std::move(buffer); out->size = data_size; - return ResultSuccess(); + R_SUCCEED(); } Result InstallTaskDataBase::Update(const InstallContentMeta &content_meta, s32 index) { @@ -64,13 +64,13 @@ namespace ams::ncm { /* If the id matches we are successful. */ if (content_meta.GetReader().GetKey().id == id) { *out = true; - return ResultSuccess(); + R_SUCCEED(); } } /* We didn't find the value. */ *out = false; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::GetProgress(InstallProgress *out_progress) { @@ -95,27 +95,27 @@ namespace ams::ncm { } *out_progress = install_progress; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out_info) { *out_info = m_system_update_task_apply_info; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::SetState(InstallProgressState state) { m_state = state; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::SetLastResult(Result result) { m_last_result = result; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::SetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo info) { m_system_update_task_apply_info = info; - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::Push(const void *data, size_t size) { @@ -137,12 +137,12 @@ namespace ams::ncm { /* Relinquish control over the memory allocated to the data holder. */ holder.release(); - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::Count(s32 *out) { *out = m_data_list.size(); - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::GetSize(size_t *out_size, s32 index) { @@ -151,7 +151,7 @@ namespace ams::ncm { for (auto &data_holder : m_data_list) { if (index == count++) { *out_size = data_holder.size; - return ResultSuccess(); + R_SUCCEED(); } } /* Out of bounds indexing is an unrecoverable error. */ @@ -165,7 +165,7 @@ namespace ams::ncm { if (index == count++) { R_UNLESS(out_size >= data_holder.size, ncm::ResultBufferInsufficient()); std::memcpy(out, data_holder.data.get(), data_holder.size); - return ResultSuccess(); + R_SUCCEED(); } } /* Out of bounds indexing is an unrecoverable error. */ @@ -179,7 +179,7 @@ namespace ams::ncm { if (index == count++) { R_UNLESS(data_size == data_holder.size, ncm::ResultBufferInsufficient()); std::memcpy(data_holder.data.get(), data, data_size); - return ResultSuccess(); + R_SUCCEED(); } } /* Out of bounds indexing is an unrecoverable error. */ @@ -200,7 +200,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result MemoryInstallTaskData::Cleanup() { @@ -209,7 +209,7 @@ namespace ams::ncm { m_data_list.pop_front(); delete data_holder; } - return ResultSuccess(); + R_SUCCEED(); } Result FileInstallTaskData::Create(const char *path, s32 max_entries) { @@ -257,12 +257,12 @@ namespace ams::ncm { } *out_progress = install_progress; - return ResultSuccess(); + R_SUCCEED(); } Result FileInstallTaskData::GetSystemUpdateTaskApplyInfo(SystemUpdateTaskApplyInfo *out_info) { *out_info = m_header.system_update_task_apply_info; - return ResultSuccess(); + R_SUCCEED(); } Result FileInstallTaskData::SetState(InstallProgressState state) { @@ -302,14 +302,14 @@ namespace ams::ncm { Result FileInstallTaskData::Count(s32 *out) { *out = m_header.count; - return ResultSuccess(); + R_SUCCEED(); } Result FileInstallTaskData::GetSize(size_t *out_size, s32 index) { EntryInfo entry_info; R_TRY(this->GetEntryInfo(std::addressof(entry_info), index)); *out_size = entry_info.size; - return ResultSuccess(); + R_SUCCEED(); } Result FileInstallTaskData::Get(s32 index, void *out, size_t out_size) { diff --git a/libraries/libstratosphere/source/ncm/ncm_on_memory_content_meta_database_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_on_memory_content_meta_database_impl.cpp index 5ede4b69e..663f9f532 100644 --- a/libraries/libstratosphere/source/ncm/ncm_on_memory_content_meta_database_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_on_memory_content_meta_database_impl.cpp @@ -61,7 +61,7 @@ namespace ams::ncm { out_entries_total.SetValue(entries_total); out_entries_written.SetValue(entries_written); - return ResultSuccess(); + R_SUCCEED(); } Result OnMemoryContentMetaDatabaseImpl::GetLatestContentMetaKey(sf::Out out_key, u64 id) { @@ -84,17 +84,17 @@ namespace ams::ncm { R_UNLESS(found_key, ncm::ResultContentMetaNotFound()); out_key.SetValue(*found_key); - return ResultSuccess(); + R_SUCCEED(); } Result OnMemoryContentMetaDatabaseImpl::LookupOrphanContent(const sf::OutArray &out_orphaned, const sf::InArray &content_ids) { AMS_UNUSED(out_orphaned, content_ids); - return ncm::ResultInvalidContentMetaDatabase(); + R_THROW(ncm::ResultInvalidContentMetaDatabase()); } Result OnMemoryContentMetaDatabaseImpl::Commit() { R_TRY(this->EnsureEnabled()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_package_install_task.cpp b/libraries/libstratosphere/source/ncm/ncm_package_install_task.cpp index 07d3f998d..dce80d674 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_install_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_install_task.cpp @@ -28,7 +28,7 @@ namespace ams::ncm { Result PackageInstallTask::GetInstallContentMetaInfo(InstallContentMetaInfo *out_info, const ContentMetaKey &key) { AMS_UNUSED(out_info, key); - return ncm::ResultContentNotFound(); + R_THROW(ncm::ResultContentNotFound()); } Result PackageInstallTask::PrepareInstallContentMetaData() { @@ -57,7 +57,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_package_install_task_base.cpp b/libraries/libstratosphere/source/ncm/ncm_package_install_task_base.cpp index c8068fc75..faf476057 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_install_task_base.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_install_task_base.cpp @@ -22,7 +22,7 @@ namespace ams::ncm { m_package_root.Assign(package_root_path); m_buffer = buffer; m_buffer_size = buffer_size; - return ResultSuccess(); + R_SUCCEED(); } Result PackageInstallTaskBase::OnWritePlaceHolder(const ContentMetaKey &key, InstallContentInfo *content_info) { @@ -56,7 +56,7 @@ namespace ams::ncm { R_TRY(this->WritePlaceHolderBuffer(content_info, m_buffer, size_read)); } - return ResultSuccess(); + R_SUCCEED(); } Result PackageInstallTaskBase::InstallTicket(const fs::RightsId &rights_id, ContentMetaType meta_type) { @@ -104,7 +104,7 @@ namespace ams::ncm { /* TODO: es::ImportTicket() */ /* TODO: How should es be handled without undesired effects? */ - return ResultSuccess(); + R_SUCCEED(); } void PackageInstallTaskBase::CreateContentPath(PackagePath *out_path, ContentId content_id) { 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 aa2be4e6a..b2b991a64 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_system_downgrade_task.cpp @@ -58,7 +58,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } Result PackageSystemDowngradeTask::Commit() { 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 d9941e1d7..8f2e49721 100644 --- a/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_package_system_update_task.cpp @@ -67,7 +67,7 @@ namespace ams::ncm { /* Set the context path. */ m_context_path.Assign(context_path); - return ResultSuccess(); + R_SUCCEED(); } util::optional PackageSystemUpdateTask::GetSystemUpdateMetaKey() { @@ -103,7 +103,7 @@ namespace ams::ncm { /* Create a new install content meta info. */ *out = InstallContentMetaInfo::MakeUnverifiable(info.GetId(), info.GetSize(), key); - return ResultSuccess(); + R_SUCCEED(); } Result PackageSystemUpdateTask::PrepareInstallContentMetaData() { @@ -140,12 +140,12 @@ namespace ams::ncm { /* Check if the info is for meta content. */ if (info.GetType() == ContentType::Meta) { *out = info; - return ResultSuccess(); + R_SUCCEED(); } } /* Not found. */ - return ncm::ResultContentInfoNotFound(); + R_THROW(ncm::ResultContentInfoNotFound()); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp b/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp index 81b8ce703..a5298d388 100644 --- a/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_placeholder_accessor.cpp @@ -72,7 +72,7 @@ namespace ams::ncm { } *out = placeholder_id; - return ResultSuccess(); + R_SUCCEED(); } Result PlaceHolderAccessor::Open(fs::FileHandle *out_handle, PlaceHolderId placeholder_id) { @@ -176,7 +176,7 @@ namespace ams::ncm { R_CONVERT(fs::ResultPathAlreadyExists, ncm::ResultPlaceHolderAlreadyExists()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result PlaceHolderAccessor::DeletePlaceHolderFile(PlaceHolderId placeholder_id) { @@ -189,7 +189,7 @@ namespace ams::ncm { R_CONVERT(fs::ResultPathNotFound, ncm::ResultPlaceHolderNotFound()) } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result PlaceHolderAccessor::WritePlaceHolderFile(PlaceHolderId placeholder_id, s64 offset, const void *buffer, size_t size) { @@ -234,7 +234,7 @@ namespace ams::ncm { *found_in_cache = false; } - return ResultSuccess(); + R_SUCCEED(); } void PlaceHolderAccessor::InvalidateAll() { diff --git a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp index f3702e43f..4679dddfe 100644 --- a/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_read_only_content_storage_impl.cpp @@ -48,7 +48,7 @@ namespace ams::ncm { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } @@ -57,42 +57,42 @@ namespace ams::ncm { R_TRY(this->EnsureEnabled()); m_root_path.Assign(path); m_make_content_path_func = content_path_func; - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GeneratePlaceHolderId(sf::Out out) { AMS_UNUSED(out); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) { AMS_UNUSED(placeholder_id, content_id, size); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::DeletePlaceHolder(PlaceHolderId placeholder_id) { AMS_UNUSED(placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::HasPlaceHolder(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, const sf::InBuffer &data) { AMS_UNUSED(placeholder_id, offset, data); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::Register(PlaceHolderId placeholder_id, ContentId content_id) { AMS_UNUSED(placeholder_id, content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::Delete(ContentId content_id) { AMS_UNUSED(content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::Has(sf::Out out, ContentId content_id) { @@ -113,7 +113,7 @@ namespace ams::ncm { } out.SetValue(has); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GetPath(sf::Out out, ContentId content_id) { @@ -137,31 +137,31 @@ namespace ams::ncm { R_TRY(fs::ConvertToFsCommonPath(common_path.str, sizeof(common_path.str), content_path)); out.SetValue(common_path); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GetPlaceHolderPath(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::CleanupAllPlaceHolder() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::ListPlaceHolder(sf::Out out_count, const sf::OutArray &out_buf) { AMS_UNUSED(out_count, out_buf); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetContentCount(sf::Out out_count) { AMS_UNUSED(out_count); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::ListContentId(sf::Out out_count, const sf::OutArray &out_buf, s32 offset) { AMS_UNUSED(out_count, out_buf, offset); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetSizeFromContentId(sf::Out out_size, ContentId content_id) { @@ -177,22 +177,22 @@ namespace ams::ncm { R_TRY(fs::GetFileSize(std::addressof(file_size), file)); out_size.SetValue(file_size); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::DisableForcibly() { m_disabled = true; - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) { AMS_UNUSED(placeholder_id, old_content_id, new_content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) { AMS_UNUSED(placeholder_id, size); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::ReadContentIdFile(const sf::OutBuffer &buf, ContentId content_id, s64 offset) { @@ -208,17 +208,17 @@ namespace ams::ncm { /* Read from the given offset up to the given size. */ R_TRY(fs::ReadFile(file, offset, buf.GetPointer(), buf.GetSize())); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdDeprecated(sf::Out out_rights_id, PlaceHolderId placeholder_id) { AMS_UNUSED(out_rights_id, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderId(sf::Out out_rights_id, PlaceHolderId placeholder_id) { AMS_UNUSED(out_rights_id, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetRightsIdFromContentIdDeprecated(sf::Out out_rights_id, ContentId content_id) { @@ -228,7 +228,7 @@ namespace ams::ncm { /* Output the fs rights id. */ out_rights_id.SetValue(rights_id.id); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GetRightsIdFromContentId(sf::Out out_rights_id, ContentId content_id) { @@ -243,49 +243,49 @@ namespace ams::ncm { R_TRY(GetRightsId(std::addressof(rights_id), path)); out_rights_id.SetValue(rights_id); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) { AMS_UNUSED(content_id, offset, data); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetFreeSpaceSize(sf::Out out_size) { out_size.SetValue(0); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::GetTotalSpaceSize(sf::Out out_size) { out_size.SetValue(0); - return ResultSuccess(); + R_SUCCEED(); } Result ReadOnlyContentStorageImpl::FlushPlaceHolder() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetSizeFromPlaceHolderId(sf::Out out, PlaceHolderId placeholder_id) { AMS_UNUSED(out, placeholder_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::RepairInvalidFileAttribute() { - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::GetRightsIdFromPlaceHolderIdWithCache(sf::Out out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) { AMS_UNUSED(out_rights_id, placeholder_id, cache_content_id); - return ncm::ResultNotSupported(); + R_THROW(ncm::ResultNotSupported()); } Result ReadOnlyContentStorageImpl::RegisterPath(const ContentId &content_id, const Path &path) { AMS_UNUSED(content_id, path); - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } Result ReadOnlyContentStorageImpl::ClearRegisteredPath() { - return ncm::ResultInvalidOperation(); + R_THROW(ncm::ResultInvalidOperation()); } } diff --git a/libraries/libstratosphere/source/ncm/ncm_registered_host_content.cpp b/libraries/libstratosphere/source/ncm/ncm_registered_host_content.cpp index dcb51fa0f..c4466bc9f 100644 --- a/libraries/libstratosphere/source/ncm/ncm_registered_host_content.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_registered_host_content.cpp @@ -52,7 +52,7 @@ namespace ams::ncm { for (auto ®istered_path : m_path_list) { if (registered_path.GetContentId() == content_id) { registered_path.SetPath(path); - return ResultSuccess(); + R_SUCCEED(); } } @@ -62,7 +62,7 @@ namespace ams::ncm { /* Insert the path into the list. */ m_path_list.push_back(*registered_path); - return ResultSuccess(); + R_SUCCEED(); } Result RegisteredHostContent::GetPath(Path *out, const ncm::ContentId &content_id) { @@ -72,10 +72,10 @@ namespace ams::ncm { for (const auto ®istered_path : m_path_list) { if (registered_path.GetContentId() == content_id) { registered_path.GetPath(out); - return ResultSuccess(); + R_SUCCEED(); } } - return ncm::ResultContentNotFound(); + R_THROW(ncm::ResultContentNotFound()); } void RegisteredHostContent::ClearPaths() { diff --git a/libraries/libstratosphere/source/ncm/ncm_remote_content_manager_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_remote_content_manager_impl.hpp index 3b1b5e8c4..7fda59ee5 100644 --- a/libraries/libstratosphere/source/ncm/ncm_remote_content_manager_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_remote_content_manager_impl.hpp @@ -51,7 +51,7 @@ namespace ams::ncm { R_TRY(::ncmOpenContentStorage(std::addressof(cs), static_cast(storage_id))); out.SetValue(ObjectFactory::CreateSharedEmplaced(cs)); - return ResultSuccess(); + R_SUCCEED(); } Result OpenContentMetaDatabase(sf::Out> out, StorageId storage_id) { @@ -59,7 +59,7 @@ namespace ams::ncm { R_TRY(::ncmOpenContentMetaDatabase(std::addressof(db), static_cast(storage_id))); out.SetValue(ObjectFactory::CreateSharedEmplaced(db)); - return ResultSuccess(); + R_SUCCEED(); } Result CloseContentStorageForcibly(StorageId storage_id) { diff --git a/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp index 255c6100b..0736bcde1 100644 --- a/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_remote_content_storage_impl.hpp @@ -141,7 +141,7 @@ namespace ams::ncm { static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id)); std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer())); - return ResultSuccess(); + R_SUCCEED(); } Result GetRightsIdFromPlaceHolderId(sf::Out out_rights_id, PlaceHolderId placeholder_id) { @@ -150,7 +150,7 @@ namespace ams::ncm { static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id)); std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer())); - return ResultSuccess(); + R_SUCCEED(); } Result GetRightsIdFromContentIdDeprecated(sf::Out out_rights_id, ContentId content_id) { @@ -159,7 +159,7 @@ namespace ams::ncm { static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id)); std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer())); - return ResultSuccess(); + R_SUCCEED(); } Result GetRightsIdFromContentId(sf::Out out_rights_id, ContentId content_id) { @@ -168,7 +168,7 @@ namespace ams::ncm { static_assert(sizeof(*out_rights_id.GetPointer()) <= sizeof(rights_id)); std::memcpy(out_rights_id.GetPointer(), std::addressof(rights_id), sizeof(*out_rights_id.GetPointer())); - return ResultSuccess(); + R_SUCCEED(); } Result WriteContentForDebug(ContentId content_id, s64 offset, const sf::InBuffer &data) { diff --git a/libraries/libstratosphere/source/ncm/ncm_storage_utils.cpp b/libraries/libstratosphere/source/ncm/ncm_storage_utils.cpp index 313333801..0435b6a9b 100644 --- a/libraries/libstratosphere/source/ncm/ncm_storage_utils.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_storage_utils.cpp @@ -45,10 +45,10 @@ namespace ams::ncm { /* Output the storage id. */ *out_storage_id = storage_id; - return ResultSuccess(); + R_SUCCEED(); } - return ncm::ResultNotEnoughInstallSpace(); + R_THROW(ncm::ResultNotEnoughInstallSpace()); } Result SelectPatchStorage(StorageId *out_storage_id, StorageId storage_id, PatchId patch_id) { @@ -77,7 +77,7 @@ namespace ams::ncm { } } - return ResultSuccess(); + R_SUCCEED(); } const char *GetStorageIdString(StorageId storage_id) { 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 85b3d2a8e..6e1be6f24 100644 --- a/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_submission_package_install_task.cpp @@ -47,7 +47,7 @@ namespace ams::ncm { /* Initialize members. */ m_mount_name = mount_name; - return ResultSuccess(); + R_SUCCEED(); } const impl::MountName &GetMountName() const { @@ -70,7 +70,7 @@ namespace ams::ncm { /* Initialize parent. N doesn't check the result. */ PackageInstallTask::Initialize(impl::GetRootDirectoryPath(m_impl->GetMountName()).str, storage_id, buffer, buffer_size, ignore_ticket); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/os/impl/os_aslr_space_manager_types.hpp b/libraries/libstratosphere/source/os/impl/os_aslr_space_manager_types.hpp index 91b99fda5..f4d6b0006 100644 --- a/libraries/libstratosphere/source/os/impl/os_aslr_space_manager_types.hpp +++ b/libraries/libstratosphere/source/os/impl/os_aslr_space_manager_types.hpp @@ -87,11 +87,11 @@ namespace ams::os::impl { /* We mapped successfully. */ *out = map_address; - return ResultSuccess(); + R_SUCCEED(); } /* We failed to map. */ - return os::ResultOutOfAddressSpace(); + R_THROW(os::ResultOutOfAddressSpace()); } }; diff --git a/libraries/libstratosphere/source/os/impl/os_inter_process_event.cpp b/libraries/libstratosphere/source/os/impl/os_inter_process_event.cpp index 8bba574de..4f897f21b 100644 --- a/libraries/libstratosphere/source/os/impl/os_inter_process_event.cpp +++ b/libraries/libstratosphere/source/os/impl/os_inter_process_event.cpp @@ -46,7 +46,7 @@ namespace ams::os::impl { R_TRY(impl::InterProcessEventImpl::Create(std::addressof(wh), std::addressof(rh))); SetupInterProcessEventType(event, rh, true, wh, true, clear_mode); - return ResultSuccess(); + R_SUCCEED(); } void DestroyInterProcessEvent(InterProcessEventType *event) { diff --git a/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.horizon.cpp index 5d75b31e2..5cae1c18d 100644 --- a/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.horizon.cpp @@ -29,7 +29,7 @@ namespace ams::os::impl { *out_write = wh; *out_read = rh; - return ResultSuccess(); + R_SUCCEED(); } void InterProcessEventHorizonImpl::Close(NativeHandle handle) { diff --git a/libraries/libstratosphere/source/os/impl/os_io_region_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_io_region_impl.os.horizon.cpp index fdd7e218b..ed5112d50 100644 --- a/libraries/libstratosphere/source/os/impl/os_io_region_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_io_region_impl.os.horizon.cpp @@ -50,7 +50,7 @@ namespace ams::os::impl { R_TRY(svc::CreateIoRegion(std::addressof(handle), io_pool_handle, address, size, svc_mapping, svc_perm)); *out = handle; - return ResultSuccess(); + R_SUCCEED(); } Result IoRegionImpl::MapIoRegion(void **out, NativeHandle handle, size_t size, MemoryPermission perm) { @@ -69,7 +69,7 @@ namespace ams::os::impl { R_CONVERT(svc::ResultInvalidCurrentMemory, os::ResultInvalidCurrentMemoryState()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); }, [handle](uintptr_t map_address, size_t map_size) -> void { return IoRegionImpl::UnmapIoRegion(handle, reinterpret_cast(map_address), map_size); @@ -78,7 +78,7 @@ namespace ams::os::impl { /* Return the address we mapped at. */ *out = reinterpret_cast(mapped_address); - return ResultSuccess(); + R_SUCCEED(); } void IoRegionImpl::UnmapIoRegion(NativeHandle handle, void *address, size_t size) { diff --git a/libraries/libstratosphere/source/os/impl/os_multiple_wait_target_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_multiple_wait_target_impl.os.horizon.cpp index cc5165199..546200210 100644 --- a/libraries/libstratosphere/source/os/impl/os_multiple_wait_target_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_multiple_wait_target_impl.os.horizon.cpp @@ -36,7 +36,7 @@ namespace ams::os::impl { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out_index = index; - return ResultSuccess(); + R_SUCCEED(); } Result MultiWaitHorizonImpl::ReplyAndReceiveN(s32 *out_index, s32 num, NativeHandle arr[], s32 array_size, s64 ns, NativeHandle reply_target) { @@ -52,20 +52,20 @@ namespace ams::os::impl { R_CATCH(svc::ResultSessionClosed) { if (index == -1) { *out_index = MultiWaitImpl::WaitInvalid; - return os::ResultSessionClosedForReply(); + R_THROW(os::ResultSessionClosedForReply()); } else { *out_index = index; - return os::ResultSessionClosedForReceive(); + R_THROW(os::ResultSessionClosedForReceive()); } } R_CATCH(svc::ResultReceiveListBroken) { *out_index = index; - return os::ResultReceiveListBroken(); + R_THROW(os::ResultReceiveListBroken()); } } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out_index = index; - return ResultSuccess(); + R_SUCCEED(); } void MultiWaitHorizonImpl::CancelWait() { diff --git a/libraries/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp index 8fa9e7e4f..799ef001a 100644 --- a/libraries/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp @@ -46,7 +46,7 @@ namespace ams::os::impl { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = handle; - return ResultSuccess(); + R_SUCCEED(); } void SharedMemoryImpl::Close(NativeHandle handle) { @@ -65,7 +65,7 @@ namespace ams::os::impl { R_CONVERT(svc::ResultInvalidCurrentMemory, os::ResultInvalidCurrentMemoryState()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); }, [handle](uintptr_t map_address, size_t map_size) -> void { return SharedMemoryImpl::Unmap(handle, reinterpret_cast(map_address), map_size); @@ -74,7 +74,7 @@ namespace ams::os::impl { /* Return the address we mapped at. */ *out = reinterpret_cast(mapped_address); - return ResultSuccess(); + R_SUCCEED(); } void SharedMemoryImpl::Unmap(NativeHandle handle, void *address, size_t size) { diff --git a/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.horizon.cpp index 438b79428..83dae07e3 100644 --- a/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.horizon.cpp @@ -101,11 +101,11 @@ namespace ams::os::impl { os::SleepThread(TimeSpan::FromMilliSeconds(10)); continue; } - return os::ResultOutOfResource(); + R_THROW(os::ResultOutOfResource()); } } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/os/impl/os_transfer_memory_impl.os.horizon.cpp b/libraries/libstratosphere/source/os/impl/os_transfer_memory_impl.os.horizon.cpp index 295d030d3..025d46d22 100644 --- a/libraries/libstratosphere/source/os/impl/os_transfer_memory_impl.os.horizon.cpp +++ b/libraries/libstratosphere/source/os/impl/os_transfer_memory_impl.os.horizon.cpp @@ -45,7 +45,7 @@ namespace ams::os::impl { } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = handle; - return ResultSuccess(); + R_SUCCEED(); } void TransferMemoryImpl::Close(NativeHandle handle) { @@ -67,7 +67,7 @@ namespace ams::os::impl { R_CONVERT(svc::ResultInvalidCurrentMemory, os::ResultInvalidCurrentMemoryState()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; - return ResultSuccess(); + R_SUCCEED(); }, [handle](uintptr_t map_address, size_t map_size) -> void { return TransferMemoryImpl::Unmap(handle, reinterpret_cast(map_address), map_size); @@ -76,7 +76,7 @@ namespace ams::os::impl { /* Return the address we mapped at. */ *out = reinterpret_cast(mapped_address); - return ResultSuccess(); + R_SUCCEED(); } void TransferMemoryImpl::Unmap(NativeHandle handle, void *address, size_t size) { diff --git a/libraries/libstratosphere/source/os/os_io_region.cpp b/libraries/libstratosphere/source/os/os_io_region.cpp index e720ae145..368abfca1 100644 --- a/libraries/libstratosphere/source/os/os_io_region.cpp +++ b/libraries/libstratosphere/source/os/os_io_region.cpp @@ -56,7 +56,7 @@ namespace ams::os { InitializeIoRegion(io_region, handle, size, true); state_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void AttachIoRegionHandle(IoRegionType *io_region, size_t size, NativeHandle handle, bool managed) { @@ -135,7 +135,7 @@ namespace ams::os { /* Set the output address. */ *out = mapped_address; - return ResultSuccess(); + R_SUCCEED(); } void UnmapIoRegion(IoRegionType *io_region) { diff --git a/libraries/libstratosphere/source/os/os_shared_memory.cpp b/libraries/libstratosphere/source/os/os_shared_memory.cpp index aaf76669e..e16ecb0b8 100644 --- a/libraries/libstratosphere/source/os/os_shared_memory.cpp +++ b/libraries/libstratosphere/source/os/os_shared_memory.cpp @@ -49,7 +49,7 @@ namespace ams::os { /* Setup the object. */ SetupSharedMemoryType(shared_memory, size, handle, true); - return ResultSuccess(); + R_SUCCEED(); } void AttachSharedMemory(SharedMemoryType *shared_memory, size_t size, NativeHandle handle, bool managed) { diff --git a/libraries/libstratosphere/source/os/os_system_event.cpp b/libraries/libstratosphere/source/os/os_system_event.cpp index f132bbf34..7c4e66769 100644 --- a/libraries/libstratosphere/source/os/os_system_event.cpp +++ b/libraries/libstratosphere/source/os/os_system_event.cpp @@ -28,7 +28,7 @@ namespace ams::os { InitializeEvent(std::addressof(event->event), false, clear_mode); event->state = SystemEventType::State_InitializedAsEvent; } - return ResultSuccess(); + R_SUCCEED(); } void DestroySystemEvent(SystemEventType *event) { diff --git a/libraries/libstratosphere/source/os/os_thread_local_storage_api.cpp b/libraries/libstratosphere/source/os/os_thread_local_storage_api.cpp index 4fa7afb22..3e362a1a1 100644 --- a/libraries/libstratosphere/source/os/os_thread_local_storage_api.cpp +++ b/libraries/libstratosphere/source/os/os_thread_local_storage_api.cpp @@ -31,7 +31,7 @@ namespace ams::os { R_UNLESS(slot >= 0, os::ResultOutOfResource()); *out = { static_cast(slot) }; - return ResultSuccess(); + R_SUCCEED(); } void FreeTlsSlot(TlsSlot slot) { diff --git a/libraries/libstratosphere/source/os/os_transfer_memory.cpp b/libraries/libstratosphere/source/os/os_transfer_memory.cpp index 6042ad8d8..3051d45f5 100644 --- a/libraries/libstratosphere/source/os/os_transfer_memory.cpp +++ b/libraries/libstratosphere/source/os/os_transfer_memory.cpp @@ -51,7 +51,7 @@ namespace ams::os { /* Setup the object. */ SetupTransferMemoryType(tmem, size, handle, true); - return ResultSuccess(); + R_SUCCEED(); } void AttachTransferMemory(TransferMemoryType *tmem, size_t size, NativeHandle handle, bool managed) { @@ -125,7 +125,7 @@ namespace ams::os { /* Set output address. */ *out = mapped_address; - return ResultSuccess(); + R_SUCCEED(); } void UnmapTransferMemory(TransferMemoryType *tmem) { diff --git a/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_info.os.horizon.cpp b/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_info.os.horizon.cpp index 0668819be..53c29107c 100644 --- a/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_info.os.horizon.cpp +++ b/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_info.os.horizon.cpp @@ -91,7 +91,7 @@ namespace ams::osdbg::impl { FillWithCurrentInfoImpl(info, thread_type.lp64); break; default: - return osdbg::ResultUnsupportedThreadVersion(); + R_THROW(osdbg::ResultUnsupportedThreadVersion()); } } else { /* Read in the thread type. */ @@ -107,7 +107,7 @@ namespace ams::osdbg::impl { FillWithCurrentInfoImpl(info, thread_type.ilp32); break; default: - return osdbg::ResultUnsupportedThreadVersion(); + R_THROW(osdbg::ResultUnsupportedThreadVersion()); } } break; @@ -167,10 +167,10 @@ namespace ams::osdbg::impl { } break; default: - return osdbg::ResultUnsupportedThreadVersion(); + R_THROW(osdbg::ResultUnsupportedThreadVersion()); } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_local_region.os.horizon.cpp b/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_local_region.os.horizon.cpp index 8fe3840ff..4cad7a7bb 100644 --- a/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_local_region.os.horizon.cpp +++ b/libraries/libstratosphere/source/osdbg/impl/osdbg_thread_local_region.os.horizon.cpp @@ -42,7 +42,7 @@ namespace ams::osdbg::impl { *out = is_lp64 ? tlr.lp64.p_thread_type : tlr.ilp32.p_thread_type; } - return ResultSuccess(); + R_SUCCEED(); } Result GetThreadArgumentAndStackPointer(u64 *out_arg, u64 *out_sp, ThreadInfo *info) { @@ -60,7 +60,7 @@ namespace ams::osdbg::impl { *out_sp = thread_context.r[13]; } - return ResultSuccess(); + R_SUCCEED(); } void DetectStratosphereThread(ThreadInfo *info) { diff --git a/libraries/libstratosphere/source/pgl/pgl_remote_event_observer.hpp b/libraries/libstratosphere/source/pgl/pgl_remote_event_observer.hpp index df57985e3..133fa963d 100644 --- a/libraries/libstratosphere/source/pgl/pgl_remote_event_observer.hpp +++ b/libraries/libstratosphere/source/pgl/pgl_remote_event_observer.hpp @@ -34,7 +34,7 @@ namespace ams::pgl { ::Event ev; R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev))); out.SetValue(ev.revent, true); - return ResultSuccess(); + R_SUCCEED(); } Result GetProcessEventInfo(ams::sf::Out out) { @@ -46,7 +46,7 @@ namespace ams::pgl { ::Event ev; R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev))); out.SetValue(ev.revent); - return ResultSuccess(); + R_SUCCEED(); } Result GetProcessEventInfo(ams::tipc::Out out) { diff --git a/libraries/libstratosphere/source/pgl/pgl_shell_api.cpp b/libraries/libstratosphere/source/pgl/pgl_shell_api.cpp index d8b548961..1e2a87eb6 100644 --- a/libraries/libstratosphere/source/pgl/pgl_shell_api.cpp +++ b/libraries/libstratosphere/source/pgl/pgl_shell_api.cpp @@ -133,7 +133,7 @@ namespace ams::pgl { *out = pgl::EventObserver(std::move(observer_holder)); } - return ResultSuccess(); + R_SUCCEED(); } #else Result Initialize() { diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp index 0568d0cb6..77c4580db 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_api.cpp @@ -201,7 +201,7 @@ namespace ams::pgl::srv { /* TODO: Should we avoid leaking the object? Nintendo does not. */ R_TRY(GetGlobalsForTipc().server_manager.AddSession(out, object)); - return ResultSuccess(); + R_SUCCEED(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp index ed78d1854..c22b0605f 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp @@ -145,7 +145,7 @@ namespace ams::pgl::srv { /* Set the globals. */ g_crashed_process_id = process_id; g_ssd_process_id = ssd_process_id; - return ResultSuccess(); + R_SUCCEED(); } bool ShouldSnapShotAutoDump() { @@ -395,7 +395,7 @@ namespace ams::pgl::srv { /* We succeeded. */ *out = process_id; - return ResultSuccess(); + R_SUCCEED(); } Result TerminateProcess(os::ProcessId process_id) { @@ -410,7 +410,7 @@ namespace ams::pgl::srv { /* Return the id. */ *out = *application_process_id; - return ResultSuccess(); + R_SUCCEED(); } Result BoostSystemMemoryResourceLimit(u64 size) { diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_event_observer.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_event_observer.cpp index f04104783..72852a212 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_event_observer.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_event_observer.cpp @@ -42,7 +42,7 @@ namespace ams::pgl::srv { /* Free the received info. */ lmem::FreeToUnitHeap(m_heap_handle, info); - return ResultSuccess(); + R_SUCCEED(); } void ShellEventObserverImpl::Notify(const pm::ProcessEventInfo &info) { @@ -67,7 +67,7 @@ namespace ams::pgl::srv { Result ShellEventObserverCmif::GetProcessEventHandle(ams::sf::OutCopyHandle out) { out.SetValue(this->GetEvent().GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } Result ShellEventObserverCmif::GetProcessEventInfo(ams::sf::Out out) { @@ -76,7 +76,7 @@ namespace ams::pgl::srv { Result ShellEventObserverTipc::GetProcessEventHandle(ams::tipc::OutCopyHandle out) { out.SetValue(this->GetEvent().GetReadableHandle()); - return ResultSuccess(); + R_SUCCEED(); } Result ShellEventObserverTipc::GetProcessEventInfo(ams::tipc::Out out) { diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp index e1ad2fa9a..7cbacc8a1 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp @@ -114,7 +114,7 @@ namespace ams::pgl::srv { /* Ensure we have a content meta buffer. */ R_UNLESS(m_content_meta_buffer.Get() != nullptr, pgl::ResultContentMetaNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ReadProgramInfo() { @@ -128,7 +128,7 @@ namespace ams::pgl::srv { m_program_id = {key.id}; m_program_version = key.version; m_content_meta_type = key.type; - return ResultSuccess(); + R_SUCCEED(); } Result GetContentPath(lr::Path *out, ncm::ContentType type, util::optional index) const { @@ -182,7 +182,7 @@ namespace ams::pgl::srv { R_TRY(this->SearchContent(std::addressof(has_content), out, file_name, fs::OpenDirectoryMode_File)); R_UNLESS(has_content, pgl::ResultApplicationContentNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result GetContentPathInNspd(lr::Path *out, ncm::ContentType type, util::optional index) const { @@ -209,14 +209,14 @@ namespace ams::pgl::srv { R_TRY(this->SearchContent(std::addressof(has_content), out, file_name, fs::OpenDirectoryMode_Directory)); R_UNLESS(has_content, pgl::ResultApplicationContentNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result GetProgramIndex(u8 *out) { /* Nspd programs do not have indices. */ if (m_extension_type == ExtensionType::Nspd) { *out = 0; - return ResultSuccess(); + R_SUCCEED(); } /* Create a reader. */ @@ -228,7 +228,7 @@ namespace ams::pgl::srv { /* Return the index. */ *out = program_content_info->GetIdOffset(); - return ResultSuccess(); + R_SUCCEED(); } Result SetExtensionType() { @@ -239,12 +239,12 @@ namespace ams::pgl::srv { if (HasSuffix(m_content_path, ".nsp")) { m_extension_type = ExtensionType::Nsp; - return ResultSuccess(); + R_SUCCEED(); } else if (HasSuffix(m_content_path, ".nspd") || HasSuffix(m_content_path, ".nspd/")) { m_extension_type = ExtensionType::Nspd; - return ResultSuccess(); + R_SUCCEED(); } else { - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); } } @@ -297,13 +297,13 @@ namespace ams::pgl::srv { } } - return ResultSuccess(); + R_SUCCEED(); } } /* We didn't find a match. */ *out = false; - return ResultSuccess(); + R_SUCCEED(); } }; @@ -351,7 +351,7 @@ namespace ams::pgl::srv { .id_offset = reader.GetProgramIndex(), }; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp index 3d6215123..009dcc254 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp @@ -49,22 +49,22 @@ namespace ams::pgl::srv { Result ShellInterfaceCommon::IsProcessTrackedImpl(bool *out, os::ProcessId process_id) { *out = pgl::srv::IsProcessTracked(process_id); - return ResultSuccess(); + R_SUCCEED(); } Result ShellInterfaceCommon::EnableApplicationCrashReportImpl(bool enabled) { pgl::srv::EnableApplicationCrashReport(enabled); - return ResultSuccess(); + R_SUCCEED(); } Result ShellInterfaceCommon::IsApplicationCrashReportEnabledImpl(bool *out) { *out = pgl::srv::IsApplicationCrashReportEnabled(); - return ResultSuccess(); + R_SUCCEED(); } Result ShellInterfaceCommon::EnableApplicationAllThreadDumpOnCrashImpl(bool enabled) { pgl::srv::EnableApplicationAllThreadDumpOnCrash(enabled); - return ResultSuccess(); + R_SUCCEED(); } Result ShellInterfaceCommon::TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) { @@ -122,12 +122,12 @@ namespace ams::pgl::srv { R_UNLESS(session != nullptr, pgl::ResultOutOfMemory()); *out = std::move(session); - return ResultSuccess(); + R_SUCCEED(); } Result ShellInterfaceCmif::Command21NotImplemented(ams::sf::Out out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2) { AMS_UNUSED(out, in, buf1, buf2); - return pgl::ResultNotImplemented(); + R_THROW(pgl::ResultNotImplemented()); } Result ShellInterfaceTipc::LaunchProgram(ams::tipc::Out out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags) { diff --git a/libraries/libstratosphere/source/pm/pm_dmnt_api.cpp b/libraries/libstratosphere/source/pm/pm_dmnt_api.cpp index ba06a3839..cbbc9c19a 100644 --- a/libraries/libstratosphere/source/pm/pm_dmnt_api.cpp +++ b/libraries/libstratosphere/source/pm/pm_dmnt_api.cpp @@ -41,7 +41,7 @@ namespace ams::pm::dmnt { Event evt; R_TRY(pmdmntHookToCreateApplicationProcess(std::addressof(evt))); *out_handle = evt.revent; - return ResultSuccess(); + R_SUCCEED(); } Result AtmosphereGetProcessInfo(os::NativeHandle *out_handle, ncm::ProgramLocation *out_loc, cfg::OverrideStatus *out_status, os::ProcessId process_id) { diff --git a/libraries/libstratosphere/source/pm/pm_info_api.cpp b/libraries/libstratosphere/source/pm/pm_info_api.cpp index 9eaed8ee7..5273e90cc 100644 --- a/libraries/libstratosphere/source/pm/pm_info_api.cpp +++ b/libraries/libstratosphere/source/pm/pm_info_api.cpp @@ -58,7 +58,7 @@ namespace ams::pm::info { R_TRY(GetProcessInfo(std::addressof(loc), std::addressof(override_status), process_id)); *out = override_status.IsHbl(); - return ResultSuccess(); + R_SUCCEED(); } Result IsHblProgramId(bool *out, ncm::ProgramId program_id) { diff --git a/libraries/libstratosphere/source/pm/pm_info_api_weak.cpp b/libraries/libstratosphere/source/pm/pm_info_api_weak.cpp index 0c826f5c1..f641629dd 100644 --- a/libraries/libstratosphere/source/pm/pm_info_api_weak.cpp +++ b/libraries/libstratosphere/source/pm/pm_info_api_weak.cpp @@ -24,7 +24,7 @@ namespace ams::pm::info { bool has_launched = false; R_TRY(pminfoAtmosphereHasLaunchedBootProgram(std::addressof(has_launched), static_cast(program_id))); *out = has_launched; - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/pm/pm_shell_api.cpp b/libraries/libstratosphere/source/pm/pm_shell_api.cpp index 346013efb..001cbb25c 100644 --- a/libraries/libstratosphere/source/pm/pm_shell_api.cpp +++ b/libraries/libstratosphere/source/pm/pm_shell_api.cpp @@ -33,7 +33,7 @@ namespace ams::pm::shell { ::Event evt; R_TRY(::pmshellGetProcessEventHandle(std::addressof(evt))); out->Attach(evt.revent, true, svc::InvalidHandle, false, os::EventClearMode_ManualClear); - return ResultSuccess(); + R_SUCCEED(); } Result GetProcessEventInfo(ProcessEventInfo *out) { 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 dbc81e7c1..2b4330080 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 @@ -107,7 +107,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(this->IsEventHandlerEnabled(), powctl::ResultNotAvailable()); *out = device->SafeCastTo().GetSystemEvent(); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetDeviceInterruptEnabled(IDevice *device, bool enable) { @@ -117,7 +117,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set the interrupt enable. */ device->SafeCastTo().SetInterruptEnabled(enable); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetDeviceErrorStatus(u32 *out, IDevice *device) { @@ -143,7 +143,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_percent = percent; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) { @@ -157,7 +157,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_percent = percent; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryFullCapacity(int *out_mah, IDevice *device) { @@ -171,7 +171,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_mah = mah; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryRemainingCapacity(int *out_mah, IDevice *device) { @@ -185,7 +185,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_mah = mah; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) { @@ -194,7 +194,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetChargePercentageMinimumAlertThreshold(percentage)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) { @@ -203,7 +203,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetChargePercentageMaximumAlertThreshold(percentage)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) { @@ -212,7 +212,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageFuelGaugePercentageMinimumAlertThreshold(percentage)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) { @@ -221,7 +221,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageFuelGaugePercentageMaximumAlertThreshold(percentage)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryFullChargeThreshold(IDevice *device, float percentage) { @@ -230,7 +230,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetFullChargeThreshold(percentage)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryAverageCurrent(int *out_ma, IDevice *device) { @@ -244,7 +244,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_ma = ma; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryCurrent(int *out_ma, IDevice *device) { @@ -258,7 +258,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_ma = ma; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) { @@ -272,7 +272,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().ReadInternalState()); GetMax17050Driver().GetInternalState(static_cast(dst)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) { @@ -285,7 +285,7 @@ namespace ams::powctl::impl::board::nintendo::nx { GetMax17050Driver().SetInternalState(*static_cast(src)); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().WriteInternalState()); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) { @@ -296,7 +296,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Get the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetNeedToRestoreParameters(out)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryNeedToRestoreParameters(IDevice *device, bool en) { @@ -306,7 +306,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetNeedToRestoreParameters(en)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) { @@ -317,7 +317,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Get the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().IsI2cShutdownEnabled(out)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryI2cShutdownEnabled(IDevice *device, bool en) { @@ -327,7 +327,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetI2cShutdownEnabled(en)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::IsBatteryPresent(bool *out, IDevice *device) { @@ -341,7 +341,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (status & 0x0008) == 0; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryCycles(int *out, IDevice *device) { @@ -355,7 +355,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = cycles; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryCycles(IDevice *device, int cycles) { @@ -364,7 +364,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().ResetCycles()); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryAge(float *out_percent, IDevice *device) { @@ -378,7 +378,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_percent = percent; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryTemperature(float *out_c, IDevice *device) { @@ -392,7 +392,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_c = temp; - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryMaximumTemperature(float *out_c, IDevice *device) { @@ -406,7 +406,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out_c = static_cast(max_temp); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) { @@ -415,7 +415,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetTemperatureMinimumAlertThreshold(c)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) { @@ -424,7 +424,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetTemperatureMaximumAlertThreshold(c)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryVCell(int *out_mv, IDevice *device) { @@ -435,7 +435,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Get the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetVCell(out_mv)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryAverageVCell(int *out_mv, IDevice *device) { @@ -446,7 +446,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Get the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetAverageVCell(out_mv)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) { @@ -460,7 +460,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = TimeSpan::FromMicroSeconds(static_cast(ms * 1000.0)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) { @@ -469,7 +469,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageMinimumAlertThreshold(mv)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) { @@ -480,7 +480,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Get the value. */ AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetOpenCircuitVoltage(out_mv)); - return ResultSuccess(); + R_SUCCEED(); } Result BatteryDriver::SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) { @@ -489,7 +489,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageMaximumAlertThreshold(mv)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.hpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.hpp index 0af47a18e..bebd58f5d 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.hpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_battery_driver.hpp @@ -109,40 +109,40 @@ namespace ams::powctl::impl::board::nintendo::nx { virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override; /* Unsupported Charger API. */ - virtual Result GetChargerChargeCurrentState(ChargeCurrentState *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) override { AMS_UNUSED(device, state); return powctl::ResultNotSupported(); } + virtual Result GetChargerChargeCurrentState(ChargeCurrentState *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) override { AMS_UNUSED(device, state); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerFastChargeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); } + virtual Result GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerFastChargeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerChargeVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); } + virtual Result GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerChargeVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) override { AMS_UNUSED(device, cfg); return powctl::ResultNotSupported(); } + virtual Result SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) override { AMS_UNUSED(device, cfg); R_THROW(powctl::ResultNotSupported()); } - virtual Result IsChargerHiZEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerHiZEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); } + virtual Result IsChargerHiZEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerHiZEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerInputCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerInputCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); } + virtual Result GetChargerInputCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerInputCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetChargerInputVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); } + virtual Result SetChargerInputVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetChargerBoostModeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); } + virtual Result SetChargerBoostModeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerChargerStatus(ChargerStatus *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } + virtual Result GetChargerChargerStatus(ChargerStatus *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerWatchdogTimerEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); } + virtual Result IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerWatchdogTimerEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) override { AMS_UNUSED(device, timeout); return powctl::ResultNotSupported(); } - virtual Result ResetChargerWatchdogTimer(IDevice *device) override { AMS_UNUSED(device); return powctl::ResultNotSupported(); } + virtual Result SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) override { AMS_UNUSED(device, timeout); R_THROW(powctl::ResultNotSupported()); } + virtual Result ResetChargerWatchdogTimer(IDevice *device) override { AMS_UNUSED(device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerBatteryCompensation(int *out_mo, IDevice *device) override { AMS_UNUSED(out_mo, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerBatteryCompensation(IDevice *device, int mo) override { AMS_UNUSED(device, mo); return powctl::ResultNotSupported(); } + virtual Result GetChargerBatteryCompensation(int *out_mo, IDevice *device) override { AMS_UNUSED(out_mo, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerBatteryCompensation(IDevice *device, int mo) override { AMS_UNUSED(device, mo); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetChargerVoltageClamp(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); } - virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); } + virtual Result GetChargerVoltageClamp(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); } }; } diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_bq24193_driver.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_bq24193_driver.cpp index bd8dc244d..0e440f666 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_bq24193_driver.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_bq24193_driver.cpp @@ -234,7 +234,7 @@ namespace ams::powctl::impl::board::nintendo::nx { const u8 new_val = (cur_val & ~mask) | (value & mask); R_TRY(i2c::WriteSingleRegister(session, address, new_val)); - return ResultSuccess(); + R_SUCCEED(); } } @@ -264,7 +264,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Reset the watchdog timer. */ R_TRY(this->ResetWatchdogTimer()); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetPreChargeCurrentLimit(int ma) { @@ -290,7 +290,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = (val & 0x01) != 0; - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetForce20PercentChargeCurrent(bool en) { @@ -304,7 +304,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out_ma = bq24193::DecodeFastChargeCurrentLimit(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetFastChargeCurrentLimit(int ma) { @@ -318,7 +318,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out_mv = bq24193::DecodeChargeVoltageLimit(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetChargeVoltageLimit(int mv) { @@ -336,7 +336,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = (val & 0x80) != 0; - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetHiZEnabled(bool en) { @@ -350,7 +350,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out_ma = bq24193::DecodeInputCurrentLimit(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetInputCurrentLimit(int ma) { @@ -372,7 +372,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = bq24193::DecodeChargerStatus(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::ResetWatchdogTimer() { @@ -390,7 +390,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out_mo = bq24193::DecodeBatteryCompensation(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetBatteryCompensation(int mo) { @@ -404,7 +404,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out_mv = bq24193::DecodeVoltageClamp(val); - return ResultSuccess(); + R_SUCCEED(); } Result Bq24193Driver::SetVoltageClamp(int mv) { 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 d620d3cf4..0cf1a6209 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 @@ -99,7 +99,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(this->IsEventHandlerEnabled(), powctl::ResultNotAvailable()); *out = device->SafeCastTo().GetSystemEvent(); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetDeviceInterruptEnabled(IDevice *device, bool enable) { @@ -109,7 +109,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set the interrupt enable. */ device->SafeCastTo().SetInterruptEnabled(enable); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetDeviceErrorStatus(u32 *out, IDevice *device) { @@ -148,7 +148,7 @@ namespace ams::powctl::impl::board::nintendo::nx { } } - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) { @@ -167,10 +167,10 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_POWCTL_DRIVER_R_TRY_WITH_RETRY(GetBq24193Driver().SetForce20PercentChargeCurrent(state == ChargeCurrentState_ChargingForce20Percent)); break; case ChargeCurrentState_Unknown: - return powctl::ResultInvalidArgument(); + R_THROW(powctl::ResultInvalidArgument()); } - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) { @@ -179,7 +179,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetFastChargeCurrentLimit(out_ma)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerFastChargeCurrentLimit(IDevice *device, int ma) { @@ -187,7 +187,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetFastChargeCurrentLimit(ma)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) { @@ -196,7 +196,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetChargeVoltageLimit(out_mv)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerChargeVoltageLimit(IDevice *device, int mv) { @@ -204,7 +204,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetChargeVoltageLimit(mv)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) { @@ -220,7 +220,7 @@ namespace ams::powctl::impl::board::nintendo::nx { } AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetChargerConfiguration(bq_cfg)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::IsChargerHiZEnabled(bool *out, IDevice *device) { @@ -229,7 +229,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().IsHiZEnabled(out)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerHiZEnabled(IDevice *device, bool en) { @@ -237,7 +237,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetHiZEnabled(en)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerInputCurrentLimit(int *out_ma, IDevice *device) { @@ -246,7 +246,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetInputCurrentLimit(out_ma)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerInputCurrentLimit(IDevice *device, int ma) { @@ -254,7 +254,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetInputCurrentLimit(ma)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerInputVoltageLimit(IDevice *device, int mv) { @@ -262,7 +262,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetInputVoltageLimit(mv)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerBoostModeCurrentLimit(IDevice *device, int ma) { @@ -270,7 +270,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetBoostModeCurrentLimit(ma)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerChargerStatus(ChargerStatus *out, IDevice *device) { @@ -294,7 +294,7 @@ namespace ams::powctl::impl::board::nintendo::nx { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) { @@ -303,7 +303,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); *out = device->SafeCastTo().IsWatchdogTimerEnabled(); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerWatchdogTimerEnabled(IDevice *device, bool en) { @@ -321,7 +321,7 @@ namespace ams::powctl::impl::board::nintendo::nx { } charger_device.SetWatchdogTimerEnabled(en); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) { @@ -329,7 +329,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); device->SafeCastTo().SetWatchdogTimerTimeout(timeout); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::ResetChargerWatchdogTimer(IDevice *device) { @@ -337,7 +337,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().ResetWatchdogTimer()); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerBatteryCompensation(int *out_mo, IDevice *device) { @@ -346,7 +346,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetBatteryCompensation(out_mo)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerBatteryCompensation(IDevice *device, int mo) { @@ -354,7 +354,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetBatteryCompensation(mo)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::GetChargerVoltageClamp(int *out_mv, IDevice *device) { @@ -363,7 +363,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetVoltageClamp(out_mv)); - return ResultSuccess(); + R_SUCCEED(); } Result ChargerDriver::SetChargerVoltageClamp(IDevice *device, int mv) { @@ -371,7 +371,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_UNLESS(device != nullptr, powctl::ResultInvalidArgument()); AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetVoltageClamp(mv)); - return ResultSuccess(); + R_SUCCEED(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.hpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.hpp index 5bb90bca7..d1227e0d9 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.hpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_charger_driver.hpp @@ -105,56 +105,56 @@ namespace ams::powctl::impl::board::nintendo::nx { virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override; /* Unsupported Battery API. */ - virtual Result GetBatteryChargePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryChargePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryFullCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); return powctl::ResultNotSupported(); } - virtual Result GetBatteryRemainingCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryFullCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result GetBatteryRemainingCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); } - virtual Result SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); } + virtual Result SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); } - virtual Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); } + virtual Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryFullChargeThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); } + virtual Result SetBatteryFullChargeThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryAverageCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); } - virtual Result GetBatteryCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryAverageCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result GetBatteryCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) override { AMS_UNUSED(dst, out_size, device, dst_size); return powctl::ResultNotSupported(); } - virtual Result SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) override { AMS_UNUSED(device, src, src_size); return powctl::ResultNotSupported(); } + virtual Result GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) override { AMS_UNUSED(dst, out_size, device, dst_size); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) override { AMS_UNUSED(device, src, src_size); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetBatteryNeedToRestoreParameters(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); } + virtual Result GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryNeedToRestoreParameters(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); } - virtual Result IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetBatteryI2cShutdownEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); } + virtual Result IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryI2cShutdownEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); } - virtual Result IsBatteryPresent(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } + virtual Result IsBatteryPresent(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryCycles(int *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } - virtual Result SetBatteryCycles(IDevice *device, int cycles) override { AMS_UNUSED(device, cycles); return powctl::ResultNotSupported(); } + virtual Result GetBatteryCycles(int *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryCycles(IDevice *device, int cycles) override { AMS_UNUSED(device, cycles); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryAge(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryAge(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); return powctl::ResultNotSupported(); } - virtual Result GetBatteryMaximumTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result GetBatteryMaximumTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); return powctl::ResultNotSupported(); } - virtual Result SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); return powctl::ResultNotSupported(); } + virtual Result SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); R_THROW(powctl::ResultNotSupported()); } + virtual Result SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); } - virtual Result GetBatteryAverageVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); } + virtual Result GetBatteryAverageVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); } + virtual Result SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); } - virtual Result GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); } + virtual Result GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); } - virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); } + virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); } }; } diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp index 00037449c..8c9365187 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo/nx/powctl_max17050_driver.cpp @@ -171,7 +171,7 @@ namespace ams::powctl::impl::board::nintendo::nx { const u16 new_val = (cur_val & ~mask) | (value & mask); R_TRY(i2c::WriteSingleRegister(session, address, new_val)); - return ResultSuccess(); + R_SUCCEED(); } ALWAYS_INLINE Result ReadRegister(const i2c::I2cSession &session, u8 address, u16 *out) { @@ -205,7 +205,7 @@ namespace ams::powctl::impl::board::nintendo::nx { const u16 new_val = (cur_val & ~mask) | (value & mask); while (!WriteValidateRegister(session, address, new_val)) { /* ... */ } - return ResultSuccess(); + R_SUCCEED(); } double CoerceToDouble(u64 value) { @@ -360,7 +360,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set cgain. */ R_TRY(WriteRegister(m_i2c_session, max17050::CGain, 0x7FFF)); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetMaximumShutdownTimerThreshold() { @@ -395,13 +395,13 @@ namespace ams::powctl::impl::board::nintendo::nx { Result Max17050Driver::LockModelTable() { R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess0, 0x0000)); R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess1, 0x0000)); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::UnlockModelTable() { R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess0, 0x0059)); R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess1, 0x00C4)); - return ResultSuccess(); + R_SUCCEED(); } bool Max17050Driver::IsModelTableLocked() { @@ -422,7 +422,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_TRY(WriteRegister(m_i2c_session, max17050::ModelChrTblStart + i, model_table[i])); } - return ResultSuccess(); + R_SUCCEED(); } bool Max17050Driver::IsModelTableSet(const u16 *model_table) { @@ -449,7 +449,7 @@ namespace ams::powctl::impl::board::nintendo::nx { R_TRY(ReadRegister(m_i2c_session, max17050::QResidual10, std::addressof(m_internal_state.qresidual10))); R_TRY(ReadRegister(m_i2c_session, max17050::QResidual20, std::addressof(m_internal_state.qresidual20))); R_TRY(ReadRegister(m_i2c_session, max17050::QResidual30, std::addressof(m_internal_state.qresidual30))); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::WriteInternalState() { @@ -480,7 +480,7 @@ namespace ams::powctl::impl::board::nintendo::nx { while (!WriteValidateRegister(m_i2c_session, max17050::LearnCfg, 0x2673)) { /* ... */ } } - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetChargePercentage(double *out) { @@ -493,7 +493,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = static_cast(val) * 0.00390625; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetVoltageFuelGaugePercentage(double *out) { @@ -506,7 +506,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = static_cast(val) * 0.00390625; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetFullCapacity(double *out, double sense_resistor) { @@ -521,7 +521,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = ((static_cast(fullcap) * 0.005) / sense_resistor) / (static_cast(cgain) * 0.0000610351562); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetRemainingCapacity(double *out, double sense_resistor) { @@ -536,7 +536,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = ((static_cast(remcap) * 0.005) / sense_resistor) / (static_cast(cgain) * 0.0000610351562); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetChargePercentageMinimumAlertThreshold(int percentage) { @@ -580,7 +580,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (((static_cast(avg_current) - (static_cast(coff) + static_cast(coff))) / (static_cast(cgain) * 0.0000610351562)) * 1.5625) / (sense_resistor * 1000.0); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetCurrent(double *out, double sense_resistor) { @@ -596,7 +596,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (((static_cast(current) - (static_cast(coff) + static_cast(coff))) / (static_cast(cgain) * 0.0000610351562)) * 1.5625) / (sense_resistor * 1000.0); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetNeedToRestoreParameters(bool *out) { @@ -606,7 +606,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = (val & 0x8000) != 0; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetNeedToRestoreParameters(bool en) { @@ -620,7 +620,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = (val & 0x0040) != 0; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetI2cShutdownEnabled(bool en) { @@ -641,7 +641,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Extract the value. */ *out = std::max(val, 0x60) - 0x60; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::ResetCycles() { @@ -658,7 +658,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = static_cast(val) * 0.00390625; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetTemperature(double *out) { @@ -671,7 +671,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = static_cast(val) * 0.00390625; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetMaximumTemperature(u8 *out) { @@ -684,7 +684,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = static_cast(val >> 8); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetTemperatureMinimumAlertThreshold(int c) { @@ -705,7 +705,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (625 * (val >> 3)) / 1000; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetAverageVCell(int *out) { @@ -718,7 +718,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (625 * (val >> 3)) / 1000; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetAverageVCellTime(double *out) { @@ -731,7 +731,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = 175.8 * ExponentiateTwoToPower(6 + ((val >> 4) & 7), 1.0); - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::GetOpenCircuitVoltage(int *out) { @@ -744,7 +744,7 @@ namespace ams::powctl::impl::board::nintendo::nx { /* Set output. */ *out = (1250 * (val >> 4)) / 1000; - return ResultSuccess(); + R_SUCCEED(); } Result Max17050Driver::SetVoltageMinimumAlertThreshold(int mv) { diff --git a/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp b/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp index 336578374..bf4a7cee2 100644 --- a/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp +++ b/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp @@ -119,7 +119,7 @@ namespace ams::powctl::impl { Result RegisterDeviceCode(DeviceCode device_code, IDevice *device) { AMS_ASSERT(device != nullptr); R_TRY(GetDeviceCodeEntryManager().Add(device_code, device)); - return ResultSuccess(); + R_SUCCEED(); } bool UnregisterDeviceCode(DeviceCode device_code) { @@ -146,7 +146,7 @@ namespace ams::powctl::impl { /* Set output. */ *out = device->SafeCastToPointer(); - return ResultSuccess(); + R_SUCCEED(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/powctl/powctl_session_api.cpp b/libraries/libstratosphere/source/powctl/powctl_session_api.cpp index c30c7dc30..09939e6a0 100644 --- a/libraries/libstratosphere/source/powctl/powctl_session_api.cpp +++ b/libraries/libstratosphere/source/powctl/powctl_session_api.cpp @@ -77,7 +77,7 @@ namespace ams::powctl { /* We opened the session! */ guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(Session &session) { diff --git a/libraries/libstratosphere/source/psc/psc_pm_module.os.horizon.cpp b/libraries/libstratosphere/source/psc/psc_pm_module.os.horizon.cpp index 144d98ab4..363693d12 100644 --- a/libraries/libstratosphere/source/psc/psc_pm_module.os.horizon.cpp +++ b/libraries/libstratosphere/source/psc/psc_pm_module.os.horizon.cpp @@ -53,7 +53,7 @@ namespace ams::psc { m_intf = RemoteObjectFactory::CreateSharedEmplaced(module); m_system_event.AttachReadableHandle(module.event.revent, false, clear_mode); m_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } Result PmModule::Finalize() { @@ -63,7 +63,7 @@ namespace ams::psc { m_intf = nullptr; os::DestroySystemEvent(m_system_event.GetBase()); m_initialized = false; - return ResultSuccess(); + R_SUCCEED(); } Result PmModule::GetRequest(PmState *out_state, PmFlagSet *out_flags) { diff --git a/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_impl_pwm_driver_api.cpp b/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_impl_pwm_driver_api.cpp index 784d4bbb7..9244d0729 100644 --- a/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_impl_pwm_driver_api.cpp +++ b/libraries/libstratosphere/source/pwm/driver/board/nintendo/nx/impl/pwm_impl_pwm_driver_api.cpp @@ -60,7 +60,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { R_ABORT_UNLESS(pwm::driver::RegisterDeviceCode(entry.device_code, device)); } - return ResultSuccess(); + R_SUCCEED(); } } 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 32d377c86..e3c100914 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 @@ -81,7 +81,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { this->SetEnabled(device, false); this->SetDuty(device, 0); this->SetPeriod(device, DefaultChannelPeriod); - return ResultSuccess(); + R_SUCCEED(); } void PwmDriverImpl::FinalizeDevice(IPwmDevice *device) { @@ -113,7 +113,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Update the period. */ reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_VALUE(PWM_CSR_PFM, pfm)); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::GetPeriod(TimeSpan *out, IPwmDevice *device) { @@ -133,7 +133,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Set the output. */ *out = TimeSpan::FromNanoSeconds(ns); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::SetDuty(IPwmDevice *device, int duty) { @@ -149,7 +149,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Update the duty. */ reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_VALUE(PWM_CSR_PWM, static_cast(duty))); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::GetDuty(int *out, IPwmDevice *device) { @@ -159,7 +159,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Get the duty. */ *out = static_cast(reg::GetValue(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_MASK(PWM_CSR_PWM))); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::SetScale(IPwmDevice *device, double scale) { @@ -183,7 +183,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Convert to scale. */ *out = (static_cast(duty) * 100.0) / 256.0; - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::SetEnabled(IPwmDevice *device, bool en) { @@ -196,7 +196,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Update the enable. */ reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_ENUM_SEL(PWM_CSR_ENB, en, ENABLE, DISABLE)); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::GetEnabled(bool *out, IPwmDevice *device) { @@ -206,7 +206,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl { /* Get the enable. */ *out = reg::HasValue(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_ENUM(PWM_CSR_ENB, ENABLE)); - return ResultSuccess(); + R_SUCCEED(); } Result PwmDriverImpl::Suspend() { diff --git a/libraries/libstratosphere/source/pwm/driver/impl/pwm_channel_session_impl.cpp b/libraries/libstratosphere/source/pwm/driver/impl/pwm_channel_session_impl.cpp index 2916ff047..cb8dd8306 100644 --- a/libraries/libstratosphere/source/pwm/driver/impl/pwm_channel_session_impl.cpp +++ b/libraries/libstratosphere/source/pwm/driver/impl/pwm_channel_session_impl.cpp @@ -36,7 +36,7 @@ namespace ams::pwm::driver::impl { /* We're opened. */ guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } void ChannelSessionImpl::Close() { diff --git a/libraries/libstratosphere/source/pwm/driver/impl/pwm_driver_core.cpp b/libraries/libstratosphere/source/pwm/driver/impl/pwm_driver_core.cpp index 19fead5c1..bb5eacbe1 100644 --- a/libraries/libstratosphere/source/pwm/driver/impl/pwm_driver_core.cpp +++ b/libraries/libstratosphere/source/pwm/driver/impl/pwm_driver_core.cpp @@ -79,7 +79,7 @@ namespace ams::pwm::driver::impl { Result RegisterDeviceCode(DeviceCode device_code, IPwmDevice *device) { AMS_ASSERT(device != nullptr); R_TRY(GetDeviceCodeEntryManager().Add(device_code, device)); - return ResultSuccess(); + R_SUCCEED(); } bool UnregisterDeviceCode(DeviceCode device_code) { @@ -96,7 +96,7 @@ namespace ams::pwm::driver::impl { /* Set output. */ *out = device->SafeCastToPointer(); - return ResultSuccess(); + R_SUCCEED(); } Result FindDeviceByChannelIndex(IPwmDevice **out, int channel) { @@ -121,7 +121,7 @@ namespace ams::pwm::driver::impl { /* Check that we found the pad. */ R_UNLESS(found, ddsf::ResultDeviceCodeNotFound()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/pwm/driver/pwm_driver_channel_api.cpp b/libraries/libstratosphere/source/pwm/driver/pwm_driver_channel_api.cpp index 4cd9e6e4b..85d64a3e9 100644 --- a/libraries/libstratosphere/source/pwm/driver/pwm_driver_channel_api.cpp +++ b/libraries/libstratosphere/source/pwm/driver/pwm_driver_channel_api.cpp @@ -32,7 +32,7 @@ namespace ams::pwm::driver { /* We succeeded. */ session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } @@ -48,7 +48,7 @@ namespace ams::pwm::driver { /* Open the session. */ R_TRY(OpenSessionImpl(out, device)); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(ChannelSession &session) { diff --git a/libraries/libstratosphere/source/pwm/pwm_api.cpp b/libraries/libstratosphere/source/pwm/pwm_api.cpp index 35a68d912..1aa0a7e58 100644 --- a/libraries/libstratosphere/source/pwm/pwm_api.cpp +++ b/libraries/libstratosphere/source/pwm/pwm_api.cpp @@ -65,7 +65,7 @@ namespace ams::pwm { out->_session = session.Detach(); /* We succeeded. */ - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(ChannelSession &session) { diff --git a/libraries/libstratosphere/source/pwm/server/pwm_server_channel_session_impl.hpp b/libraries/libstratosphere/source/pwm/server/pwm_server_channel_session_impl.hpp index d797f558c..de76e67fd 100644 --- a/libraries/libstratosphere/source/pwm/server/pwm_server_channel_session_impl.hpp +++ b/libraries/libstratosphere/source/pwm/server/pwm_server_channel_session_impl.hpp @@ -39,48 +39,48 @@ namespace ams::pwm::server { R_TRY(pwm::driver::OpenSession(std::addressof(m_internal_session), device_code)); m_has_session = true; - return ResultSuccess(); + R_SUCCEED(); } public: /* Actual commands. */ Result SetPeriod(TimeSpanType period) { pwm::driver::SetPeriod(m_internal_session, period); - return ResultSuccess(); + R_SUCCEED(); } Result GetPeriod(ams::sf::Out out) { out.SetValue(pwm::driver::GetPeriod(m_internal_session)); - return ResultSuccess(); + R_SUCCEED(); } Result SetDuty(int duty) { pwm::driver::SetDuty(m_internal_session, duty); - return ResultSuccess(); + R_SUCCEED(); } Result GetDuty(ams::sf::Out out) { out.SetValue(pwm::driver::GetDuty(m_internal_session)); - return ResultSuccess(); + R_SUCCEED(); } Result SetEnabled(bool enabled) { pwm::driver::SetEnabled(m_internal_session, enabled); - return ResultSuccess(); + R_SUCCEED(); } Result GetEnabled(ams::sf::Out out) { out.SetValue(pwm::driver::GetEnabled(m_internal_session)); - return ResultSuccess(); + R_SUCCEED(); } Result SetScale(double scale) { pwm::driver::SetScale(m_internal_session, scale); - return ResultSuccess(); + R_SUCCEED(); } Result GetScale(ams::sf::Out out) { out.SetValue(pwm::driver::GetScale(m_internal_session)); - return ResultSuccess(); + R_SUCCEED(); } }; static_assert(pwm::sf::IsIChannelSession); diff --git a/libraries/libstratosphere/source/pwm/server/pwm_server_manager_impl.cpp b/libraries/libstratosphere/source/pwm/server/pwm_server_manager_impl.cpp index 744dd017b..95562daa9 100644 --- a/libraries/libstratosphere/source/pwm/server/pwm_server_manager_impl.cpp +++ b/libraries/libstratosphere/source/pwm/server/pwm_server_manager_impl.cpp @@ -46,7 +46,7 @@ namespace ams::pwm::server { /* We succeeded. */ *out = std::move(session); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/scs/scs_shell.cpp b/libraries/libstratosphere/source/scs/scs_shell.cpp index f6662827f..3ebf317b3 100644 --- a/libraries/libstratosphere/source/scs/scs_shell.cpp +++ b/libraries/libstratosphere/source/scs/scs_shell.cpp @@ -67,7 +67,7 @@ namespace ams::scs { .socket = socket, }; - return ResultSuccess(); + R_SUCCEED(); } void Unregister(s32 socket) { @@ -339,7 +339,7 @@ namespace ams::scs { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } void FlushProgramArgument(ncm::ProgramId program_id) { @@ -390,7 +390,7 @@ namespace ams::scs { /* Launch the program. */ R_TRY(pgl::LaunchProgram(out, loc, process_flags | pm::LaunchFlags_SignalOnExit, 0)); - return ResultSuccess(); + R_SUCCEED(); } Result SubscribeProcessEvent(s32 socket, bool is_register, u64 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 687a5707c..97b4728c2 100644 --- a/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp +++ b/libraries/libstratosphere/source/settings/impl/settings_key_value_store.cpp @@ -330,7 +330,7 @@ namespace ams::settings::impl { /* Set the output pointer. */ *out = map; - return ResultSuccess(); + R_SUCCEED(); } Result GetKeyValueStoreMapForciblyForDebug(Map **out) { @@ -388,7 +388,7 @@ namespace ams::settings::impl { /* Ensure we don't free the value buffers we returned. */ map_value.current_value = nullptr; map_value.default_value = nullptr; - return ResultSuccess(); + R_SUCCEED(); } template @@ -428,7 +428,7 @@ namespace ams::settings::impl { /* Set the output pointer. */ *out_data = data; - return ResultSuccess(); + R_SUCCEED(); } Result GetSystemSaveData(SystemSaveData **out_data, bool create_save) { @@ -453,7 +453,7 @@ namespace ams::settings::impl { /* Set the output pointer. */ *out_data = data; - return ResultSuccess(); + R_SUCCEED(); } Result LoadKeyValueStoreMap(Map *out) { @@ -501,7 +501,7 @@ namespace ams::settings::impl { } } - return ResultSuccess(); + R_SUCCEED(); } Result LoadKeyValueStoreMap(Map *out, SplHardwareType hardware_type) { @@ -510,7 +510,7 @@ namespace ams::settings::impl { /* Get the platform configuration system data for the hardware type. */ switch (hardware_type) { case SplHardwareType_None: - return ResultSuccess(); + R_SUCCEED(); case SplHardwareType_Icosa: R_TRY(GetSystemData(std::addressof(data), ncm::SystemDataId::PlatformConfigIcosa)); break; @@ -579,10 +579,10 @@ namespace ams::settings::impl { } } - return ResultSuccess(); + R_SUCCEED(); })); - return ResultSuccess(); + R_SUCCEED(); } template @@ -636,10 +636,10 @@ namespace ams::settings::impl { /* Insert the value into the map. */ map[std::move(default_key)] = default_value; - return ResultSuccess(); + R_SUCCEED(); })); - return ResultSuccess(); + R_SUCCEED(); } template @@ -657,7 +657,7 @@ namespace ams::settings::impl { R_TRY(LoadKeyValueStoreMapEntry(out, data, offset, load)); } - return ResultSuccess(); + R_SUCCEED(); } template @@ -729,7 +729,7 @@ namespace ams::settings::impl { /* Load the current values for the system save data. */ R_TRY(LoadKeyValueStoreMapCurrent(out, *system_save_data)); - return ResultSuccess(); + R_SUCCEED(); } template @@ -741,7 +741,7 @@ namespace ams::settings::impl { /* Increment the offset. */ offset += static_cast(size); - return ResultSuccess(); + R_SUCCEED(); } template @@ -762,7 +762,7 @@ namespace ams::settings::impl { /* We succeeded. */ alloc_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } template @@ -788,7 +788,7 @@ namespace ams::settings::impl { /* Set the count. */ *out_count = size; - return ResultSuccess(); + R_SUCCEED(); } Result ReadSystemDataFirmwareDebug(u64 *out_count, char * const out_buffer, size_t out_buffer_size) { @@ -808,7 +808,7 @@ namespace ams::settings::impl { *out_count = 0; } - return ResultSuccess(); + R_SUCCEED(); } Result ReadSystemDataPlatformConfiguration(u64 *out_count, char * const out_buffer, size_t out_buffer_size) { @@ -821,7 +821,7 @@ namespace ams::settings::impl { switch (GetSplHardwareType()) { case SplHardwareType_None: *out_count = 0; - return ResultSuccess(); + R_SUCCEED(); case SplHardwareType_Icosa: system_data_id = ncm::SystemDataId::PlatformConfigIcosa; break; @@ -855,7 +855,7 @@ namespace ams::settings::impl { *out_count = 0; } - return ResultSuccess(); + R_SUCCEED(); } Result ReadSystemSaveData(u64 *out_count, char * const out_buffer, size_t out_buffer_size) { @@ -875,7 +875,7 @@ namespace ams::settings::impl { *out_count = 0; } - return ResultSuccess(); + R_SUCCEED(); } Result SaveKeyValueStoreMap(const Map &map) { @@ -1007,7 +1007,7 @@ namespace ams::settings::impl { offset += static_cast(value_size); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -1067,7 +1067,7 @@ namespace ams::settings::impl { .entire_size = item_map_key_size, .map_key = buffer, }; - return ResultSuccess(); + R_SUCCEED(); } Result KeyValueStore::GetValue(u64 *out_count, char *out_buffer, size_t out_buffer_size, const SettingsItemKey &item_key) { @@ -1104,7 +1104,7 @@ namespace ams::settings::impl { /* Set the output count. */ *out_count = current_value_size; - return ResultSuccess(); + R_SUCCEED(); } Result KeyValueStore::GetValueSize(u64 *out_value_size, const SettingsItemKey &item_key) { @@ -1128,7 +1128,7 @@ namespace ams::settings::impl { /* Output the value size. */ *out_value_size = it->second.current_value_size; - return ResultSuccess(); + R_SUCCEED(); } Result KeyValueStore::ResetValue(const SettingsItemKey &item_key) { @@ -1177,7 +1177,7 @@ namespace ams::settings::impl { FreeToHeap(prev_value, prev_value_size); } - return ResultSuccess(); + R_SUCCEED(); } Result KeyValueStore::SetValue(const SettingsItemKey &item_key, const void *buffer, size_t buffer_size) { @@ -1246,7 +1246,7 @@ namespace ams::settings::impl { return result; } - return ResultSuccess(); + R_SUCCEED(); } Result AddKeyValueStoreItemForDebug(const KeyValueStoreItemForDebug * const items, size_t items_count) { @@ -1298,7 +1298,7 @@ namespace ams::settings::impl { map_value.default_value = nullptr; } - return ResultSuccess(); + R_SUCCEED(); } Result AdvanceKeyValueStoreKeyIterator(KeyValueStoreKeyIterator *out) { @@ -1350,7 +1350,7 @@ namespace ams::settings::impl { out->entire_size = map_key_size; out->map_key = buffer; - return ResultSuccess(); + R_SUCCEED(); } Result DestroyKeyValueStoreKeyIterator(KeyValueStoreKeyIterator *out) { @@ -1370,7 +1370,7 @@ namespace ams::settings::impl { out->header_size = 0; out->entire_size = 0; out->map_key = nullptr; - return ResultSuccess(); + R_SUCCEED(); } Result GetKeyValueStoreItemCountForDebug(u64 *out_count) { @@ -1387,7 +1387,7 @@ namespace ams::settings::impl { /* Output the item count. */ *out_count = map->size(); - return ResultSuccess(); + R_SUCCEED(); } Result GetKeyValueStoreItemForDebug(u64 *out_count, KeyValueStoreItemForDebug * const out_items, size_t out_items_count) { @@ -1430,7 +1430,7 @@ namespace ams::settings::impl { /* Set the output count. */ *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result GetKeyValueStoreKeyIteratorKey(u64 *out_count, char *out_buffer, size_t out_buffer_size, const KeyValueStoreKeyIterator &iterator) { @@ -1452,7 +1452,7 @@ namespace ams::settings::impl { /* Output the key size. */ *out_count = key_size; - return ResultSuccess(); + R_SUCCEED(); } Result GetKeyValueStoreKeyIteratorKeySize(u64 *out_count, const KeyValueStoreKeyIterator &iterator) { @@ -1464,7 +1464,7 @@ namespace ams::settings::impl { /* Output the key size. */ *out_count = std::min(iterator.entire_size - iterator.header_size, SettingsItemKeyLengthMax + 1); - return ResultSuccess(); + R_SUCCEED(); } Result ReadKeyValueStoreFirmwareDebug(u64 *out_count, char * const out_buffer, size_t out_buffer_size) { diff --git a/libraries/libstratosphere/source/settings/impl/settings_system_data.cpp b/libraries/libstratosphere/source/settings/impl/settings_system_data.cpp index 3ec4a39ed..27037ebe2 100644 --- a/libraries/libstratosphere/source/settings/impl/settings_system_data.cpp +++ b/libraries/libstratosphere/source/settings/impl/settings_system_data.cpp @@ -128,7 +128,7 @@ namespace ams::settings::impl { AMS_ASSERT(succeeded); AMS_UNUSED(succeeded); - return ResultSuccess(); + R_SUCCEED(); } LazyFileAccessor &GetLazyFileAccessor() { diff --git a/libraries/libstratosphere/source/settings/impl/settings_system_save_data.cpp b/libraries/libstratosphere/source/settings/impl/settings_system_save_data.cpp index cd9066509..31cac7684 100644 --- a/libraries/libstratosphere/source/settings/impl/settings_system_save_data.cpp +++ b/libraries/libstratosphere/source/settings/impl/settings_system_save_data.cpp @@ -92,7 +92,7 @@ namespace ams::settings::impl { m_is_activated = true; } - return ResultSuccess(); + R_SUCCEED(); } Result LazyFileAccessor::Commit(const char *name, bool synchronous) { @@ -113,7 +113,7 @@ namespace ams::settings::impl { m_timer_event.StartOneShot(TimeSpan::FromMilliSeconds(LazyWriterDelayMilliSeconds)); } - return ResultSuccess(); + R_SUCCEED(); } Result LazyFileAccessor::Create(const char *name, s64 size) { @@ -157,7 +157,7 @@ namespace ams::settings::impl { /* Start the timer to write. */ m_timer_event.StartOneShot(TimeSpan::FromMilliSeconds(LazyWriterDelayMilliSeconds)); - return ResultSuccess(); + R_SUCCEED(); } Result LazyFileAccessor::Open(const char *name, int mode) { @@ -177,7 +177,7 @@ namespace ams::settings::impl { if (m_open_mode == mode || m_open_mode == fs::OpenMode_Read) { m_is_busy = true; m_open_mode = mode; - return ResultSuccess(); + R_SUCCEED(); } caches = false; } @@ -212,7 +212,7 @@ namespace ams::settings::impl { m_is_busy = true; m_open_mode = mode; - return ResultSuccess(); + R_SUCCEED(); } void LazyFileAccessor::Close() { @@ -238,7 +238,7 @@ namespace ams::settings::impl { std::memcpy(dst, m_buffer + offset, size); - return ResultSuccess(); + R_SUCCEED(); } Result LazyFileAccessor::Write(s64 offset, const void *src, size_t size) { @@ -272,7 +272,7 @@ namespace ams::settings::impl { m_size = size; } - return ResultSuccess(); + R_SUCCEED(); } Result LazyFileAccessor::SetFileSize(s64 size) { @@ -310,7 +310,7 @@ namespace ams::settings::impl { /* Update state. */ m_is_file_size_changed = prev_file_size != size; m_file_size = size; - return ResultSuccess(); + R_SUCCEED(); } void LazyFileAccessor::ThreadFunc(void *arg) { @@ -402,7 +402,7 @@ namespace ams::settings::impl { R_TRY(fs::CommitSaveData(m_mount_name)); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -493,7 +493,7 @@ namespace ams::settings::impl { Result SystemSaveData::Flush() { /* N doesn't do anything here. */ - return ResultSuccess(); + R_SUCCEED(); } Result SystemSaveData::SetFileSize(s64 size) { diff --git a/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_manager.cpp b/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_manager.cpp index cc17bc007..2ad695831 100644 --- a/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_manager.cpp +++ b/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_manager.cpp @@ -44,7 +44,7 @@ namespace ams::sf::cmif { AMS_ABORT_UNLESS(entry->owner == nullptr); out_ids[i] = m_manager->m_entry_manager.GetId(entry); } - return ResultSuccess(); + R_SUCCEED(); } void ServerDomainManager::Domain::ReserveSpecificIds(const DomainObjectId *ids, size_t count) { diff --git a/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp b/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp index b3ab676cf..ab55a9958 100644 --- a/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp +++ b/libraries/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp @@ -55,7 +55,7 @@ namespace ams::sf::cmif { case CmifDomainRequestType_Close: /* TODO: N doesn't error check here. Should we? */ domain->UnregisterObject(target_object_id); - return ResultSuccess(); + R_SUCCEED(); default: return sf::cmif::ResultInvalidInHeader(); } @@ -103,7 +103,7 @@ namespace ams::sf::cmif { /* If the object is in the domain, close our copy of it. Mitm objects are required to close their associated domain id, so this shouldn't cause desynch. */ domain->UnregisterObject(target_object_id); - return ResultSuccess(); + R_SUCCEED(); } default: return sf::cmif::ResultInvalidInHeader(); @@ -125,7 +125,7 @@ namespace ams::sf::cmif { for (size_t i = 0; i < this->GetInObjectCount(); i++) { in_objects[i] = m_domain->GetObject(m_in_object_ids[i]); } - return ResultSuccess(); + R_SUCCEED(); } HipcRequest DomainServiceObjectProcessor::PrepareForReply(const cmif::ServiceDispatchContext &ctx, PointerAndSize &out_raw_data, const ServerMessageRuntimeMetadata runtime_metadata) { diff --git a/libraries/libstratosphere/source/sf/cmif/sf_cmif_service_dispatch.cpp b/libraries/libstratosphere/source/sf/cmif/sf_cmif_service_dispatch.cpp index 1be21ecc2..ff89fc85f 100644 --- a/libraries/libstratosphere/source/sf/cmif/sf_cmif_service_dispatch.cpp +++ b/libraries/libstratosphere/source/sf/cmif/sf_cmif_service_dispatch.cpp @@ -117,7 +117,7 @@ namespace ams::sf::cmif { /* Write output header to raw data. */ *out_header = CmifOutHeader{OutHeaderMagic, 0, command_result.GetValue(), interface_id_for_debug}; - return ResultSuccess(); + R_SUCCEED(); } #if AMS_SF_MITM_SUPPORTED @@ -164,7 +164,7 @@ namespace ams::sf::cmif { /* Write output header to raw data. */ *out_header = CmifOutHeader{OutHeaderMagic, 0, command_result.GetValue(), interface_id_for_debug}; - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/sf/hipc/sf_hipc_api.os.horizon.cpp b/libraries/libstratosphere/source/sf/hipc/sf_hipc_api.os.horizon.cpp index 6c5b6d55f..8df6b7d8f 100644 --- a/libraries/libstratosphere/source/sf/hipc/sf_hipc_api.os.horizon.cpp +++ b/libraries/libstratosphere/source/sf/hipc/sf_hipc_api.os.horizon.cpp @@ -53,26 +53,26 @@ namespace ams::sf::hipc { R_TRY_CATCH(ReceiveImpl(session_handle, message_buffer.GetPointer(), message_buffer.GetSize())) { R_CATCH(svc::ResultSessionClosed) { *out_recv_result = ReceiveResult::Closed; - return ResultSuccess(); + R_SUCCEED(); } R_CATCH(svc::ResultReceiveListBroken) { *out_recv_result = ReceiveResult::NeedsRetry; - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; *out_recv_result = ReceiveResult::Success; - return ResultSuccess(); + R_SUCCEED(); } Result Receive(bool *out_closed, os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer) { R_TRY_CATCH(ReceiveImpl(session_handle, message_buffer.GetPointer(), message_buffer.GetSize())) { R_CATCH(svc::ResultSessionClosed) { *out_closed = true; - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; *out_closed = false; - return ResultSuccess(); + R_SUCCEED(); } Result Reply(os::NativeHandle session_handle, const cmif::PointerAndSize &message_buffer) { @@ -88,7 +88,7 @@ namespace ams::sf::hipc { R_TRY_CATCH(svc::CreateSession(out_server_handle, out_client_handle, 0, 0)) { R_CONVERT(svc::ResultOutOfResource, sf::hipc::ResultOutOfSessions()); } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp index 38336828d..17c257226 100644 --- a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp +++ b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp @@ -56,7 +56,7 @@ namespace ams::sf::hipc { /* Set output client handle. */ out_client_handle.SetValue(client_handle, false); - return ResultSuccess(); + R_SUCCEED(); } public: #if AMS_SF_MITM_SUPPORTED @@ -113,7 +113,7 @@ namespace ams::sf::hipc { /* Return the allocated id. */ AMS_ABORT_UNLESS(object_id != cmif::InvalidDomainObjectId); *out = object_id; - return ResultSuccess(); + R_SUCCEED(); } Result CopyFromCurrentDomain(sf::OutMoveHandle out, cmif::DomainObjectId object_id) { @@ -134,7 +134,7 @@ namespace ams::sf::hipc { R_TRY(cmifCopyFromCurrentDomain(util::GetReference(m_session->m_forward_service)->session, object_id.value, std::addressof(handle))); out.SetValue(handle, false); - return ResultSuccess(); + R_SUCCEED(); } #else R_UNLESS(!!(object), sf::hipc::ResultDomainObjectNotFound()); @@ -177,7 +177,7 @@ namespace ams::sf::hipc { #endif } - return ResultSuccess(); + R_SUCCEED(); } Result CloneCurrentObject(sf::OutMoveHandle out) { diff --git a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp index 99fb35b9e..b831344c7 100644 --- a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp +++ b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp @@ -30,7 +30,7 @@ namespace ams::sf::hipc { /* Clear future declarations if any, now that our query handler is present. */ R_ABORT_UNLESS(sm::mitm::ClearFutureMitm(service_name)); - return ResultSuccess(); + R_SUCCEED(); } #endif @@ -158,7 +158,7 @@ namespace ams::sf::hipc { } R_END_TRY_CATCH; } - return ResultSuccess(); + R_SUCCEED(); } Result ServerManagerBase::Process(os::MultiWaitHolderType *holder) { diff --git a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_session_manager.cpp b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_session_manager.cpp index 64996c5db..bc25555ca 100644 --- a/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_session_manager.cpp +++ b/libraries/libstratosphere/source/sf/hipc/sf_hipc_server_session_manager.cpp @@ -73,7 +73,7 @@ namespace ams::sf::hipc { } } - return ResultSuccess(); + R_SUCCEED(); } #endif @@ -102,7 +102,7 @@ namespace ams::sf::hipc { /* Register to wait list. */ this->RegisterServerSessionToWait(session_memory); - return ResultSuccess(); + R_SUCCEED(); } Result ServerSessionManager::AcceptSessionImpl(ServerSession *session_memory, os::NativeHandle port_handle, cmif::ServiceObjectHolder &&obj) { @@ -121,7 +121,7 @@ namespace ams::sf::hipc { R_TRY(this->RegisterSessionImpl(session_memory, session_handle, std::forward(obj))); session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } #if AMS_SF_MITM_SUPPORTED @@ -141,7 +141,7 @@ namespace ams::sf::hipc { /* Register to wait list. */ this->RegisterServerSessionToWait(session_memory); - return ResultSuccess(); + R_SUCCEED(); } Result ServerSessionManager::AcceptMitmSessionImpl(ServerSession *session_memory, os::NativeHandle mitm_port_handle, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) { @@ -157,7 +157,7 @@ namespace ams::sf::hipc { R_TRY(this->RegisterMitmSessionImpl(session_memory, mitm_session_handle, std::forward(obj), std::forward>(fsrv))); session_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } #endif @@ -207,10 +207,10 @@ namespace ams::sf::hipc { switch (recv_result) { case hipc::ReceiveResult::Success: session->m_is_closed = false; - return ResultSuccess(); + R_SUCCEED(); case hipc::ReceiveResult::Closed: session->m_is_closed = true; - return ResultSuccess(); + R_SUCCEED(); case hipc::ReceiveResult::NeedsRetry: continue; AMS_UNREACHABLE_DEFAULT_CASE(); @@ -231,14 +231,14 @@ namespace ams::sf::hipc { Result ServerSessionManager::ProcessRequest(ServerSession *session, const cmif::PointerAndSize &message) { if (session->m_is_closed) { this->CloseSessionImpl(session); - return ResultSuccess(); + R_SUCCEED(); } switch (GetCmifCommandType(message)) { case CmifCommandType_Close: { this->CloseSessionImpl(session); - return ResultSuccess(); + R_SUCCEED(); } default: { @@ -250,13 +250,13 @@ namespace ams::sf::hipc { R_CATCH_ALL() { /* All other results indicate something went very wrong. */ this->CloseSessionImpl(session); - return ResultSuccess(); + R_SUCCEED(); } } R_END_TRY_CATCH; /* We succeeded, so we can process future messages on this session. */ this->RegisterServerSessionToWait(session); - return ResultSuccess(); + R_SUCCEED(); } } } @@ -297,7 +297,7 @@ namespace ams::sf::hipc { Result ServerSessionManager::DispatchManagerRequest(ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message) { /* This will get overridden by ... WithDomain class. */ AMS_UNUSED(session, in_message, out_message); - return sf::ResultNotSupported(); + R_THROW(sf::ResultNotSupported()); } Result ServerSessionManager::DispatchRequest(cmif::ServiceObjectHolder &&obj_holder, ServerSession *session, const cmif::PointerAndSize &in_message, const cmif::PointerAndSize &out_message) { @@ -342,7 +342,7 @@ namespace ams::sf::hipc { R_TRY(hipc::Reply(session->m_session_handle, out_message)); } - return ResultSuccess(); + R_SUCCEED(); } diff --git a/libraries/libstratosphere/source/sm/sm_api.cpp b/libraries/libstratosphere/source/sm/sm_api.cpp index 47cd30f90..a145023f6 100644 --- a/libraries/libstratosphere/source/sm/sm_api.cpp +++ b/libraries/libstratosphere/source/sm/sm_api.cpp @@ -37,12 +37,12 @@ namespace ams::sm { g_ref_count = 1; } - return ResultSuccess(); + R_SUCCEED(); } Result Finalize() { /* NOTE: Nintendo does nothing here. */ - return ResultSuccess(); + R_SUCCEED(); } /* Ordinary SM API. */ diff --git a/libraries/libstratosphere/source/socket/impl/socket_api.os.horizon.cpp b/libraries/libstratosphere/source/socket/impl/socket_api.os.horizon.cpp index 299d762d6..45d600e12 100644 --- a/libraries/libstratosphere/source/socket/impl/socket_api.os.horizon.cpp +++ b/libraries/libstratosphere/source/socket/impl/socket_api.os.horizon.cpp @@ -208,7 +208,7 @@ namespace ams::socket::impl { g_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } ALWAYS_INLINE struct sockaddr *ConvertForLibnx(SockAddr *addr) { @@ -275,7 +275,7 @@ namespace ams::socket::impl { } lmem::DestroyExpHeap(heap_handle); - return ResultSuccess(); + R_SUCCEED(); } Result InitializeAllocatorForInternal(void *buffer, size_t size) { @@ -284,7 +284,7 @@ namespace ams::socket::impl { AMS_ABORT_UNLESS(size >= 4_KB); InitializeHeapImpl(buffer, size); - return ResultSuccess(); + R_SUCCEED(); } ssize_t RecvFrom(s32 desc, void *buffer, size_t buffer_size, MsgFlag flags, SockAddr *out_address, SockLenT *out_addr_len) { diff --git a/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp b/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp index 8352f849e..397932369 100644 --- a/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp +++ b/libraries/libstratosphere/source/spl/impl/spl_api_impl.cpp @@ -189,7 +189,7 @@ namespace ams::spl::impl { Result Allocate() { R_TRY(AllocateAesKeySlot(std::addressof(m_slot_index))); m_allocated = true; - return ResultSuccess(); + R_SUCCEED(); } }; @@ -394,7 +394,7 @@ namespace ams::spl::impl { util::GetReference(g_drbg).Generate(out, size, nullptr, 0); } - return ResultSuccess(); + R_SUCCEED(); } Result DecryptAndStoreDeviceUniqueKey(const void *src, size_t src_size, const AccessKey &access_key, const KeySource &key_source, u32 option) { @@ -458,7 +458,7 @@ namespace ams::spl::impl { std::memcpy(out, g_work_buffer, out_size); } - return ResultSuccess(); + R_SUCCEED(); } Result PrepareEsDeviceUniqueKey(AccessKey *out_access_key, const void *base, size_t base_size, const void *mod, size_t mod_size, const void *label_digest, size_t label_digest_size, smc::EsDeviceUniqueKeyType type, u32 generation) { @@ -500,7 +500,7 @@ namespace ams::spl::impl { } std::memcpy(out_access_key, g_work_buffer, sizeof(*out_access_key)); - return ResultSuccess(); + R_SUCCEED(); } } @@ -583,7 +583,7 @@ namespace ams::spl::impl { } std::memcpy(out, g_work_buffer, out_size); - return ResultSuccess(); + R_SUCCEED(); } Result SetConfig(ConfigItem key, u64 value) { @@ -593,7 +593,7 @@ namespace ams::spl::impl { if (key == ConfigItem::ExosphereApiVersion) { hos::InitializeVersionInternal(false); } - return ResultSuccess(); + R_SUCCEED(); } Result GenerateRandomBytes(void *out, size_t size) { @@ -601,7 +601,7 @@ namespace ams::spl::impl { R_TRY(GenerateRandomBytesImpl(static_cast(out) + offset, std::min(size - offset, Drbg::RequestSizeMax))); } - return ResultSuccess(); + R_SUCCEED(); } Result IsDevelopment(bool *out) { @@ -609,7 +609,7 @@ namespace ams::spl::impl { R_TRY(impl::GetConfig(std::addressof(hardware_state), ConfigItem::HardwareState)); *out = (hardware_state == HardwareState_Development); - return ResultSuccess(); + R_SUCCEED(); } Result SetBootReason(BootReasonValue boot_reason) { @@ -617,14 +617,14 @@ namespace ams::spl::impl { g_boot_reason = boot_reason; g_is_boot_reason_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } Result GetBootReason(BootReasonValue *out) { R_UNLESS(g_is_boot_reason_initialized, spl::ResultBootReasonNotInitialized()); *out = g_boot_reason; - return ResultSuccess(); + R_SUCCEED(); } /* Crypto. */ @@ -644,7 +644,7 @@ namespace ams::spl::impl { g_aes_keyslot_contents[index].aes_key.access_key = access_key; g_aes_keyslot_contents[index].aes_key.key_source = key_source; - return ResultSuccess(); + R_SUCCEED(); } Result GenerateAesKey(AesKey *out_key, const AccessKey &access_key, const KeySource &key_source) { @@ -747,7 +747,7 @@ namespace ams::spl::impl { } #endif - return ResultSuccess(); + R_SUCCEED(); } Result ComputeCmac(Cmac *out_cmac, s32 keyslot, const void *data, size_t size) { @@ -764,12 +764,12 @@ namespace ams::spl::impl { g_is_aes_keyslot_allocated[i] = true; g_aes_keyslot_contents[i].type = AesKeySlotContentType::None; *out_keyslot = MakeVirtualAesKeySlot(i); - return ResultSuccess(); + R_SUCCEED(); } } util::GetReference(g_aes_keyslot_available_event).Clear(); - return spl::ResultNoAvailableKeySlot(); + R_THROW(spl::ResultNoAvailableKeySlot()); } Result DeallocateAesKeySlot(s32 keyslot) { @@ -791,14 +791,14 @@ namespace ams::spl::impl { g_is_aes_keyslot_allocated[index] = false; util::GetReference(g_aes_keyslot_available_event).Signal(); - return ResultSuccess(); + R_SUCCEED(); } Result TestAesKeySlot(s32 *out_index, bool *out_virtual, s32 keyslot) { if (g_is_physical_keyslot_allowed && IsPhysicalAesKeySlot(keyslot)) { *out_index = keyslot; *out_virtual = false; - return ResultSuccess(); + R_SUCCEED(); } R_UNLESS(IsVirtualAesKeySlot(keyslot), spl::ResultInvalidKeySlot()); @@ -808,7 +808,7 @@ namespace ams::spl::impl { *out_index = index; *out_virtual = true; - return ResultSuccess(); + R_SUCCEED(); } os::SystemEvent *GetAesKeySlotAvailableEvent() { @@ -910,7 +910,7 @@ namespace ams::spl::impl { R_UNLESS(data_size > 0, spl::ResultDecryptionFailed()); *out_size = static_cast(data_size); - return ResultSuccess(); + R_SUCCEED(); } Result GenerateSpecificAesKey(AesKey *out_key, const KeySource &key_source, u32 generation, u32 which) { @@ -928,7 +928,7 @@ namespace ams::spl::impl { g_aes_keyslot_contents[index].type = AesKeySlotContentType::PreparedKey; g_aes_keyslot_contents[index].prepared_key.access_key = access_key; - return ResultSuccess(); + R_SUCCEED(); } Result GetPackage2Hash(void *dst, const size_t size) { @@ -941,7 +941,7 @@ namespace ams::spl::impl { } std::memcpy(dst, hash, sizeof(hash)); - return ResultSuccess(); + R_SUCCEED(); } /* Manu. */ diff --git a/libraries/libstratosphere/source/spl/spl_api.os.horizon.cpp b/libraries/libstratosphere/source/spl/spl_api.os.horizon.cpp index e296579c1..04e62b88b 100644 --- a/libraries/libstratosphere/source/spl/spl_api.os.horizon.cpp +++ b/libraries/libstratosphere/source/spl/spl_api.os.horizon.cpp @@ -73,7 +73,7 @@ namespace ams::spl { } } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } } @@ -259,7 +259,7 @@ namespace ams::spl { R_TRY(splGetBootReason(std::addressof(v))); std::memcpy(out, std::addressof(v), sizeof(*out)); - return ResultSuccess(); + R_SUCCEED(); } SocType GetSocType() { diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.cpp index da5a452e1..332c1583d 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.cpp @@ -48,7 +48,7 @@ namespace ams::sprofile::srv { /* Return the object. */ *out = std::move(obj); - return ResultSuccess(); + R_SUCCEED(); } void ProfileUpdateObserverManager::CloseObserver(ProfileUpdateObserverImpl *observer) { diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp index aa6a276d1..f54d230d4 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp @@ -48,7 +48,7 @@ namespace ams::sprofile::srv { /* Add the profile. */ m_profiles[m_profile_count++] = profile; - return ResultSuccess(); + R_SUCCEED(); } Result Unlisten(Identifier profile) { @@ -57,16 +57,16 @@ namespace ams::sprofile::srv { if (m_profiles[i] == profile) { m_profiles[i] = m_profiles[--m_profile_count]; AMS_ABORT_UNLESS(m_profile_count >= 0); - return ResultSuccess(); + R_SUCCEED(); } } - return sprofile::ResultNotListening(); + R_THROW(sprofile::ResultNotListening()); } Result GetEventHandle(sf::OutCopyHandle out) { out.SetValue(m_event.GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } public: void OnUpdate(Identifier profile) { diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp index 9c3c8c86b..d99891d09 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp @@ -31,7 +31,7 @@ namespace ams::sprofile::srv { /* Return the object. */ *out = std::move(obj); - return ResultSuccess(); + R_SUCCEED(); } Result ServiceForBgAgent::GetImportableProfileUrls(sf::Out out_count, const sf::OutArray &out, const sprofile::srv::ProfileMetadataForImportMetadata &arg) { @@ -71,7 +71,7 @@ namespace ams::sprofile::srv { /* Set output count. */ *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } @@ -88,7 +88,7 @@ namespace ams::sprofile::srv { /* Determine if update is needed. */ *out = !(loaded_metadata && revision_key == primary_metadata.revision_key); - return ResultSuccess(); + R_SUCCEED(); } Result ServiceForBgAgent::Reset() { diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_system_process.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_system_process.cpp index b4f7b1a54..aee7a533b 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_system_process.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_system_process.cpp @@ -28,7 +28,7 @@ namespace ams::sprofile::srv { /* Return the object. */ *out = std::move(obj); - return ResultSuccess(); + R_SUCCEED(); } Result ServiceForSystemProcess::OpenProfileUpdateObserver(sf::Out> out) { @@ -45,7 +45,7 @@ namespace ams::sprofile::srv { /* Return the object. */ *out = std::move(obj); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/time/impl/util/time_impl_util_api.cpp b/libraries/libstratosphere/source/time/impl/util/time_impl_util_api.cpp index 3226db2b4..a610b1454 100644 --- a/libraries/libstratosphere/source/time/impl/util/time_impl_util_api.cpp +++ b/libraries/libstratosphere/source/time/impl/util/time_impl_util_api.cpp @@ -158,7 +158,7 @@ namespace ams::time::impl::util { R_UNLESS(from.source_id == to.source_id, time::ResultNotComparable()); R_UNLESS(ams::util::TrySubtractWithoutOverflow(out, to.value, from.value), time::ResultOverflowed()); - return ResultSuccess(); + R_SUCCEED(); } bool IsValidDate(int year, int month, int day) { diff --git a/libraries/libstratosphere/source/time/time_api.cpp b/libraries/libstratosphere/source/time/time_api.cpp index 737deaa70..e774637ef 100644 --- a/libraries/libstratosphere/source/time/time_api.cpp +++ b/libraries/libstratosphere/source/time/time_api.cpp @@ -47,7 +47,7 @@ namespace ams::time { if (g_initialize_count > 0) { AMS_ABORT_UNLESS(mode == g_initialize_mode); g_initialize_count++; - return ResultSuccess(); + R_SUCCEED(); } #if defined(ATMOSPHERE_OS_HORIZON) @@ -67,7 +67,7 @@ namespace ams::time { g_initialize_count++; g_initialize_mode = mode; - return ResultSuccess(); + R_SUCCEED(); } } @@ -102,7 +102,7 @@ namespace ams::time { } } - return ResultSuccess(); + R_SUCCEED(); } bool IsInitialized() { diff --git a/libraries/libstratosphere/source/updater/updater_api.cpp b/libraries/libstratosphere/source/updater/updater_api.cpp index a34fbcbf7..e1703c1f6 100644 --- a/libraries/libstratosphere/source/updater/updater_api.cpp +++ b/libraries/libstratosphere/source/updater/updater_api.cpp @@ -54,7 +54,7 @@ namespace ams::updater { R_UNLESS(work_buffer_size >= BctSize + EksSize, updater::ResultTooSmallWorkBuffer()); R_UNLESS(util::IsAligned(work_buffer, os::MemoryPageSize), updater::ResultNotAlignedWorkBuffer()); R_UNLESS(util::IsAligned(work_buffer_size, 0x200), updater::ResultNotAlignedWorkBuffer()); - return ResultSuccess(); + R_SUCCEED(); } bool HasEks(BootImageUpdateType boot_image_update_type) { @@ -106,7 +106,7 @@ namespace ams::updater { /* Read data from save. */ out->needs_verify_normal = save.GetNeedsVerification(BootModeType::Normal); out->needs_verify_safe = save.GetNeedsVerification(BootModeType::Safe); - return ResultSuccess(); + R_SUCCEED(); } Result VerifyBootImagesAndRepairIfNeeded(bool *out_repaired, BootModeType mode, void *work_buffer, size_t work_buffer_size, BootImageUpdateType boot_image_update_type) { @@ -192,7 +192,7 @@ namespace ams::updater { R_TRY(CompareHash(file_hash, nand_hash, sizeof(file_hash))); } - return ResultSuccess(); + R_SUCCEED(); } Result VerifyBootImagesSafe(ncm::SystemDataId data_id, void *work_buffer, size_t work_buffer_size, BootImageUpdateType boot_image_update_type) { @@ -254,7 +254,7 @@ namespace ams::updater { R_TRY(CompareHash(file_hash, nand_hash, sizeof(file_hash))); } - return ResultSuccess(); + R_SUCCEED(); } Result UpdateBootImagesNormal(ncm::SystemDataId data_id, void *work_buffer, size_t work_buffer_size, BootImageUpdateType boot_image_update_type) { @@ -324,7 +324,7 @@ namespace ams::updater { R_TRY(boot0_accessor.Write(GetPackage1Path(boot_image_update_type), work_buffer, work_buffer_size, Boot0Partition::Package1NormalMain)); } - return ResultSuccess(); + R_SUCCEED(); } Result UpdateBootImagesSafe(ncm::SystemDataId data_id, void *work_buffer, size_t work_buffer_size, BootImageUpdateType boot_image_update_type) { @@ -397,7 +397,7 @@ namespace ams::updater { R_TRY(boot1_accessor.Write(GetPackage1Path(boot_image_update_type), work_buffer, work_buffer_size, Boot1Partition::Package1SafeMain)); } - return ResultSuccess(); + R_SUCCEED(); } Result SetVerificationNeeded(BootModeType mode, void *work_buffer, size_t work_buffer_size, bool needed) { @@ -416,7 +416,7 @@ namespace ams::updater { save.SetNeedsVerification(mode, needed); R_TRY(save.Save()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateBctFileHash(Boot0Accessor &accessor, Boot0Partition which, const void *stored_hash, void *work_buffer, size_t work_buffer_size, BootImageUpdateType boot_image_update_type) { @@ -459,7 +459,7 @@ namespace ams::updater { Result CompareHash(const void *lhs, const void *rhs, size_t size) { R_UNLESS(crypto::IsSameBytes(lhs, rhs, size), updater::ResultNeedsRepairBootImages()); - return ResultSuccess(); + R_SUCCEED(); } } @@ -511,14 +511,14 @@ namespace ams::updater { if (attr & ncm::ContentMetaAttribute_IncludesExFatDriver) { out_data_id->value = keys[i].id; - return ResultSuccess(); + R_SUCCEED(); } } } /* If there's only one entry or no exfat entries, return that entry. */ out_data_id->value = keys[0].id; - return ResultSuccess(); + R_SUCCEED(); } Result MarkVerifyingRequired(BootModeType mode, void *work_buffer, size_t work_buffer_size) { @@ -553,7 +553,7 @@ namespace ams::updater { /* If we don't need to verify anything, we're done. */ if (!verification_state.needs_verify_normal && !verification_state.needs_verify_safe) { - return ResultSuccess(); + R_SUCCEED(); } /* Get a session to ncm. */ @@ -573,7 +573,7 @@ namespace ams::updater { } R_END_TRY_CATCH; } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/updater/updater_bis_management.cpp b/libraries/libstratosphere/source/updater/updater_bis_management.cpp index 0ed210d5c..fc94ee011 100644 --- a/libraries/libstratosphere/source/updater/updater_bis_management.cpp +++ b/libraries/libstratosphere/source/updater/updater_bis_management.cpp @@ -91,7 +91,7 @@ namespace ams::updater { break; } } - return ResultSuccess(); + R_SUCCEED(); } Result BisAccessor::Clear(u64 offset, u64 size, void *work_buffer, size_t work_buffer_size) { @@ -106,7 +106,7 @@ namespace ams::updater { R_TRY(this->Write(offset + written, work_buffer, cur_write_size)); written += cur_write_size; } - return ResultSuccess(); + R_SUCCEED(); } Result BisAccessor::GetHash(void *dst, u64 offset, u64 size, u64 hash_size, void *work_buffer, size_t work_buffer_size) { @@ -127,7 +127,7 @@ namespace ams::updater { } generator.GetHash(dst, hash_size); - return ResultSuccess(); + R_SUCCEED(); } size_t Boot0Accessor::GetBootloaderVersion(void *bct) { @@ -154,7 +154,7 @@ namespace ams::updater { Result Boot0Accessor::UpdateEksManually(void *dst_bct, const void *src_eks) { this->CopyEks(dst_bct, src_eks, GetEksIndex(GetBootloaderVersion(dst_bct))); - return ResultSuccess(); + R_SUCCEED(); } Result Boot0Accessor::PreserveAutoRcm(void *dst_bct, void *work_buffer, Boot0Partition which) { @@ -168,7 +168,7 @@ namespace ams::updater { void *src_pubk = reinterpret_cast(reinterpret_cast(work_buffer) + BctPubkOffsetErista); std::memcpy(dst_pubk, src_pubk, BctPubkSize); - return ResultSuccess(); + R_SUCCEED(); } Result Boot0Accessor::DetectCustomPublicKey(bool *out, void *work_buffer, BootImageUpdateType boot_image_update_type) { @@ -181,18 +181,18 @@ namespace ams::updater { if (std::memcmp(reinterpret_cast(reinterpret_cast(work_buffer) + pubk_offset), CustomPublicKey, sizeof(CustomPublicKey)) != 0) { *out = false; - return ResultSuccess(); + R_SUCCEED(); } R_TRY(this->Read(&read_size, work_buffer, BctSize, Boot0Partition::BctSafeMain)); if (std::memcmp(reinterpret_cast(reinterpret_cast(work_buffer) + pubk_offset), CustomPublicKey, sizeof(CustomPublicKey)) != 0) { *out = false; - return ResultSuccess(); + R_SUCCEED(); } *out = true; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/updater/updater_bis_management.hpp b/libraries/libstratosphere/source/updater/updater_bis_management.hpp index 7e9bcb169..2d6039f01 100644 --- a/libraries/libstratosphere/source/updater/updater_bis_management.hpp +++ b/libraries/libstratosphere/source/updater/updater_bis_management.hpp @@ -143,7 +143,7 @@ namespace ams::updater { R_TRY(BisAccessor::Read(dst, entry->size, entry->offset)); *out_size = entry->size; - return ResultSuccess(); + R_SUCCEED(); } Result Write(const void *src, size_t size, EnumType which) { diff --git a/libraries/libstratosphere/source/updater/updater_bis_save.cpp b/libraries/libstratosphere/source/updater/updater_bis_save.cpp index 5515ba3bd..085bb9537 100644 --- a/libraries/libstratosphere/source/updater/updater_bis_save.cpp +++ b/libraries/libstratosphere/source/updater/updater_bis_save.cpp @@ -36,7 +36,7 @@ namespace ams::updater { R_TRY(m_accessor.Initialize()); m_save_buffer = work_buffer; - return ResultSuccess(); + R_SUCCEED(); } void BisSave::Finalize() { diff --git a/libraries/libstratosphere/source/updater/updater_files.cpp b/libraries/libstratosphere/source/updater/updater_files.cpp index 5ec086c46..da22ba6cc 100644 --- a/libraries/libstratosphere/source/updater/updater_files.cpp +++ b/libraries/libstratosphere/source/updater/updater_files.cpp @@ -57,7 +57,7 @@ namespace ams::updater { generator.GetHash(dst_hash, crypto::Sha256Generator::HashSize); *out_size = total_size; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/usb/usb_device.cpp b/libraries/libstratosphere/source/usb/usb_device.cpp index 4881e05e0..17d6feb91 100644 --- a/libraries/libstratosphere/source/usb/usb_device.cpp +++ b/libraries/libstratosphere/source/usb/usb_device.cpp @@ -73,7 +73,7 @@ namespace ams::usb { /* Mark ourselves as initialized. */ m_is_initialized = true; - return ResultSuccess(); + R_SUCCEED(); } Result DsClient::Finalize() { @@ -104,7 +104,7 @@ namespace ams::usb { m_ds_service = nullptr; m_root_session = nullptr; - return ResultSuccess(); + R_SUCCEED(); } bool DsClient::IsInitialized() { @@ -132,7 +132,7 @@ namespace ams::usb { /* Mark disabled. */ m_is_enabled = true; - return ResultSuccess(); + R_SUCCEED(); } Result DsClient::DisableDevice() { @@ -156,7 +156,7 @@ namespace ams::usb { /* Mark disabled. */ m_is_enabled = false; - return ResultSuccess(); + R_SUCCEED(); } os::SystemEventType *DsClient::GetStateChangeEvent() { @@ -215,7 +215,7 @@ namespace ams::usb { /* Set interface. */ m_interfaces[bInterfaceNumber] = intf; - return ResultSuccess(); + R_SUCCEED(); } Result DsClient::DeleteInterface(uint8_t bInterfaceNumber) { @@ -231,7 +231,7 @@ namespace ams::usb { /* Clear the interface. */ m_interfaces[bInterfaceNumber] = nullptr; - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::Initialize(DsClient *client, u8 bInterfaceNumber) { @@ -280,7 +280,7 @@ namespace ams::usb { m_is_initialized = true; intf_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::Finalize() { @@ -322,7 +322,7 @@ namespace ams::usb { --m_client->m_reference_count; m_client = nullptr; - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::AppendConfigurationData(UsbDeviceSpeed speed, void *data, u32 size) { @@ -369,7 +369,7 @@ namespace ams::usb { /* Perform the enable. */ R_TRY(m_interface->Enable()); - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::Disable() { @@ -388,7 +388,7 @@ namespace ams::usb { /* Perform the disable. */ R_TRY(m_interface->Disable()); - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::AddEndpoint(DsEndpoint *ep, u8 bEndpointAddress, sf::SharedPointer *out) { @@ -410,7 +410,7 @@ namespace ams::usb { /* Set the endpoint. */ m_endpoints[impl::GetEndpointIndex(bEndpointAddress)] = ep; - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::DeleteEndpoint(u8 bEndpointAddress) { @@ -428,7 +428,7 @@ namespace ams::usb { /* Clear the endpoint. */ m_endpoints[index] = nullptr; - return ResultSuccess(); + R_SUCCEED(); } Result DsInterface::CtrlIn(u32 *out_transferred, void *dst, u32 size) { @@ -475,13 +475,13 @@ namespace ams::usb { /* Handle the report. */ switch (m_report.reports[0].status) { case UrbStatus_Cancelled: - return usb::ResultInterrupted(); + R_THROW(usb::ResultInterrupted()); case UrbStatus_Failed: - return usb::ResultTransactionError(); + R_THROW(usb::ResultTransactionError()); case UrbStatus_Finished: - return ResultSuccess(); + R_SUCCEED(); default: - return usb::ResultInternalStateError(); + R_THROW(usb::ResultInternalStateError()); } } @@ -536,13 +536,13 @@ namespace ams::usb { /* Handle the report. */ switch (m_report.reports[0].status) { case UrbStatus_Cancelled: - return usb::ResultInterrupted(); + R_THROW(usb::ResultInterrupted()); case UrbStatus_Failed: - return usb::ResultTransactionError(); + R_THROW(usb::ResultTransactionError()); case UrbStatus_Finished: - return ResultSuccess(); + R_SUCCEED(); default: - return usb::ResultInternalStateError(); + R_THROW(usb::ResultInternalStateError()); } } @@ -661,7 +661,7 @@ namespace ams::usb { m_is_initialized = true; ep_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result DsEndpoint::Finalize() { @@ -696,7 +696,7 @@ namespace ams::usb { /* Mark uninitialized. */ m_is_initialized = false; - return ResultSuccess(); + R_SUCCEED(); } bool DsEndpoint::IsInitialized() { @@ -735,13 +735,13 @@ namespace ams::usb { /* Handle the report. */ switch (report.reports[0].status) { case UrbStatus_Cancelled: - return usb::ResultInterrupted(); + R_THROW(usb::ResultInterrupted()); case UrbStatus_Failed: - return usb::ResultTransactionError(); + R_THROW(usb::ResultTransactionError()); case UrbStatus_Finished: - return ResultSuccess(); + R_SUCCEED(); default: - return usb::ResultInternalStateError(); + R_THROW(usb::ResultInternalStateError()); } } @@ -763,7 +763,7 @@ namespace ams::usb { R_TRY(m_endpoint->PostBufferAsync(std::addressof(urb_id), reinterpret_cast(buf), size)); *out_urb_id = urb_id; - return ResultSuccess(); + R_SUCCEED(); } os::SystemEventType *DsEndpoint::GetCompletionEvent() { diff --git a/libraries/libstratosphere/source/usb/usb_remote_ds_endpoint.cpp b/libraries/libstratosphere/source/usb/usb_remote_ds_endpoint.cpp index f9bfa9bec..61d80d4fb 100644 --- a/libraries/libstratosphere/source/usb/usb_remote_ds_endpoint.cpp +++ b/libraries/libstratosphere/source/usb/usb_remote_ds_endpoint.cpp @@ -44,7 +44,7 @@ namespace ams::usb { ))); out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsEndpoint::GetUrbReport(sf::Out out) { diff --git a/libraries/libstratosphere/source/usb/usb_remote_ds_interface.cpp b/libraries/libstratosphere/source/usb/usb_remote_ds_interface.cpp index bd89e4491..a41855b8c 100644 --- a/libraries/libstratosphere/source/usb/usb_remote_ds_interface.cpp +++ b/libraries/libstratosphere/source/usb/usb_remote_ds_interface.cpp @@ -31,7 +31,7 @@ namespace ams::usb { *out = ObjectFactory::CreateSharedEmplaced(m_allocator, srv); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsInterface::GetSetupEvent(sf::OutCopyHandle out) { @@ -44,7 +44,7 @@ namespace ams::usb { ))); out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsInterface::GetSetupPacket(const sf::OutBuffer &out) { @@ -85,7 +85,7 @@ namespace ams::usb { ))); out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsInterface::GetCtrlInUrbReport(sf::Out out) { @@ -103,7 +103,7 @@ namespace ams::usb { ))); out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsInterface::GetCtrlOutUrbReport(sf::Out out) { diff --git a/libraries/libstratosphere/source/usb/usb_remote_ds_root_session.cpp b/libraries/libstratosphere/source/usb/usb_remote_ds_root_session.cpp index fea1ada56..04f01c6e1 100644 --- a/libraries/libstratosphere/source/usb/usb_remote_ds_root_session.cpp +++ b/libraries/libstratosphere/source/usb/usb_remote_ds_root_session.cpp @@ -28,7 +28,7 @@ namespace ams::usb { *out = ObjectFactory::CreateSharedEmplaced(m_allocator, srv, m_allocator); - return ResultSuccess(); + R_SUCCEED(); } #endif diff --git a/libraries/libstratosphere/source/usb/usb_remote_ds_service.cpp b/libraries/libstratosphere/source/usb/usb_remote_ds_service.cpp index efab02ac3..1baea6642 100644 --- a/libraries/libstratosphere/source/usb/usb_remote_ds_service.cpp +++ b/libraries/libstratosphere/source/usb/usb_remote_ds_service.cpp @@ -38,7 +38,7 @@ namespace ams::usb { ); } - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsService::RegisterInterface(sf::Out> out, u8 bInterfaceNumber) { @@ -52,7 +52,7 @@ namespace ams::usb { *out = ObjectFactory::CreateSharedEmplaced(m_allocator, srv, m_allocator); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsService::GetStateChangeEvent(sf::OutCopyHandle out) { @@ -65,7 +65,7 @@ namespace ams::usb { ))); out.SetValue(event_handle, true); - return ResultSuccess(); + R_SUCCEED(); } Result RemoteDsService::GetState(sf::Out out) { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.cpp index 94abb5cd0..71a0cdf7b 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.cpp @@ -60,7 +60,7 @@ namespace ams::sdmmc::impl { m_memory_capacity = (c_size + 1) << ((read_bl_len + c_size_mult + 2) - 9); m_is_valid_memory_capacity = true; - return ResultSuccess(); + R_SUCCEED(); } Result BaseDevice::CheckDeviceStatus(u32 r1_resp) const { @@ -94,7 +94,7 @@ namespace ams::sdmmc::impl { #undef AMS_SDMMC_CHECK_DEVICE_STATUS_ERROR - return ResultSuccess(); + R_SUCCEED(); } DeviceState BaseDevice::GetDeviceState(u32 r1_resp) const { @@ -125,7 +125,7 @@ namespace ams::sdmmc::impl { R_UNLESS(m_base_device->GetDeviceState(*out_response) == expected_state, sdmmc::ResultUnexpectedDeviceState()); } - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::IssueCommandGoIdleState() const { @@ -146,7 +146,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(dst_size >= DeviceCidSize); m_host_controller->GetLastResponse(static_cast(dst), DeviceCidSize, CommandResponseType); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::IssueCommandSelectCard() const { @@ -174,7 +174,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(dst_size >= DeviceCsdSize); m_host_controller->GetLastResponse(static_cast(dst), DeviceCsdSize, CommandResponseType); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::IssueCommandSendStatus(u32 *out_device_status, u32 status_ignore_mask) const { @@ -260,7 +260,7 @@ namespace ams::sdmmc::impl { /* Check the device status. */ R_TRY(m_base_device->CheckDeviceStatus(st_resp & ~status_ignore_mask)); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::ReadWriteSingle(u32 *out_num_transferred_blocks, u32 sector_index, u32 num_sectors, void *buf, bool is_read) const { @@ -281,7 +281,7 @@ namespace ams::sdmmc::impl { u32 device_status; R_TRY(this->IssueCommandSendStatus(std::addressof(device_status), status_ignore_mask)); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::ReadWriteMultiple(u32 sector_index, u32 num_sectors, u32 sector_index_alignment, void *buf, size_t buf_size, bool is_read) { @@ -357,7 +357,7 @@ namespace ams::sdmmc::impl { cur_buf += num_transferred_blocks * SectorSize; } - return ResultSuccess(); + R_SUCCEED(); } #if defined(AMS_SDMMC_USE_DEVICE_VIRTUAL_ADDRESS) @@ -399,7 +399,7 @@ namespace ams::sdmmc::impl { activate_guard.Cancel(); m_base_device->SetActive(); - return ResultSuccess(); + R_SUCCEED(); } void BaseDeviceAccessor::Deactivate() { @@ -428,7 +428,7 @@ namespace ams::sdmmc::impl { /* We successfully performed the read/write. */ rw_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::CheckConnection(SpeedMode *out_speed_mode, BusWidth *out_bus_width) { @@ -446,7 +446,7 @@ namespace ams::sdmmc::impl { /* Verify that we can get the status. */ R_TRY(m_host_controller->GetInternalStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetMemoryCapacity(u32 *out_sectors) const { @@ -461,7 +461,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(out_sectors != nullptr); *out_sectors = m_base_device->GetMemoryCapacity(); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetDeviceStatus(u32 *out) const { @@ -475,7 +475,7 @@ namespace ams::sdmmc::impl { /* Get the status. */ R_TRY(this->IssueCommandSendStatus(out, 0)); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetOcr(u32 *out) const { @@ -490,7 +490,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(out != nullptr); *out = m_base_device->GetOcr(); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetRca(u16 *out) const { @@ -505,7 +505,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(out != nullptr); *out = m_base_device->GetRca(); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetCid(void *out, size_t size) const { @@ -519,7 +519,7 @@ namespace ams::sdmmc::impl { /* Get the cid. */ m_base_device->GetCid(out, size); - return ResultSuccess(); + R_SUCCEED(); } Result BaseDeviceAccessor::GetCsd(void *out, size_t size) const { @@ -533,7 +533,7 @@ namespace ams::sdmmc::impl { /* Get the csd. */ m_base_device->GetCsd(out, size); - return ResultSuccess(); + R_SUCCEED(); } void BaseDeviceAccessor::GetAndClearErrorInfo(ErrorInfo *out_error_info, size_t *out_log_size, char *out_log_buffer, size_t log_buffer_size) { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.hpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.hpp index 30137af47..d31dce079 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.hpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_base_device_accessor.hpp @@ -306,7 +306,7 @@ namespace ams::sdmmc::impl { R_UNLESS(!this->IsRemoved(), sdmmc::ResultDeviceRemoved()); #endif - return ResultSuccess(); + R_SUCCEED(); } Result CheckAccessible() const { @@ -319,7 +319,7 @@ namespace ams::sdmmc::impl { /* Check removed. */ R_TRY(this->CheckRemoved()); - return ResultSuccess(); + R_SUCCEED(); } void SetHighCapacity(bool en) { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_gc_asic_device_accessor.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_gc_asic_device_accessor.cpp index 3f6a30990..6c18f3e9f 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_gc_asic_device_accessor.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_gc_asic_device_accessor.cpp @@ -96,25 +96,25 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_gc_asic_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::IssueCommandFinishOperation() const { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_GcAsicFinishOperation, 0, true, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::IssueCommandSleep() { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_GcAsicSleep, 0, true, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::IssueCommandUpdateKey() const { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_GcAsicUpdateKey, 0, true, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::StartupGcAsicDevice() { @@ -136,7 +136,7 @@ namespace ams::sdmmc::impl { /* Enable power saving. */ hc->SetPowerSaving(true); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::OnActivate() { @@ -148,7 +148,7 @@ namespace ams::sdmmc::impl { /* We started up, so we don't need to power down. */ power_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::OnReadWrite(u32 sector_index, u32 num_sectors, void *buf, size_t buf_size, bool is_read) { @@ -165,7 +165,7 @@ namespace ams::sdmmc::impl { /* Require that we read/wrote as many sectors as we expected. */ AMS_ABORT_UNLESS(num_transferred_blocks == num_sectors); - return ResultSuccess(); + R_SUCCEED(); } void GcAsicDeviceAccessor::Initialize() { @@ -229,7 +229,7 @@ namespace ams::sdmmc::impl { R_TRY(m_gc_asic_device.CheckAccessible()); *out_speed_mode = SpeedMode_GcAsicSpeed; - return ResultSuccess(); + R_SUCCEED(); } void GcAsicDeviceAccessor::PutGcAsicToSleep() { @@ -275,7 +275,7 @@ namespace ams::sdmmc::impl { R_TRY(BaseDeviceAccessor::GetHostController()->Awaken()); } - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::WriteGcAsicOperation(const void *op_buf, size_t op_buf_size) { @@ -289,7 +289,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandWriteOperation(op_buf, op_buf_size)); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::FinishGcAsicOperation() { @@ -303,7 +303,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandFinishOperation()); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::AbortGcAsicOperation() { @@ -318,7 +318,7 @@ namespace ams::sdmmc::impl { R_TRY(BaseDeviceAccessor::GetHostController()->IssueStopTransmissionCommand(std::addressof(resp))); R_TRY(m_gc_asic_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::SleepGcAsic() { @@ -332,7 +332,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSleep()); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result GcAsicDeviceAccessor::UpdateGcAsicKey() { @@ -346,7 +346,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandUpdateKey()); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_io_impl.board.nintendo_nx.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_io_impl.board.nintendo_nx.cpp index e3a5cdd07..7e4ca0443 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_io_impl.board.nintendo_nx.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_io_impl.board.nintendo_nx.cpp @@ -339,14 +339,14 @@ namespace ams::sdmmc::impl { /* TODO: A way for this to be non-fatal? */ AMS_ABORT_UNLESS(max7762x::SetVoltageEnabled(en)); - return ResultSuccess(); + R_SUCCEED(); } Result SetSdCardVoltageValue(u32 micro_volts) { /* TODO: A way for this to be non-fatal? */ AMS_ABORT_UNLESS(max7762x::SetVoltageValue(micro_volts)); - return ResultSuccess(); + R_SUCCEED(); } namespace gpio_impl { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_mmc_device_accessor.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_mmc_device_accessor.cpp index 20e6bde08..790bca026 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_mmc_device_accessor.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_mmc_device_accessor.cpp @@ -113,10 +113,10 @@ namespace ams::sdmmc::impl { case 1: *out = SpeedMode_MmcHighSpeed; break; case 2: *out = SpeedMode_MmcHs200; break; case 3: *out = SpeedMode_MmcHs400; break; - default: return sdmmc::ResultUnexpectedMmcExtendedCsdValue(); + default: R_THROW(sdmmc::ResultUnexpectedMmcExtendedCsdValue()); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -147,7 +147,7 @@ namespace ams::sdmmc::impl { /* Get the response. */ hc->GetLastResponse(out_ocr, sizeof(*out_ocr), CommandResponseType); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandSetRelativeAddr() const { @@ -159,7 +159,7 @@ namespace ams::sdmmc::impl { const u32 arg = rca << 16; R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_SetRelativeAddr, arg, false, DeviceState_Unknown)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandSwitch(CommandSwitch cs) const { @@ -169,7 +169,7 @@ namespace ams::sdmmc::impl { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_Switch, arg, true, DeviceState_Unknown)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandSendExtCsd(void *dst, size_t dst_size) const { @@ -189,7 +189,7 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_mmc_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandEraseGroupStart(u32 sector_index) const { @@ -199,7 +199,7 @@ namespace ams::sdmmc::impl { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_EraseGroupStart, arg, false, DeviceState_Unknown)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandEraseGroupEnd(u32 sector_index) const { @@ -209,14 +209,14 @@ namespace ams::sdmmc::impl { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_EraseGroupEnd, arg, false, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::IssueCommandErase() const { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_Erase, 0, false, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::CancelToshibaMmcModel() { @@ -232,7 +232,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSwitch(CommandSwitch_WriteProductionStateAwarenessNormal)); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::ChangeToReadyState(BusPower bus_power) { @@ -244,7 +244,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSendOpCond(std::addressof(ocr), bus_power)); if ((ocr & OcrCardPowerUpStatus) != 0) { m_mmc_device.SetOcrAndHighCapacity(ocr); - return ResultSuccess(); + R_SUCCEED(); } /* Check if we've timed out. */ @@ -271,7 +271,7 @@ namespace ams::sdmmc::impl { cs = CommandSwitch_WriteBusWidth4Bit; } else { /* Target bus width is 1bit. */ - return ResultSuccess(); + R_SUCCEED(); } /* Set the bus width. */ @@ -279,7 +279,7 @@ namespace ams::sdmmc::impl { R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); hc->SetBusWidth(target_bw); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::EnableBkopsAuto() { @@ -287,7 +287,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSwitch(CommandSwitch_SetBitsBkopsEnAutoEn)); R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::ChangeToHighSpeed(bool check_before) { @@ -307,7 +307,7 @@ namespace ams::sdmmc::impl { R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); } - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::ChangeToHs200() { @@ -324,7 +324,7 @@ namespace ams::sdmmc::impl { /* Check status. */ R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::ChangeToHs400() { @@ -348,7 +348,7 @@ namespace ams::sdmmc::impl { /* Check status. */ R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::ExtendBusSpeed(u8 device_type, SpeedMode max_sm) { @@ -369,7 +369,7 @@ namespace ams::sdmmc::impl { } /* We can't, so stay at normal speeds. */ - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::StartupMmcDevice(BusWidth max_bw, SpeedMode max_sm, void *wb, size_t wb_size) { @@ -418,7 +418,7 @@ namespace ams::sdmmc::impl { R_TRY(m_mmc_device.SetLegacyMemoryCapacity()); m_mmc_device.SetActive(); - return ResultSuccess(); + R_SUCCEED(); } /* Extend the bus width to the largest that we can. */ @@ -442,7 +442,7 @@ namespace ams::sdmmc::impl { /* Enable power saving. */ hc->SetPowerSaving(true); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::OnActivate() { @@ -479,7 +479,7 @@ namespace ams::sdmmc::impl { BaseDeviceAccessor::IncrementNumActivationErrorCorrections(); } - return ResultSuccess(); + R_SUCCEED(); } /* Log that our startup failed. */ @@ -519,7 +519,7 @@ namespace ams::sdmmc::impl { return result; } - return ResultSuccess(); + R_SUCCEED(); } void MmcDeviceAccessor::Initialize() { @@ -564,7 +564,7 @@ namespace ams::sdmmc::impl { R_TRY(GetMmcExtendedCsd(m_work_buffer, m_work_buffer_size)); R_TRY(GetCurrentSpeedModeFromExtCsd(out_speed_mode, static_cast(m_work_buffer))); - return ResultSuccess(); + R_SUCCEED(); } void MmcDeviceAccessor::PutMmcToSleep() { @@ -630,7 +630,7 @@ namespace ams::sdmmc::impl { } m_current_partition = part; - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::EraseMmc() { @@ -693,7 +693,7 @@ namespace ams::sdmmc::impl { } } - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::GetMmcBootPartitionCapacity(u32 *out_num_sectors) const { @@ -702,7 +702,7 @@ namespace ams::sdmmc::impl { R_TRY(this->GetMmcExtendedCsd(m_work_buffer, m_work_buffer_size)); *out_num_sectors = GetBootPartitionMemoryCapacityFromExtCsd(static_cast(m_work_buffer)); - return ResultSuccess(); + R_SUCCEED(); } Result MmcDeviceAccessor::GetMmcExtendedCsd(void *dst, size_t dst_size) const { @@ -722,7 +722,7 @@ namespace ams::sdmmc::impl { /* Get the ext csd. */ R_TRY(this->IssueCommandSendExtCsd(dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_card_device_accessor.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_card_device_accessor.cpp index 9738abb52..e611159a7 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_card_device_accessor.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_card_device_accessor.cpp @@ -149,10 +149,10 @@ namespace ams::sdmmc::impl { *out_sm = SpeedMode_SdCardDdr50; break; default: - return sdmmc::ResultUnexpectedSdCardSwitchFunctionStatus(); + R_THROW(sdmmc::ResultUnexpectedSdCardSwitchFunctionStatus()); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -193,7 +193,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(out_rca != nullptr); *out_rca = static_cast(resp >> 16); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSendIfCond() const { @@ -214,7 +214,7 @@ namespace ams::sdmmc::impl { /* Verify that our argument was returned to us. */ R_UNLESS((resp & SendIfCommandArgumentMask) == (SendIfCommandArgument & SendIfCommandArgumentMask), sdmmc::ResultSdCardValidationError()); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandCheckSupportedFunction(void *dst, size_t dst_size) const { @@ -237,7 +237,7 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_sd_card_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSwitchAccessMode(void *dst, size_t dst_size, bool set_function, SwitchFunctionAccessMode access_mode) const { @@ -260,13 +260,13 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_sd_card_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandVoltageSwitch() const { /* Issue the command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(CommandIndex_VoltageSwitch, 0, false, DeviceState_Ready)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandAppCmd(DeviceState expected_state, u32 ignore_mask) const { @@ -299,14 +299,14 @@ namespace ams::sdmmc::impl { R_UNLESS(m_sd_card_device.GetDeviceState(resp) == expected_state, sdmmc::ResultUnexpectedDeviceState()); } - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSetBusWidth4Bit() const { /* Issue the application command. */ constexpr u32 Arg = 0x2; R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(SdApplicationCommandIndex_SetBusWidth, Arg, false, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSdStatus(void *dst, size_t dst_size) const { @@ -326,7 +326,7 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_sd_card_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSendOpCond(u32 *out_ocr, bool spec_under_2, bool uhs_i_supported) const { @@ -342,13 +342,13 @@ namespace ams::sdmmc::impl { /* Get the response. */ hc->GetLastResponse(out_ocr, sizeof(u32), CommandResponseType); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandClearCardDetect() const { /* Issue the application command. */ R_TRY(BaseDeviceAccessor::IssueCommandAndCheckR1(SdApplicationCommandIndex_SetClearCardDetect, 0, false, DeviceState_Tran)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::IssueCommandSendScr(void *dst, size_t dst_size) const { @@ -368,7 +368,7 @@ namespace ams::sdmmc::impl { hc->GetLastResponse(std::addressof(resp), sizeof(resp), CommandResponseType); R_TRY(m_sd_card_device.CheckDeviceStatus(resp)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::EnterUhsIMode() { @@ -378,7 +378,7 @@ namespace ams::sdmmc::impl { /* Switch to sdr12. */ R_TRY(BaseDeviceAccessor::GetHostController()->SwitchToSdr12()); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::ChangeToReadyState(bool spec_under_2, bool uhs_i_supported) { @@ -406,7 +406,7 @@ namespace ams::sdmmc::impl { m_sd_card_device.SetUhsIMode(true); } - return ResultSuccess(); + R_SUCCEED(); } /* Check if we've timed out. */ @@ -426,7 +426,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSendRelativeAddr(std::addressof(rca))); if (rca != 0) { m_sd_card_device.SetRca(rca); - return ResultSuccess(); + R_SUCCEED(); } /* Check if we've timed out. */ @@ -442,7 +442,7 @@ namespace ams::sdmmc::impl { m_sd_card_device.SetMemoryCapacity(GetMemoryCapacityFromCsd(static_cast(csd))); } - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetScr(void *dst, size_t dst_size) const { @@ -450,7 +450,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandAppCmd(DeviceState_Tran)); R_TRY(this->IssueCommandSendScr(dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::ExtendBusWidth(BusWidth max_bw, u8 sd_bw) { @@ -471,7 +471,7 @@ namespace ams::sdmmc::impl { /* Set the host controller's bus width. */ hc->SetBusWidth(BusWidth_4Bit); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::SwitchAccessMode(SwitchFunctionAccessMode access_mode, void *wb, size_t wb_size) { @@ -487,7 +487,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSwitchAccessMode(wb, wb_size, true, access_mode)); R_UNLESS(IsAccessModeInFunctionSelection(static_cast(wb), access_mode), sdmmc::ResultSdCardFailedSwitchAccessMode()); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::ExtendBusSpeedAtUhsIMode(SpeedMode max_sm, void *wb, size_t wb_size) { @@ -506,7 +506,7 @@ namespace ams::sdmmc::impl { target_am = SwitchFunctionAccessMode_Sdr50; target_sm = SpeedMode_SdCardSdr50; } else { - return sdmmc::ResultSdCardNotSupportSdr104AndSdr50(); + R_THROW(sdmmc::ResultSdCardNotSupportSdr104AndSdr50()); } /* Switch the access mode. */ @@ -519,7 +519,7 @@ namespace ams::sdmmc::impl { /* Check status. */ R_TRY(BaseDeviceAccessor::IssueCommandSendStatus()); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::ExtendBusSpeedAtNonUhsIMode(SpeedMode max_sm, bool spec_under_1_1, void *wb, size_t wb_size) { @@ -542,7 +542,7 @@ namespace ams::sdmmc::impl { /* Set the host controller speed mode. */ R_TRY(BaseDeviceAccessor::GetHostController()->SetSpeedMode(SpeedMode_SdCardHighSpeed)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetSdStatus(void *dst, size_t dst_size) const { @@ -550,7 +550,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandAppCmd(DeviceState_Tran)); R_TRY(this->IssueCommandSdStatus(dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } void SdCardDeviceAccessor::TryDisconnectDat3PullUpResistor() const { @@ -637,7 +637,7 @@ namespace ams::sdmmc::impl { /* Enable power saving. */ hc->SetPowerSaving(true); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::OnActivate() { @@ -679,7 +679,7 @@ namespace ams::sdmmc::impl { BaseDeviceAccessor::IncrementNumActivationErrorCorrections(); } - return ResultSuccess(); + R_SUCCEED(); } /* Check if we were removed. */ @@ -740,7 +740,7 @@ namespace ams::sdmmc::impl { return result; } - return ResultSuccess(); + R_SUCCEED(); } void SdCardDeviceAccessor::Initialize() { @@ -842,14 +842,14 @@ namespace ams::sdmmc::impl { R_TRY(this->GetScr(m_work_buffer, m_work_buffer_size)); if (IsLessThanSpecification1_1(static_cast(m_work_buffer))) { *out_speed_mode = SpeedMode_SdCardDefaultSpeed; - return ResultSuccess(); + R_SUCCEED(); } /* Get the current speed mode. */ R_TRY(this->IssueCommandCheckSupportedFunction(m_work_buffer, m_work_buffer_size)); R_TRY(GetCurrentSpeedMode(out_speed_mode, static_cast(m_work_buffer), m_sd_card_device.IsUhsIMode())); - return ResultSuccess(); + R_SUCCEED(); } void SdCardDeviceAccessor::PutSdCardToSleep() { @@ -928,7 +928,7 @@ namespace ams::sdmmc::impl { /* Get the SCR. */ R_TRY(this->GetScr(dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetSdCardSwitchFunctionStatus(void *dst, size_t dst_size, SdCardSwitchFunction switch_function) const { @@ -959,7 +959,7 @@ namespace ams::sdmmc::impl { R_TRY(this->IssueCommandSwitchAccessMode(dst, dst_size, false, am)); } - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetSdCardCurrentConsumption(u16 *out_current_consumption, SpeedMode speed_mode) const { @@ -1004,7 +1004,7 @@ namespace ams::sdmmc::impl { AMS_ABORT_UNLESS(out_current_consumption != nullptr); *out_current_consumption = GetMaximumCurrentConsumption(static_cast(m_work_buffer)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetSdCardSdStatus(void *dst, size_t dst_size) const { @@ -1017,7 +1017,7 @@ namespace ams::sdmmc::impl { /* Get the status. */ R_TRY(this->GetSdStatus(dst, dst_size)); - return ResultSuccess(); + R_SUCCEED(); } Result SdCardDeviceAccessor::GetSdCardProtectedAreaCapacity(u32 *out_num_sectors) const { @@ -1047,7 +1047,7 @@ namespace ams::sdmmc::impl { *out_num_sectors = size_of_protected_area / SectorSize; } - return ResultSuccess(); + R_SUCCEED(); } diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.cpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.cpp index ee1e733e2..540203a29 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.cpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.cpp @@ -106,7 +106,7 @@ namespace ams::sdmmc::impl { /* Configure timeout control to use the maximum timeout value (TMCLK * 2^27) */ reg::ReadWrite(m_registers->timeout_control, SD_REG_BITS_VALUE(TIMEOUT_CONTROL_DATA_TIMEOUT_COUNTER, 0b1110)); - return ResultSuccess(); + R_SUCCEED(); } void SdHostStandardController::SetBusPower(BusPower bus_power) { @@ -176,13 +176,13 @@ namespace ams::sdmmc::impl { os::MultiWaitHolderType *signaled_holder = os::TimedWaitAny(std::addressof(m_multi_wait), TimeSpan::FromMilliSeconds(timeout_ms)); if (signaled_holder == std::addressof(m_interrupt_event_holder)) { /* We received the interrupt. */ - return ResultSuccess(); + R_SUCCEED(); } else if (signaled_holder == std::addressof(m_removed_event_holder)) { /* The device was removed. */ - return sdmmc::ResultDeviceRemoved(); + R_THROW(sdmmc::ResultDeviceRemoved()); } else { /* Timeout occurred. */ - return sdmmc::ResultWaitInterruptSoftwareTimeout(); + R_THROW(sdmmc::ResultWaitInterruptSoftwareTimeout()); } } @@ -338,17 +338,17 @@ namespace ams::sdmmc::impl { /* Otherwise, check if we've timed out. */ if (!timer.Update()) { - return sdmmc::ResultAbortTransactionSoftwareTimeout(); + R_THROW(sdmmc::ResultAbortTransactionSoftwareTimeout()); } } } - return ResultSuccess(); + R_SUCCEED(); } Result SdHostStandardController::AbortTransaction() { R_TRY(this->ResetCmdDatLine()); - return ResultSuccess(); + R_SUCCEED(); } Result SdHostStandardController::WaitWhileCommandInhibit(bool has_dat) { @@ -370,7 +370,7 @@ namespace ams::sdmmc::impl { /* Otherwise, check if we've timed out. */ if (!timer.Update()) { this->AbortTransaction(); - return sdmmc::ResultCommandInhibitCmdSoftwareTimeout(); + R_THROW(sdmmc::ResultCommandInhibitCmdSoftwareTimeout()); } } } @@ -390,12 +390,12 @@ namespace ams::sdmmc::impl { /* Otherwise, check if we've timed out. */ if (!timer.Update()) { this->AbortTransaction(); - return sdmmc::ResultCommandInhibitDatSoftwareTimeout(); + R_THROW(sdmmc::ResultCommandInhibitDatSoftwareTimeout()); } } } - return ResultSuccess(); + R_SUCCEED(); } Result SdHostStandardController::CheckAndClearInterruptStatus(volatile u16 *out_normal_int_status, u16 wait_mask) { @@ -417,7 +417,7 @@ namespace ams::sdmmc::impl { /* Write the masked value to the status register to ensure consistent state. */ reg::Write(m_registers->normal_int_status, masked_status); - return ResultSuccess(); + R_SUCCEED(); } /* We have an error interrupt. Write the status to the register to ensure consistent state. */ @@ -440,10 +440,10 @@ namespace ams::sdmmc::impl { R_UNLESS(reg::HasValue(auto_cmd_err_status, SD_REG_BITS_ENUM(AUTO_CMD_ERROR_AUTO_CMD_TIMEOUT, NO_ERROR)), sdmmc::ResultAutoCommandResponseTimeoutError()); /* An known auto cmd error occurred. */ - return sdmmc::ResultSdHostStandardUnknownAutoCmdError(); + R_THROW(sdmmc::ResultSdHostStandardUnknownAutoCmdError()); } else { /* Unknown error occurred. */ - return sdmmc::ResultSdHostStandardUnknownError(); + R_THROW(sdmmc::ResultSdHostStandardUnknownError()); } } @@ -468,7 +468,7 @@ namespace ams::sdmmc::impl { } else { /* If the device wasn't removed, cancel our transaction. */ this->AbortTransaction(); - return sdmmc::ResultCommandCompleteSoftwareTimeout(); + R_THROW(sdmmc::ResultCommandCompleteSoftwareTimeout()); } } #else @@ -485,12 +485,12 @@ namespace ams::sdmmc::impl { /* If we succeeded, we're done. */ if (R_SUCCEEDED(result)) { - return ResultSuccess(); + R_SUCCEED(); } else if (sdmmc::ResultNoWaitedInterrupt::Includes(result)) { /* Otherwise, if the wait for the interrupt isn't done, update the timer and check for timeout. */ if (!timer.Update()) { this->AbortTransaction(); - return sdmmc::ResultCommandCompleteSoftwareTimeout(); + R_THROW(sdmmc::ResultCommandCompleteSoftwareTimeout()); } } else { /* Otherwise, we have a generic failure. */ @@ -525,7 +525,7 @@ namespace ams::sdmmc::impl { if (R_SUCCEEDED(result)) { /* If the transfer is complete, we're done. */ if (reg::HasValue(normal_int_status, SD_REG_BITS_ENUM(NORMAL_INTERRUPT_STATUS_TRANSFER_COMPLETE, COMPLETE))) { - return ResultSuccess(); + R_SUCCEED(); } /* Otherwise, if a DMA interrupt was generated, advance to the next address. */ @@ -549,7 +549,7 @@ namespace ams::sdmmc::impl { /* Otherwise, timeout if the transfer hasn't advanced. */ if (last_block_count != reg::Read(m_registers->block_count)) { this->AbortTransaction(); - return sdmmc::ResultTransferCompleteSoftwareTimeout(); + R_THROW(sdmmc::ResultTransferCompleteSoftwareTimeout()); } } } @@ -574,7 +574,7 @@ namespace ams::sdmmc::impl { if (R_SUCCEEDED(result)) { /* If the transfer is complete, we're done. */ if (reg::HasValue(normal_int_status, SD_REG_BITS_ENUM(NORMAL_INTERRUPT_STATUS_TRANSFER_COMPLETE, COMPLETE))) { - return ResultSuccess(); + R_SUCCEED(); } /* Otherwise, if a DMA interrupt was generated, advance to the next address. */ @@ -590,7 +590,7 @@ namespace ams::sdmmc::impl { /* Only timeout if the transfer hasn't advanced. */ if (last_block_count != reg::Read(m_registers->block_count)) { this->AbortTransaction(); - return sdmmc::ResultTransferCompleteSoftwareTimeout(); + R_THROW(sdmmc::ResultTransferCompleteSoftwareTimeout()); } break; } @@ -619,13 +619,13 @@ namespace ams::sdmmc::impl { /* If the DAT0 line signal is level high, we're done. */ if (reg::HasValue(m_registers->present_state, SD_REG_BITS_ENUM(PRESENT_STATE_DAT0_LINE_SIGNAL_LEVEL, HIGH))) { - return ResultSuccess(); + R_SUCCEED(); } /* Otherwise, check if we're timed out. */ if (!timer.Update()) { this->AbortTransaction(); - return sdmmc::ResultBusySoftwareTimeout(); + R_THROW(sdmmc::ResultBusySoftwareTimeout()); } } } @@ -715,7 +715,7 @@ namespace ams::sdmmc::impl { R_TRY(this->WaitWhileBusy()); } - return ResultSuccess(); + R_SUCCEED(); } Result SdHostStandardController::IssueStopTransmissionCommandWithDeviceClock(u32 *out_response) { @@ -742,7 +742,7 @@ namespace ams::sdmmc::impl { /* Wait until we're done. */ R_TRY(this->WaitWhileBusy()); - return ResultSuccess(); + R_SUCCEED(); } SdHostStandardController::SdHostStandardController(dd::PhysicalAddress registers_phys_addr, size_t registers_size) { diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.hpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.hpp index f6501547c..a97c49199 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.hpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_sd_host_standard_controller.hpp @@ -112,7 +112,7 @@ namespace ams::sdmmc::impl { R_UNLESS(!this->IsRemoved(), sdmmc::ResultDeviceRemoved()); #endif - return ResultSuccess(); + R_SUCCEED(); } public: SdHostStandardController(dd::PhysicalAddress registers_phys_addr, size_t registers_size); 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 5e01328c3..f16467e38 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 @@ -271,7 +271,7 @@ namespace ams::sdmmc::impl { /* Enable internal clock. */ R_TRY(SdHostStandardController::EnableInternalClock()); - return ResultSuccess(); + R_SUCCEED(); } Result SdmmcController::SetClockTrimmer(SpeedMode speed_mode, u8 tap_value) { @@ -289,7 +289,7 @@ namespace ams::sdmmc::impl { /* Reset the cmd/dat line. */ R_TRY(SdHostStandardController::ResetCmdDatLine()); - return ResultSuccess(); + R_SUCCEED(); } u8 SdmmcController::GetCurrentTapValue() { @@ -338,7 +338,7 @@ namespace ams::sdmmc::impl { } } - return ResultSuccess(); + R_SUCCEED(); } Result SdmmcController::SetSpeedModeWithTapValue(SpeedMode speed_mode, u8 tap_value) { @@ -434,7 +434,7 @@ namespace ams::sdmmc::impl { /* Set the current speed mode. */ m_current_speed_mode = speed_mode; - return ResultSuccess(); + R_SUCCEED(); } Result SdmmcController::IssueTuningCommand(u32 command_index) { @@ -494,10 +494,10 @@ namespace ams::sdmmc::impl { /* If we succeeded, clear the interrupt. */ reg::Write(m_sdmmc_registers->sd_host_standard_registers.normal_int_status, SD_REG_BITS_ENUM(NORMAL_INTERRUPT_BUFFER_READ_READY, ENABLED)); this->ClearInterrupt(); - return ResultSuccess(); + R_SUCCEED(); } else if (sdmmc::ResultWaitInterruptSoftwareTimeout::Includes(result)) { SdHostStandardController::AbortTransaction(); - return sdmmc::ResultIssueTuningCommandSoftwareTimeout(); + R_THROW(sdmmc::ResultIssueTuningCommandSoftwareTimeout()); } else { return result; } @@ -511,13 +511,13 @@ namespace ams::sdmmc::impl { if (reg::HasValue(m_sdmmc_registers->sd_host_standard_registers.normal_int_status, SD_REG_BITS_ENUM(NORMAL_INTERRUPT_BUFFER_READ_READY, ENABLED))) { /* If we did, acknowledge it. */ reg::Write(m_sdmmc_registers->sd_host_standard_registers.normal_int_status, SD_REG_BITS_ENUM(NORMAL_INTERRUPT_BUFFER_READ_READY, ENABLED)); - return ResultSuccess(); + R_SUCCEED(); } /* Otherwise, check if we timed out. */ if (!timer.Update()) { SdHostStandardController::AbortTransaction(); - return sdmmc::ResultIssueTuningCommandSoftwareTimeout(); + R_THROW(sdmmc::ResultIssueTuningCommandSoftwareTimeout()); } } } @@ -641,7 +641,7 @@ namespace ams::sdmmc::impl { /* Ensure that we can control the device. */ SdHostStandardController::EnsureControl(); - return ResultSuccess(); + R_SUCCEED(); } void SdmmcController::Shutdown() { @@ -721,7 +721,7 @@ namespace ams::sdmmc::impl { SdHostStandardController::EnableDeviceClock(); SdHostStandardController::EnsureControl(); - return ResultSuccess(); + R_SUCCEED(); } Result SdmmcController::SwitchToSdr12() { @@ -761,7 +761,7 @@ namespace ams::sdmmc::impl { /* Check that the dat lines are all high. */ R_UNLESS(reg::HasValue(m_sdmmc_registers->sd_host_standard_registers.present_state, SD_REG_BITS_VALUE(PRESENT_STATE_DAT0_3_LINE_SIGNAL_LEVEL, 0b1111)), sdmmc::ResultSdCardNotCompleteVoltageSwitch()); - return ResultSuccess(); + R_SUCCEED(); } Result SdmmcController::SetSpeedMode(SpeedMode speed_mode) { @@ -777,7 +777,7 @@ namespace ams::sdmmc::impl { /* Set the speed mode. */ R_TRY(this->SetSpeedModeWithTapValue(speed_mode, tap_value)); - return ResultSuccess(); + R_SUCCEED(); } void SdmmcController::SetPowerSaving(bool en) { @@ -868,7 +868,7 @@ namespace ams::sdmmc::impl { /* Check if we're using the tuned clock. */ R_UNLESS(reg::HasValue(m_sdmmc_registers->sd_host_standard_registers.host_control2, SD_REG_BITS_ENUM(HOST_CONTROL2_SAMPLING_CLOCK, USING_TUNED_CLOCK)), sdmmc::ResultTuningFailed()); - return ResultSuccess(); + R_SUCCEED(); } void SdmmcController::SaveTuningStatusForHs400() { @@ -886,7 +886,7 @@ namespace ams::sdmmc::impl { /* pcv::PowerOn(pcv::PowerControlTarget_SdCard, 3300000); */ R_TRY(m_power_controller->PowerOn(BusPower_3_3V)); - return ResultSuccess(); + R_SUCCEED(); } void Sdmmc1Controller::PowerOffForRegisterControl() { @@ -925,7 +925,7 @@ namespace ams::sdmmc::impl { /* pcv::ChangeVoltage(pcv::PowerControlTarget_SdCard, 1800000); */ R_TRY(m_power_controller->LowerBusPower()); - return ResultSuccess(); + R_SUCCEED(); } void Sdmmc1Controller::SetSchmittTriggerForRegisterControl(BusPower bus_power) { @@ -958,7 +958,7 @@ namespace ams::sdmmc::impl { ON_SCOPE_EXIT { m_current_bus_power = BusPower_3_3V; }; /* TODO: return pcv::PowerOn(pcv::PowerControlTarget_SdCard, 3300000); */ - return ResultSuccess(); + R_SUCCEED(); } void Sdmmc1Controller::PowerOffForPcvControl() { @@ -987,7 +987,7 @@ namespace ams::sdmmc::impl { ON_SCOPE_EXIT { m_current_bus_power = BusPower_1_8V; }; /* TODO: return pcv::ChangeVoltage(pcv::PowerControlTarget_SdCard, 1800000); */ - return ResultSuccess(); + R_SUCCEED(); } void Sdmmc1Controller::SetSchmittTriggerForPcvControl(BusPower bus_power) { @@ -1163,7 +1163,7 @@ namespace ams::sdmmc::impl { AMS_UNREACHABLE_DEFAULT_CASE(); } - return ResultSuccess(); + R_SUCCEED(); } void Sdmmc1Controller::PowerController::SetSdmmcIoMode(bool is_3_3V) { @@ -1258,7 +1258,7 @@ namespace ams::sdmmc::impl { /* Update our current bus power. */ m_current_bus_power = bus_power; - return ResultSuccess(); + R_SUCCEED(); } Result Sdmmc1Controller::PowerController::PowerOff() { @@ -1289,7 +1289,7 @@ namespace ams::sdmmc::impl { /* Update our current bus power. */ m_current_bus_power = BusPower_Off; - return ResultSuccess(); + R_SUCCEED(); } Result Sdmmc1Controller::PowerController::LowerBusPower() { @@ -1305,7 +1305,7 @@ namespace ams::sdmmc::impl { /* Update our current bus power. */ m_current_bus_power = BusPower_1_8V; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.hpp b/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.hpp index 3ac8f3969..0e04c4896 100644 --- a/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.hpp +++ b/libraries/libvapours/source/sdmmc/impl/sdmmc_sdmmc_controller.board.nintendo_nx.hpp @@ -444,7 +444,7 @@ namespace ams::sdmmc::impl { virtual Result PowerOn(BusPower bus_power) override { /* Power for SDMMC2/4 is assumed on, so we don't need to do anything. */ AMS_UNUSED(bus_power); - return ResultSuccess(); + R_SUCCEED(); } virtual void PowerOff() override { diff --git a/stratosphere/ams_mitm/source/amsmitm_fs_utils.cpp b/stratosphere/ams_mitm/source/amsmitm_fs_utils.cpp index 5dda00fc0..6b0c88b85 100644 --- a/stratosphere/ams_mitm/source/amsmitm_fs_utils.cpp +++ b/stratosphere/ams_mitm/source/amsmitm_fs_utils.cpp @@ -29,7 +29,7 @@ namespace ams::mitm::fs { /* Helpers. */ Result EnsureSdInitialized() { R_UNLESS(serviceIsActive(std::addressof(g_sd_filesystem.s)), ams::fs::ResultSdCardNotPresent()); - return ResultSuccess(); + R_SUCCEED(); } void FormatAtmosphereRomfsPath(char *dst_path, size_t dst_path_size, ncm::ProgramId program_id, const char *src_path) { @@ -230,7 +230,7 @@ namespace ams::mitm::fs { /* Set output. */ file_guard.Cancel(); *out = f; - return ResultSuccess(); + R_SUCCEED(); } Result CreateAndOpenAtmosphereSdFile(FsFile *out, ncm::ProgramId program_id, const char *path, size_t size) { @@ -254,7 +254,7 @@ namespace ams::mitm::fs { /* Set output. */ file_guard.Cancel(); *out = f; - return ResultSuccess(); + R_SUCCEED(); } diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp index f735c2cac..8ea3b9f28 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp @@ -148,7 +148,7 @@ namespace ams::mitm::bpc { /* NOTE: Preferred reboot type will be parsed from settings later on. */ g_reboot_type = RebootType::ToPayload; - return ResultSuccess(); + R_SUCCEED(); } Result DetectPreferredRebootFunctionality() { @@ -163,7 +163,7 @@ namespace ams::mitm::bpc { g_reboot_type = RebootType::ToPayload; } - return ResultSuccess(); + R_SUCCEED(); } } 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 148126048..2c76f0027 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp @@ -22,12 +22,12 @@ namespace ams::mitm::bpc { Result BpcMitmService::RebootSystem() { R_UNLESS(bpc::IsRebootManaged(), sm::mitm::ResultShouldForwardToSession()); bpc::RebootSystem(); - return ResultSuccess(); + R_SUCCEED(); } Result BpcMitmService::ShutdownSystem() { bpc::ShutdownSystem(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp index a56efd711..5daf6421b 100644 --- a/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp +++ b/stratosphere/ams_mitm/source/dns_mitm/dnsmitm_resolver_impl.cpp @@ -105,7 +105,7 @@ namespace ams::mitm::socket::resolver { *out_errno = 0; *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result ResolverImpl::GetAddrInfoRequest(u32 cancel_handle, const sf::ClientProcessId &client_pid, bool use_nsd_resolve, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutBuffer &out_addrinfo, sf::Out out_errno, sf::Out out_retval, sf::Out out_size) { @@ -144,7 +144,7 @@ namespace ams::mitm::socket::resolver { *out_errno = 0; *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result ResolverImpl::GetHostByNameRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InAutoSelectBuffer &name, const sf::OutAutoSelectBuffer &out_hostent, sf::Out out_size, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out out_host_error, sf::Out out_errno) { @@ -166,7 +166,7 @@ namespace ams::mitm::socket::resolver { *out_errno = 0; *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result ResolverImpl::GetAddrInfoRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutAutoSelectBuffer &out_addrinfo, sf::Out out_size, sf::Out out_retval, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out out_host_error, sf::Out out_errno) { @@ -206,13 +206,13 @@ namespace ams::mitm::socket::resolver { *out_errno = 0; *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } Result ResolverImpl::AtmosphereReloadHostsFile() { /* Perform a hosts file reload. */ InitializeResolverRedirections(); - return ResultSuccess(); + R_SUCCEED(); } } 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 90c24abfb..9c36f9115 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp @@ -91,7 +91,7 @@ namespace ams::mitm::fs { R_TRY(subdir_fs->Initialize(AtmosphereHblWebContentDirPath)); out.SetValue(MakeSharedFileSystem(std::make_shared(std::move(subdir_fs)), false), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result OpenProgramSpecificWebContentFileSystem(sf::Out> &out, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) { @@ -142,7 +142,7 @@ namespace ams::mitm::fs { out.SetValue(MakeSharedFileSystem(std::move(new_fs), false), target_object_id); } - return ResultSuccess(); + R_SUCCEED(); } Result OpenWebContentFileSystem(sf::Out> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id, bool try_program_specific) { @@ -185,7 +185,7 @@ namespace ams::mitm::fs { R_TRY(redir_fs->InitializeWithFixedPath("/Nintendo", emummc::GetNintendoDirPath())); out.SetValue(MakeSharedFileSystem(std::move(redir_fs), false), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::OpenSaveDataFileSystem(sf::Out> out, u8 _space_id, const fs::SaveDataAttribute &attribute) { @@ -260,7 +260,7 @@ namespace ams::mitm::fs { /* Set output. */ out.SetValue(MakeSharedFileSystem(std::move(dirsave_ifs), false), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::OpenBisStorage(sf::Out> out, u32 _bis_partition_id) { @@ -302,7 +302,7 @@ namespace ams::mitm::fs { } } - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::OpenDataStorageByCurrentProcess(sf::Out> out) { @@ -319,7 +319,7 @@ namespace ams::mitm::fs { /* Get a layered storage for the process romfs. */ out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(m_client_info.program_id, data_storage, true)), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::OpenDataStorageByDataId(sf::Out> out, ncm::DataId _data_id, u8 storage_id) { @@ -339,7 +339,7 @@ namespace ams::mitm::fs { /* Get a layered storage for the data id. */ out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(data_id, data_storage, false)), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::OpenDataStorageWithProgramIndex(sf::Out> out, u8 program_index) { @@ -360,7 +360,7 @@ namespace ams::mitm::fs { /* Get a layered storage for the process romfs. */ out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(program_id, data_storage, true)), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } Result FsMitmService::RegisterProgramIndexMapInfo(const sf::InBuffer &info_buffer, s32 info_count) { @@ -370,7 +370,7 @@ namespace ams::mitm::fs { /* Register with ourselves. */ R_ABORT_UNLESS(g_program_index_map_info_manager.Reset(reinterpret_cast(info_buffer.GetPointer()), info_count)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp index f60439f97..39daf9aa4 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.hpp @@ -36,7 +36,7 @@ namespace ams::mitm::fs { /* Check if we have nothing to do. */ if (size == 0) { - return ResultSuccess(); + R_SUCCEED(); } /* Fast case. */ @@ -69,7 +69,7 @@ namespace ams::mitm::fs { } } - return ResultSuccess(); + R_SUCCEED(); } virtual Result Write(s64 offset, const void *_buffer, size_t size) override { @@ -80,7 +80,7 @@ namespace ams::mitm::fs { /* Check if we have nothing to do. */ if (size == 0) { - return ResultSuccess(); + R_SUCCEED(); } /* Fast case. */ @@ -117,7 +117,7 @@ namespace ams::mitm::fs { } } - return ResultSuccess(); + R_SUCCEED(); } }; diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layered_romfs_storage.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layered_romfs_storage.cpp index c7d52cf56..6bd810f1a 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layered_romfs_storage.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_layered_romfs_storage.cpp @@ -368,7 +368,7 @@ namespace ams::mitm::fs { } } - return ResultSuccess(); + R_SUCCEED(); } Result LayeredRomfsStorageImpl::GetSize(s64 *out_size) { @@ -378,11 +378,11 @@ namespace ams::mitm::fs { } *out_size = this->GetSize(); - return ResultSuccess(); + R_SUCCEED(); } Result LayeredRomfsStorageImpl::Flush() { - return ResultSuccess(); + R_SUCCEED(); } Result LayeredRomfsStorageImpl::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { @@ -397,12 +397,12 @@ namespace ams::mitm::fs { R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize()); reinterpret_cast(dst)->Clear(); } - return ResultSuccess(); + R_SUCCEED(); } /* TODO: How to deal with this? */ - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); default: - return fs::ResultUnsupportedOperation(); + R_THROW(fs::ResultUnsupportedOperation()); } } diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_readonly_layered_filesystem.hpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_readonly_layered_filesystem.hpp index 22edd7662..c5113bc4b 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_readonly_layered_filesystem.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_readonly_layered_filesystem.hpp @@ -78,7 +78,7 @@ namespace ams::mitm::fs { } virtual Result DoCommit() override final { - return ResultSuccess(); + R_SUCCEED(); } virtual Result DoGetFreeSpaceSize(s64 *out, const ams::fs::Path &path) { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp index 2227fac57..db5a88359 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp @@ -44,10 +44,10 @@ namespace ams::mitm::fs { *out_str = "safe"; break; default: - return fs::ResultInvalidSaveDataSpaceId(); + R_THROW(fs::ResultInvalidSaveDataSpaceId()); } - return ResultSuccess(); + R_SUCCEED(); } Result GetSaveDataTypeString(const char **out_str, SaveDataType save_data_type) { @@ -75,10 +75,10 @@ namespace ams::mitm::fs { break; default: /* TODO: Better result? */ - return fs::ResultInvalidArgument(); + R_THROW(fs::ResultInvalidArgument()); } - return ResultSuccess(); + R_SUCCEED(); } constexpr inline bool IsEmptyAccountId(const UserId &uid) { @@ -108,7 +108,7 @@ namespace ams::mitm::fs { R_UNLESS(out_path_len < dst_size, fs::ResultTooLongPath()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_am_mitm_service.cpp b/stratosphere/ams_mitm/source/ns_mitm/ns_am_mitm_service.cpp index c0f9daa68..4c855a7a1 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_am_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_am_mitm_service.cpp @@ -29,7 +29,7 @@ namespace ams::mitm::ns { bool is_hbl; if (R_SUCCEEDED(pm::info::IsHblProgramId(&is_hbl, application_id)) && is_hbl) { nsamResolveApplicationContentPathFwd(m_forward_service.get(), static_cast(application_id), static_cast(content_type)); - return ResultSuccess(); + R_SUCCEED(); } return nsamResolveApplicationContentPathFwd(m_forward_service.get(), static_cast(application_id), static_cast(content_type)); } diff --git a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp index d7f10e36b..6e2234e51 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/ns_mitm/ns_web_mitm_service.cpp @@ -28,7 +28,7 @@ namespace ams::mitm::ns { bool is_hbl; if (R_SUCCEEDED(pm::info::IsHblProgramId(std::addressof(is_hbl), application_id)) && is_hbl) { nswebResolveApplicationContentPath(m_srv.get(), static_cast(application_id), static_cast(content_type)); - return ResultSuccess(); + R_SUCCEED(); } return nswebResolveApplicationContentPath(m_srv.get(), static_cast(application_id), static_cast(content_type)); } @@ -44,7 +44,7 @@ namespace ams::mitm::ns { const sf::cmif::DomainObjectId target_object_id{serviceGetObjectId(std::addressof(doc.s))}; out.SetValue(sf::CreateSharedObjectEmplaced(m_client_info, std::make_unique(doc)), target_object_id); - return ResultSuccess(); + R_SUCCEED(); } } 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 79b977cd1..07686ff77 100644 --- a/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp @@ -48,7 +48,7 @@ namespace ams::mitm::settings { Result SetMitmService::EnsureLocale() { /* Optimization: if locale has already been gotten, we can stop. */ if (AMS_LIKELY(m_got_locale)) { - return ResultSuccess(); + R_SUCCEED(); } std::scoped_lock lk(m_lock); @@ -77,7 +77,7 @@ namespace ams::mitm::settings { } } - return ResultSuccess(); + R_SUCCEED(); } void SetMitmService::InvalidateLocale() { @@ -105,7 +105,7 @@ namespace ams::mitm::settings { } out.SetValue(m_locale.language_code); - return ResultSuccess(); + R_SUCCEED(); } Result SetMitmService::GetRegionCode(sf::Out out) { @@ -124,7 +124,7 @@ namespace ams::mitm::settings { } out.SetValue(m_locale.region_code); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp index 6dd4d37cc..fc8f9bbd1 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp @@ -84,7 +84,7 @@ namespace ams::mitm::settings { *out = g_firmware_version; } - return ResultSuccess(); + R_SUCCEED(); } } @@ -95,7 +95,7 @@ namespace ams::mitm::settings { /* GetFirmwareVersion sanitizes the revision fields. */ out.GetPointer()->revision_major = 0; out.GetPointer()->revision_minor = 0; - return ResultSuccess(); + R_SUCCEED(); } Result SetSysMitmService::GetFirmwareVersion2(sf::Out out) { @@ -108,7 +108,7 @@ namespace ams::mitm::settings { R_CONVERT_ALL(sm::mitm::ResultShouldForwardToSession()); } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result SetSysMitmService::GetSettingsItemValue(sf::Out out_size, const sf::OutBuffer &out, const settings::SettingsName &name, const settings::SettingsItemKey &key) { @@ -117,7 +117,7 @@ namespace ams::mitm::settings { R_CONVERT_ALL(sm::mitm::ResultShouldForwardToSession()); } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } Result SetSysMitmService::GetDebugModeFlag(sf::Out out) { @@ -129,7 +129,7 @@ namespace ams::mitm::settings { settings::fwdbg::GetSettingsItemValue(std::addressof(en), sizeof(en), "atmosphere", "enable_am_debug_mode"); out.SetValue(en != 0); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp index 8d869a4e1..fda9bfce1 100644 --- a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp @@ -127,7 +127,7 @@ namespace ams::settings::fwdbg { R_UNLESS(len > 0, settings::ResultEmptySettingsName()); R_UNLESS(len <= SettingsNameLengthMax, settings::ResultTooLongSettingsName()); R_UNLESS(IsValidSettingsFormat(name, len), settings::ResultInvalidFormatSettingsName()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateSettingsItemKey(const char *key) { @@ -136,7 +136,7 @@ namespace ams::settings::fwdbg { R_UNLESS(len > 0, settings::ResultEmptySettingsItemKey()); R_UNLESS(len <= SettingsNameLengthMax, settings::ResultTooLongSettingsItemKey()); R_UNLESS(IsValidSettingsFormat(key, len), settings::ResultInvalidFormatSettingsItemKey()); - return ResultSuccess(); + R_SUCCEED(); } Result AllocateValue(void **out, size_t size) { @@ -144,35 +144,35 @@ namespace ams::settings::fwdbg { *out = g_value_storage + g_allocated_value_storage_size; g_allocated_value_storage_size += size; - return ResultSuccess(); + R_SUCCEED(); } Result FindSettingsName(const char **out, const char *name) { for (auto &stored : g_names) { if (std::strcmp(stored.value, name) == 0) { *out = stored.value; - return ResultSuccess(); + R_SUCCEED(); } else if (std::strcmp(stored.value, "") == 0) { *out = stored.value; std::strcpy(stored.value, name); - return ResultSuccess(); + R_SUCCEED(); } } - return settings::ResultSettingsItemKeyAllocationFailed(); + R_THROW(settings::ResultSettingsItemKeyAllocationFailed()); } Result FindSettingsItemKey(const char **out, const char *key) { for (auto &stored : g_item_keys) { if (std::strcmp(stored.value, key) == 0) { *out = stored.value; - return ResultSuccess(); + R_SUCCEED(); } else if (std::strcmp(stored.value, "") == 0) { std::strcpy(stored.value, key); *out = stored.value; - return ResultSuccess(); + R_SUCCEED(); } } - return settings::ResultSettingsItemKeyAllocationFailed(); + R_THROW(settings::ResultSettingsItemKeyAllocationFailed()); } template @@ -182,7 +182,7 @@ namespace ams::settings::fwdbg { T value = static_cast(strtoul(value_str, nullptr, 0)); std::memcpy(out.value, std::addressof(value), sizeof(T)); - return ResultSuccess(); + R_SUCCEED(); } Result GetEntry(SdKeyValueStoreEntry **out, const char *name, const char *key) { @@ -200,7 +200,7 @@ namespace ams::settings::fwdbg { R_UNLESS(*it == test_entry, settings::ResultSettingsItemNotFound()); *out = std::addressof(*it); - return ResultSuccess(); + R_SUCCEED(); } Result ParseSettingsItemValueImpl(const char *name, const char *key, const char *val_tup) { @@ -253,7 +253,7 @@ namespace ams::settings::fwdbg { } else if (strncasecmp(type, "u64", type_len) == 0) { R_TRY((ParseSettingsItemIntegralValue(new_value, value_str))); } else { - return settings::ResultInvalidFormatSettingsItemValue(); + R_THROW(settings::ResultInvalidFormatSettingsItemValue()); } /* Insert the entry. */ @@ -267,7 +267,7 @@ namespace ams::settings::fwdbg { } R_UNLESS(inserted, settings::ResultSettingsItemValueAllocationFailed()); - return ResultSuccess(); + R_SUCCEED(); } Result ParseSettingsItemValue(const char *name, const char *key, const char *value) { @@ -303,7 +303,7 @@ namespace ams::settings::fwdbg { util::ini::ParseFile(file.get(), std::addressof(parse_result), SystemSettingsIniHandler); R_TRY(parse_result); - return ResultSuccess(); + R_SUCCEED(); } void LoadDefaultCustomSettings() { @@ -435,7 +435,7 @@ namespace ams::settings::fwdbg { R_TRY(GetEntry(std::addressof(entry), name, key)); *out_size = entry->value_size; - return ResultSuccess(); + R_SUCCEED(); } Result GetSdCardKeyValueStoreSettingsItemValue(size_t *out_size, void *dst, size_t dst_size, const char *name, const char *key) { @@ -449,7 +449,7 @@ namespace ams::settings::fwdbg { std::memcpy(dst, entry->value, size); } *out_size = size; - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_apply_manager.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_apply_manager.cpp index 91770958d..dd9d2169a 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_apply_manager.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_apply_manager.cpp @@ -33,7 +33,7 @@ namespace ams::mitm::sysupdater { R_TRY(updater::MarkVerifyingRequired(updater::BootModeType::Safe, g_boot_image_update_buffer, sizeof(g_boot_image_update_buffer))); /* Pre-commit is now marked. */ - return ResultSuccess(); + R_SUCCEED(); } Result UpdateBootImages() { @@ -59,7 +59,7 @@ namespace ams::mitm::sysupdater { R_TRY(updater::MarkVerified(boot_mode, g_boot_image_update_buffer, sizeof(g_boot_image_update_buffer))); /* The boot images are updated. */ - return ResultSuccess(); + R_SUCCEED(); }; /* Get the boot image update type. */ @@ -72,7 +72,7 @@ namespace ams::mitm::sysupdater { R_TRY(UpdateBootImageImpl(updater::BootModeType::Normal, boot_image_update_type)); /* Both sets of images are updated. */ - return ResultSuccess(); + R_SUCCEED(); } } @@ -92,7 +92,7 @@ namespace ams::mitm::sysupdater { /* Update the boot images. */ R_TRY(UpdateBootImages()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.cpp index de94f205a..be1124095 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.cpp @@ -25,7 +25,7 @@ namespace ams::mitm::sysupdater { R_CONVERT(ncm::ResultInstallTaskCancelled, ns::ResultCanceled()); } R_END_TRY_CATCH; - return ResultSuccess(); + R_SUCCEED(); } AsyncPrepareSdCardUpdateImpl::~AsyncPrepareSdCardUpdateImpl() { @@ -66,7 +66,7 @@ namespace ams::mitm::sysupdater { /* Set our thread info. */ m_thread_info = info; - return ResultSuccess(); + R_SUCCEED(); } Result AsyncPrepareSdCardUpdateImpl::Execute() { diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.hpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.hpp index 81c0e9620..6684177ff 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.hpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_async_impl.hpp @@ -34,13 +34,13 @@ namespace ams::mitm::sysupdater { return result; } - return ResultSuccess(); + R_SUCCEED(); } template Result GetAndSaveErrorContext(T &async) { R_TRY(this->SaveErrorContextIfFailed(async, async.Get())); - return ResultSuccess(); + R_SUCCEED(); } template @@ -50,7 +50,7 @@ namespace ams::mitm::sysupdater { return result; } - return ResultSuccess(); + R_SUCCEED(); } const err::ErrorContext &GetErrorContextImpl() { @@ -66,12 +66,12 @@ namespace ams::mitm::sysupdater { Result Cancel() { this->CancelImpl(); - return ResultSuccess(); + R_SUCCEED(); } virtual Result GetErrorContext(sf::Out out) { *out = {}; - return ResultSuccess(); + R_SUCCEED(); } private: virtual void CancelImpl() = 0; @@ -105,7 +105,7 @@ namespace ams::mitm::sysupdater { virtual Result GetErrorContext(sf::Out out) override { *out = ErrorContextHolder::GetErrorContextImpl(); - return ResultSuccess(); + R_SUCCEED(); } Result Run(); diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp index b2f2abcdc..27a0478ea 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_fs_utils.cpp @@ -54,7 +54,7 @@ namespace ams::mitm::sysupdater { const bool is_nsp = util::Strnicmp(extension, NspExtension, NcaNspExtensionSize) == 0; R_UNLESS(is_nca || is_nsp, fs::ResultPathNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ParseMountName(const char **path, std::shared_ptr *out) { @@ -88,13 +88,13 @@ namespace ams::mitm::sysupdater { /* Set the output fs. */ *out = std::move(fsa); } else { - return fs::ResultPathNotFound(); + R_THROW(fs::ResultPathNotFound()); } /* Ensure that there's something that could be a mount name delimiter. */ R_UNLESS(util::Strnlen(*path, fs::EntryNameLengthMax) != 0, fs::ResultPathNotFound()); - return ResultSuccess(); + R_SUCCEED(); } Result ParseNsp(const char **path, std::shared_ptr *out, std::shared_ptr base_fs) { @@ -132,7 +132,7 @@ namespace ams::mitm::sysupdater { /* Update the path. */ *path = work_path; - return ResultSuccess(); + R_SUCCEED(); } Result ParseNca(const char **path, std::shared_ptr *out, std::shared_ptr base_fs) { @@ -154,7 +154,7 @@ namespace ams::mitm::sysupdater { /* Set output reader. */ *out = std::move(nca_reader); - return ResultSuccess(); + R_SUCCEED(); } Result OpenMetaStorage(std::shared_ptr *out, std::shared_ptr *out_splitter, std::shared_ptr nca_reader, fssystem::NcaFsHeader::FsType *out_fs_type) { @@ -173,7 +173,7 @@ namespace ams::mitm::sysupdater { /* Set the output fs type. */ *out_fs_type = fs_header_reader.GetFsType(); - return ResultSuccess(); + R_SUCCEED(); } Result OpenContentMetaFileSystem(std::shared_ptr *out, const char *path) { @@ -211,7 +211,7 @@ namespace ams::mitm::sysupdater { case fssystem::NcaFsHeader::FsType::PartitionFs: return creator_intfs->partition_fs_creator->Create(out, std::move(storage)); case fssystem::NcaFsHeader::FsType::RomFs: return creator_intfs->rom_fs_creator->Create(out, std::move(storage)); default: - return fs::ResultInvalidNcaFileSystemType(); + R_THROW(fs::ResultInvalidNcaFileSystemType()); } } diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp index aa497d72d..689dba496 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_service.cpp @@ -51,7 +51,7 @@ namespace ams::mitm::sysupdater { R_SUCCEED_IF(done); } - return ResultSuccess(); + R_SUCCEED(); } Result ConvertToFsCommonPath(char *dst, size_t dst_size, const char *package_root_path, const char *entry_path) { @@ -118,13 +118,13 @@ namespace ams::mitm::sysupdater { *out = ncm::ContentInfo::Make(*content_id, entry.file_size, ncm::ContentType::Meta); } - return ResultSuccess(); + R_SUCCEED(); })); /* If we didn't find anything, error. */ R_UNLESS(found_system_update, ncm::ResultSystemUpdateNotFoundInPackage()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateSystemUpdate(Result *out_result, Result *out_exfat_result, UpdateValidationInfo *out_info, const ncm::PackagedContentMetaReader &update_reader, const char *package_root) { @@ -212,7 +212,7 @@ namespace ams::mitm::sysupdater { util::SNPrintf(path, sizeof(path), "%s%s%s", package_root, content_id_str.data, content_info->GetType() == ncm::ContentType::Meta ? ".cnmt.nca" : ".nca"); if (R_FAILED(ValidateResult(fs::OpenFile(std::addressof(file), path, ams::fs::OpenMode_Read)))) { *done = true; - return ResultSuccess(); + R_SUCCEED(); } } ON_SCOPE_EXIT { fs::CloseFile(file); }; @@ -221,12 +221,12 @@ namespace ams::mitm::sysupdater { s64 file_size; if (R_FAILED(ValidateResult(fs::GetFileSize(std::addressof(file_size), file)))) { *done = true; - return ResultSuccess(); + R_SUCCEED(); } if (file_size != content_size) { *out_result = ncm::ResultInvalidContentHash(); *done = true; - return ResultSuccess(); + R_SUCCEED(); } /* Read and hash the file in chunks. */ @@ -238,7 +238,7 @@ namespace ams::mitm::sysupdater { const size_t cur_size = std::min(static_cast(content_size - ofs), data_buffer_size); if (R_FAILED(ValidateResult(fs::ReadFile(file, ofs, data_buffer, cur_size)))) { *done = true; - return ResultSuccess(); + R_SUCCEED(); } sha.Update(data_buffer, cur_size); @@ -254,7 +254,7 @@ namespace ams::mitm::sysupdater { if (std::memcmp(std::addressof(calc_digest), std::addressof(content_info->digest), sizeof(ncm::Digest)) != 0) { *out_result = ncm::ResultInvalidContentHash(); *done = true; - return ResultSuccess(); + R_SUCCEED(); } } @@ -262,7 +262,7 @@ namespace ams::mitm::sysupdater { content_meta_valid[validation_index] = true; *out_info = {}; - return ResultSuccess(); + R_SUCCEED(); })); /* If we're otherwise going to succeed, ensure that every content was found. */ @@ -284,7 +284,7 @@ namespace ams::mitm::sysupdater { } } - return ResultSuccess(); + R_SUCCEED(); } Result FormatUserPackagePath(ncm::Path *out, const ncm::Path &user_path) { @@ -300,7 +300,7 @@ namespace ams::mitm::sysupdater { out->str[len - 1] = '\x00'; } - return ResultSuccess(); + R_SUCCEED(); } const char *GetFirmwareVariationSettingName(settings::system::PlatformRegion region) { @@ -382,7 +382,7 @@ namespace ams::mitm::sysupdater { /* Set the parsed update info. */ out.SetValue(update_info); - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::ValidateUpdate(sf::Out out_validate_result, sf::Out out_validate_exfat_result, sf::Out out_validate_info, const ncm::Path &path) { @@ -407,7 +407,7 @@ namespace ams::mitm::sysupdater { R_TRY(ValidateSystemUpdate(out_validate_result.GetPointer(), out_validate_exfat_result.GetPointer(), out_validate_info.GetPointer(), reader, package_root.str)); } - return ResultSuccess(); + R_SUCCEED(); }; Result SystemUpdateService::SetupUpdate(sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat) { @@ -435,7 +435,7 @@ namespace ams::mitm::sysupdater { out_event_handle.SetValue(async_result.GetImpl().GetEvent().GetReadableHandle(), false); *out_async = std::move(async_result); - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::GetPrepareUpdateProgress(sf::Out out) { @@ -445,7 +445,7 @@ namespace ams::mitm::sysupdater { /* Get the progress. */ auto install_progress = m_update_task->GetProgress(); out.SetValue({ .current_size = install_progress.installed_size, .total_size = install_progress.total_size }); - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::HasPreparedUpdate(sf::Out out) { @@ -453,7 +453,7 @@ namespace ams::mitm::sysupdater { R_UNLESS(m_setup_update, ns::ResultCardUpdateNotSetup()); out.SetValue(m_update_task->GetProgress().state == ncm::InstallProgressState::Downloaded); - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::ApplyPreparedUpdate() { @@ -466,7 +466,7 @@ namespace ams::mitm::sysupdater { /* Apply the task. */ R_TRY(m_apply_manager.ApplyPackageTask(std::addressof(*m_update_task))); - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::SetupUpdateImpl(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id) { @@ -485,7 +485,7 @@ namespace ams::mitm::sysupdater { /* The update is now set up. */ m_setup_update = true; - return ResultSuccess(); + R_SUCCEED(); } Result SystemUpdateService::InitializeUpdateTask(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id) { @@ -516,7 +516,7 @@ namespace ams::mitm::sysupdater { /* We successfully setup the update. */ tmem_guard.Cancel(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ams_mitm/source/sysupdater/sysupdater_thread_allocator.cpp b/stratosphere/ams_mitm/source/sysupdater/sysupdater_thread_allocator.cpp index 1add28bd8..82d878f51 100644 --- a/stratosphere/ams_mitm/source/sysupdater/sysupdater_thread_allocator.cpp +++ b/stratosphere/ams_mitm/source/sysupdater/sysupdater_thread_allocator.cpp @@ -31,11 +31,11 @@ namespace ams::mitm::sysupdater { .stack_size = m_stack_size, }; m_bitmap |= mask; - return ResultSuccess(); + R_SUCCEED(); } } - return ns::ResultOutOfMaxRunningTask(); + R_THROW(ns::ResultOutOfMaxRunningTask()); } void ThreadAllocator::Free(const ThreadInfo &info) { diff --git a/stratosphere/boot/source/api_overrides/pcv_clkrst_api_for_boot.board.nintendo_nx.cpp b/stratosphere/boot/source/api_overrides/pcv_clkrst_api_for_boot.board.nintendo_nx.cpp index 325b1f18d..ed132c582 100644 --- a/stratosphere/boot/source/api_overrides/pcv_clkrst_api_for_boot.board.nintendo_nx.cpp +++ b/stratosphere/boot/source/api_overrides/pcv_clkrst_api_for_boot.board.nintendo_nx.cpp @@ -144,7 +144,7 @@ namespace ams { Result OpenSession(ClkRstSession *out, DeviceCode device_code) { /* Get the relevant definition. */ out->_session = const_cast(GetDefinition(device_code)); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(ClkRstSession *session) { @@ -188,21 +188,21 @@ namespace ams { /* Set clock. */ SetClockEnabled(GetDefinition(module), en); - return ResultSuccess(); + R_SUCCEED(); } Result SetClockRate(Module module, ClockHz hz) { /* Set the clock rate. */ SetClockRate(GetDefinition(module), hz); - return ResultSuccess(); + R_SUCCEED(); } Result SetReset(Module module, bool en) { /* Set reset. */ SetResetEnabled(GetDefinition(module), en); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/boot/source/api_overrides/regulator_api_for_boot.cpp b/stratosphere/boot/source/api_overrides/regulator_api_for_boot.cpp index f911f5d2a..b7c86a0b8 100644 --- a/stratosphere/boot/source/api_overrides/regulator_api_for_boot.cpp +++ b/stratosphere/boot/source/api_overrides/regulator_api_for_boot.cpp @@ -27,7 +27,7 @@ namespace ams::regulator { Result OpenSession(RegulatorSession *out, DeviceCode device_code) { AMS_UNUSED(out, device_code); - return ResultSuccess(); + R_SUCCEED(); } void CloseSession(RegulatorSession *session) { @@ -41,12 +41,12 @@ namespace ams::regulator { Result SetVoltageEnabled(RegulatorSession *session, bool enabled) { AMS_UNUSED(session, enabled); - return ResultSuccess(); + R_SUCCEED(); } Result SetVoltageValue(RegulatorSession *session, u32 micro_volts) { AMS_UNUSED(session, micro_volts); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/boot/source/boot_battery_driver.hpp b/stratosphere/boot/source/boot_battery_driver.hpp index 9b0c64c2b..9a385fc66 100644 --- a/stratosphere/boot/source/boot_battery_driver.hpp +++ b/stratosphere/boot/source/boot_battery_driver.hpp @@ -42,7 +42,7 @@ namespace ams::boot { R_TRY(powctl::IsBatteryPresent(std::addressof(present), s_battery_session)); *out = !present; - return ResultSuccess(); + R_SUCCEED(); } Result GetChargePercentage(float *out) { diff --git a/stratosphere/boot/source/boot_charger_driver.hpp b/stratosphere/boot/source/boot_charger_driver.hpp index 5d9da2feb..4c570fdf1 100644 --- a/stratosphere/boot/source/boot_charger_driver.hpp +++ b/stratosphere/boot/source/boot_charger_driver.hpp @@ -58,7 +58,7 @@ namespace ams::boot { /* Set configuration to charge battery. */ R_TRY(powctl::SetChargerChargerConfiguration(m_charger_session, powctl::ChargerConfiguration_ChargeBattery)); - return ResultSuccess(); + R_SUCCEED(); } Result GetChargeCurrentState(powctl::ChargeCurrentState *out) { @@ -107,7 +107,7 @@ namespace ams::boot { case powctl::ChargerStatus_ChargeTerminationDone: *out = boot::ChargerStatus_ChargeTerminationDone; break; } - return ResultSuccess(); + R_SUCCEED(); } Result GetBatteryCompensation(int *out) { diff --git a/stratosphere/boot/source/boot_pmic_driver.cpp b/stratosphere/boot/source/boot_pmic_driver.cpp index d02f4068b..e87e8c602 100644 --- a/stratosphere/boot/source/boot_pmic_driver.cpp +++ b/stratosphere/boot/source/boot_pmic_driver.cpp @@ -31,7 +31,7 @@ namespace ams::boot { u8 power_status; R_TRY(this->GetPowerStatus(std::addressof(power_status))); *out = (power_status & 0x02) != 0; - return ResultSuccess(); + R_SUCCEED(); } Result PmicDriver::GetOnOffIrq(u8 *out) { @@ -53,7 +53,7 @@ namespace ams::boot { u8 on_off_irq; R_TRY(this->GetOnOffIrq(std::addressof(on_off_irq))); *out = (on_off_irq & 0x08) != 0; - return ResultSuccess(); + R_SUCCEED(); } void PmicDriver::ShutdownSystem(bool reboot) { diff --git a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp index 6590f96c0..c5db5cd0b 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_breakpoint_manager_base.cpp @@ -48,7 +48,7 @@ namespace ams::dmnt { return bp->Clear(m_debug_process); } } - return ResultSuccess(); + R_SUCCEED(); } BreakPointBase *BreakPointManagerBase::GetFreeBreakPoint() { diff --git a/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp b/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp index a62f8c0d6..42ec735f1 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_debug_process.cpp @@ -51,7 +51,7 @@ namespace ams::dmnt { /* Get process info. */ this->CollectProcessInfo(); - return ResultSuccess(); + R_SUCCEED(); } void DebugProcess::Detach() { @@ -127,7 +127,7 @@ namespace ams::dmnt { m_is_valid = true; this->SetDebugBreaked(); - return ResultSuccess(); + R_SUCCEED(); } s32 DebugProcess::ThreadCreate(u64 thread_id) { @@ -230,7 +230,7 @@ namespace ams::dmnt { address = next_address; } - return ResultSuccess(); + R_SUCCEED(); } void DebugProcess::CollectProcessInfo() { @@ -254,7 +254,7 @@ namespace ams::dmnt { R_TRY(svc::GetInfo(std::addressof(value), svc::InfoType_IsApplication, handle, 0)); m_is_application = value != 0; - return ResultSuccess(); + R_SUCCEED(); }; /* Get process info/status. */ @@ -313,7 +313,7 @@ namespace ams::dmnt { this->SetLastThreadId(0); this->SetLastSignal(GdbSignal_Signal0); - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::Continue(u64 thread_id) { @@ -328,7 +328,7 @@ namespace ams::dmnt { this->SetLastThreadId(0); this->SetLastSignal(GdbSignal_Signal0); - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::Step() { @@ -371,7 +371,7 @@ namespace ams::dmnt { bp_guard.Cancel(); } - return ResultSuccess(); + R_SUCCEED(); } void DebugProcess::ClearStep() { @@ -388,7 +388,7 @@ namespace ams::dmnt { return svc::BreakDebugProcess(m_debug_handle); } else { AMS_DMNT2_GDB_LOG_ERROR("DebugProcess::Break called on non-running process!\n"); - return ResultSuccess(); + R_SUCCEED(); } } @@ -398,7 +398,7 @@ namespace ams::dmnt { this->Detach(); } - return ResultSuccess(); + R_SUCCEED(); } void DebugProcess::GetBranchTarget(svc::ThreadContext &ctx, u64 thread_id, u64 ¤t_pc, u64 &target) { @@ -472,7 +472,7 @@ namespace ams::dmnt { Result DebugProcess::ClearBreakPoint(uintptr_t address, size_t size) { m_software_breakpoints.ClearBreakPoint(address, size); - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::SetHardwareBreakPoint(uintptr_t address, size_t size, bool is_step) { @@ -481,7 +481,7 @@ namespace ams::dmnt { Result DebugProcess::ClearHardwareBreakPoint(uintptr_t address, size_t size) { m_hardware_breakpoints.ClearBreakPoint(address, size); - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::SetWatchPoint(u64 address, u64 size, bool read, bool write) { @@ -507,7 +507,7 @@ namespace ams::dmnt { R_TRY(svc::GetDebugThreadParam(std::addressof(dummy_value), std::addressof(val32), m_debug_handle, thread_id, svc::DebugThreadParam_CurrentCore)); *out = val32; - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::GetProcessDebugEvent(svc::DebugEventInfo *out) { @@ -550,7 +550,7 @@ namespace ams::dmnt { this->SetDebugBreaked(); } - return ResultSuccess(); + R_SUCCEED(); } u64 DebugProcess::GetLastThreadId() { @@ -578,7 +578,7 @@ namespace ams::dmnt { } *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result DebugProcess::GetThreadInfoList(s32 *out_count, osdbg::ThreadInfo **out_infos, size_t max_count) { @@ -592,7 +592,7 @@ namespace ams::dmnt { } *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } void DebugProcess::GetThreadName(char *dst, u64 thread_id) const { diff --git a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp index fd1fb7fb7..53247291e 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_gdb_server_impl.cpp @@ -1915,7 +1915,7 @@ namespace ams::dmnt { break; } - return ResultSuccess(); + R_SUCCEED(); } void GdbServerImpl::q() { diff --git a/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp b/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp index e5ba23af0..3d62436c1 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_hardware_breakpoint.cpp @@ -116,7 +116,7 @@ namespace ams::dmnt { /* Set as in-use. */ m_in_use = true; - return ResultSuccess(); + R_SUCCEED(); } HardwareBreakPointManager::HardwareBreakPointManager(DebugProcess *debug_process) : BreakPointManager(debug_process) { @@ -147,7 +147,7 @@ namespace ams::dmnt { }; R_UNLESS(SendMultiCoreRequest(request), dmnt::ResultUnknown()); - return ResultSuccess(); + R_SUCCEED(); } Result HardwareBreakPointManager::SetContextBreakPoint(svc::HardwareBreakPointRegisterName ctx, DebugProcess *debug_process) { diff --git a/stratosphere/dmnt.gen2/source/dmnt2_hardware_watchpoint.cpp b/stratosphere/dmnt.gen2/source/dmnt2_hardware_watchpoint.cpp index aed443994..137c0a0c7 100644 --- a/stratosphere/dmnt.gen2/source/dmnt2_hardware_watchpoint.cpp +++ b/stratosphere/dmnt.gen2/source/dmnt2_hardware_watchpoint.cpp @@ -119,7 +119,7 @@ namespace ams::dmnt { /* Set as in-use. */ m_in_use = true; - return ResultSuccess(); + R_SUCCEED(); } HardwareWatchPointManager::HardwareWatchPointManager(DebugProcess *debug_process) : BreakPointManagerBase(debug_process) { @@ -153,7 +153,7 @@ namespace ams::dmnt { if (bp.m_address <= address && address < bp.m_address + bp.m_size) { read = bp.m_read; write = bp.m_write; - return ResultSuccess(); + R_SUCCEED(); } } } @@ -163,7 +163,7 @@ namespace ams::dmnt { read = false; write = false; - return svc::ResultInvalidArgument(); + R_THROW(svc::ResultInvalidArgument()); } } diff --git a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp index 2d3aa5f3b..5c04f82e3 100644 --- a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp +++ b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp @@ -37,7 +37,7 @@ namespace ams::dmnt::cheat { Result CheatService::ForceOpenCheatProcess() { R_UNLESS(R_SUCCEEDED(dmnt::cheat::impl::ForceOpenCheatProcess()), dmnt::cheat::ResultCheatNotAttached()); - return ResultSuccess(); + R_SUCCEED(); } Result CheatService::PauseCheatProcess() { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index d300b2930..4906eed47 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -236,7 +236,7 @@ namespace ams::dmnt::cheat::impl { Result EnsureCheatProcess() { R_UNLESS(this->HasActiveCheatProcess(), dmnt::cheat::ResultCheatNotAttached()); - return ResultSuccess(); + R_SUCCEED(); } os::NativeHandle GetCheatProcessHandle() const { @@ -297,7 +297,7 @@ namespace ams::dmnt::cheat::impl { R_TRY(this->EnsureCheatProcess()); std::memcpy(out, std::addressof(m_cheat_process_metadata), sizeof(*out)); - return ResultSuccess(); + R_SUCCEED(); } Result ForceOpenCheatProcess() { @@ -306,7 +306,7 @@ namespace ams::dmnt::cheat::impl { Result ForceCloseCheatProcess() { this->CloseActiveCheatProcess(); - return ResultSuccess(); + R_SUCCEED(); } Result ReadCheatProcessMemoryUnsafe(u64 proc_addr, void *out_data, size_t size) { @@ -334,7 +334,7 @@ namespace ams::dmnt::cheat::impl { } } - return ResultSuccess(); + R_SUCCEED(); } Result PauseCheatProcessUnsafe() { @@ -347,7 +347,7 @@ namespace ams::dmnt::cheat::impl { m_broken_unsafe = false; m_unsafe_break_event.Signal(); dmnt::cheat::impl::ContinueCheatProcess(this->GetCheatProcessHandle()); - return ResultSuccess(); + R_SUCCEED(); } Result GetCheatProcessMappingCount(u64 *out_count) { @@ -371,7 +371,7 @@ namespace ams::dmnt::cheat::impl { } while (address != 0); *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result GetCheatProcessMappings(svc::MemoryInfo *mappings, size_t max_count, u64 *out_count, u64 offset) { @@ -398,7 +398,7 @@ namespace ams::dmnt::cheat::impl { } while (address != 0 && written_count < max_count); *out_count = written_count; - return ResultSuccess(); + R_SUCCEED(); } Result ReadCheatProcessMemory(u64 proc_addr, void *out_data, size_t size) { @@ -455,7 +455,7 @@ namespace ams::dmnt::cheat::impl { } *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result GetCheats(CheatEntry *out_cheats, size_t max_count, u64 *out_count, u64 offset) { @@ -474,7 +474,7 @@ namespace ams::dmnt::cheat::impl { } *out_count = count; - return ResultSuccess(); + R_SUCCEED(); } Result GetCheatById(CheatEntry *out_cheat, u32 cheat_id) { @@ -487,7 +487,7 @@ namespace ams::dmnt::cheat::impl { R_UNLESS(entry->definition.num_opcodes != 0, dmnt::cheat::ResultCheatUnknownId()); *out_cheat = *entry; - return ResultSuccess(); + R_SUCCEED(); } Result ToggleCheat(u32 cheat_id) { @@ -506,7 +506,7 @@ namespace ams::dmnt::cheat::impl { /* Trigger a VM reload. */ this->SetNeedsReloadVm(true); - return ResultSuccess(); + R_SUCCEED(); } Result AddCheat(u32 *out_id, const CheatDefinition &def, bool enabled) { @@ -529,7 +529,7 @@ namespace ams::dmnt::cheat::impl { /* Set output id. */ *out_id = new_entry->cheat_id; - return ResultSuccess(); + R_SUCCEED(); } Result RemoveCheat(u32 cheat_id) { @@ -543,7 +543,7 @@ namespace ams::dmnt::cheat::impl { /* Trigger a VM reload. */ this->SetNeedsReloadVm(true); - return ResultSuccess(); + R_SUCCEED(); } Result SetMasterCheat(const CheatDefinition &def) { @@ -562,7 +562,7 @@ namespace ams::dmnt::cheat::impl { /* Trigger a VM reload. */ this->SetNeedsReloadVm(true); - return ResultSuccess(); + R_SUCCEED(); } Result ReadStaticRegister(u64 *out, size_t which) { @@ -572,7 +572,7 @@ namespace ams::dmnt::cheat::impl { R_UNLESS(which < CheatVirtualMachine::NumStaticRegisters, dmnt::cheat::ResultCheatInvalid()); *out = m_cheat_vm.GetStaticRegister(which); - return ResultSuccess(); + R_SUCCEED(); } Result WriteStaticRegister(size_t which, u64 value) { @@ -582,7 +582,7 @@ namespace ams::dmnt::cheat::impl { R_UNLESS(which < CheatVirtualMachine::NumStaticRegisters, dmnt::cheat::ResultCheatInvalid()); m_cheat_vm.SetStaticRegister(which, value); - return ResultSuccess(); + R_SUCCEED(); } Result ResetStaticRegisters() { @@ -591,7 +591,7 @@ namespace ams::dmnt::cheat::impl { R_TRY(this->EnsureCheatProcess()); m_cheat_vm.ResetStaticRegisters(); - return ResultSuccess(); + R_SUCCEED(); } Result GetFrozenAddressCount(u64 *out_count) { @@ -600,7 +600,7 @@ namespace ams::dmnt::cheat::impl { R_TRY(this->EnsureCheatProcess()); *out_count = std::distance(m_frozen_addresses_map.begin(), m_frozen_addresses_map.end()); - return ResultSuccess(); + R_SUCCEED(); } Result GetFrozenAddresses(FrozenAddressEntry *frz_addrs, size_t max_count, u64 *out_count, u64 offset) { @@ -623,7 +623,7 @@ namespace ams::dmnt::cheat::impl { } *out_count = written_count; - return ResultSuccess(); + R_SUCCEED(); } Result GetFrozenAddress(FrozenAddressEntry *frz_addr, u64 address) { @@ -636,7 +636,7 @@ namespace ams::dmnt::cheat::impl { frz_addr->address = it->GetAddress(); frz_addr->value = it->GetValue(); - return ResultSuccess(); + R_SUCCEED(); } Result EnableFrozenAddress(u64 *out_value, u64 address, u64 width) { @@ -656,7 +656,7 @@ namespace ams::dmnt::cheat::impl { m_frozen_addresses_map.insert(*entry); *out_value = value.value; - return ResultSuccess(); + R_SUCCEED(); } Result DisableFrozenAddress(u64 address) { @@ -671,7 +671,7 @@ namespace ams::dmnt::cheat::impl { m_frozen_addresses_map.erase(it); DeallocateFrozenAddress(entry); - return ResultSuccess(); + R_SUCCEED(); } }; @@ -884,7 +884,7 @@ namespace ams::dmnt::cheat::impl { /* Signal to our fans. */ m_cheat_process_event.Signal(); - return ResultSuccess(); + R_SUCCEED(); } #undef R_ABORT_UNLESS_IF_NEW_PROCESS diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp index cca48aa29..7c71891f2 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp @@ -69,7 +69,7 @@ namespace ams::dmnt::cheat::impl { /* Set the target core. */ *out = target_core; - return ResultSuccess(); + R_SUCCEED(); } void SendHandle(size_t target_core, os::NativeHandle debug_handle) { diff --git a/stratosphere/fatal/source/fatal_event_manager.cpp b/stratosphere/fatal/source/fatal_event_manager.cpp index 230242007..c1ab1c3c7 100644 --- a/stratosphere/fatal/source/fatal_event_manager.cpp +++ b/stratosphere/fatal/source/fatal_event_manager.cpp @@ -32,7 +32,7 @@ namespace ams::fatal::srv { R_UNLESS(m_num_events_gotten < FatalEventManager::NumFatalEvents, fatal::ResultTooManyEvents()); *out = std::addressof(m_events[m_num_events_gotten++]); - return ResultSuccess(); + R_SUCCEED(); } void FatalEventManager::SignalEvents() { diff --git a/stratosphere/fatal/source/fatal_font.cpp b/stratosphere/fatal/source/fatal_font.cpp index d3e7e8b8d..f1c9be83b 100644 --- a/stratosphere/fatal/source/fatal_font.cpp +++ b/stratosphere/fatal/source/fatal_font.cpp @@ -254,7 +254,7 @@ namespace ams::fatal::srv::font { stbtt_InitFont(std::addressof(g_stb_font), font_buffer, stbtt_GetFontOffsetForIndex(font_buffer, 0)); SetFontSize(16.0f); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/fatal/source/fatal_task_clock.cpp b/stratosphere/fatal/source/fatal_task_clock.cpp index 7c689197f..350ef0703 100644 --- a/stratosphere/fatal/source/fatal_task_clock.cpp +++ b/stratosphere/fatal/source/fatal_task_clock.cpp @@ -53,7 +53,7 @@ namespace ams::fatal::srv { R_TRY(pcvSetClockRate(module, hz)); } - return ResultSuccess(); + R_SUCCEED(); } Result AdjustClockTask::AdjustClock() { @@ -66,7 +66,7 @@ namespace ams::fatal::srv { R_TRY(AdjustClockForModule(PcvModule_GPU, GPU_CLOCK_307MHZ)); R_TRY(AdjustClockForModule(PcvModule_EMC, EMC_CLOCK_1331MHZ)); - return ResultSuccess(); + R_SUCCEED(); } Result AdjustClockTask::Run() { diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index c0ba05458..cac9db288 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -165,7 +165,7 @@ namespace ams::fatal::srv { /* Signal we're done with our job. */ m_context->erpt_event->Signal(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/fatal/source/fatal_task_power.cpp b/stratosphere/fatal/source/fatal_task_power.cpp index 128b66337..9abfae8ec 100644 --- a/stratosphere/fatal/source/fatal_task_power.cpp +++ b/stratosphere/fatal/source/fatal_task_power.cpp @@ -207,18 +207,18 @@ namespace ams::fatal::srv { Result PowerControlTask::Run() { this->MonitorBatteryState(); - return ResultSuccess(); + R_SUCCEED(); } Result PowerButtonObserveTask::Run() { this->WaitForPowerButton(); - return ResultSuccess(); + R_SUCCEED(); } Result StateTransitionStopTask::Run() { /* Nintendo ignores the output of this call... */ spsmPutErrorState(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index 24abe8d64..9ccaa8bd1 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -125,7 +125,7 @@ namespace ams::fatal::srv { /* Set alpha to 1.0f. */ R_TRY(viSetDisplayAlpha(std::addressof(temp_display), 1.0f)); - return ResultSuccess(); + R_SUCCEED(); } Result ShowFatalTask::SetupDisplayExternal() { @@ -141,7 +141,7 @@ namespace ams::fatal::srv { /* Set alpha to 1.0f. */ R_TRY(viSetDisplayAlpha(std::addressof(temp_display), 1.0f)); - return ResultSuccess(); + R_SUCCEED(); } Result ShowFatalTask::PrepareScreenForDrawing() { @@ -196,7 +196,7 @@ namespace ams::fatal::srv { R_TRY(this->InitializeNativeWindow()); } - return ResultSuccess(); + R_SUCCEED(); } void ShowFatalTask::PreRenderFrameBuffer() { @@ -468,7 +468,7 @@ namespace ams::fatal::srv { R_TRY(nwindowConfigureBuffer(std::addressof(m_win), 0, std::addressof(grbuf))); } - return ResultSuccess(); + R_SUCCEED(); } void ShowFatalTask::DisplayPreRenderedFrame() { @@ -488,7 +488,7 @@ namespace ams::fatal::srv { /* Display the pre-rendered frame. */ this->DisplayPreRenderedFrame(); - return ResultSuccess(); + R_SUCCEED(); } Result ShowFatalTask::Run() { @@ -506,7 +506,7 @@ namespace ams::fatal::srv { Result BacklightControlTask::Run() { TurnOnBacklight(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/fatal/source/fatal_task_sound.cpp b/stratosphere/fatal/source/fatal_task_sound.cpp index 06849c60c..276c1adec 100644 --- a/stratosphere/fatal/source/fatal_task_sound.cpp +++ b/stratosphere/fatal/source/fatal_task_sound.cpp @@ -82,7 +82,7 @@ namespace ams::fatal::srv { Result StopSoundTask::Run() { StopSound(); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/loader/source/ldr_argument_store.cpp b/stratosphere/loader/source/ldr_argument_store.cpp index cd2a52691..8bdaf62f9 100644 --- a/stratosphere/loader/source/ldr_argument_store.cpp +++ b/stratosphere/loader/source/ldr_argument_store.cpp @@ -56,7 +56,7 @@ namespace ams::ldr { entry.argument_size = size; std::memcpy(entry.argument, argument, entry.argument_size); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/loader/source/ldr_argument_store.hpp b/stratosphere/loader/source/ldr_argument_store.hpp index 4fdb61a86..cc7bee4b8 100644 --- a/stratosphere/loader/source/ldr_argument_store.hpp +++ b/stratosphere/loader/source/ldr_argument_store.hpp @@ -43,7 +43,7 @@ namespace ams::ldr { for (auto &entry : m_argument_map) { entry.program_id = ncm::InvalidProgramId; } - return ResultSuccess(); + R_SUCCEED(); } private: static int FindIndex(Entry *map, ncm::ProgramId program_id); diff --git a/stratosphere/loader/source/ldr_capabilities.cpp b/stratosphere/loader/source/ldr_capabilities.cpp index 762413798..62892aaaf 100644 --- a/stratosphere/loader/source/ldr_capabilities.cpp +++ b/stratosphere/loader/source/ldr_capabilities.cpp @@ -353,7 +353,7 @@ namespace ams::ldr { #undef VALIDATE_CASE } - return ResultSuccess(); + R_SUCCEED(); } u16 MakeProgramInfoFlag(const util::BitPack32 *kac, size_t count) { diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index e1a821052..cd5ae8b29 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -68,7 +68,7 @@ namespace ams::ldr { m_mounted_code = true; } - return ResultSuccess(); + R_SUCCEED(); } void ScopedCodeMount::EnsureOverrideStatus(const ncm::ProgramLocation &loc) { @@ -85,7 +85,7 @@ namespace ams::ldr { if (static_cast(loc.storage_id) == ncm::StorageId::None) { std::memset(out_path, 0, out_size); std::memcpy(out_path, "/", std::min(out_size, 2)); - return ResultSuccess(); + R_SUCCEED(); } lr::Path path; @@ -118,13 +118,13 @@ namespace ams::ldr { std::memset(out_path, 0, out_size); std::memcpy(out_path, path.str, std::min(out_size, sizeof(path))); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectProgramPath(const char *path, size_t size, const ncm::ProgramLocation &loc) { /* Check for storage id none. */ if (static_cast(loc.storage_id) == ncm::StorageId::None) { - return ResultSuccess(); + R_SUCCEED(); } /* Open location resolver. */ @@ -139,7 +139,7 @@ namespace ams::ldr { /* Redirect the path. */ lr.RedirectProgramPath(lr_path, loc.program_id); - return ResultSuccess(); + R_SUCCEED(); } Result RedirectHtmlDocumentPathForHbl(const ncm::ProgramLocation &loc) { @@ -156,7 +156,7 @@ namespace ams::ldr { R_TRY(lr.ResolveProgramPath(std::addressof(path), loc.program_id)); lr.RedirectApplicationHtmlDocumentPath(path, loc.program_id, loc.program_id); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/loader/source/ldr_launch_record.cpp b/stratosphere/loader/source/ldr_launch_record.cpp index 9b6a18449..b5e4439f4 100644 --- a/stratosphere/loader/source/ldr_launch_record.cpp +++ b/stratosphere/loader/source/ldr_launch_record.cpp @@ -74,7 +74,7 @@ namespace ams::pm::info { Result HasLaunchedBootProgram(bool *out, ncm::ProgramId program_id) { *out = ldr::HasLaunchedBootProgram(program_id); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/loader/source/ldr_loader_service.cpp b/stratosphere/loader/source/ldr_loader_service.cpp index bf39058f9..e4ca20612 100644 --- a/stratosphere/loader/source/ldr_loader_service.cpp +++ b/stratosphere/loader/source/ldr_loader_service.cpp @@ -76,7 +76,7 @@ namespace ams::ldr { *out_status = status; } - return ResultSuccess(); + R_SUCCEED(); } Result LoaderService::PinProgram(PinId *out, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &status) { @@ -116,7 +116,7 @@ namespace ams::ldr { Result LoaderService::SetEnabledProgramVerification(bool enabled) { ldr::SetEnabledProgramVerification(enabled); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/loader/source/ldr_meta.cpp b/stratosphere/loader/source/ldr_meta.cpp index 741ab3ff6..35e922b05 100644 --- a/stratosphere/loader/source/ldr_meta.cpp +++ b/stratosphere/loader/source/ldr_meta.cpp @@ -47,7 +47,7 @@ namespace ams::ldr { R_UNLESS(allowed_start <= start, ldr::ResultInvalidMeta()); R_UNLESS(start <= allowed_end, ldr::ResultInvalidMeta()); R_UNLESS(start + size <= allowed_end, ldr::ResultInvalidMeta()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateNpdm(const Npdm *npdm, size_t size) { @@ -77,7 +77,7 @@ namespace ams::ldr { /* Validate Aci extends. */ R_TRY(ValidateSubregion(sizeof(Npdm), size, npdm->aci_offset, npdm->aci_size, sizeof(Aci))); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateAcid(const Acid *acid, size_t size) { @@ -94,7 +94,7 @@ namespace ams::ldr { R_TRY(ValidateSubregion(sizeof(Acid), size, acid->sac_offset, acid->sac_size)); R_TRY(ValidateSubregion(sizeof(Acid), size, acid->kac_offset, acid->kac_size)); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateAci(const Aci *aci, size_t size) { @@ -106,7 +106,7 @@ namespace ams::ldr { R_TRY(ValidateSubregion(sizeof(Aci), size, aci->sac_offset, aci->sac_size)); R_TRY(ValidateSubregion(sizeof(Aci), size, aci->kac_offset, aci->kac_size)); - return ResultSuccess(); + R_SUCCEED(); } const u8 *GetAcidSignatureModulus(u32 key_generation) { @@ -117,7 +117,7 @@ namespace ams::ldr { /* Loader did not check signatures prior to 10.0.0. */ if (hos::GetVersion() < hos::Version_10_0_0) { meta->check_verification_data = false; - return ResultSuccess(); + R_SUCCEED(); } /* Verify the signature. */ @@ -133,7 +133,7 @@ namespace ams::ldr { R_UNLESS(is_signature_valid || !IsEnabledProgramVerification(), ldr::ResultInvalidAcidSignature()); meta->check_verification_data = is_signature_valid; - return ResultSuccess(); + R_SUCCEED(); } Result LoadMetaFromFile(fs::FileHandle file, MetaCache *cache) { @@ -182,7 +182,7 @@ namespace ams::ldr { meta->modulus = acid->modulus; } - return ResultSuccess(); + R_SUCCEED(); } } @@ -270,7 +270,7 @@ namespace ams::ldr { g_cached_override_status = status; *out_meta = *meta; - return ResultSuccess(); + R_SUCCEED(); } Result LoadMetaFromCache(Meta *out_meta, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &status) { @@ -278,7 +278,7 @@ namespace ams::ldr { return LoadMeta(out_meta, loc, status); } *out_meta = g_meta_cache.meta; - return ResultSuccess(); + R_SUCCEED(); } void InvalidateMetaCache() { diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 92c3e878b..59eb46647 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -126,7 +126,7 @@ namespace ams::ldr { #else AMS_UNUSED(program_id, version); #endif - return ResultSuccess(); + R_SUCCEED(); } /* Helpers. */ @@ -157,7 +157,7 @@ namespace ams::ldr { /* Copy flags. */ out->flags = MakeProgramInfoFlag(static_cast(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)); - return ResultSuccess(); + R_SUCCEED(); } bool IsApplet(const Meta *meta) { @@ -195,7 +195,7 @@ namespace ams::ldr { } } - return ResultSuccess(); + R_SUCCEED(); } Result ValidateNsoHeaders(const NsoHeader *nso_headers, const bool *has_nso) { @@ -214,7 +214,7 @@ namespace ams::ldr { R_UNLESS(nso_headers[i].text_dst_offset == 0, ldr::ResultInvalidNso()); } - return ResultSuccess(); + R_SUCCEED(); } Result ValidateMeta(const Meta *meta, const ncm::ProgramLocation &loc, const fs::CodeVerificationData &code_verification_data) { @@ -244,7 +244,7 @@ namespace ams::ldr { } /* All good. */ - return ResultSuccess(); + R_SUCCEED(); } Result GetCreateProcessFlags(u32 *out, const Meta *meta, const u32 ldr_flags) { @@ -272,7 +272,7 @@ namespace ams::ldr { flags |= svc::CreateProcessFlag_AddressSpace64Bit; break; default: - return ldr::ResultInvalidMeta(); + R_THROW(ldr::ResultInvalidMeta()); } /* Set Enable Debug. */ @@ -317,7 +317,7 @@ namespace ams::ldr { flags |= svc::CreateProcessFlag_PoolPartitionSystemNonSecure; break; default: - return ldr::ResultInvalidMeta(); + R_THROW(ldr::ResultInvalidMeta()); } } else if (hos::GetVersion() >= hos::Version_4_0_0) { /* On 4.0.0+, the corresponding bit was simply "UseSecureMemory". */ @@ -332,7 +332,7 @@ namespace ams::ldr { } *out = flags; - return ResultSuccess(); + R_SUCCEED(); } Result GetCreateProcessParameter(svc::CreateProcessParameter *out, const Meta *meta, u32 flags, os::NativeHandle resource_limit) { @@ -367,7 +367,7 @@ namespace ams::ldr { out->system_resource_num_pages = meta->npdm->system_resource_size >> 12; } - return ResultSuccess(); + R_SUCCEED(); } ALWAYS_INLINE u64 GetCurrentProcessInfo(svc::InfoType info_type) { @@ -415,7 +415,7 @@ namespace ams::ldr { /* If the memory range is free and big enough, use it. */ if (mem_info.state == svc::MemoryState_Free && mapping_size <= ((mem_info.base_address + mem_info.size) - address)) { *out = address; - return ResultSuccess(); + R_SUCCEED(); } /* Check that we can advance. */ @@ -514,7 +514,7 @@ namespace ams::ldr { out_param->code_address = aslr_start; out_param->code_num_pages = total_size >> 12; - return ResultSuccess(); + R_SUCCEED(); } Result CreateProcessImpl(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const bool *has_nso, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) { @@ -532,7 +532,7 @@ namespace ams::ldr { /* Set the output handle. */ out->process_handle = process_handle; - return ResultSuccess(); + R_SUCCEED(); } Result LoadNsoSegment(fs::FileHandle file, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) { @@ -565,7 +565,7 @@ namespace ams::ldr { R_UNLESS(std::memcmp(hash, file_hash, sizeof(hash)) == 0, ldr::ResultInvalidNso()); } - return ResultSuccess(); + R_SUCCEED(); } Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, uintptr_t map_address, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size) { @@ -612,7 +612,7 @@ namespace ams::ldr { R_TRY(svc::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, svc::MemoryPermission_ReadWrite)); } - return ResultSuccess(); + R_SUCCEED(); } Result LoadAutoLoadModules(const ProcessInfo *process_info, const NsoHeader *nso_headers, const bool *has_nso, const ArgumentStore::Entry *argument) { @@ -651,7 +651,7 @@ namespace ams::ldr { R_TRY(svc::SetProcessMemoryPermission(process_info->process_handle, process_info->args_address, process_info->args_size, svc::MemoryPermission_ReadWrite)); } - return ResultSuccess(); + R_SUCCEED(); } } @@ -742,22 +742,22 @@ namespace ams::ldr { Result PinProgram(PinId *out_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status) { R_UNLESS(RoManager::GetInstance().Allocate(out_id, loc, override_status), ldr::ResultMaxProcess()); - return ResultSuccess(); + R_SUCCEED(); } Result UnpinProgram(PinId id) { R_UNLESS(RoManager::GetInstance().Free(id), ldr::ResultNotPinned()); - return ResultSuccess(); + R_SUCCEED(); } Result GetProcessModuleInfo(u32 *out_count, ldr::ModuleInfo *out, size_t max_out_count, os::ProcessId process_id) { R_UNLESS(RoManager::GetInstance().GetProcessModuleInfo(out_count, out, max_out_count, process_id), ldr::ResultNotPinned()); - return ResultSuccess(); + R_SUCCEED(); } Result GetProgramLocationAndOverrideStatusFromPinId(ncm::ProgramLocation *out, cfg::OverrideStatus *out_status, PinId pin_id) { R_UNLESS(RoManager::GetInstance().GetProgramLocationAndStatus(out, out_status, pin_id), ldr::ResultNotPinned()); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ncm/source/ncm_main.cpp b/stratosphere/ncm/source/ncm_main.cpp index 29f80a849..412733e3c 100644 --- a/stratosphere/ncm/source/ncm_main.cpp +++ b/stratosphere/ncm/source/ncm_main.cpp @@ -83,7 +83,7 @@ namespace ams { R_TRY(os::CreateThread(std::addressof(m_thread), ThreadFunction, this, g_content_manager_thread_stack, sizeof(g_content_manager_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(ncm, ContentManagerServerIpcSession))); os::SetThreadNamePointer(std::addressof(m_thread), AMS_GET_SYSTEM_THREAD_NAME(ncm, ContentManagerServerIpcSession)); os::StartThread(std::addressof(m_thread)); - return ResultSuccess(); + R_SUCCEED(); } void Wait() { @@ -127,7 +127,7 @@ namespace ams { R_TRY(os::CreateThread(std::addressof(m_thread), ThreadFunction, this, g_location_resolver_thread_stack, sizeof(g_location_resolver_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(ncm, LocationResolverServerIpcSession))); os::SetThreadNamePointer(std::addressof(m_thread), AMS_GET_SYSTEM_THREAD_NAME(ncm, LocationResolverServerIpcSession)); os::StartThread(std::addressof(m_thread)); - return ResultSuccess(); + R_SUCCEED(); } void Wait() { diff --git a/stratosphere/ro/source/impl/ro_map_utils.cpp b/stratosphere/ro/source/impl/ro_map_utils.cpp index 4db96e8b0..e5c525a02 100644 --- a/stratosphere/ro/source/impl/ro_map_utils.cpp +++ b/stratosphere/ro/source/impl/ro_map_utils.cpp @@ -68,7 +68,7 @@ namespace ams::ro::impl { /* If the memory range is free and big enough, use it. */ if (mem_info.state == svc::MemoryState_Free && mapping_size <= ((mem_info.base_address + mem_info.size) - address)) { *out = address; - return ResultSuccess(); + R_SUCCEED(); } /* Check that we can advance. */ diff --git a/stratosphere/ro/source/impl/ro_nro_utils.cpp b/stratosphere/ro/source/impl/ro_nro_utils.cpp index e8dd2689b..6d7b7effa 100644 --- a/stratosphere/ro/source/impl/ro_nro_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nro_utils.cpp @@ -74,7 +74,7 @@ namespace ams::ro::impl { bss_mcm.Cancel(); *out_base_address = base_address; - return ResultSuccess(); + R_SUCCEED(); } Result SetNroPerms(os::NativeHandle process_handle, u64 base_address, u64 rx_size, u64 ro_size, u64 rw_size) { @@ -86,7 +86,7 @@ namespace ams::ro::impl { R_TRY(svc::SetProcessMemoryPermission(process_handle, base_address + ro_offset, ro_size, svc::MemoryPermission_Read)); R_TRY(svc::SetProcessMemoryPermission(process_handle, base_address + rw_offset, rw_size, svc::MemoryPermission_ReadWrite)); - return ResultSuccess(); + R_SUCCEED(); } Result UnmapNro(os::NativeHandle process_handle, u64 base_address, u64 nro_heap_address, u64 bss_heap_address, u64 bss_heap_size, u64 code_size, u64 rw_size) { @@ -103,7 +103,7 @@ namespace ams::ro::impl { /* Finally, unmap .text + .rodata. */ R_TRY(svc::UnmapProcessCodeMemory(process_handle, base_address, nro_heap_address, code_size)); - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/ro/source/impl/ro_nrr_utils.cpp b/stratosphere/ro/source/impl/ro_nrr_utils.cpp index cf05678a8..17d145d4e 100644 --- a/stratosphere/ro/source/impl/ro_nrr_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nrr_utils.cpp @@ -119,7 +119,7 @@ namespace ams::ro::impl { } *out = IsDevelopmentHardware() ? DevModuli[key_generation] : ProdModuli[key_generation]; - return ResultSuccess(); + R_SUCCEED(); } Result ValidateNrrCertification(const NrrHeader *header, const u8 *mod) { @@ -138,7 +138,7 @@ namespace ams::ro::impl { /* Check ProgramId pattern is valid. */ R_UNLESS(header->IsProgramIdValid(), ro::ResultNotAuthorized()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateNrrSignature(const NrrHeader *header) { @@ -155,7 +155,7 @@ namespace ams::ro::impl { const size_t msg_size = header->GetSignedAreaSize(); R_UNLESS(crypto::VerifyRsa2048PssSha256(sig, sig_size, mod, mod_size, exp, exp_size, msg, msg_size), ro::ResultNotAuthorized()); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateNrr(const NrrHeader *header, u64 size, ncm::ProgramId program_id, NrrKind nrr_kind, bool enforce_nrr_kind) { @@ -189,7 +189,7 @@ namespace ams::ro::impl { } } - return ResultSuccess(); + R_SUCCEED(); } } @@ -246,13 +246,13 @@ namespace ams::ro::impl { *out_header = nrr_header; *out_mapped_code_address = code_address; - return ResultSuccess(); + R_SUCCEED(); } Result UnmapNrr(os::NativeHandle process_handle, const NrrHeader *header, u64 nrr_heap_address, u64 nrr_heap_size, u64 mapped_code_address) { R_TRY(svc::UnmapProcessMemory(reinterpret_cast(header), process_handle, mapped_code_address, nrr_heap_size)); R_TRY(svc::UnmapProcessCodeMemory(process_handle, mapped_code_address, nrr_heap_address, nrr_heap_size)); - return ResultSuccess(); + R_SUCCEED(); } bool ValidateNrrHashTableEntry(const void *signed_area, size_t signed_area_size, size_t hashes_offset, size_t num_hashes, const void *nrr_hash, const u8 *hash_table, const void *desired_hash) { diff --git a/stratosphere/ro/source/impl/ro_service_impl.cpp b/stratosphere/ro/source/impl/ro_service_impl.cpp index 36cf7a1bf..85c21f593 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.cpp +++ b/stratosphere/ro/source/impl/ro_service_impl.cpp @@ -148,10 +148,10 @@ namespace ams::ro::impl { if (out != nullptr) { *out = m_nrr_infos + i; } - return ResultSuccess(); + R_SUCCEED(); } } - return ro::ResultNotRegistered(); + R_THROW(ro::ResultNotRegistered()); } Result GetFreeNrrInfo(NrrInfo **out) { @@ -160,10 +160,10 @@ namespace ams::ro::impl { if (out != nullptr) { *out = m_nrr_infos + i; } - return ResultSuccess(); + R_SUCCEED(); } } - return ro::ResultTooManyNrr(); + R_THROW(ro::ResultTooManyNrr()); } Result GetNroInfoByAddress(NroInfo **out, u64 nro_address) { @@ -172,10 +172,10 @@ namespace ams::ro::impl { if (out != nullptr) { *out = m_nro_infos + i; } - return ResultSuccess(); + R_SUCCEED(); } } - return ro::ResultNotLoaded(); + R_THROW(ro::ResultNotLoaded()); } Result GetNroInfoByModuleId(NroInfo **out, const ModuleId *module_id) { @@ -184,10 +184,10 @@ namespace ams::ro::impl { if (out != nullptr) { *out = m_nro_infos + i; } - return ResultSuccess(); + R_SUCCEED(); } } - return ro::ResultNotLoaded(); + R_THROW(ro::ResultNotLoaded()); } Result GetFreeNroInfo(NroInfo **out) { @@ -196,10 +196,10 @@ namespace ams::ro::impl { if (out != nullptr) { *out = m_nro_infos + i; } - return ResultSuccess(); + R_SUCCEED(); } } - return ro::ResultTooManyNro(); + R_THROW(ro::ResultTooManyNro()); } Result ValidateHasNroHash(const NroHeader *nro_header) const { @@ -241,10 +241,10 @@ namespace ams::ro::impl { } /* The hash is valid! */ - return ResultSuccess(); + R_SUCCEED(); } - return ro::ResultNotAuthorized(); + R_THROW(ro::ResultNotAuthorized()); } Result ValidateNro(ModuleId *out_module_id, u64 *out_rx_size, u64 *out_ro_size, u64 *out_rw_size, u64 base_address, u64 expected_nro_size, u64 expected_bss_size) { @@ -305,7 +305,7 @@ namespace ams::ro::impl { *out_rx_size = text_size; *out_ro_size = ro_size; *out_rw_size = rw_size; - return ResultSuccess(); + R_SUCCEED(); } void SetNrrInfoInUse(const NrrInfo *info, bool in_use) { @@ -391,14 +391,14 @@ namespace ams::ro::impl { R_UNLESS(size != 0, ro::ResultInvalidSize()); R_UNLESS(util::IsAligned(size, os::MemoryPageSize), ro::ResultInvalidSize()); R_UNLESS(address < address + size, ro::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } constexpr inline Result ValidateAddressAndSize(u64 address, u64 size) { R_UNLESS(util::IsAligned(address, os::MemoryPageSize), ro::ResultInvalidAddress()); R_UNLESS(util::IsAligned(size, os::MemoryPageSize), ro::ResultInvalidSize()); R_UNLESS(size == 0 || address < address + size, ro::ResultInvalidSize()); - return ResultSuccess(); + R_SUCCEED(); } } @@ -451,14 +451,14 @@ namespace ams::ro::impl { *out_context_id = AllocateContext(process_handle.GetOsHandle(), process_id); process_handle.Detach(); - return ResultSuccess(); + R_SUCCEED(); } Result ValidateProcess(size_t context_id, os::ProcessId process_id) { const ProcessContext *ctx = GetContextById(context_id); R_UNLESS(ctx != nullptr, ro::ResultInvalidProcess()); R_UNLESS(ctx->GetProcessId() == process_id, ro::ResultInvalidProcess()); - return ResultSuccess(); + R_SUCCEED(); } void UnregisterProcess(size_t context_id) { @@ -504,7 +504,7 @@ namespace ams::ro::impl { std::memcpy(nrr_info->cached_signed_area, header->GetSignedArea(), std::min(sizeof(nrr_info->cached_signed_area), header->GetHashesOffset() - header->GetSignedAreaOffset())); std::memcpy(std::addressof(nrr_info->signed_area_hash), std::addressof(signed_area_hash), sizeof(signed_area_hash)); - return ResultSuccess(); + R_SUCCEED(); } Result UnregisterModuleInfo(size_t context_id, u64 nrr_address) { @@ -603,7 +603,7 @@ namespace ams::ro::impl { context->GetProcessModuleInfo(out_count, out_infos, max_out_count); } - return ResultSuccess(); + R_SUCCEED(); } } diff --git a/stratosphere/spl/source/spl_crypto_service.hpp b/stratosphere/spl/source/spl_crypto_service.hpp index b7839261c..e38b0aec0 100644 --- a/stratosphere/spl/source/spl_crypto_service.hpp +++ b/stratosphere/spl/source/spl_crypto_service.hpp @@ -63,7 +63,7 @@ namespace ams::spl { Result GetAesKeySlotAvailableEvent(sf::OutCopyHandle out_hnd) { out_hnd.SetValue(m_manager.GetAesKeySlotAvailableEvent()->GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } }; static_assert(spl::impl::IsICryptoInterface); diff --git a/stratosphere/spl/source/spl_deprecated_service.hpp b/stratosphere/spl/source/spl_deprecated_service.hpp index 721838d65..099e8f7de 100644 --- a/stratosphere/spl/source/spl_deprecated_service.hpp +++ b/stratosphere/spl/source/spl_deprecated_service.hpp @@ -129,7 +129,7 @@ namespace ams::spl { Result GetAesKeySlotAvailableEvent(sf::OutCopyHandle out_hnd) { out_hnd.SetValue(m_manager.GetAesKeySlotAvailableEvent()->GetReadableHandle(), false); - return ResultSuccess(); + R_SUCCEED(); } Result SetBootReason(BootReasonValue boot_reason) { diff --git a/stratosphere/spl/source/spl_secure_monitor_manager.cpp b/stratosphere/spl/source/spl_secure_monitor_manager.cpp index daeb0808e..2e0e1779b 100644 --- a/stratosphere/spl/source/spl_secure_monitor_manager.cpp +++ b/stratosphere/spl/source/spl_secure_monitor_manager.cpp @@ -145,7 +145,7 @@ namespace ams::spl { m_aes_keyslot_owners[index] = owner; *out_keyslot = keyslot; - return ResultSuccess(); + R_SUCCEED(); } Result SecureMonitorManager::DeallocateAesKeySlot(s32 keyslot, const void *owner) { @@ -190,7 +190,7 @@ namespace ams::spl { if (out_index != nullptr) { *out_index = index; } - return ResultSuccess(); + R_SUCCEED(); }