Compare commits
32 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d15814d39f | ||
|
|
b5e83bcc7b | ||
|
|
fc3eb72359 | ||
|
|
eceee8e5f4 | ||
|
|
101d86897b | ||
|
|
1dbb9e353e | ||
|
|
5eb0b65590 | ||
|
|
45ac3f414e | ||
|
|
b92198b7f8 | ||
|
|
cf4893410b | ||
|
|
345bcd4cdf | ||
|
|
84786dde00 | ||
|
|
ca2d904770 | ||
|
|
3431e0acf5 | ||
|
|
a99f84f4b2 | ||
|
|
8eddafd9d0 | ||
|
|
78e233c460 | ||
|
|
789af19c60 | ||
|
|
c624edceba | ||
|
|
9eab07f863 | ||
|
|
a5bff8e9b3 | ||
|
|
92d676d788 | ||
|
|
480b03b645 | ||
|
|
5eda606952 | ||
|
|
b54cbc985e | ||
|
|
f499c8177e | ||
|
|
d8b3f665db | ||
|
|
03884b7ea6 | ||
|
|
c905044e1b | ||
|
|
bf32fcc817 | ||
|
|
f6de57c1a5 | ||
|
|
cc112f971e |
@@ -124,7 +124,10 @@ void Fiber::YieldTo(std::weak_ptr<Fiber> weak_from, Fiber& to) {
|
||||
|
||||
// "from" might no longer be valid if the thread was killed
|
||||
if (auto from = weak_from.lock()) {
|
||||
ASSERT(from->impl->previous_fiber != nullptr);
|
||||
if (from->impl->previous_fiber == nullptr) {
|
||||
ASSERT_MSG(false, "previous_fiber is nullptr!");
|
||||
return;
|
||||
}
|
||||
from->impl->previous_fiber->impl->context = transfer.fctx;
|
||||
from->impl->previous_fiber->impl->guard.unlock();
|
||||
from->impl->previous_fiber.reset();
|
||||
|
||||
@@ -209,6 +209,13 @@ enum class ButtonNames {
|
||||
Triangle,
|
||||
Share,
|
||||
Options,
|
||||
|
||||
// Mouse buttons
|
||||
ButtonMouseWheel,
|
||||
ButtonBackward,
|
||||
ButtonForward,
|
||||
ButtonTask,
|
||||
ButtonExtra,
|
||||
};
|
||||
|
||||
// Callback data consisting of an input type and the equivalent data status
|
||||
|
||||
@@ -247,6 +247,9 @@ add_library(core STATIC
|
||||
hle/kernel/k_trace.h
|
||||
hle/kernel/k_transfer_memory.cpp
|
||||
hle/kernel/k_transfer_memory.h
|
||||
hle/kernel/k_worker_task.h
|
||||
hle/kernel/k_worker_task_manager.cpp
|
||||
hle/kernel/k_worker_task_manager.h
|
||||
hle/kernel/k_writable_event.cpp
|
||||
hle/kernel/k_writable_event.h
|
||||
hle/kernel/kernel.cpp
|
||||
|
||||
@@ -158,7 +158,7 @@ void EmulatedConsole::SetMotion(const Common::Input::CallbackStatus& callback) {
|
||||
auto& motion = console.motion_state;
|
||||
motion.accel = emulated.GetAcceleration();
|
||||
motion.gyro = emulated.GetGyroscope();
|
||||
motion.rotation = emulated.GetGyroscope();
|
||||
motion.rotation = emulated.GetRotations();
|
||||
motion.orientation = emulated.GetOrientation();
|
||||
motion.quaternion = emulated.GetQuaternion();
|
||||
motion.gyro_bias = emulated.GetGyroBias();
|
||||
|
||||
@@ -145,7 +145,7 @@ void EmulatedController::LoadDevices() {
|
||||
motion_devices.begin(), Common::Input::CreateDevice<Common::Input::InputDevice>);
|
||||
std::transform(trigger_params.begin(), trigger_params.end(), trigger_devices.begin(),
|
||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
||||
std::transform(battery_params.begin(), battery_params.begin(), battery_devices.end(),
|
||||
std::transform(battery_params.begin(), battery_params.end(), battery_devices.begin(),
|
||||
Common::Input::CreateDevice<Common::Input::InputDevice>);
|
||||
std::transform(output_params.begin(), output_params.end(), output_devices.begin(),
|
||||
Common::Input::CreateDevice<Common::Input::OutputDevice>);
|
||||
|
||||
@@ -8,12 +8,16 @@
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "core/core.h"
|
||||
#include "core/device_memory.h"
|
||||
#include "core/hle/kernel/k_memory_manager.h"
|
||||
#include "core/hle/kernel/k_page_linked_list.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
KMemoryManager::KMemoryManager(Core::System& system_) : system{system_} {}
|
||||
|
||||
std::size_t KMemoryManager::Impl::Initialize(Pool new_pool, u64 start_address, u64 end_address) {
|
||||
const auto size{end_address - start_address};
|
||||
|
||||
@@ -81,7 +85,7 @@ VAddr KMemoryManager::AllocateAndOpenContinuous(std::size_t num_pages, std::size
|
||||
}
|
||||
|
||||
ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
|
||||
Direction dir) {
|
||||
Direction dir, u32 heap_fill_value) {
|
||||
ASSERT(page_list.GetNumPages() == 0);
|
||||
|
||||
// Early return if we're allocating no pages
|
||||
@@ -139,6 +143,12 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
|
||||
}
|
||||
}
|
||||
|
||||
// Clear allocated memory.
|
||||
for (const auto& it : page_list.Nodes()) {
|
||||
std::memset(system.DeviceMemory().GetPointer(it.GetAddress()), heap_fill_value,
|
||||
it.GetSize());
|
||||
}
|
||||
|
||||
// Only succeed if we allocated as many pages as we wanted
|
||||
if (num_pages) {
|
||||
return ResultOutOfMemory;
|
||||
@@ -146,11 +156,12 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
|
||||
|
||||
// We succeeded!
|
||||
group_guard.Cancel();
|
||||
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
|
||||
Direction dir) {
|
||||
Direction dir, u32 heap_fill_value) {
|
||||
// Early return if we're freeing no pages
|
||||
if (!num_pages) {
|
||||
return ResultSuccess;
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
#include "core/hle/kernel/k_page_heap.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KPageLinkedList;
|
||||
@@ -42,7 +46,7 @@ public:
|
||||
Mask = (0xF << Shift),
|
||||
};
|
||||
|
||||
KMemoryManager() = default;
|
||||
explicit KMemoryManager(Core::System& system_);
|
||||
|
||||
constexpr std::size_t GetSize(Pool pool) const {
|
||||
return managers[static_cast<std::size_t>(pool)].GetSize();
|
||||
@@ -51,10 +55,10 @@ public:
|
||||
void InitializeManager(Pool pool, u64 start_address, u64 end_address);
|
||||
|
||||
VAddr AllocateAndOpenContinuous(size_t num_pages, size_t align_pages, u32 option);
|
||||
ResultCode Allocate(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
|
||||
Direction dir = Direction::FromFront);
|
||||
ResultCode Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
|
||||
Direction dir = Direction::FromFront);
|
||||
ResultCode Allocate(KPageLinkedList& page_list, std::size_t num_pages, Pool pool, Direction dir,
|
||||
u32 heap_fill_value = 0);
|
||||
ResultCode Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool, Direction dir,
|
||||
u32 heap_fill_value = 0);
|
||||
|
||||
static constexpr std::size_t MaxManagerCount = 10;
|
||||
|
||||
@@ -129,6 +133,7 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
Core::System& system;
|
||||
std::array<std::mutex, static_cast<std::size_t>(Pool::Count)> pool_locks;
|
||||
std::array<Impl, MaxManagerCount> managers;
|
||||
};
|
||||
|
||||
@@ -289,8 +289,8 @@ ResultCode KPageTable::MapProcessCode(VAddr addr, std::size_t num_pages, KMemory
|
||||
}
|
||||
|
||||
KPageLinkedList page_linked_list;
|
||||
CASCADE_CODE(
|
||||
system.Kernel().MemoryManager().Allocate(page_linked_list, num_pages, memory_pool));
|
||||
CASCADE_CODE(system.Kernel().MemoryManager().Allocate(page_linked_list, num_pages, memory_pool,
|
||||
allocation_option));
|
||||
CASCADE_CODE(Operate(addr, num_pages, page_linked_list, OperationType::MapGroup));
|
||||
|
||||
block_manager->Update(addr, num_pages, state, perm);
|
||||
@@ -457,8 +457,8 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
|
||||
|
||||
KPageLinkedList page_linked_list;
|
||||
|
||||
CASCADE_CODE(
|
||||
system.Kernel().MemoryManager().Allocate(page_linked_list, remaining_pages, memory_pool));
|
||||
CASCADE_CODE(system.Kernel().MemoryManager().Allocate(page_linked_list, remaining_pages,
|
||||
memory_pool, allocation_option));
|
||||
|
||||
// We succeeded, so commit the memory reservation.
|
||||
memory_reservation.Commit();
|
||||
@@ -541,7 +541,8 @@ ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) {
|
||||
}
|
||||
|
||||
const std::size_t num_pages{size / PageSize};
|
||||
system.Kernel().MemoryManager().Free(page_linked_list, num_pages, memory_pool);
|
||||
system.Kernel().MemoryManager().Free(page_linked_list, num_pages, memory_pool,
|
||||
allocation_option);
|
||||
|
||||
block_manager->Update(addr, num_pages, KMemoryState::Free);
|
||||
|
||||
@@ -960,7 +961,7 @@ ResultCode KPageTable::SetHeapSize(VAddr* out, std::size_t size) {
|
||||
// Allocate pages for the heap extension.
|
||||
KPageLinkedList page_linked_list;
|
||||
R_TRY(system.Kernel().MemoryManager().Allocate(page_linked_list, allocation_size / PageSize,
|
||||
memory_pool));
|
||||
memory_pool, allocation_option));
|
||||
|
||||
// Map the pages.
|
||||
{
|
||||
@@ -1027,8 +1028,8 @@ ResultVal<VAddr> KPageTable::AllocateAndMapMemory(std::size_t needed_num_pages,
|
||||
CASCADE_CODE(Operate(addr, needed_num_pages, perm, OperationType::Map, map_addr));
|
||||
} else {
|
||||
KPageLinkedList page_group;
|
||||
CASCADE_CODE(
|
||||
system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages, memory_pool));
|
||||
CASCADE_CODE(system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages,
|
||||
memory_pool, allocation_option));
|
||||
CASCADE_CODE(Operate(addr, needed_num_pages, page_group, OperationType::MapGroup));
|
||||
}
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ private:
|
||||
bool is_aslr_enabled{};
|
||||
|
||||
KMemoryManager::Pool memory_pool{KMemoryManager::Pool::Application};
|
||||
KMemoryManager::Direction allocation_option{KMemoryManager::Direction::FromFront};
|
||||
|
||||
Common::PageTable page_table_impl;
|
||||
|
||||
|
||||
@@ -149,6 +149,10 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void KProcess::DoWorkerTaskImpl() {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
KResourceLimit* KProcess::GetResourceLimit() const {
|
||||
return resource_limit;
|
||||
}
|
||||
@@ -477,7 +481,7 @@ void KProcess::Finalize() {
|
||||
}
|
||||
|
||||
// Perform inherited finalization.
|
||||
KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize();
|
||||
KAutoObjectWithSlabHeapAndContainer<KProcess, KWorkerTask>::Finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "core/hle/kernel/k_condition_variable.h"
|
||||
#include "core/hle/kernel/k_handle_table.h"
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
#include "core/hle/kernel/k_worker_task.h"
|
||||
#include "core/hle/kernel/process_capability.h"
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/result.h"
|
||||
@@ -62,8 +63,7 @@ enum class ProcessStatus {
|
||||
DebugBreak,
|
||||
};
|
||||
|
||||
class KProcess final
|
||||
: public KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject> {
|
||||
class KProcess final : public KAutoObjectWithSlabHeapAndContainer<KProcess, KWorkerTask> {
|
||||
KERNEL_AUTOOBJECT_TRAITS(KProcess, KSynchronizationObject);
|
||||
|
||||
public:
|
||||
@@ -345,6 +345,8 @@ public:
|
||||
|
||||
bool IsSignaled() const override;
|
||||
|
||||
void DoWorkerTaskImpl();
|
||||
|
||||
void PinCurrentThread(s32 core_id);
|
||||
void UnpinCurrentThread(s32 core_id);
|
||||
void UnpinThread(KThread* thread);
|
||||
|
||||
@@ -49,8 +49,6 @@ void KScheduler::RescheduleCores(KernelCore& kernel, u64 cores_pending_reschedul
|
||||
if (!must_context_switch || core != current_core) {
|
||||
auto& phys_core = kernel.PhysicalCore(core);
|
||||
phys_core.Interrupt();
|
||||
} else {
|
||||
must_context_switch = true;
|
||||
}
|
||||
cores_pending_reschedule &= ~(1ULL << core);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "core/hle/kernel/k_system_control.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_thread_queue.h"
|
||||
#include "core/hle/kernel/k_worker_task_manager.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/kernel/time_manager.h"
|
||||
@@ -332,7 +333,7 @@ void KThread::Finalize() {
|
||||
}
|
||||
|
||||
// Perform inherited finalization.
|
||||
KAutoObjectWithSlabHeapAndContainer<KThread, KSynchronizationObject>::Finalize();
|
||||
KSynchronizationObject::Finalize();
|
||||
}
|
||||
|
||||
bool KThread::IsSignaled() const {
|
||||
@@ -376,11 +377,28 @@ void KThread::StartTermination() {
|
||||
|
||||
// Register terminated dpc flag.
|
||||
RegisterDpc(DpcFlag::Terminated);
|
||||
}
|
||||
|
||||
void KThread::FinishTermination() {
|
||||
// Ensure that the thread is not executing on any core.
|
||||
if (parent != nullptr) {
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(Core::Hardware::NUM_CPU_CORES); ++i) {
|
||||
KThread* core_thread{};
|
||||
do {
|
||||
core_thread = kernel.Scheduler(i).GetCurrentThread();
|
||||
} while (core_thread == this);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the thread.
|
||||
this->Close();
|
||||
}
|
||||
|
||||
void KThread::DoWorkerTaskImpl() {
|
||||
// Finish the termination that was begun by Exit().
|
||||
this->FinishTermination();
|
||||
}
|
||||
|
||||
void KThread::Pin(s32 current_core) {
|
||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
||||
|
||||
@@ -417,12 +435,7 @@ void KThread::Pin(s32 current_core) {
|
||||
static_cast<u32>(ThreadState::SuspendShift)));
|
||||
|
||||
// Update our state.
|
||||
const ThreadState old_state = thread_state;
|
||||
thread_state = static_cast<ThreadState>(GetSuspendFlags() |
|
||||
static_cast<u32>(old_state & ThreadState::Mask));
|
||||
if (thread_state != old_state) {
|
||||
KScheduler::OnThreadStateChanged(kernel, this, old_state);
|
||||
}
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
// TODO(bunnei): Update our SVC access permissions.
|
||||
@@ -463,20 +476,13 @@ void KThread::Unpin() {
|
||||
}
|
||||
|
||||
// Allow performing thread suspension (if termination hasn't been requested).
|
||||
{
|
||||
if (!IsTerminationRequested()) {
|
||||
// Update our allow flags.
|
||||
if (!IsTerminationRequested()) {
|
||||
suspend_allowed_flags |= (1 << (static_cast<u32>(SuspendType::Thread) +
|
||||
static_cast<u32>(ThreadState::SuspendShift)));
|
||||
}
|
||||
suspend_allowed_flags |= (1 << (static_cast<u32>(SuspendType::Thread) +
|
||||
static_cast<u32>(ThreadState::SuspendShift)));
|
||||
|
||||
// Update our state.
|
||||
const ThreadState old_state = thread_state;
|
||||
thread_state = static_cast<ThreadState>(GetSuspendFlags() |
|
||||
static_cast<u32>(old_state & ThreadState::Mask));
|
||||
if (thread_state != old_state) {
|
||||
KScheduler::OnThreadStateChanged(kernel, this, old_state);
|
||||
}
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
// TODO(bunnei): Update our SVC access permissions.
|
||||
@@ -689,12 +695,7 @@ void KThread::Resume(SuspendType type) {
|
||||
~(1u << (static_cast<u32>(ThreadState::SuspendShift) + static_cast<u32>(type)));
|
||||
|
||||
// Update our state.
|
||||
const ThreadState old_state = thread_state;
|
||||
thread_state = static_cast<ThreadState>(GetSuspendFlags() |
|
||||
static_cast<u32>(old_state & ThreadState::Mask));
|
||||
if (thread_state != old_state) {
|
||||
KScheduler::OnThreadStateChanged(kernel, this, old_state);
|
||||
}
|
||||
this->UpdateState();
|
||||
}
|
||||
|
||||
void KThread::WaitCancel() {
|
||||
@@ -721,19 +722,22 @@ void KThread::TrySuspend() {
|
||||
ASSERT(GetNumKernelWaiters() == 0);
|
||||
|
||||
// Perform the suspend.
|
||||
Suspend();
|
||||
this->UpdateState();
|
||||
}
|
||||
|
||||
void KThread::Suspend() {
|
||||
void KThread::UpdateState() {
|
||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
||||
ASSERT(IsSuspendRequested());
|
||||
|
||||
// Set our suspend flags in state.
|
||||
const auto old_state = thread_state;
|
||||
thread_state = static_cast<ThreadState>(GetSuspendFlags()) | (old_state & ThreadState::Mask);
|
||||
const auto new_state =
|
||||
static_cast<ThreadState>(this->GetSuspendFlags()) | (old_state & ThreadState::Mask);
|
||||
thread_state = new_state;
|
||||
|
||||
// Note the state change in scheduler.
|
||||
KScheduler::OnThreadStateChanged(kernel, this, old_state);
|
||||
if (new_state != old_state) {
|
||||
KScheduler::OnThreadStateChanged(kernel, this, old_state);
|
||||
}
|
||||
}
|
||||
|
||||
void KThread::Continue() {
|
||||
@@ -998,13 +1002,16 @@ ResultCode KThread::Run() {
|
||||
|
||||
// If the current thread has been asked to suspend, suspend it and retry.
|
||||
if (GetCurrentThread(kernel).IsSuspended()) {
|
||||
GetCurrentThread(kernel).Suspend();
|
||||
GetCurrentThread(kernel).UpdateState();
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we're not a kernel thread and we've been asked to suspend, suspend ourselves.
|
||||
if (IsUserThread() && IsSuspended()) {
|
||||
Suspend();
|
||||
if (KProcess* owner = this->GetOwnerProcess(); owner != nullptr) {
|
||||
if (IsUserThread() && IsSuspended()) {
|
||||
this->UpdateState();
|
||||
}
|
||||
owner->IncrementThreadCount();
|
||||
}
|
||||
|
||||
// Set our state and finish.
|
||||
@@ -1029,11 +1036,18 @@ void KThread::Exit() {
|
||||
{
|
||||
KScopedSchedulerLock sl{kernel};
|
||||
|
||||
// Disallow all suspension.
|
||||
suspend_allowed_flags = 0;
|
||||
this->UpdateState();
|
||||
|
||||
// Disallow all suspension.
|
||||
suspend_allowed_flags = 0;
|
||||
|
||||
// Start termination.
|
||||
StartTermination();
|
||||
|
||||
// Register the thread as a work task.
|
||||
KWorkerTaskManager::AddTask(kernel, KWorkerTaskManager::WorkerType::Exit, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "core/hle/kernel/k_light_lock.h"
|
||||
#include "core/hle/kernel/k_spin_lock.h"
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
#include "core/hle/kernel/k_worker_task.h"
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/kernel/svc_common.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
@@ -100,7 +101,7 @@ enum class ThreadWaitReasonForDebugging : u32 {
|
||||
[[nodiscard]] KThread& GetCurrentThread(KernelCore& kernel);
|
||||
[[nodiscard]] s32 GetCurrentCoreId(KernelCore& kernel);
|
||||
|
||||
class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KSynchronizationObject>,
|
||||
class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KWorkerTask>,
|
||||
public boost::intrusive::list_base_hook<> {
|
||||
KERNEL_AUTOOBJECT_TRAITS(KThread, KSynchronizationObject);
|
||||
|
||||
@@ -192,9 +193,9 @@ public:
|
||||
|
||||
void TrySuspend();
|
||||
|
||||
void Continue();
|
||||
void UpdateState();
|
||||
|
||||
void Suspend();
|
||||
void Continue();
|
||||
|
||||
constexpr void SetSyncedIndex(s32 index) {
|
||||
synced_index = index;
|
||||
@@ -385,6 +386,8 @@ public:
|
||||
|
||||
void OnTimer();
|
||||
|
||||
void DoWorkerTaskImpl();
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
[[nodiscard]] static ResultCode InitializeDummyThread(KThread* thread);
|
||||
@@ -679,6 +682,8 @@ private:
|
||||
|
||||
void StartTermination();
|
||||
|
||||
void FinishTermination();
|
||||
|
||||
[[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
|
||||
s32 prio, s32 virt_core, KProcess* owner, ThreadType type);
|
||||
|
||||
|
||||
18
src/core/hle/kernel/k_worker_task.h
Normal file
18
src/core/hle/kernel/k_worker_task.h
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2022 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KWorkerTask : public KSynchronizationObject {
|
||||
public:
|
||||
explicit KWorkerTask(KernelCore& kernel_);
|
||||
|
||||
void DoWorkerTask();
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
42
src/core/hle/kernel/k_worker_task_manager.cpp
Normal file
42
src/core/hle/kernel/k_worker_task_manager.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2022 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_worker_task.h"
|
||||
#include "core/hle/kernel/k_worker_task_manager.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
KWorkerTask::KWorkerTask(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
|
||||
|
||||
void KWorkerTask::DoWorkerTask() {
|
||||
if (auto* const thread = this->DynamicCast<KThread*>(); thread != nullptr) {
|
||||
return thread->DoWorkerTaskImpl();
|
||||
} else {
|
||||
auto* const process = this->DynamicCast<KProcess*>();
|
||||
ASSERT(process != nullptr);
|
||||
|
||||
return process->DoWorkerTaskImpl();
|
||||
}
|
||||
}
|
||||
|
||||
KWorkerTaskManager::KWorkerTaskManager() : m_waiting_thread(1, "yuzu:KWorkerTaskManager") {}
|
||||
|
||||
void KWorkerTaskManager::AddTask(KernelCore& kernel, WorkerType type, KWorkerTask* task) {
|
||||
ASSERT(type <= WorkerType::Count);
|
||||
kernel.WorkerTaskManager().AddTask(kernel, task);
|
||||
}
|
||||
|
||||
void KWorkerTaskManager::AddTask(KernelCore& kernel, KWorkerTask* task) {
|
||||
KScopedSchedulerLock sl(kernel);
|
||||
m_waiting_thread.QueueWork([task]() {
|
||||
// Do the task.
|
||||
task->DoWorkerTask();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
33
src/core/hle/kernel/k_worker_task_manager.h
Normal file
33
src/core/hle/kernel/k_worker_task_manager.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2022 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/thread_worker.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
class KWorkerTask;
|
||||
|
||||
class KWorkerTaskManager final {
|
||||
public:
|
||||
enum class WorkerType : u32 {
|
||||
Exit,
|
||||
Count,
|
||||
};
|
||||
|
||||
KWorkerTaskManager();
|
||||
|
||||
static void AddTask(KernelCore& kernel_, WorkerType type, KWorkerTask* task);
|
||||
|
||||
private:
|
||||
void AddTask(KernelCore& kernel, KWorkerTask* task);
|
||||
|
||||
private:
|
||||
Common::ThreadWorker m_waiting_thread;
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "core/hle/kernel/k_shared_memory.h"
|
||||
#include "core/hle/kernel/k_slab_heap.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_worker_task_manager.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/service_thread.h"
|
||||
@@ -51,7 +52,8 @@ namespace Kernel {
|
||||
|
||||
struct KernelCore::Impl {
|
||||
explicit Impl(Core::System& system_, KernelCore& kernel_)
|
||||
: time_manager{system_}, object_list_container{kernel_}, system{system_} {}
|
||||
: time_manager{system_}, object_list_container{kernel_},
|
||||
service_threads_manager{1, "yuzu:ServiceThreadsManager"}, system{system_} {}
|
||||
|
||||
void SetMulticore(bool is_multi) {
|
||||
is_multicore = is_multi;
|
||||
@@ -629,7 +631,7 @@ struct KernelCore::Impl {
|
||||
const auto application_pool = memory_layout.GetKernelApplicationPoolRegionPhysicalExtents();
|
||||
|
||||
// Initialize memory managers
|
||||
memory_manager = std::make_unique<KMemoryManager>();
|
||||
memory_manager = std::make_unique<KMemoryManager>(system);
|
||||
memory_manager->InitializeManager(KMemoryManager::Pool::Application,
|
||||
application_pool.GetAddress(),
|
||||
application_pool.GetEndAddress());
|
||||
@@ -707,24 +709,22 @@ struct KernelCore::Impl {
|
||||
std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel,
|
||||
const std::string& name) {
|
||||
auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name);
|
||||
{
|
||||
std::lock_guard lk(service_threads_lock);
|
||||
service_threads.emplace(service_thread);
|
||||
}
|
||||
|
||||
service_threads_manager.QueueWork(
|
||||
[this, service_thread]() { service_threads.emplace(service_thread); });
|
||||
|
||||
return service_thread;
|
||||
}
|
||||
|
||||
void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) {
|
||||
auto strong_ptr = service_thread.lock();
|
||||
{
|
||||
std::lock_guard lk(service_threads_lock);
|
||||
service_threads.erase(strong_ptr);
|
||||
if (auto strong_ptr = service_thread.lock()) {
|
||||
service_threads_manager.QueueWork(
|
||||
[this, strong_ptr{std::move(strong_ptr)}]() { service_threads.erase(strong_ptr); });
|
||||
}
|
||||
}
|
||||
|
||||
void ClearServiceThreads() {
|
||||
std::lock_guard lk(service_threads_lock);
|
||||
service_threads.clear();
|
||||
service_threads_manager.QueueWork([this]() { service_threads.clear(); });
|
||||
}
|
||||
|
||||
std::mutex server_ports_lock;
|
||||
@@ -732,7 +732,6 @@ struct KernelCore::Impl {
|
||||
std::mutex registered_objects_lock;
|
||||
std::mutex registered_in_use_objects_lock;
|
||||
std::mutex dummy_thread_lock;
|
||||
std::mutex service_threads_lock;
|
||||
|
||||
std::atomic<u32> next_object_id{0};
|
||||
std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin};
|
||||
@@ -783,6 +782,7 @@ struct KernelCore::Impl {
|
||||
|
||||
// Threads used for services
|
||||
std::unordered_set<std::shared_ptr<Kernel::ServiceThread>> service_threads;
|
||||
Common::ThreadWorker service_threads_manager;
|
||||
|
||||
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> suspend_threads;
|
||||
std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES> interrupts{};
|
||||
@@ -798,6 +798,8 @@ struct KernelCore::Impl {
|
||||
|
||||
std::array<u64, Core::Hardware::NUM_CPU_CORES> svc_ticks{};
|
||||
|
||||
KWorkerTaskManager worker_task_manager;
|
||||
|
||||
// System context
|
||||
Core::System& system;
|
||||
};
|
||||
@@ -1138,6 +1140,14 @@ const Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() const {
|
||||
return impl->slab_resource_counts;
|
||||
}
|
||||
|
||||
KWorkerTaskManager& KernelCore::WorkerTaskManager() {
|
||||
return impl->worker_task_manager;
|
||||
}
|
||||
|
||||
const KWorkerTaskManager& KernelCore::WorkerTaskManager() const {
|
||||
return impl->worker_task_manager;
|
||||
}
|
||||
|
||||
bool KernelCore::IsPhantomModeForSingleCore() const {
|
||||
return impl->IsPhantomModeForSingleCore();
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ class KSharedMemory;
|
||||
class KSharedMemoryInfo;
|
||||
class KThread;
|
||||
class KTransferMemory;
|
||||
class KWorkerTaskManager;
|
||||
class KWritableEvent;
|
||||
class KCodeMemory;
|
||||
class PhysicalCore;
|
||||
@@ -343,6 +344,12 @@ public:
|
||||
/// Gets the current slab resource counts.
|
||||
const Init::KSlabResourceCounts& SlabResourceCounts() const;
|
||||
|
||||
/// Gets the current worker task manager, used for dispatching KThread/KProcess tasks.
|
||||
KWorkerTaskManager& WorkerTaskManager();
|
||||
|
||||
/// Gets the current worker task manager, used for dispatching KThread/KProcess tasks.
|
||||
const KWorkerTaskManager& WorkerTaskManager() const;
|
||||
|
||||
private:
|
||||
friend class KProcess;
|
||||
friend class KThread;
|
||||
|
||||
@@ -16,6 +16,7 @@ constexpr int mouse_axis_x = 0;
|
||||
constexpr int mouse_axis_y = 1;
|
||||
constexpr int wheel_axis_x = 2;
|
||||
constexpr int wheel_axis_y = 3;
|
||||
constexpr int motion_wheel_y = 4;
|
||||
constexpr int touch_axis_x = 10;
|
||||
constexpr int touch_axis_y = 11;
|
||||
constexpr PadIdentifier identifier = {
|
||||
@@ -30,8 +31,9 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
|
||||
PreSetAxis(identifier, mouse_axis_y);
|
||||
PreSetAxis(identifier, wheel_axis_x);
|
||||
PreSetAxis(identifier, wheel_axis_y);
|
||||
PreSetAxis(identifier, motion_wheel_y);
|
||||
PreSetAxis(identifier, touch_axis_x);
|
||||
PreSetAxis(identifier, touch_axis_x);
|
||||
PreSetAxis(identifier, touch_axis_y);
|
||||
update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); });
|
||||
}
|
||||
|
||||
@@ -48,6 +50,8 @@ void Mouse::UpdateThread(std::stop_token stop_token) {
|
||||
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y * sensitivity);
|
||||
}
|
||||
|
||||
SetAxis(identifier, motion_wheel_y, 0.0f);
|
||||
|
||||
if (mouse_panning_timout++ > 20) {
|
||||
StopPanning();
|
||||
}
|
||||
@@ -136,6 +140,7 @@ void Mouse::MouseWheelChange(int x, int y) {
|
||||
wheel_position.y += y;
|
||||
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
||||
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
||||
SetAxis(identifier, motion_wheel_y, static_cast<f32>(y) / 100.0f);
|
||||
}
|
||||
|
||||
void Mouse::ReleaseAllButtons() {
|
||||
@@ -171,13 +176,39 @@ AnalogMapping Mouse::GetAnalogMappingForDevice(
|
||||
return mapping;
|
||||
}
|
||||
|
||||
Common::Input::ButtonNames Mouse::GetUIButtonName(const Common::ParamPackage& params) const {
|
||||
const auto button = static_cast<MouseButton>(params.Get("button", 0));
|
||||
switch (button) {
|
||||
case MouseButton::Left:
|
||||
return Common::Input::ButtonNames::ButtonLeft;
|
||||
case MouseButton::Right:
|
||||
return Common::Input::ButtonNames::ButtonRight;
|
||||
case MouseButton::Wheel:
|
||||
return Common::Input::ButtonNames::ButtonMouseWheel;
|
||||
case MouseButton::Backward:
|
||||
return Common::Input::ButtonNames::ButtonBackward;
|
||||
case MouseButton::Forward:
|
||||
return Common::Input::ButtonNames::ButtonForward;
|
||||
case MouseButton::Task:
|
||||
return Common::Input::ButtonNames::ButtonTask;
|
||||
case MouseButton::Extra:
|
||||
return Common::Input::ButtonNames::ButtonExtra;
|
||||
case MouseButton::Undefined:
|
||||
default:
|
||||
return Common::Input::ButtonNames::Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Common::Input::ButtonNames Mouse::GetUIName(const Common::ParamPackage& params) const {
|
||||
if (params.Has("button")) {
|
||||
return Common::Input::ButtonNames::Value;
|
||||
return GetUIButtonName(params);
|
||||
}
|
||||
if (params.Has("axis")) {
|
||||
return Common::Input::ButtonNames::Value;
|
||||
}
|
||||
if (params.Has("axis_x") && params.Has("axis_y") && params.Has("axis_z")) {
|
||||
return Common::Input::ButtonNames::Engine;
|
||||
}
|
||||
|
||||
return Common::Input::ButtonNames::Invalid;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ private:
|
||||
void UpdateThread(std::stop_token stop_token);
|
||||
void StopPanning();
|
||||
|
||||
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
||||
|
||||
Common::Vec2<int> mouse_origin;
|
||||
Common::Vec2<int> last_mouse_position;
|
||||
Common::Vec2<float> last_mouse_change;
|
||||
|
||||
@@ -198,9 +198,9 @@ public:
|
||||
if (sdl_controller) {
|
||||
switch (SDL_GameControllerGetType(sdl_controller.get())) {
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
return "XBox 360 Controller";
|
||||
return "Xbox 360 Controller";
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
return "XBox One Controller";
|
||||
return "Xbox One Controller";
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
return "DualShock 3 Controller";
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
|
||||
@@ -173,7 +173,7 @@ void InputEngine::ResetButtonState() {
|
||||
SetButton(controller.first, button.first, false);
|
||||
}
|
||||
for (const auto& button : controller.second.hat_buttons) {
|
||||
SetHatButton(controller.first, button.first, false);
|
||||
SetHatButton(controller.first, button.first, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,19 @@ void MappingFactory::RegisterMotion(const MappingData& data) {
|
||||
}
|
||||
new_input.Set("port", static_cast<int>(data.pad.port));
|
||||
new_input.Set("pad", static_cast<int>(data.pad.pad));
|
||||
|
||||
// If engine is mouse map the mouse position as 3 axis motion
|
||||
if (data.engine == "mouse") {
|
||||
new_input.Set("axis_x", 1);
|
||||
new_input.Set("invert_x", "-");
|
||||
new_input.Set("axis_y", 0);
|
||||
new_input.Set("axis_z", 4);
|
||||
new_input.Set("range", 1.0f);
|
||||
new_input.Set("deadzone", 0.0f);
|
||||
input_queue.Push(new_input);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (data.type) {
|
||||
case EngineInputType::Button:
|
||||
case EngineInputType::HatButton:
|
||||
|
||||
@@ -155,9 +155,6 @@ uint SwizzleOffset(uvec2 pos) {
|
||||
// Replicates low num_bits such that [(to_bit - 1):(to_bit - 1 - from_bit)]
|
||||
// is the same as [(num_bits - 1):0] and repeats all the way down.
|
||||
uint Replicate(uint val, uint num_bits, uint to_bit) {
|
||||
if (num_bits == 0 || to_bit == 0) {
|
||||
return 0;
|
||||
}
|
||||
const uint v = val & uint((1 << num_bits) - 1);
|
||||
uint res = v;
|
||||
uint reslen = num_bits;
|
||||
@@ -187,42 +184,57 @@ uint ReplicateBitTo9(uint value) {
|
||||
return REPLICATE_1_BIT_TO_9_TABLE[value];
|
||||
}
|
||||
|
||||
uint FastReplicateTo8(uint value, uint num_bits) {
|
||||
switch (num_bits) {
|
||||
case 1:
|
||||
return REPLICATE_1_BIT_TO_8_TABLE[value];
|
||||
case 2:
|
||||
return REPLICATE_2_BIT_TO_8_TABLE[value];
|
||||
case 3:
|
||||
return REPLICATE_3_BIT_TO_8_TABLE[value];
|
||||
case 4:
|
||||
return REPLICATE_4_BIT_TO_8_TABLE[value];
|
||||
case 5:
|
||||
return REPLICATE_5_BIT_TO_8_TABLE[value];
|
||||
case 6:
|
||||
return REPLICATE_6_BIT_TO_8_TABLE[value];
|
||||
case 7:
|
||||
return REPLICATE_7_BIT_TO_8_TABLE[value];
|
||||
case 8:
|
||||
uint FastReplicate(uint value, uint num_bits, uint to_bit) {
|
||||
if (num_bits == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (num_bits == to_bit) {
|
||||
return value;
|
||||
}
|
||||
return Replicate(value, num_bits, 8);
|
||||
if (to_bit == 6) {
|
||||
switch (num_bits) {
|
||||
case 1:
|
||||
return REPLICATE_1_BIT_TO_6_TABLE[value];
|
||||
case 2:
|
||||
return REPLICATE_2_BIT_TO_6_TABLE[value];
|
||||
case 3:
|
||||
return REPLICATE_3_BIT_TO_6_TABLE[value];
|
||||
case 4:
|
||||
return REPLICATE_4_BIT_TO_6_TABLE[value];
|
||||
case 5:
|
||||
return REPLICATE_5_BIT_TO_6_TABLE[value];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else { /* if (to_bit == 8) */
|
||||
switch (num_bits) {
|
||||
case 1:
|
||||
return REPLICATE_1_BIT_TO_8_TABLE[value];
|
||||
case 2:
|
||||
return REPLICATE_2_BIT_TO_8_TABLE[value];
|
||||
case 3:
|
||||
return REPLICATE_3_BIT_TO_8_TABLE[value];
|
||||
case 4:
|
||||
return REPLICATE_4_BIT_TO_8_TABLE[value];
|
||||
case 5:
|
||||
return REPLICATE_5_BIT_TO_8_TABLE[value];
|
||||
case 6:
|
||||
return REPLICATE_6_BIT_TO_8_TABLE[value];
|
||||
case 7:
|
||||
return REPLICATE_7_BIT_TO_8_TABLE[value];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Replicate(value, num_bits, to_bit);
|
||||
}
|
||||
|
||||
uint FastReplicateTo8(uint value, uint num_bits) {
|
||||
return FastReplicate(value, num_bits, 8);
|
||||
}
|
||||
|
||||
uint FastReplicateTo6(uint value, uint num_bits) {
|
||||
switch (num_bits) {
|
||||
case 1:
|
||||
return REPLICATE_1_BIT_TO_6_TABLE[value];
|
||||
case 2:
|
||||
return REPLICATE_2_BIT_TO_6_TABLE[value];
|
||||
case 3:
|
||||
return REPLICATE_3_BIT_TO_6_TABLE[value];
|
||||
case 4:
|
||||
return REPLICATE_4_BIT_TO_6_TABLE[value];
|
||||
case 5:
|
||||
return REPLICATE_5_BIT_TO_6_TABLE[value];
|
||||
}
|
||||
return Replicate(value, num_bits, 6);
|
||||
return FastReplicate(value, num_bits, 6);
|
||||
}
|
||||
|
||||
uint Div3Floor(uint v) {
|
||||
|
||||
@@ -1038,7 +1038,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
}
|
||||
if (has_ext_shader_atomic_int64) {
|
||||
VkPhysicalDeviceShaderAtomicInt64Features atomic_int64;
|
||||
atomic_int64.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT;
|
||||
atomic_int64.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES;
|
||||
atomic_int64.pNext = nullptr;
|
||||
features.pNext = &atomic_int64;
|
||||
physical.GetFeatures2KHR(features);
|
||||
|
||||
@@ -743,7 +743,10 @@ void Config::ReadUIValues() {
|
||||
qt_config->beginGroup(QStringLiteral("UI"));
|
||||
|
||||
UISettings::values.theme =
|
||||
ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second))
|
||||
ReadSetting(
|
||||
QStringLiteral("theme"),
|
||||
QString::fromUtf8(
|
||||
UISettings::themes[static_cast<size_t>(UISettings::Theme::DarkColorful)].second))
|
||||
.toString();
|
||||
ReadBasicSetting(UISettings::values.enable_discord_presence);
|
||||
ReadBasicSetting(UISettings::values.select_user_on_boot);
|
||||
@@ -1270,8 +1273,10 @@ void Config::SaveSystemValues() {
|
||||
void Config::SaveUIValues() {
|
||||
qt_config->beginGroup(QStringLiteral("UI"));
|
||||
|
||||
WriteSetting(QStringLiteral("theme"), UISettings::values.theme,
|
||||
QString::fromUtf8(UISettings::themes[0].second));
|
||||
WriteSetting(
|
||||
QStringLiteral("theme"), UISettings::values.theme,
|
||||
QString::fromUtf8(
|
||||
UISettings::themes[static_cast<size_t>(UISettings::Theme::DarkColorful)].second));
|
||||
WriteBasicSetting(UISettings::values.enable_discord_presence);
|
||||
WriteBasicSetting(UISettings::values.select_user_on_boot);
|
||||
|
||||
|
||||
@@ -102,6 +102,16 @@ QString GetButtonName(Common::Input::ButtonNames button_name) {
|
||||
return QObject::tr("Share");
|
||||
case Common::Input::ButtonNames::Options:
|
||||
return QObject::tr("Options");
|
||||
case Common::Input::ButtonNames::ButtonMouseWheel:
|
||||
return QObject::tr("Wheel", "Indicates the mouse wheel");
|
||||
case Common::Input::ButtonNames::ButtonBackward:
|
||||
return QObject::tr("Backward");
|
||||
case Common::Input::ButtonNames::ButtonForward:
|
||||
return QObject::tr("Forward");
|
||||
case Common::Input::ButtonNames::ButtonTask:
|
||||
return QObject::tr("Task");
|
||||
case Common::Input::ButtonNames::ButtonExtra:
|
||||
return QObject::tr("Extra");
|
||||
default:
|
||||
return QObject::tr("[undefined]");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,15 @@ struct Shortcut {
|
||||
ContextualShortcut shortcut;
|
||||
};
|
||||
|
||||
enum class Theme {
|
||||
Default,
|
||||
DefaultColorful,
|
||||
Dark,
|
||||
DarkColorful,
|
||||
MidnightBlue,
|
||||
MidnightBlueColorful,
|
||||
};
|
||||
|
||||
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
||||
extern const Themes themes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user