early-access version 1659

This commit is contained in:
pineappleEA
2021-05-06 03:20:08 +02:00
parent 590872e3be
commit 37b353b187
142 changed files with 1763 additions and 1991 deletions

View File

@@ -4,6 +4,7 @@
#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"
@@ -16,10 +17,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{
system.Kernel()} {
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
auto_correction_time{SteadyClockTimePoint::GetRandom()},
auto_correction_event{Kernel::KEvent::Create(
system.Kernel(), "StandardUserSystemClockCore:AutoCorrectionEvent")} {
auto_correction_event->Initialize();
}
ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::System& system,

View File

@@ -4,7 +4,6 @@
#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"
@@ -55,7 +54,7 @@ private:
StandardNetworkSystemClockCore& network_system_clock_core;
bool auto_correction_enabled{};
SteadyClockTimePoint auto_correction_time;
Kernel::KEvent auto_correction_event;
std::shared_ptr<Kernel::KEvent> auto_correction_event;
};
} // namespace Service::Time::Clock

View File

@@ -8,7 +8,8 @@
#include "core/core_timing_util.h"
#include "core/hardware_properties.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/service/time/interface.h"
@@ -392,7 +393,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(&system.Kernel().GetTimeSharedMem());
rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem()));
}
Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,

View File

@@ -16,11 +16,16 @@ namespace Service::Time {
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
SharedMemory::SharedMemory(Core::System& system) : system(system) {
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
shared_memory_holder = SharedFrom(&system.Kernel().GetTimeSharedMem());
std::memset(shared_memory_holder->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(
@@ -29,22 +34,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(
system.Kernel().GetTimeSharedMem().GetPointer(), context);
shared_memory_holder->GetPointer(), context);
}
void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) {
shared_memory_format.standard_local_system_clock_context.StoreData(
system.Kernel().GetTimeSharedMem().GetPointer(), context);
shared_memory_holder->GetPointer(), context);
}
void SharedMemory::UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context) {
shared_memory_format.standard_network_system_clock_context.StoreData(
system.Kernel().GetTimeSharedMem().GetPointer(), context);
shared_memory_holder->GetPointer(), context);
}
void SharedMemory::SetAutomaticCorrectionEnabled(bool is_enabled) {
shared_memory_format.standard_user_system_clock_automatic_correction.StoreData(
system.Kernel().GetTimeSharedMem().GetPointer(), is_enabled);
shared_memory_holder->GetPointer(), is_enabled);
}
} // namespace Service::Time

View File

@@ -17,6 +17,9 @@ 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 {
@@ -60,6 +63,7 @@ public:
void SetAutomaticCorrectionEnabled(bool is_enabled);
private:
std::shared_ptr<Kernel::KSharedMemory> shared_memory_holder;
Core::System& system;
Format shared_memory_format{};
};