mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-09 23:19:26 +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"
|
#include "track.h"
|
||||||
|
|
||||||
namespace skyline::audio {
|
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)
|
if (sampleRate != constant::SampleRate)
|
||||||
throw exception("Unsupported audio sample rate: {}", sampleRate);
|
throw exception("Unsupported audio sample rate: {}", sampleRate);
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#include "kernel/types/KProcess.h"
|
#include "kernel/types/KProcess.h"
|
||||||
|
|
||||||
namespace skyline {
|
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);
|
logFile.open(path, std::ios::trunc);
|
||||||
UpdateTag();
|
UpdateTag();
|
||||||
Write(LogLevel::Info, "Logging started");
|
Write(LogLevel::Info, "Logging started");
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
#include "command_scheduler.h"
|
#include "command_scheduler.h"
|
||||||
|
|
||||||
namespace skyline::gpu {
|
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) {
|
bool CommandScheduler::CommandBufferSlot::AllocateIfFree(CommandScheduler::CommandBufferSlot &slot) {
|
||||||
if (!slot.active.test_and_set(std::memory_order_acq_rel)) {
|
if (!slot.active.test_and_set(std::memory_order_acq_rel)) {
|
||||||
|
@ -16,11 +16,18 @@ namespace skyline::gpu::memory {
|
|||||||
VmaAllocation vmaAllocation;
|
VmaAllocation vmaAllocation;
|
||||||
vk::Buffer vkBuffer;
|
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;
|
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;
|
StagingBuffer &operator=(const StagingBuffer &) = delete;
|
||||||
|
|
||||||
@ -42,13 +49,24 @@ namespace skyline::gpu::memory {
|
|||||||
VmaAllocation vmaAllocation;
|
VmaAllocation vmaAllocation;
|
||||||
vk::Image vkImage;
|
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;
|
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;
|
Image &operator=(const Image &) = delete;
|
||||||
|
|
||||||
|
@ -20,7 +20,13 @@ extern jfloat AverageFrametimeDeviationMs;
|
|||||||
namespace skyline::gpu {
|
namespace skyline::gpu {
|
||||||
using namespace service::hosbinder;
|
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()};
|
auto desc{presentationTrack.Serialize()};
|
||||||
desc.set_name("Presentation");
|
desc.set_name("Presentation");
|
||||||
perfetto::TrackEvent::SetTrackDescriptor(presentationTrack, desc);
|
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
|
GuestTexture::Mappings::iterator iterator; //!< An iterator to the mapping in the texture's GuestTexture corresponding to this mapping
|
||||||
|
|
||||||
template<typename... Args>
|
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;
|
GPU &gpu;
|
||||||
|
@ -24,6 +24,11 @@ namespace skyline::input {
|
|||||||
NpadManager npad;
|
NpadManager npad;
|
||||||
TouchManager touch;
|
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"
|
#include "npad.h"
|
||||||
|
|
||||||
namespace skyline::input {
|
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) {
|
void NpadDevice::Connect(NpadControllerType newType) {
|
||||||
if (type == newType) {
|
if (type == newType) {
|
||||||
|
@ -53,7 +53,13 @@ namespace skyline {
|
|||||||
|
|
||||||
thread_local inline JniEnvironment env;
|
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);
|
env.Initialize(environ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,12 @@
|
|||||||
#include "KProcess.h"
|
#include "KProcess.h"
|
||||||
|
|
||||||
namespace skyline::kernel::type {
|
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))
|
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);
|
throw exception("KPrivateMemory allocation isn't inside guest address space: 0x{:X} - 0x{:X}", ptr, ptr + size);
|
||||||
if (!util::IsPageAligned(ptr) || !util::IsPageAligned(size))
|
if (!util::IsPageAligned(ptr) || !util::IsPageAligned(size))
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#include "KProcess.h"
|
#include "KProcess.h"
|
||||||
|
|
||||||
namespace skyline::kernel::type {
|
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);
|
fd = ASharedMemory_create("KSharedMemory", size);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
throw exception("An error occurred while creating shared memory: {}", fd);
|
throw exception("An error occurred while creating shared memory: {}", fd);
|
||||||
|
@ -11,7 +11,18 @@
|
|||||||
#include "KThread.h"
|
#include "KThread.h"
|
||||||
|
|
||||||
namespace skyline::kernel::type {
|
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);
|
affinityMask.set(coreId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ namespace skyline::kernel::type {
|
|||||||
/**
|
/**
|
||||||
* @note 'ptr' needs to be in guest-reserved address space
|
* @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);
|
std::memcpy(host.ptr, ptr, size);
|
||||||
Map(ptr, size, permission);
|
Map(ptr, size, permission);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ namespace skyline::kernel {
|
|||||||
std::string appFilesPath,
|
std::string appFilesPath,
|
||||||
std::string deviceTimeZone,
|
std::string deviceTimeZone,
|
||||||
language::SystemLanguage systemLanguage,
|
language::SystemLanguage systemLanguage,
|
||||||
std::shared_ptr<vfs::FileSystem> assetFileSystem
|
std::shared_ptr<vfs::FileSystem> assetFileSystem)
|
||||||
) : state(this, jvmManager, settings, logger),
|
: state(this, jvmManager, settings, logger),
|
||||||
appFilesPath(std::move(appFilesPath)),
|
appFilesPath(std::move(appFilesPath)),
|
||||||
deviceTimeZone(std::move(deviceTimeZone)),
|
deviceTimeZone(std::move(deviceTimeZone)),
|
||||||
assetFileSystem(std::move(assetFileSystem)),
|
assetFileSystem(std::move(assetFileSystem)),
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
#include "ISelfController.h"
|
#include "ISelfController.h"
|
||||||
|
|
||||||
namespace skyline::service::am {
|
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) {
|
Result ISelfController::Exit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
throw nce::NCE::ExitException(true);
|
throw nce::NCE::ExitException(true);
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
#include "IAudioOut.h"
|
#include "IAudioOut.h"
|
||||||
|
|
||||||
namespace skyline::service::audio {
|
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(); });
|
track = state.audio->OpenTrack(channelCount, constant::SampleRate, [this]() { releaseEvent->Signal(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
#include "INotificationService.h"
|
#include "INotificationService.h"
|
||||||
|
|
||||||
namespace skyline::service::friends {
|
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) {
|
Result INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
KHandle handle{state.process->InsertItem(notificationEvent)};
|
KHandle handle{state.process->InsertItem(notificationEvent)};
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
#include "IFile.h"
|
#include "IFile.h"
|
||||||
|
|
||||||
namespace skyline::service::fssrv {
|
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) {
|
Result IFile::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
auto readOption{request.Pop<u32>()};
|
auto readOption{request.Pop<u32>()};
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
#include "IStaticService.h"
|
#include "IStaticService.h"
|
||||||
|
|
||||||
namespace skyline::service::glue {
|
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) {
|
Result IStaticService::GetStandardUserSystemClock(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
return core->GetStandardUserSystemClock(session, request, response);
|
return core->GetStandardUserSystemClock(session, request, response);
|
||||||
|
@ -10,7 +10,12 @@
|
|||||||
#include "ITimeZoneService.h"
|
#include "ITimeZoneService.h"
|
||||||
|
|
||||||
namespace skyline::service::glue {
|
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) {
|
Result ITimeZoneService::GetDeviceLocationName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
return core->GetDeviceLocationName(session, request, response);
|
return core->GetDeviceLocationName(session, request, response);
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
#include "IRequest.h"
|
#include "IRequest.h"
|
||||||
|
|
||||||
namespace skyline::service::nifm {
|
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) {
|
Result IRequest::GetRequestState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
constexpr u32 Unsubmitted{1}; //!< The request has not been submitted
|
constexpr u32 Unsubmitted{1}; //!< The request has not been submitted
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
#include "IStaticService.h"
|
#include "IStaticService.h"
|
||||||
|
|
||||||
namespace skyline::service::timesrv {
|
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) {
|
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);
|
manager.RegisterService(std::make_shared<ISystemClock>(state, manager, core.userSystemClock, permissions.writeUserSystemClock, permissions.ignoreUninitializedChecks), session, response);
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
#include "ISteadyClock.h"
|
#include "ISteadyClock.h"
|
||||||
|
|
||||||
namespace skyline::service::timesrv {
|
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) {
|
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
|
// When a clock is uninitialized it still ticks however the offsets aren't configured
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
#include "ISystemClock.h"
|
#include "ISystemClock.h"
|
||||||
|
|
||||||
namespace skyline::service::timesrv {
|
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) {
|
Result ISystemClock::GetCurrentTime(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
if (!ignoreUninitializedChecks && !core.IsClockInitialized())
|
if (!ignoreUninitializedChecks && !core.IsClockInitialized())
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
#include "ITimeZoneService.h"
|
#include "ITimeZoneService.h"
|
||||||
|
|
||||||
namespace skyline::service::timesrv {
|
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) {
|
Result ITimeZoneService::GetDeviceLocationName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
auto locationName{core.timeZoneManager.GetLocationName()};
|
auto locationName{core.timeZoneManager.GetLocationName()};
|
||||||
|
@ -217,7 +217,15 @@ namespace skyline::service::timesrv::core {
|
|||||||
return localSystemClock.GetClockContext();
|
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:
|
// Setup time service:
|
||||||
// A new rtc UUID is generated every time glue inits time
|
// A new rtc UUID is generated every time glue inits time
|
||||||
auto rtcId{UUID::GenerateUuidV4()};
|
auto rtcId{UUID::GenerateUuidV4()};
|
||||||
|
@ -57,7 +57,9 @@ namespace skyline::service::timesrv::core {
|
|||||||
return out;
|
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) {
|
void TimeSharedMemory::SetupStandardSteadyClock(UUID rtcId, TimeSpanType baseTimePoint) {
|
||||||
SteadyClockTimePoint context{
|
SteadyClockTimePoint context{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user