early-access version 3470

This commit is contained in:
pineappleEA 2023-03-23 16:38:29 +01:00
parent 9d69b0118c
commit 723613f367
7 changed files with 42 additions and 33 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3468. This is the source code for early-access 3470.
## Legal Notice ## Legal Notice

View file

@ -143,7 +143,7 @@ private:
++m_read_index; ++m_read_index;
// Notify the producer that we have popped off the queue. // Notify the producer that we have popped off the queue.
std::unique_lock lock{producer_cv_mutex}; std::scoped_lock lock{producer_cv_mutex};
producer_cv.notify_one(); producer_cv.notify_one();
return true; return true;

View file

@ -3,6 +3,8 @@
#pragma once #pragma once
#include <compare>
#include <type_traits>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/common_types.h" #include "common/common_types.h"
@ -13,11 +15,12 @@ template <bool Virtual, typename T>
class TypedAddress { class TypedAddress {
public: public:
// Constructors. // Constructors.
inline TypedAddress() : m_address(0) {} constexpr inline TypedAddress() : m_address(0) {}
constexpr inline TypedAddress(uint64_t a) : m_address(a) {} constexpr inline TypedAddress(uint64_t a) : m_address(a) {}
template <typename U> template <typename U>
constexpr inline explicit TypedAddress(U* ptr) : m_address(reinterpret_cast<uint64_t>(ptr)) {} constexpr inline explicit TypedAddress(const U* ptr)
: m_address(reinterpret_cast<uint64_t>(ptr)) {}
// Copy constructor. // Copy constructor.
constexpr inline TypedAddress(const TypedAddress& rhs) = default; constexpr inline TypedAddress(const TypedAddress& rhs) = default;
@ -105,36 +108,16 @@ public:
return m_address / size; return m_address / size;
} }
constexpr inline bool operator!() const { constexpr explicit operator bool() const {
return m_address == 0; return m_address != 0;
} }
// constexpr inline uint64_t operator%(U align) const { return m_address % align; } // constexpr inline uint64_t operator%(U align) const { return m_address % align; }
// Comparison operators. // Comparison operators.
constexpr inline bool operator==(TypedAddress rhs) const { constexpr bool operator==(const TypedAddress&) const = default;
return m_address == rhs.m_address; constexpr bool operator!=(const TypedAddress&) const = default;
} constexpr auto operator<=>(const TypedAddress&) const = default;
constexpr inline bool operator!=(TypedAddress rhs) const {
return m_address != rhs.m_address;
}
constexpr inline bool operator<(TypedAddress rhs) const {
return m_address < rhs.m_address;
}
constexpr inline bool operator<=(TypedAddress rhs) const {
return m_address <= rhs.m_address;
}
constexpr inline bool operator>(TypedAddress rhs) const {
return m_address > rhs.m_address;
}
constexpr inline bool operator>=(TypedAddress rhs) const {
return m_address >= rhs.m_address;
}
// For convenience, also define comparison operators versus uint64_t. // For convenience, also define comparison operators versus uint64_t.
constexpr inline bool operator==(uint64_t rhs) const { constexpr inline bool operator==(uint64_t rhs) const {

View file

@ -42,8 +42,18 @@ NfcDevice::~NfcDevice() {
}; };
void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
if (type == Core::HID::ControllerTriggerType::Connected || if (!is_initalized) {
type == Core::HID::ControllerTriggerType::Disconnected) { return;
}
if (type == Core::HID::ControllerTriggerType::Connected) {
Initialize();
availability_change_event->Signal();
return;
}
if (type == Core::HID::ControllerTriggerType::Disconnected) {
device_state = NFP::DeviceState::Unavailable;
availability_change_event->Signal(); availability_change_event->Signal();
return; return;
} }
@ -113,6 +123,7 @@ void NfcDevice::Initialize() {
device_state = device_state =
npad_device->HasNfc() ? NFP::DeviceState::Initialized : NFP::DeviceState::Unavailable; npad_device->HasNfc() ? NFP::DeviceState::Initialized : NFP::DeviceState::Unavailable;
encrypted_tag_data = {}; encrypted_tag_data = {};
is_initalized = true;
} }
void NfcDevice::Finalize() { void NfcDevice::Finalize() {
@ -121,6 +132,7 @@ void NfcDevice::Finalize() {
StopDetection(); StopDetection();
} }
device_state = NFP::DeviceState::Unavailable; device_state = NFP::DeviceState::Unavailable;
is_initalized = false;
} }
Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) { Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) {

View file

@ -67,6 +67,7 @@ private:
Kernel::KEvent* deactivate_event = nullptr; Kernel::KEvent* deactivate_event = nullptr;
Kernel::KEvent* availability_change_event = nullptr; Kernel::KEvent* availability_change_event = nullptr;
bool is_initalized{};
NFP::TagProtocol allowed_protocols{}; NFP::TagProtocol allowed_protocols{};
NFP::DeviceState device_state{NFP::DeviceState::Unavailable}; NFP::DeviceState device_state{NFP::DeviceState::Unavailable};

View file

@ -66,8 +66,18 @@ NfpDevice::~NfpDevice() {
}; };
void NfpDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { void NfpDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
if (type == Core::HID::ControllerTriggerType::Connected || if (!is_initalized) {
type == Core::HID::ControllerTriggerType::Disconnected) { return;
}
if (type == Core::HID::ControllerTriggerType::Connected) {
Initialize();
availability_change_event->Signal();
return;
}
if (type == Core::HID::ControllerTriggerType::Disconnected) {
device_state = DeviceState::Unavailable;
availability_change_event->Signal(); availability_change_event->Signal();
return; return;
} }
@ -145,6 +155,7 @@ void NfpDevice::Initialize() {
device_state = npad_device->HasNfc() ? DeviceState::Initialized : DeviceState::Unavailable; device_state = npad_device->HasNfc() ? DeviceState::Initialized : DeviceState::Unavailable;
encrypted_tag_data = {}; encrypted_tag_data = {};
tag_data = {}; tag_data = {};
is_initalized = true;
} }
void NfpDevice::Finalize() { void NfpDevice::Finalize() {
@ -155,6 +166,7 @@ void NfpDevice::Finalize() {
StopDetection(); StopDetection();
} }
device_state = DeviceState::Unavailable; device_state = DeviceState::Unavailable;
is_initalized = false;
} }
Result NfpDevice::StartDetection(TagProtocol allowed_protocol) { Result NfpDevice::StartDetection(TagProtocol allowed_protocol) {

View file

@ -92,6 +92,7 @@ private:
Kernel::KEvent* deactivate_event = nullptr; Kernel::KEvent* deactivate_event = nullptr;
Kernel::KEvent* availability_change_event = nullptr; Kernel::KEvent* availability_change_event = nullptr;
bool is_initalized{};
bool is_data_moddified{}; bool is_data_moddified{};
bool is_app_area_open{}; bool is_app_area_open{};
TagProtocol allowed_protocols{}; TagProtocol allowed_protocols{};