mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:35:12 +01:00
Use semantic wrapping where appropriate for class initialiser lists
This commit is contained in:
parent
6b33268d85
commit
ef10d3d394
@ -4,7 +4,10 @@
|
||||
#include "track.h"
|
||||
|
||||
namespace skyline::audio {
|
||||
AudioTrack::AudioTrack(u8 channelCount, u32 sampleRate, std::function<void()> releaseCallback) : channelCount(channelCount), sampleRate(sampleRate), releaseCallback(std::move(releaseCallback)) {
|
||||
AudioTrack::AudioTrack(u8 channelCount, u32 sampleRate, std::function<void()> releaseCallback)
|
||||
: channelCount(channelCount),
|
||||
sampleRate(sampleRate),
|
||||
releaseCallback(std::move(releaseCallback)) {
|
||||
if (sampleRate != constant::SampleRate)
|
||||
throw exception("Unsupported audio sample rate: {}", sampleRate);
|
||||
|
||||
|
@ -11,7 +11,9 @@
|
||||
#include "kernel/types/KProcess.h"
|
||||
|
||||
namespace skyline {
|
||||
Logger::Logger(const std::string &path, LogLevel configLevel) : configLevel(configLevel), start(util::GetTimeNs() / constant::NsInMillisecond) {
|
||||
Logger::Logger(const std::string &path, LogLevel configLevel)
|
||||
: configLevel(configLevel),
|
||||
start(util::GetTimeNs() / constant::NsInMillisecond) {
|
||||
logFile.open(path, std::ios::trunc);
|
||||
UpdateTag();
|
||||
Write(LogLevel::Info, "Logging started");
|
||||
|
@ -5,7 +5,11 @@
|
||||
#include "command_scheduler.h"
|
||||
|
||||
namespace skyline::gpu {
|
||||
CommandScheduler::CommandBufferSlot::CommandBufferSlot(vk::raii::Device &device, vk::CommandBuffer commandBuffer, vk::raii::CommandPool &pool) : device(device), commandBuffer(device, commandBuffer, pool), fence(device, vk::FenceCreateInfo{}), cycle(std::make_shared<FenceCycle>(device, *fence)) {}
|
||||
CommandScheduler::CommandBufferSlot::CommandBufferSlot(vk::raii::Device &device, vk::CommandBuffer commandBuffer, vk::raii::CommandPool &pool)
|
||||
: device(device),
|
||||
commandBuffer(device, commandBuffer, pool),
|
||||
fence(device, vk::FenceCreateInfo{}),
|
||||
cycle(std::make_shared<FenceCycle>(device, *fence)) {}
|
||||
|
||||
bool CommandScheduler::CommandBufferSlot::AllocateIfFree(CommandScheduler::CommandBufferSlot &slot) {
|
||||
if (!slot.active.test_and_set(std::memory_order_acq_rel)) {
|
||||
|
@ -16,11 +16,18 @@ namespace skyline::gpu::memory {
|
||||
VmaAllocation vmaAllocation;
|
||||
vk::Buffer vkBuffer;
|
||||
|
||||
constexpr StagingBuffer(u8 *pointer, size_t size, VmaAllocator vmaAllocator, vk::Buffer vkBuffer, VmaAllocation vmaAllocation) : vmaAllocator(vmaAllocator), vkBuffer(vkBuffer), vmaAllocation(vmaAllocation), span(pointer, size) {}
|
||||
constexpr StagingBuffer(u8 *pointer, size_t size, VmaAllocator vmaAllocator, vk::Buffer vkBuffer, VmaAllocation vmaAllocation)
|
||||
: vmaAllocator(vmaAllocator),
|
||||
vkBuffer(vkBuffer),
|
||||
vmaAllocation(vmaAllocation),
|
||||
span(pointer, size) {}
|
||||
|
||||
StagingBuffer(const StagingBuffer &) = delete;
|
||||
|
||||
constexpr StagingBuffer(StagingBuffer &&other) : vmaAllocator(std::exchange(other.vmaAllocator, nullptr)), vmaAllocation(std::exchange(other.vmaAllocation, nullptr)), vkBuffer(std::exchange(other.vkBuffer, {})) {}
|
||||
constexpr StagingBuffer(StagingBuffer &&other)
|
||||
: vmaAllocator(std::exchange(other.vmaAllocator, nullptr)),
|
||||
vmaAllocation(std::exchange(other.vmaAllocation, nullptr)),
|
||||
vkBuffer(std::exchange(other.vkBuffer, {})) {}
|
||||
|
||||
StagingBuffer &operator=(const StagingBuffer &) = delete;
|
||||
|
||||
@ -42,13 +49,24 @@ namespace skyline::gpu::memory {
|
||||
VmaAllocation vmaAllocation;
|
||||
vk::Image vkImage;
|
||||
|
||||
constexpr Image(VmaAllocator vmaAllocator, vk::Image vkImage, VmaAllocation vmaAllocation) : vmaAllocator(vmaAllocator), vkImage(vkImage), vmaAllocation(vmaAllocation) {}
|
||||
constexpr Image(VmaAllocator vmaAllocator, vk::Image vkImage, VmaAllocation vmaAllocation)
|
||||
: vmaAllocator(vmaAllocator),
|
||||
vkImage(vkImage),
|
||||
vmaAllocation(vmaAllocation) {}
|
||||
|
||||
constexpr Image(u8 *pointer, VmaAllocator vmaAllocator, vk::Image vkImage, VmaAllocation vmaAllocation) : pointer(pointer), vmaAllocator(vmaAllocator), vkImage(vkImage), vmaAllocation(vmaAllocation) {}
|
||||
constexpr Image(u8 *pointer, VmaAllocator vmaAllocator, vk::Image vkImage, VmaAllocation vmaAllocation)
|
||||
: pointer(pointer),
|
||||
vmaAllocator(vmaAllocator),
|
||||
vkImage(vkImage),
|
||||
vmaAllocation(vmaAllocation) {}
|
||||
|
||||
Image(const Image &) = delete;
|
||||
|
||||
constexpr Image(Image &&other) : pointer(std::exchange(other.pointer, nullptr)), vmaAllocator(std::exchange(other.vmaAllocator, nullptr)), vmaAllocation(std::exchange(other.vmaAllocation, nullptr)), vkImage(std::exchange(other.vkImage, {})) {}
|
||||
constexpr Image(Image &&other)
|
||||
: pointer(std::exchange(other.pointer, nullptr)),
|
||||
vmaAllocator(std::exchange(other.vmaAllocator, nullptr)),
|
||||
vmaAllocation(std::exchange(other.vmaAllocation, nullptr)),
|
||||
vkImage(std::exchange(other.vkImage, {})) {}
|
||||
|
||||
Image &operator=(const Image &) = delete;
|
||||
|
||||
|
@ -20,7 +20,13 @@ extern jfloat AverageFrametimeDeviationMs;
|
||||
namespace skyline::gpu {
|
||||
using namespace service::hosbinder;
|
||||
|
||||
PresentationEngine::PresentationEngine(const DeviceState &state, GPU &gpu) : state(state), gpu(gpu), acquireFence(gpu.vkDevice, vk::FenceCreateInfo{}), presentationTrack(static_cast<u64>(trace::TrackIds::Presentation), perfetto::ProcessTrack::Current()), choreographerThread(&PresentationEngine::ChoreographerThread, this), vsyncEvent(std::make_shared<kernel::type::KEvent>(state, true)) {
|
||||
PresentationEngine::PresentationEngine(const DeviceState &state, GPU &gpu)
|
||||
: state(state),
|
||||
gpu(gpu),
|
||||
acquireFence(gpu.vkDevice, vk::FenceCreateInfo{}),
|
||||
presentationTrack(static_cast<u64>(trace::TrackIds::Presentation), perfetto::ProcessTrack::Current()),
|
||||
choreographerThread(&PresentationEngine::ChoreographerThread, this),
|
||||
vsyncEvent(std::make_shared<kernel::type::KEvent>(state, true)) {
|
||||
auto desc{presentationTrack.Serialize()};
|
||||
desc.set_name("Presentation");
|
||||
perfetto::TrackEvent::SetTrackDescriptor(presentationTrack, desc);
|
||||
|
@ -20,7 +20,10 @@ namespace skyline::gpu {
|
||||
GuestTexture::Mappings::iterator iterator; //!< An iterator to the mapping in the texture's GuestTexture corresponding to this mapping
|
||||
|
||||
template<typename... Args>
|
||||
TextureMapping(std::shared_ptr<Texture> texture, GuestTexture::Mappings::iterator iterator, Args &&... args) : span<u8>(std::forward<Args>(args)...), texture(std::move(texture)), iterator(iterator) {}
|
||||
TextureMapping(std::shared_ptr<Texture> texture, GuestTexture::Mappings::iterator iterator, Args &&... args)
|
||||
: span<u8>(std::forward<Args>(args)...),
|
||||
texture(std::move(texture)),
|
||||
iterator(iterator) {}
|
||||
};
|
||||
|
||||
GPU &gpu;
|
||||
|
@ -24,6 +24,11 @@ namespace skyline::input {
|
||||
NpadManager npad;
|
||||
TouchManager touch;
|
||||
|
||||
Input(const DeviceState &state) : state(state), kHid(std::make_shared<kernel::type::KSharedMemory>(state, sizeof(HidSharedMemory))), hid(reinterpret_cast<HidSharedMemory *>(kHid->host.ptr)), npad(state, hid), touch(state, hid) {}
|
||||
Input(const DeviceState &state)
|
||||
: state(state),
|
||||
kHid(std::make_shared<kernel::type::KSharedMemory>(state, sizeof(HidSharedMemory))),
|
||||
hid(reinterpret_cast<HidSharedMemory *>(kHid->host.ptr)),
|
||||
npad(state, hid),
|
||||
touch(state, hid) {}
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,11 @@
|
||||
#include "npad.h"
|
||||
|
||||
namespace skyline::input {
|
||||
NpadDevice::NpadDevice(NpadManager &manager, NpadSection §ion, NpadId id) : manager(manager), section(section), id(id), updateEvent(std::make_shared<kernel::type::KEvent>(manager.state, false)) {}
|
||||
NpadDevice::NpadDevice(NpadManager &manager, NpadSection §ion, NpadId id)
|
||||
: manager(manager),
|
||||
section(section),
|
||||
id(id),
|
||||
updateEvent(std::make_shared<kernel::type::KEvent>(manager.state, false)) {}
|
||||
|
||||
void NpadDevice::Connect(NpadControllerType newType) {
|
||||
if (type == newType) {
|
||||
|
@ -53,7 +53,13 @@ namespace skyline {
|
||||
|
||||
thread_local inline JniEnvironment env;
|
||||
|
||||
JvmManager::JvmManager(JNIEnv *environ, jobject instance) : instance(environ->NewGlobalRef(instance)), instanceClass(reinterpret_cast<jclass>(environ->NewGlobalRef(environ->GetObjectClass(instance)))), initializeControllersId(environ->GetMethodID(instanceClass, "initializeControllers", "()V")), vibrateDeviceId(environ->GetMethodID(instanceClass, "vibrateDevice", "(I[J[I)V")), clearVibrationDeviceId(environ->GetMethodID(instanceClass, "clearVibrationDevice", "(I)V")), getVersionCodeId(environ->GetMethodID(instanceClass, "getVersionCode", "()I")) {
|
||||
JvmManager::JvmManager(JNIEnv *environ, jobject instance)
|
||||
: instance(environ->NewGlobalRef(instance)),
|
||||
instanceClass(reinterpret_cast<jclass>(environ->NewGlobalRef(environ->GetObjectClass(instance)))),
|
||||
initializeControllersId(environ->GetMethodID(instanceClass, "initializeControllers", "()V")),
|
||||
vibrateDeviceId(environ->GetMethodID(instanceClass, "vibrateDevice", "(I[J[I)V")),
|
||||
clearVibrationDeviceId(environ->GetMethodID(instanceClass, "clearVibrationDevice", "(I)V")),
|
||||
getVersionCodeId(environ->GetMethodID(instanceClass, "getVersionCode", "()I")) {
|
||||
env.Initialize(environ);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,12 @@
|
||||
#include "KProcess.h"
|
||||
|
||||
namespace skyline::kernel::type {
|
||||
KPrivateMemory::KPrivateMemory(const DeviceState &state, u8 *ptr, size_t size, memory::Permission permission, memory::MemoryState memState) : ptr(ptr), size(size), permission(permission), memoryState(memState), KMemory(state, KType::KPrivateMemory) {
|
||||
KPrivateMemory::KPrivateMemory(const DeviceState &state, u8 *ptr, size_t size, memory::Permission permission, memory::MemoryState memState)
|
||||
: ptr(ptr),
|
||||
size(size),
|
||||
permission(permission),
|
||||
memoryState(memState),
|
||||
KMemory(state, KType::KPrivateMemory) {
|
||||
if (!state.process->memory.base.IsInside(ptr) || !state.process->memory.base.IsInside(ptr + size))
|
||||
throw exception("KPrivateMemory allocation isn't inside guest address space: 0x{:X} - 0x{:X}", ptr, ptr + size);
|
||||
if (!util::IsPageAligned(ptr) || !util::IsPageAligned(size))
|
||||
|
@ -8,7 +8,9 @@
|
||||
#include "KProcess.h"
|
||||
|
||||
namespace skyline::kernel::type {
|
||||
KSharedMemory::KSharedMemory(const DeviceState &state, size_t size, memory::MemoryState memState, KType type) : memoryState(memState), KMemory(state, type) {
|
||||
KSharedMemory::KSharedMemory(const DeviceState &state, size_t size, memory::MemoryState memState, KType type)
|
||||
: memoryState(memState),
|
||||
KMemory(state, type) {
|
||||
fd = ASharedMemory_create("KSharedMemory", size);
|
||||
if (fd < 0)
|
||||
throw exception("An error occurred while creating shared memory: {}", fd);
|
||||
|
@ -11,7 +11,18 @@
|
||||
#include "KThread.h"
|
||||
|
||||
namespace skyline::kernel::type {
|
||||
KThread::KThread(const DeviceState &state, KHandle handle, KProcess *parent, size_t id, void *entry, u64 argument, void *stackTop, i8 priority, u8 idealCore) : handle(handle), parent(parent), id(id), entry(entry), entryArgument(argument), stackTop(stackTop), priority(priority), basePriority(priority), idealCore(idealCore), coreId(idealCore), KSyncObject(state, KType::KThread) {
|
||||
KThread::KThread(const DeviceState &state, KHandle handle, KProcess *parent, size_t id, void *entry, u64 argument, void *stackTop, i8 priority, u8 idealCore)
|
||||
: handle(handle),
|
||||
parent(parent),
|
||||
id(id),
|
||||
entry(entry),
|
||||
entryArgument(argument),
|
||||
stackTop(stackTop),
|
||||
priority(priority),
|
||||
basePriority(priority),
|
||||
idealCore(idealCore),
|
||||
coreId(idealCore),
|
||||
KSyncObject(state, KType::KThread) {
|
||||
affinityMask.set(coreId);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,8 @@ namespace skyline::kernel::type {
|
||||
/**
|
||||
* @note 'ptr' needs to be in guest-reserved address space
|
||||
*/
|
||||
KTransferMemory(const DeviceState &state, u8 *ptr, size_t size, memory::Permission permission, memory::MemoryState memState = memory::states::TransferMemory) : KSharedMemory(state, size, memState, KType::KTransferMemory) {
|
||||
KTransferMemory(const DeviceState &state, u8 *ptr, size_t size, memory::Permission permission, memory::MemoryState memState = memory::states::TransferMemory)
|
||||
: KSharedMemory(state, size, memState, KType::KTransferMemory) {
|
||||
std::memcpy(host.ptr, ptr, size);
|
||||
Map(ptr, size, permission);
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ namespace skyline::kernel {
|
||||
std::string appFilesPath,
|
||||
std::string deviceTimeZone,
|
||||
language::SystemLanguage systemLanguage,
|
||||
std::shared_ptr<vfs::FileSystem> assetFileSystem
|
||||
) : state(this, jvmManager, settings, logger),
|
||||
appFilesPath(std::move(appFilesPath)),
|
||||
deviceTimeZone(std::move(deviceTimeZone)),
|
||||
assetFileSystem(std::move(assetFileSystem)),
|
||||
serviceManager(state),
|
||||
systemLanguage(systemLanguage) {}
|
||||
std::shared_ptr<vfs::FileSystem> assetFileSystem)
|
||||
: state(this, jvmManager, settings, logger),
|
||||
appFilesPath(std::move(appFilesPath)),
|
||||
deviceTimeZone(std::move(deviceTimeZone)),
|
||||
assetFileSystem(std::move(assetFileSystem)),
|
||||
serviceManager(state),
|
||||
systemLanguage(systemLanguage) {}
|
||||
|
||||
void OS::Execute(int romFd, loader::RomFormat romType) {
|
||||
auto romFile{std::make_shared<vfs::OsBacking>(romFd)};
|
||||
|
@ -7,7 +7,11 @@
|
||||
#include "ISelfController.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state, false)), accumulatedSuspendedTickChangedEvent(std::make_shared<type::KEvent>(state, false)), hosbinder(manager.CreateOrGetService<hosbinder::IHOSBinderDriver>("dispdrv")), BaseService(state, manager) {}
|
||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager)
|
||||
: libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
accumulatedSuspendedTickChangedEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
hosbinder(manager.CreateOrGetService<hosbinder::IHOSBinderDriver>("dispdrv")),
|
||||
BaseService(state, manager) {}
|
||||
|
||||
Result ISelfController::Exit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
throw nce::NCE::ExitException(true);
|
||||
|
@ -5,7 +5,11 @@
|
||||
#include "IAudioOut.h"
|
||||
|
||||
namespace skyline::service::audio {
|
||||
IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate) : sampleRate(sampleRate), channelCount(channelCount), releaseEvent(std::make_shared<type::KEvent>(state, false)), BaseService(state, manager) {
|
||||
IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate)
|
||||
: sampleRate(sampleRate),
|
||||
channelCount(channelCount),
|
||||
releaseEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
BaseService(state, manager) {
|
||||
track = state.audio->OpenTrack(channelCount, constant::SampleRate, [this]() { releaseEvent->Signal(); });
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,9 @@
|
||||
#include "INotificationService.h"
|
||||
|
||||
namespace skyline::service::friends {
|
||||
INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared<type::KEvent>(state, false)), BaseService(state, manager) {}
|
||||
INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager)
|
||||
: notificationEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
BaseService(state, manager) {}
|
||||
|
||||
Result INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
KHandle handle{state.process->InsertItem(notificationEvent)};
|
||||
|
@ -5,7 +5,9 @@
|
||||
#include "IFile.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IFile::IFile(std::shared_ptr<vfs::Backing> backing, const DeviceState &state, ServiceManager &manager) : backing(std::move(backing)), BaseService(state, manager) {}
|
||||
IFile::IFile(std::shared_ptr<vfs::Backing> backing, const DeviceState &state, ServiceManager &manager)
|
||||
: BaseService(state, manager),
|
||||
backing(std::move(backing)) {}
|
||||
|
||||
Result IFile::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto readOption{request.Pop<u32>()};
|
||||
|
@ -7,7 +7,11 @@
|
||||
#include "IStaticService.h"
|
||||
|
||||
namespace skyline::service::glue {
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager, std::shared_ptr<timesrv::IStaticService> core, timesrv::core::TimeServiceObject ×rvCore, timesrv::StaticServicePermissions permissions) : BaseService(state, manager), core(std::move(core)), timesrvCore(timesrvCore), permissions(permissions) {}
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager, std::shared_ptr<timesrv::IStaticService> core, timesrv::core::TimeServiceObject ×rvCore, timesrv::StaticServicePermissions permissions)
|
||||
: BaseService(state, manager),
|
||||
core(std::move(core)),
|
||||
timesrvCore(timesrvCore),
|
||||
permissions(permissions) {}
|
||||
|
||||
Result IStaticService::GetStandardUserSystemClock(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return core->GetStandardUserSystemClock(session, request, response);
|
||||
|
@ -10,7 +10,12 @@
|
||||
#include "ITimeZoneService.h"
|
||||
|
||||
namespace skyline::service::glue {
|
||||
ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager, std::shared_ptr<timesrv::ITimeZoneService> core, timesrv::core::TimeServiceObject ×rvCore, bool writeable) : BaseService(state, manager), core(std::move(core)), timesrvCore(timesrvCore), locationNameUpdateEvent(std::make_shared<kernel::type::KEvent>(state, false)), writeable(writeable) {}
|
||||
ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager, std::shared_ptr<timesrv::ITimeZoneService> core, timesrv::core::TimeServiceObject ×rvCore, bool writeable)
|
||||
: BaseService(state, manager),
|
||||
core(std::move(core)),
|
||||
timesrvCore(timesrvCore),
|
||||
locationNameUpdateEvent(std::make_shared<kernel::type::KEvent>(state, false)),
|
||||
writeable(writeable) {}
|
||||
|
||||
Result ITimeZoneService::GetDeviceLocationName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return core->GetDeviceLocationName(session, request, response);
|
||||
|
@ -5,7 +5,10 @@
|
||||
#include "IRequest.h"
|
||||
|
||||
namespace skyline::service::nifm {
|
||||
IRequest::IRequest(const DeviceState &state, ServiceManager &manager) : event0(std::make_shared<type::KEvent>(state, false)), event1(std::make_shared<type::KEvent>(state, false)), BaseService(state, manager) {}
|
||||
IRequest::IRequest(const DeviceState &state, ServiceManager &manager)
|
||||
: event0(std::make_shared<type::KEvent>(state, false)),
|
||||
event1(std::make_shared<type::KEvent>(state, false)),
|
||||
BaseService(state, manager) {}
|
||||
|
||||
Result IRequest::GetRequestState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
constexpr u32 Unsubmitted{1}; //!< The request has not been submitted
|
||||
|
@ -10,7 +10,10 @@
|
||||
#include "IStaticService.h"
|
||||
|
||||
namespace skyline::service::timesrv {
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager, core::TimeServiceObject &core, StaticServicePermissions permissions) : BaseService(state, manager), core(core), permissions(permissions) {}
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager, core::TimeServiceObject &core, StaticServicePermissions permissions)
|
||||
: BaseService(state, manager),
|
||||
core(core),
|
||||
permissions(permissions) {}
|
||||
|
||||
Result IStaticService::GetStandardUserSystemClock(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(std::make_shared<ISystemClock>(state, manager, core.userSystemClock, permissions.writeUserSystemClock, permissions.ignoreUninitializedChecks), session, response);
|
||||
|
@ -5,7 +5,11 @@
|
||||
#include "ISteadyClock.h"
|
||||
|
||||
namespace skyline::service::timesrv {
|
||||
ISteadyClock::ISteadyClock(const DeviceState &state, ServiceManager &manager, core::SteadyClockCore &core, bool writeable, bool ignoreUninitializedChecks) : BaseService(state, manager), core(core), writeable(writeable), ignoreUninitializedChecks(ignoreUninitializedChecks) {}
|
||||
ISteadyClock::ISteadyClock(const DeviceState &state, ServiceManager &manager, core::SteadyClockCore &core, bool writeable, bool ignoreUninitializedChecks)
|
||||
: BaseService(state, manager),
|
||||
core(core),
|
||||
writeable(writeable),
|
||||
ignoreUninitializedChecks(ignoreUninitializedChecks) {}
|
||||
|
||||
Result ISteadyClock::GetCurrentTimePoint(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
// When a clock is uninitialized it still ticks however the offsets aren't configured
|
||||
|
@ -7,7 +7,11 @@
|
||||
#include "ISystemClock.h"
|
||||
|
||||
namespace skyline::service::timesrv {
|
||||
ISystemClock::ISystemClock(const DeviceState &state, ServiceManager &manager, core::SystemClockCore &core, bool writeClock, bool ignoreUninitializedChecks) : BaseService(state, manager), core(core), writable(writeClock), ignoreUninitializedChecks(ignoreUninitializedChecks) {}
|
||||
ISystemClock::ISystemClock(const DeviceState &state, ServiceManager &manager, core::SystemClockCore &core, bool writeClock, bool ignoreUninitializedChecks)
|
||||
: BaseService(state, manager),
|
||||
core(core),
|
||||
writable(writeClock),
|
||||
ignoreUninitializedChecks(ignoreUninitializedChecks) {}
|
||||
|
||||
Result ISystemClock::GetCurrentTime(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
if (!ignoreUninitializedChecks && !core.IsClockInitialized())
|
||||
|
@ -6,7 +6,10 @@
|
||||
#include "ITimeZoneService.h"
|
||||
|
||||
namespace skyline::service::timesrv {
|
||||
ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager, core::TimeServiceObject &core, bool writeable) : BaseService(state, manager), core(core), writeable(writeable) {}
|
||||
ITimeZoneService::ITimeZoneService(const DeviceState &state, ServiceManager &manager, core::TimeServiceObject &core, bool writeable)
|
||||
: BaseService(state, manager),
|
||||
core(core),
|
||||
writeable(writeable) {}
|
||||
|
||||
Result ITimeZoneService::GetDeviceLocationName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto locationName{core.timeZoneManager.GetLocationName()};
|
||||
|
@ -217,7 +217,15 @@ namespace skyline::service::timesrv::core {
|
||||
return localSystemClock.GetClockContext();
|
||||
}
|
||||
|
||||
TimeServiceObject::TimeServiceObject(const DeviceState &state) : timeSharedMemory(state), localSystemClockContextWriter(timeSharedMemory), networkSystemClockContextWriter(timeSharedMemory), localSystemClock(standardSteadyClock), networkSystemClock(standardSteadyClock), userSystemClock(state, standardSteadyClock, localSystemClock, networkSystemClock, timeSharedMemory), empheralSystemClock(tickBasedSteadyClock), managerServer(*this) {
|
||||
TimeServiceObject::TimeServiceObject(const DeviceState &state)
|
||||
: timeSharedMemory(state),
|
||||
localSystemClockContextWriter(timeSharedMemory),
|
||||
networkSystemClockContextWriter(timeSharedMemory),
|
||||
localSystemClock(standardSteadyClock),
|
||||
networkSystemClock(standardSteadyClock),
|
||||
userSystemClock(state, standardSteadyClock, localSystemClock, networkSystemClock, timeSharedMemory),
|
||||
empheralSystemClock(tickBasedSteadyClock),
|
||||
managerServer(*this) {
|
||||
// Setup time service:
|
||||
// A new rtc UUID is generated every time glue inits time
|
||||
auto rtcId{UUID::GenerateUuidV4()};
|
||||
|
@ -57,7 +57,9 @@ namespace skyline::service::timesrv::core {
|
||||
return out;
|
||||
}
|
||||
|
||||
TimeSharedMemory::TimeSharedMemory(const DeviceState &state) : kTimeSharedMemory(std::make_shared<kernel::type::KSharedMemory>(state, TimeSharedMemorySize)), timeSharedMemory(reinterpret_cast<TimeSharedMemoryLayout *>(kTimeSharedMemory->host.ptr)) {}
|
||||
TimeSharedMemory::TimeSharedMemory(const DeviceState &state)
|
||||
: kTimeSharedMemory(std::make_shared<kernel::type::KSharedMemory>(state, TimeSharedMemorySize)),
|
||||
timeSharedMemory(reinterpret_cast<TimeSharedMemoryLayout *>(kTimeSharedMemory->host.ptr)) {}
|
||||
|
||||
void TimeSharedMemory::SetupStandardSteadyClock(UUID rtcId, TimeSpanType baseTimePoint) {
|
||||
SteadyClockTimePoint context{
|
||||
|
Loading…
Reference in New Issue
Block a user