mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Merge pull request #6246 from lioncash/shadow
service: Eliminate cases of member variable shadowing
This commit is contained in:
commit
cd80471c90
15 changed files with 81 additions and 76 deletions
|
@ -158,11 +158,11 @@ void Error::Execute() {
|
||||||
break;
|
break;
|
||||||
case ErrorAppletMode::ShowSystemError:
|
case ErrorAppletMode::ShowSystemError:
|
||||||
case ErrorAppletMode::ShowApplicationError: {
|
case ErrorAppletMode::ShowApplicationError: {
|
||||||
const auto system = mode == ErrorAppletMode::ShowSystemError;
|
const auto is_system = mode == ErrorAppletMode::ShowSystemError;
|
||||||
const auto& main_text =
|
const auto& main_text =
|
||||||
system ? args->system_error.main_text : args->application_error.main_text;
|
is_system ? args->system_error.main_text : args->application_error.main_text;
|
||||||
const auto& detail_text =
|
const auto& detail_text =
|
||||||
system ? args->system_error.detail_text : args->application_error.detail_text;
|
is_system ? args->system_error.detail_text : args->application_error.detail_text;
|
||||||
|
|
||||||
const auto main_text_string =
|
const auto main_text_string =
|
||||||
Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size());
|
Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size());
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Auth::Execute() {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AuthAppletType::ShowParentalAuthentication: {
|
case AuthAppletType::ShowParentalAuthentication: {
|
||||||
const auto callback = [this](bool successful) { AuthFinished(successful); };
|
const auto callback = [this](bool is_successful) { AuthFinished(is_successful); };
|
||||||
|
|
||||||
if (arg0 == 1 && arg1 == 0 && arg2 == 1) {
|
if (arg0 == 1 && arg1 == 0 && arg2 == 1) {
|
||||||
// ShowAuthenticatorForConfiguration
|
// ShowAuthenticatorForConfiguration
|
||||||
|
|
|
@ -415,9 +415,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
|
||||||
if (Settings::values.bcat_boxcat_local) {
|
if (Settings::values.bcat_boxcat_local) {
|
||||||
LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download.");
|
LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download.");
|
||||||
} else {
|
} else {
|
||||||
Boxcat::Client client{path, title.title_id, title.build_id};
|
Client launch_client{path, title.title_id, title.build_id};
|
||||||
|
|
||||||
const auto res = client.DownloadLaunchParam();
|
const auto res = launch_client.DownloadLaunchParam();
|
||||||
if (res != DownloadResult::Success) {
|
if (res != DownloadResult::Success) {
|
||||||
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
|
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
|
||||||
|
|
||||||
|
|
|
@ -174,9 +174,9 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
|
std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
|
||||||
auto& backend{progress.at(static_cast<std::size_t>(type))};
|
auto& progress_backend{GetProgressBackend(type)};
|
||||||
return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(),
|
return std::make_shared<IDeliveryCacheProgressService>(system, progress_backend.GetEvent(),
|
||||||
backend.GetImpl());
|
progress_backend.GetImpl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
|
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -184,7 +184,7 @@ private:
|
||||||
|
|
||||||
backend.Synchronize({system.CurrentProcess()->GetTitleID(),
|
backend.Synchronize({system.CurrentProcess()->GetTitleID(),
|
||||||
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
||||||
progress.at(static_cast<std::size_t>(SyncType::Normal)));
|
GetProgressBackend(SyncType::Normal));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -201,8 +201,7 @@ private:
|
||||||
|
|
||||||
backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(),
|
backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(),
|
||||||
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
||||||
name,
|
name, GetProgressBackend(SyncType::Directory));
|
||||||
progress.at(static_cast<std::size_t>(SyncType::Directory)));
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -265,9 +264,16 @@ private:
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Backend& backend;
|
ProgressServiceBackend& GetProgressBackend(SyncType type) {
|
||||||
|
return progress.at(static_cast<size_t>(type));
|
||||||
|
}
|
||||||
|
|
||||||
std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress;
|
const ProgressServiceBackend& GetProgressBackend(SyncType type) const {
|
||||||
|
return progress.at(static_cast<size_t>(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
Backend& backend;
|
||||||
|
std::array<ProgressServiceBackend, static_cast<size_t>(SyncType::Count)> progress;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
|
@ -337,13 +337,14 @@ public:
|
||||||
const auto file_buffer = ctx.ReadBuffer();
|
const auto file_buffer = ctx.ReadBuffer();
|
||||||
const std::string name = Common::StringFromBuffer(file_buffer);
|
const std::string name = Common::StringFromBuffer(file_buffer);
|
||||||
|
|
||||||
const u64 mode = rp.Pop<u64>();
|
const u64 file_mode = rp.Pop<u64>();
|
||||||
const u32 size = rp.Pop<u32>();
|
const u32 file_size = rp.Pop<u32>();
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, mode, size);
|
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, file_mode,
|
||||||
|
file_size);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(backend.CreateFile(name, size));
|
rb.Push(backend.CreateFile(name, file_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteFile(Kernel::HLERequestContext& ctx) {
|
void DeleteFile(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -935,8 +936,8 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
|
||||||
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
LOG_DEBUG(Service_FS, "called");
|
||||||
|
|
||||||
auto romfs = fsc.OpenRomFSCurrentProcess();
|
auto current_romfs = fsc.OpenRomFSCurrentProcess();
|
||||||
if (romfs.Failed()) {
|
if (current_romfs.Failed()) {
|
||||||
// TODO (bunnei): Find the right error code to use here
|
// TODO (bunnei): Find the right error code to use here
|
||||||
LOG_CRITICAL(Service_FS, "no file system interface available!");
|
LOG_CRITICAL(Service_FS, "no file system interface available!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
@ -944,7 +945,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
|
auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap()));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -1010,10 +1011,10 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
|
LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
|
||||||
|
|
||||||
auto romfs = fsc.OpenPatchedRomFSWithProgramIndex(
|
auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex(
|
||||||
system.CurrentProcess()->GetTitleID(), program_index, FileSys::ContentRecordType::Program);
|
system.CurrentProcess()->GetTitleID(), program_index, FileSys::ContentRecordType::Program);
|
||||||
|
|
||||||
if (romfs.Failed()) {
|
if (patched_romfs.Failed()) {
|
||||||
// TODO: Find the right error code to use here
|
// TODO: Find the right error code to use here
|
||||||
LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index);
|
LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index);
|
||||||
|
|
||||||
|
@ -1022,7 +1023,7 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
|
auto storage = std::make_shared<IStorage>(system, std::move(patched_romfs.Unwrap()));
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
|
@ -72,7 +72,7 @@ NVFlinger::NVFlinger(Core::System& system) : system(system) {
|
||||||
// Schedule the screen composition events
|
// Schedule the screen composition events
|
||||||
composition_event = Core::Timing::CreateEvent(
|
composition_event = Core::Timing::CreateEvent(
|
||||||
"ScreenComposition", [this](std::uintptr_t, std::chrono::nanoseconds ns_late) {
|
"ScreenComposition", [this](std::uintptr_t, std::chrono::nanoseconds ns_late) {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
Compose();
|
Compose();
|
||||||
|
|
||||||
const auto ticks = std::chrono::nanoseconds{GetNextTicks()};
|
const auto ticks = std::chrono::nanoseconds{GetNextTicks()};
|
||||||
|
@ -112,7 +112,7 @@ void NVFlinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
|
std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
|
|
||||||
LOG_DEBUG(Service, "Opening \"{}\" display", name);
|
LOG_DEBUG(Service, "Opening \"{}\" display", name);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
|
std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
auto* const display = FindDisplay(display_id);
|
auto* const display = FindDisplay(display_id);
|
||||||
|
|
||||||
if (display == nullptr) {
|
if (display == nullptr) {
|
||||||
|
@ -147,7 +147,7 @@ std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NVFlinger::CloseLayer(u64 layer_id) {
|
void NVFlinger::CloseLayer(u64 layer_id) {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
|
|
||||||
for (auto& display : displays) {
|
for (auto& display : displays) {
|
||||||
display.CloseLayer(layer_id);
|
display.CloseLayer(layer_id);
|
||||||
|
@ -155,7 +155,7 @@ void NVFlinger::CloseLayer(u64 layer_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) const {
|
std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) const {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
const auto* const layer = FindLayer(display_id, layer_id);
|
const auto* const layer = FindLayer(display_id, layer_id);
|
||||||
|
|
||||||
if (layer == nullptr) {
|
if (layer == nullptr) {
|
||||||
|
@ -166,7 +166,7 @@ std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) co
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id) const {
|
std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id) const {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
auto* const display = FindDisplay(display_id);
|
auto* const display = FindDisplay(display_id);
|
||||||
|
|
||||||
if (display == nullptr) {
|
if (display == nullptr) {
|
||||||
|
@ -177,7 +177,7 @@ std::shared_ptr<Kernel::KReadableEvent> NVFlinger::FindVsyncEvent(u64 display_id
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferQueue* NVFlinger::FindBufferQueue(u32 id) {
|
BufferQueue* NVFlinger::FindBufferQueue(u32 id) {
|
||||||
const auto guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
const auto itr = std::find_if(buffer_queues.begin(), buffer_queues.end(),
|
const auto itr = std::find_if(buffer_queues.begin(), buffer_queues.end(),
|
||||||
[id](const auto& queue) { return queue->GetId() == id; });
|
[id](const auto& queue) { return queue->GetId() == id; });
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,12 @@ ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
|
||||||
return local_system_clock_core.GetClockContext(system, context);
|
return local_system_clock_core.GetClockContext(system, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext& context) {
|
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext&) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return ERROR_NOT_IMPLEMENTED;
|
return ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext& context) {
|
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext&) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return ERROR_NOT_IMPLEMENTED;
|
return ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ResultCode Flush(const SystemClockContext& context) override;
|
ResultCode Flush(const SystemClockContext&) override;
|
||||||
|
|
||||||
ResultCode SetClockContext(const SystemClockContext&) override;
|
ResultCode SetClockContext(const SystemClockContext&) override;
|
||||||
|
|
||||||
|
|
|
@ -45,18 +45,18 @@ ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time)
|
||||||
return Flush(clock_context);
|
return Flush(clock_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode SystemClockCore::Flush(const SystemClockContext& context) {
|
ResultCode SystemClockCore::Flush(const SystemClockContext& clock_context) {
|
||||||
if (!system_clock_context_update_callback) {
|
if (!system_clock_context_update_callback) {
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
return system_clock_context_update_callback->Update(context);
|
return system_clock_context_update_callback->Update(clock_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& context) {
|
ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& clock_context) {
|
||||||
if (const ResultCode result{SetClockContext(context)}; result != RESULT_SUCCESS) {
|
if (const ResultCode result{SetClockContext(clock_context)}; result != RESULT_SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return Flush(context);
|
return Flush(clock_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemClockCore::IsClockSetup(Core::System& system) const {
|
bool SystemClockCore::IsClockSetup(Core::System& system) const {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ResultCode Flush(const SystemClockContext& context);
|
virtual ResultCode Flush(const SystemClockContext& clock_context);
|
||||||
|
|
||||||
void SetUpdateCallbackInstance(std::shared_ptr<SystemClockContextUpdateCallback> callback) {
|
void SetUpdateCallbackInstance(std::shared_ptr<SystemClockContextUpdateCallback> callback) {
|
||||||
system_clock_context_update_callback = std::move(callback);
|
system_clock_context_update_callback = std::move(callback);
|
||||||
|
|
|
@ -129,7 +129,7 @@ struct TimeManager::Impl final {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupStandardSteadyClock(Core::System& system, Common::UUID clock_source_id,
|
void SetupStandardSteadyClock(Core::System& system_, Common::UUID clock_source_id,
|
||||||
Clock::TimeSpanType setup_value,
|
Clock::TimeSpanType setup_value,
|
||||||
Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) {
|
Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) {
|
||||||
standard_steady_clock_core.SetClockSourceId(clock_source_id);
|
standard_steady_clock_core.SetClockSourceId(clock_source_id);
|
||||||
|
@ -137,21 +137,21 @@ struct TimeManager::Impl final {
|
||||||
standard_steady_clock_core.SetInternalOffset(internal_offset);
|
standard_steady_clock_core.SetInternalOffset(internal_offset);
|
||||||
standard_steady_clock_core.MarkAsInitialized();
|
standard_steady_clock_core.MarkAsInitialized();
|
||||||
|
|
||||||
const auto current_time_point{standard_steady_clock_core.GetCurrentRawTimePoint(system)};
|
const auto current_time_point{standard_steady_clock_core.GetCurrentRawTimePoint(system_)};
|
||||||
shared_memory.SetupStandardSteadyClock(system, clock_source_id, current_time_point);
|
shared_memory.SetupStandardSteadyClock(clock_source_id, current_time_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupStandardLocalSystemClock(Core::System& system,
|
void SetupStandardLocalSystemClock(Core::System& system_,
|
||||||
Clock::SystemClockContext clock_context, s64 posix_time) {
|
Clock::SystemClockContext clock_context, s64 posix_time) {
|
||||||
standard_local_system_clock_core.SetUpdateCallbackInstance(
|
standard_local_system_clock_core.SetUpdateCallbackInstance(
|
||||||
local_system_clock_context_writer);
|
local_system_clock_context_writer);
|
||||||
|
|
||||||
const auto current_time_point{
|
const auto current_time_point{
|
||||||
standard_local_system_clock_core.GetSteadyClockCore().GetCurrentTimePoint(system)};
|
standard_local_system_clock_core.GetSteadyClockCore().GetCurrentTimePoint(system_)};
|
||||||
if (current_time_point.clock_source_id == clock_context.steady_time_point.clock_source_id) {
|
if (current_time_point.clock_source_id == clock_context.steady_time_point.clock_source_id) {
|
||||||
standard_local_system_clock_core.SetSystemClockContext(clock_context);
|
standard_local_system_clock_core.SetSystemClockContext(clock_context);
|
||||||
} else {
|
} else {
|
||||||
if (standard_local_system_clock_core.SetCurrentTime(system, posix_time) !=
|
if (standard_local_system_clock_core.SetCurrentTime(system_, posix_time) !=
|
||||||
RESULT_SUCCESS) {
|
RESULT_SUCCESS) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return;
|
return;
|
||||||
|
@ -177,10 +177,10 @@ struct TimeManager::Impl final {
|
||||||
standard_network_system_clock_core.MarkAsInitialized();
|
standard_network_system_clock_core.MarkAsInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupStandardUserSystemClock(Core::System& system, bool is_automatic_correction_enabled,
|
void SetupStandardUserSystemClock(Core::System& system_, bool is_automatic_correction_enabled,
|
||||||
Clock::SteadyClockTimePoint steady_clock_time_point) {
|
Clock::SteadyClockTimePoint steady_clock_time_point) {
|
||||||
if (standard_user_system_clock_core.SetAutomaticCorrectionEnabled(
|
if (standard_user_system_clock_core.SetAutomaticCorrectionEnabled(
|
||||||
system, is_automatic_correction_enabled) != RESULT_SUCCESS) {
|
system_, is_automatic_correction_enabled) != RESULT_SUCCESS) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -196,10 +196,10 @@ struct TimeManager::Impl final {
|
||||||
ephemeral_network_system_clock_core.MarkAsInitialized();
|
ephemeral_network_system_clock_core.MarkAsInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateLocalSystemClockTime(Core::System& system, s64 posix_time) {
|
void UpdateLocalSystemClockTime(Core::System& system_, s64 posix_time) {
|
||||||
const auto timespan{Service::Time::Clock::TimeSpanType::FromSeconds(posix_time)};
|
const auto timespan{Clock::TimeSpanType::FromSeconds(posix_time)};
|
||||||
if (GetStandardLocalSystemClockCore()
|
if (GetStandardLocalSystemClockCore()
|
||||||
.SetCurrentTime(system, timespan.ToSeconds())
|
.SetCurrentTime(system_, timespan.ToSeconds())
|
||||||
.IsError()) {
|
.IsError()) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,8 +26,7 @@ std::shared_ptr<Kernel::KSharedMemory> SharedMemory::GetSharedMemoryHolder() con
|
||||||
return shared_memory_holder;
|
return shared_memory_holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedMemory::SetupStandardSteadyClock(Core::System& system,
|
void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
||||||
const Common::UUID& clock_source_id,
|
|
||||||
Clock::TimeSpanType current_time_point) {
|
Clock::TimeSpanType current_time_point) {
|
||||||
const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
|
const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
|
||||||
system.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)};
|
system.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)};
|
||||||
|
|
|
@ -56,8 +56,8 @@ public:
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Format) == 0xd8, "Format is an invalid size");
|
static_assert(sizeof(Format) == 0xd8, "Format is an invalid size");
|
||||||
|
|
||||||
void SetupStandardSteadyClock(Core::System& system, const Common::UUID& clock_source_id,
|
void SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
||||||
Clock::TimeSpanType currentTimePoint);
|
Clock::TimeSpanType current_time_point);
|
||||||
void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context);
|
void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context);
|
||||||
void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context);
|
void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context);
|
||||||
void SetAutomaticCorrectionEnabled(bool is_enabled);
|
void SetAutomaticCorrectionEnabled(bool is_enabled);
|
||||||
|
|
|
@ -41,24 +41,22 @@ void Display::SignalVSyncEvent() {
|
||||||
vsync_event->GetWritableEvent()->Signal();
|
vsync_event->GetWritableEvent()->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue) {
|
void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) {
|
||||||
// TODO(Subv): Support more than 1 layer.
|
// TODO(Subv): Support more than 1 layer.
|
||||||
ASSERT_MSG(layers.empty(), "Only one layer is supported per display at the moment");
|
ASSERT_MSG(layers.empty(), "Only one layer is supported per display at the moment");
|
||||||
|
|
||||||
layers.emplace_back(std::make_shared<Layer>(id, buffer_queue));
|
layers.emplace_back(std::make_shared<Layer>(layer_id, buffer_queue));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::CloseLayer(u64 id) {
|
void Display::CloseLayer(u64 layer_id) {
|
||||||
layers.erase(
|
std::erase_if(layers, [layer_id](const auto& layer) { return layer->GetID() == layer_id; });
|
||||||
std::remove_if(layers.begin(), layers.end(),
|
|
||||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; }),
|
|
||||||
layers.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer* Display::FindLayer(u64 id) {
|
Layer* Display::FindLayer(u64 layer_id) {
|
||||||
const auto itr =
|
const auto itr =
|
||||||
std::find_if(layers.begin(), layers.end(),
|
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
|
||||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
|
return layer->GetID() == layer_id;
|
||||||
|
});
|
||||||
|
|
||||||
if (itr == layers.end()) {
|
if (itr == layers.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -67,10 +65,11 @@ Layer* Display::FindLayer(u64 id) {
|
||||||
return itr->get();
|
return itr->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Layer* Display::FindLayer(u64 id) const {
|
const Layer* Display::FindLayer(u64 layer_id) const {
|
||||||
const auto itr =
|
const auto itr =
|
||||||
std::find_if(layers.begin(), layers.end(),
|
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
|
||||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
|
return layer->GetID() == layer_id;
|
||||||
|
});
|
||||||
|
|
||||||
if (itr == layers.end()) {
|
if (itr == layers.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -68,34 +68,34 @@ public:
|
||||||
|
|
||||||
/// Creates and adds a layer to this display with the given ID.
|
/// Creates and adds a layer to this display with the given ID.
|
||||||
///
|
///
|
||||||
/// @param id The ID to assign to the created layer.
|
/// @param layer_id The ID to assign to the created layer.
|
||||||
/// @param buffer_queue The buffer queue for the layer instance to use.
|
/// @param buffer_queue The buffer queue for the layer instance to use.
|
||||||
///
|
///
|
||||||
void CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue);
|
void CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue);
|
||||||
|
|
||||||
/// Closes and removes a layer from this display with the given ID.
|
/// Closes and removes a layer from this display with the given ID.
|
||||||
///
|
///
|
||||||
/// @param id The ID assigned to the layer to close.
|
/// @param layer_id The ID assigned to the layer to close.
|
||||||
///
|
///
|
||||||
void CloseLayer(u64 id);
|
void CloseLayer(u64 layer_id);
|
||||||
|
|
||||||
/// Attempts to find a layer with the given ID.
|
/// Attempts to find a layer with the given ID.
|
||||||
///
|
///
|
||||||
/// @param id The layer ID.
|
/// @param layer_id The layer ID.
|
||||||
///
|
///
|
||||||
/// @returns If found, the Layer instance with the given ID.
|
/// @returns If found, the Layer instance with the given ID.
|
||||||
/// If not found, then nullptr is returned.
|
/// If not found, then nullptr is returned.
|
||||||
///
|
///
|
||||||
Layer* FindLayer(u64 id);
|
Layer* FindLayer(u64 layer_id);
|
||||||
|
|
||||||
/// Attempts to find a layer with the given ID.
|
/// Attempts to find a layer with the given ID.
|
||||||
///
|
///
|
||||||
/// @param id The layer ID.
|
/// @param layer_id The layer ID.
|
||||||
///
|
///
|
||||||
/// @returns If found, the Layer instance with the given ID.
|
/// @returns If found, the Layer instance with the given ID.
|
||||||
/// If not found, then nullptr is returned.
|
/// If not found, then nullptr is returned.
|
||||||
///
|
///
|
||||||
const Layer* FindLayer(u64 id) const;
|
const Layer* FindLayer(u64 layer_id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u64 id;
|
u64 id;
|
||||||
|
|
Loading…
Reference in a new issue