early-access version 1660
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/service/time/standard_local_system_clock_core.h"
|
||||
#include "core/hle/service/time/standard_network_system_clock_core.h"
|
||||
#include "core/hle/service/time/standard_user_system_clock_core.h"
|
||||
@@ -17,10 +16,10 @@ StandardUserSystemClockCore::StandardUserSystemClockCore(
|
||||
: SystemClockCore(local_system_clock_core.GetSteadyClockCore()),
|
||||
local_system_clock_core{local_system_clock_core},
|
||||
network_system_clock_core{network_system_clock_core}, auto_correction_enabled{},
|
||||
auto_correction_time{SteadyClockTimePoint::GetRandom()},
|
||||
auto_correction_event{Kernel::KEvent::Create(
|
||||
system.Kernel(), "StandardUserSystemClockCore:AutoCorrectionEvent")} {
|
||||
auto_correction_event->Initialize();
|
||||
auto_correction_time{SteadyClockTimePoint::GetRandom()}, auto_correction_event{
|
||||
system.Kernel()} {
|
||||
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
|
||||
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::System& system,
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/service/time/clock_types.h"
|
||||
#include "core/hle/service/time/system_clock_core.h"
|
||||
|
||||
@@ -54,7 +55,7 @@ private:
|
||||
StandardNetworkSystemClockCore& network_system_clock_core;
|
||||
bool auto_correction_enabled{};
|
||||
SteadyClockTimePoint auto_correction_time;
|
||||
std::shared_ptr<Kernel::KEvent> auto_correction_event;
|
||||
Kernel::KEvent auto_correction_event;
|
||||
};
|
||||
|
||||
} // namespace Service::Time::Clock
|
||||
|
@@ -8,8 +8,7 @@
|
||||
#include "core/core_timing_util.h"
|
||||
#include "core/hardware_properties.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/client_session.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/service/time/interface.h"
|
||||
@@ -393,7 +392,7 @@ void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& c
|
||||
LOG_DEBUG(Service_Time, "called");
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem()));
|
||||
rb.PushCopyObjects(&system.Kernel().GetTimeSharedMem());
|
||||
}
|
||||
|
||||
Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
|
||||
|
@@ -16,16 +16,11 @@ namespace Service::Time {
|
||||
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
|
||||
|
||||
SharedMemory::SharedMemory(Core::System& system) : system(system) {
|
||||
shared_memory_holder = SharedFrom(&system.Kernel().GetTimeSharedMem());
|
||||
std::memset(shared_memory_holder->GetPointer(), 0, SHARED_MEMORY_SIZE);
|
||||
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
|
||||
}
|
||||
|
||||
SharedMemory::~SharedMemory() = default;
|
||||
|
||||
std::shared_ptr<Kernel::KSharedMemory> SharedMemory::GetSharedMemoryHolder() const {
|
||||
return shared_memory_holder;
|
||||
}
|
||||
|
||||
void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
||||
Clock::TimeSpanType current_time_point) {
|
||||
const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
|
||||
@@ -34,22 +29,22 @@ void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
|
||||
static_cast<u64>(current_time_point.nanoseconds - ticks_time_span.nanoseconds),
|
||||
clock_source_id};
|
||||
shared_memory_format.standard_steady_clock_timepoint.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) {
|
||||
shared_memory_format.standard_local_system_clock_context.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context) {
|
||||
shared_memory_format.standard_network_system_clock_context.StoreData(
|
||||
shared_memory_holder->GetPointer(), context);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), context);
|
||||
}
|
||||
|
||||
void SharedMemory::SetAutomaticCorrectionEnabled(bool is_enabled) {
|
||||
shared_memory_format.standard_user_system_clock_automatic_correction.StoreData(
|
||||
shared_memory_holder->GetPointer(), is_enabled);
|
||||
system.Kernel().GetTimeSharedMem().GetPointer(), is_enabled);
|
||||
}
|
||||
|
||||
} // namespace Service::Time
|
||||
|
@@ -17,9 +17,6 @@ public:
|
||||
explicit SharedMemory(Core::System& system);
|
||||
~SharedMemory();
|
||||
|
||||
// Return the shared memory handle
|
||||
std::shared_ptr<Kernel::KSharedMemory> GetSharedMemoryHolder() const;
|
||||
|
||||
// TODO(ogniK): We have to properly simulate memory barriers, how are we going to do this?
|
||||
template <typename T, std::size_t Offset>
|
||||
struct MemoryBarrier {
|
||||
@@ -63,7 +60,6 @@ public:
|
||||
void SetAutomaticCorrectionEnabled(bool is_enabled);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Kernel::KSharedMemory> shared_memory_holder;
|
||||
Core::System& system;
|
||||
Format shared_memory_format{};
|
||||
};
|
||||
|
Reference in New Issue
Block a user