summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp4
-rw-r--r--src/core/core_timing.cpp14
-rw-r--r--src/core/core_timing.h6
-rw-r--r--src/core/hid/emulated_controller.cpp15
-rw-r--r--src/core/hid/input_converter.cpp3
-rw-r--r--src/core/hle/result.h2
-rw-r--r--src/core/hle/service/audio/audout_u.cpp3
-rw-r--r--src/core/hle/service/audio/audren_u.cpp4
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp7
9 files changed, 29 insertions, 29 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index e651ce100..121092868 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -141,8 +141,6 @@ struct System::Impl {
core_timing.SyncPause(false);
is_paused = false;
- audio_core->PauseSinks(false);
-
return status;
}
@@ -150,8 +148,6 @@ struct System::Impl {
std::unique_lock<std::mutex> lk(suspend_guard);
status = SystemResultStatus::Success;
- audio_core->PauseSinks(true);
-
core_timing.SyncPause(true);
kernel.Suspend(true);
is_paused = true;
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 2dbb99c8b..5375a5d59 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -73,7 +73,6 @@ void CoreTiming::Shutdown() {
if (timer_thread) {
timer_thread->join();
}
- pause_callbacks.clear();
ClearPendingEvents();
timer_thread.reset();
has_started = false;
@@ -86,10 +85,6 @@ void CoreTiming::Pause(bool is_paused) {
if (!is_paused) {
pause_end_time = GetGlobalTimeNs().count();
}
-
- for (auto& cb : pause_callbacks) {
- cb(is_paused);
- }
}
void CoreTiming::SyncPause(bool is_paused) {
@@ -110,10 +105,6 @@ void CoreTiming::SyncPause(bool is_paused) {
if (!is_paused) {
pause_end_time = GetGlobalTimeNs().count();
}
-
- for (auto& cb : pause_callbacks) {
- cb(is_paused);
- }
}
bool CoreTiming::IsRunning() const {
@@ -219,11 +210,6 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
}
}
-void CoreTiming::RegisterPauseCallback(PauseCallback&& callback) {
- std::scoped_lock lock{basic_lock};
- pause_callbacks.emplace_back(std::move(callback));
-}
-
std::optional<s64> CoreTiming::Advance() {
std::scoped_lock lock{advance_lock, basic_lock};
global_timer = GetGlobalTimeNs().count();
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index 6aa3ae923..3259397b2 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -22,7 +22,6 @@ namespace Core::Timing {
/// A callback that may be scheduled for a particular core timing event.
using TimedCallback = std::function<std::optional<std::chrono::nanoseconds>(
std::uintptr_t user_data, s64 time, std::chrono::nanoseconds ns_late)>;
-using PauseCallback = std::function<void(bool paused)>;
/// Contains the characteristics of a particular event.
struct EventType {
@@ -134,9 +133,6 @@ public:
/// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
std::optional<s64> Advance();
- /// Register a callback function to be called when coretiming pauses.
- void RegisterPauseCallback(PauseCallback&& callback);
-
private:
struct Event;
@@ -176,8 +172,6 @@ private:
/// Cycle timing
u64 ticks{};
s64 downcount{};
-
- std::vector<PauseCallback> pause_callbacks{};
};
/// Creates a core timing event with the given name and callback.
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index f9f902c2d..01c43be93 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -562,6 +562,16 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
return;
}
+ // GC controllers have triggers not buttons
+ if (npad_type == NpadStyleIndex::GameCube) {
+ if (index == Settings::NativeButton::ZR) {
+ return;
+ }
+ if (index == Settings::NativeButton::ZL) {
+ return;
+ }
+ }
+
switch (index) {
case Settings::NativeButton::A:
controller.npad_button_state.a.Assign(current_status.value);
@@ -738,6 +748,11 @@ void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callbac
return;
}
+ // Only GC controllers have analog triggers
+ if (npad_type != NpadStyleIndex::GameCube) {
+ return;
+ }
+
const auto& trigger = controller.trigger_values[index];
switch (index) {
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp
index 68d143a01..52fb69e9c 100644
--- a/src/core/hid/input_converter.cpp
+++ b/src/core/hid/input_converter.cpp
@@ -52,6 +52,9 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu
Common::Input::ButtonStatus status{};
switch (callback.type) {
case Common::Input::InputType::Analog:
+ status.value = TransformToTrigger(callback).pressed.value;
+ status.toggle = callback.analog_status.properties.toggle;
+ break;
case Common::Input::InputType::Trigger:
status.value = TransformToTrigger(callback).pressed.value;
break;
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 4de44cd06..47a1b829b 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -117,6 +117,7 @@ union Result {
BitField<0, 9, ErrorModule> module;
BitField<9, 13, u32> description;
+ Result() = default;
constexpr explicit Result(u32 raw_) : raw(raw_) {}
constexpr Result(ErrorModule module_, u32 description_)
@@ -130,6 +131,7 @@ union Result {
return !IsSuccess();
}
};
+static_assert(std::is_trivial_v<Result>);
[[nodiscard]] constexpr bool operator==(const Result& a, const Result& b) {
return a.raw == b.raw;
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index a44dd842a..49c092301 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -246,9 +246,8 @@ void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {
const auto write_count =
static_cast<u32>(ctx.GetWriteBufferSize() / sizeof(AudioDevice::AudioDeviceName));
std::vector<AudioDevice::AudioDeviceName> device_names{};
- std::string print_names{};
if (write_count > 0) {
- device_names.push_back(AudioDevice::AudioDeviceName("DeviceOut"));
+ device_names.emplace_back("DeviceOut");
LOG_DEBUG(Service_Audio, "called. \nName=DeviceOut");
} else {
LOG_DEBUG(Service_Audio, "called. Empty buffer passed in.");
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index bc69117c6..6fb07c37d 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -252,7 +252,7 @@ private:
std::vector<AudioDevice::AudioDeviceName> out_names{};
- u32 out_count = impl->ListAudioDeviceName(out_names, in_count);
+ const u32 out_count = impl->ListAudioDeviceName(out_names, in_count);
std::string out{};
for (u32 i = 0; i < out_count; i++) {
@@ -365,7 +365,7 @@ private:
std::vector<AudioDevice::AudioDeviceName> out_names{};
- u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count);
+ const u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count);
std::string out{};
for (u32 i = 0; i < out_count; i++) {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
index 2a5128c60..a7385fce8 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "audio_core/audio_core.h"
#include "common/assert.h"
#include "common/logging/log.h"
#include "core/core.h"
@@ -65,7 +66,10 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>&
return NvResult::NotImplemented;
}
-void nvhost_nvdec::OnOpen(DeviceFD fd) {}
+void nvhost_nvdec::OnOpen(DeviceFD fd) {
+ LOG_INFO(Service_NVDRV, "NVDEC video stream started");
+ system.AudioCore().SetNVDECActive(true);
+}
void nvhost_nvdec::OnClose(DeviceFD fd) {
LOG_INFO(Service_NVDRV, "NVDEC video stream ended");
@@ -73,6 +77,7 @@ void nvhost_nvdec::OnClose(DeviceFD fd) {
if (iter != fd_to_id.end()) {
system.GPU().ClearCdmaInstance(iter->second);
}
+ system.AudioCore().SetNVDECActive(false);
}
} // namespace Service::Nvidia::Devices