mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-06-06 07:45:56 +08:00
windows sucks
This commit is contained in:
parent
51836ad460
commit
7e38f33f60
@ -23,7 +23,7 @@ constexpr auto INCREMENT_TIME{5ms};
|
||||
|
||||
DeviceSession::DeviceSession(Core::System& system_)
|
||||
: system{system_}
|
||||
, thread_event{system_.CreateEvent("AudioOutSampleTick", [this](s64 time, std::chrono::nanoseconds) {
|
||||
, thread_event{system_.CreateTimingEvent("AudioOutSampleTick", [this](s64 time, std::chrono::nanoseconds) {
|
||||
return ThreadFunc();
|
||||
})}
|
||||
{}
|
||||
|
||||
@ -968,7 +968,7 @@ void System::ApplySettings() {
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Core::Timing::EventType> System::CreateEvent(std::string name, Core::Timing::TimedCallback&& callback) {
|
||||
std::shared_ptr<Core::Timing::EventType> System::CreateTimingEvent(std::string name, Core::Timing::TimedCallback&& callback) {
|
||||
return std::make_shared<Core::Timing::EventType>(std::move(callback), std::move(name));
|
||||
}
|
||||
|
||||
|
||||
@ -439,7 +439,7 @@ public:
|
||||
/// Applies any changes to settings to this core instance.
|
||||
void ApplySettings();
|
||||
|
||||
std::shared_ptr<Core::Timing::EventType> CreateEvent(std::string name, Core::Timing::TimedCallback&& callback);
|
||||
std::shared_ptr<Core::Timing::EventType> CreateTimingEvent(std::string name, Core::Timing::TimedCallback&& callback);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
|
||||
@ -13,7 +13,7 @@ namespace Kernel {
|
||||
|
||||
void KHardwareTimer::Initialize() {
|
||||
// Create the timing callback to register with CoreTiming.
|
||||
m_event_type = m_kernel.System().CreateEvent("KHardwareTimer::Callback", [this](s64, std::chrono::nanoseconds) {
|
||||
m_event_type = m_kernel.System().CreateTimingEvent("KHardwareTimer::Callback", [this](s64, std::chrono::nanoseconds) {
|
||||
this->DoTask();
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
@ -256,7 +256,7 @@ struct KernelCore::Impl {
|
||||
}
|
||||
|
||||
void InitializePreemption(KernelCore& kernel) {
|
||||
preemption_event = system.CreateEvent("PreemptionCallback", [this, &kernel](s64 time, std::chrono::nanoseconds) -> std::optional<std::chrono::nanoseconds> {
|
||||
preemption_event = system.CreateTimingEvent("PreemptionCallback", [this, &kernel](s64 time, std::chrono::nanoseconds) -> std::optional<std::chrono::nanoseconds> {
|
||||
{
|
||||
KScopedSchedulerLock lock(kernel);
|
||||
global_scheduler_context->PreemptThreads();
|
||||
|
||||
@ -51,7 +51,7 @@ Hidbus::Hidbus(Core::System& system_)
|
||||
RegisterHandlers(functions);
|
||||
|
||||
// Register update callbacks
|
||||
hidbus_update_event = system_.CreateEvent("Hidbus::UpdateCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
hidbus_update_event = system_.CreateTimingEvent("Hidbus::UpdateCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
const auto guard = LockService();
|
||||
UpdateHidbus(ns_late);
|
||||
return std::nullopt;
|
||||
|
||||
@ -23,14 +23,14 @@ Conductor::Conductor(Core::System& system, Container& container, DisplayList& di
|
||||
});
|
||||
|
||||
if (system.IsMulticore()) {
|
||||
m_event = system.CreateEvent("ScreenComposition", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
m_event = system.CreateTimingEvent("ScreenComposition", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
m_signal.Set();
|
||||
return std::chrono::nanoseconds(this->GetNextTicks());
|
||||
});
|
||||
system.CoreTiming().ScheduleLoopingEvent(FrameNs, FrameNs, m_event);
|
||||
m_thread = std::jthread([this](std::stop_token token) { this->VsyncThread(token); });
|
||||
} else {
|
||||
m_event = system.CreateEvent("ScreenComposition", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
m_event = system.CreateTimingEvent("ScreenComposition", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
this->ProcessVsync();
|
||||
return std::chrono::nanoseconds(this->GetNextTicks());
|
||||
});
|
||||
|
||||
@ -233,9 +233,7 @@ CheatEngine::~CheatEngine() {
|
||||
}
|
||||
|
||||
void CheatEngine::Initialize() {
|
||||
event = system.CreateEvent(
|
||||
"CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id),
|
||||
[this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
event = system.CreateTimingEvent("CheatEngine::FrameCallback::" + Common::HexToString(metadata.main_nso_build_id), [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
FrameCallback(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
@ -54,7 +54,7 @@ void MemoryWriteWidth(Core::Memory::Memory& memory, u32 width, VAddr addr, u64 v
|
||||
|
||||
Freezer::Freezer(Core::System& system_, Core::Timing::CoreTiming& core_timing_, Core::Memory::Memory& memory_)
|
||||
: core_timing{core_timing_}, memory{memory_} {
|
||||
event = system_.CreateEvent("MemoryFreezer::FrameCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
event = system_.CreateTimingEvent("MemoryFreezer::FrameCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
FrameCallback(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
@ -56,19 +56,19 @@ ResourceManager::ResourceManager(Core::System& system_,
|
||||
applet_resource = std::make_shared<AppletResource>(system);
|
||||
|
||||
// Register update callbacks
|
||||
npad_update_event = system.CreateEvent("HID::UpdatePadCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
npad_update_event = system.CreateTimingEvent("HID::UpdatePadCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
UpdateNpad(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
default_update_event = system.CreateEvent("HID::UpdateDefaultCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
default_update_event = system.CreateTimingEvent("HID::UpdateDefaultCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
UpdateControllers(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
mouse_keyboard_update_event = system.CreateEvent("HID::UpdateMouseKeyboardCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
mouse_keyboard_update_event = system.CreateTimingEvent("HID::UpdateMouseKeyboardCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
UpdateMouseKeyboard(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
motion_update_event = system.CreateEvent("HID::UpdateMotionCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
motion_update_event = system.CreateTimingEvent("HID::UpdateMotionCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
UpdateMotion(ns_late);
|
||||
return std::nullopt;
|
||||
});
|
||||
@ -256,8 +256,7 @@ void ResourceManager::InitializeTouchScreenSampler() {
|
||||
touch_screen = std::make_shared<TouchScreen>(touch_resource);
|
||||
gesture = std::make_shared<Gesture>(touch_resource);
|
||||
|
||||
touch_update_event = system.CreateEvent("HID::TouchUpdateCallback", [this](s64 time,
|
||||
std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
touch_update_event = system.CreateTimingEvent("HID::TouchUpdateCallback", [this](s64 time, std::chrono::nanoseconds ns_late) -> std::optional<std::chrono::nanoseconds> {
|
||||
touch_resource->OnTouchUpdate(time);
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
@ -60,11 +60,11 @@ TEST_CASE("CoreTiming[BasicOrder]", "[core]") {
|
||||
ScopeInit guard;
|
||||
auto& core_timing = guard.core_timing;
|
||||
std::vector<std::shared_ptr<Core::Timing::EventType>> events{
|
||||
system.CreateEvent("callbackA", HostCallbackTemplate<0>),
|
||||
system.CreateEvent("callbackB", HostCallbackTemplate<1>),
|
||||
system.CreateEvent("callbackC", HostCallbackTemplate<2>),
|
||||
system.CreateEvent("callbackD", HostCallbackTemplate<3>),
|
||||
system.CreateEvent("callbackE", HostCallbackTemplate<4>),
|
||||
system.CreateTimingEvent("callbackA", HostCallbackTemplate<0>),
|
||||
system.CreateTimingEvent("callbackB", HostCallbackTemplate<1>),
|
||||
system.CreateTimingEvent("callbackC", HostCallbackTemplate<2>),
|
||||
system.CreateTimingEvent("callbackD", HostCallbackTemplate<3>),
|
||||
system.CreateTimingEvent("callbackE", HostCallbackTemplate<4>),
|
||||
};
|
||||
|
||||
expected_callback = 0;
|
||||
@ -101,11 +101,11 @@ TEST_CASE("CoreTiming[BasicOrderNoPausing]", "[core]") {
|
||||
ScopeInit guard;
|
||||
auto& core_timing = guard.core_timing;
|
||||
std::vector<std::shared_ptr<Core::Timing::EventType>> events{
|
||||
system.CreateEvent("callbackA", HostCallbackTemplate<0>),
|
||||
system.CreateEvent("callbackB", HostCallbackTemplate<1>),
|
||||
system.CreateEvent("callbackC", HostCallbackTemplate<2>),
|
||||
system.CreateEvent("callbackD", HostCallbackTemplate<3>),
|
||||
system.CreateEvent("callbackE", HostCallbackTemplate<4>),
|
||||
system.CreateTimingEvent("callbackA", HostCallbackTemplate<0>),
|
||||
system.CreateTimingEvent("callbackB", HostCallbackTemplate<1>),
|
||||
system.CreateTimingEvent("callbackC", HostCallbackTemplate<2>),
|
||||
system.CreateTimingEvent("callbackD", HostCallbackTemplate<3>),
|
||||
system.CreateTimingEvent("callbackE", HostCallbackTemplate<4>),
|
||||
};
|
||||
|
||||
core_timing.SyncPause(true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user