early-access version 3737

This commit is contained in:
pineappleEA 2023-07-03 21:12:47 +02:00
parent 6f5de5d826
commit 6ff23ca431
8 changed files with 50 additions and 15 deletions

View file

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

View file

@ -54,6 +54,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<activity <activity
android:name="org.yuzu.yuzu_emu.activities.EmulationActivity" android:name="org.yuzu.yuzu_emu.activities.EmulationActivity"
android:theme="@style/Theme.Yuzu.Main" android:theme="@style/Theme.Yuzu.Main"
android:launchMode="singleTop"
android:screenOrientation="userLandscape" android:screenOrientation="userLandscape"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode"

View file

@ -1243,10 +1243,12 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
auto& nfc_output_device = output_devices[3]; auto& nfc_output_device = output_devices[3];
if (device_index == EmulatedDeviceIndex::LeftIndex) { if (device_index == EmulatedDeviceIndex::LeftIndex) {
controller.left_polling_mode = polling_mode;
return left_output_device->SetPollingMode(polling_mode); return left_output_device->SetPollingMode(polling_mode);
} }
if (device_index == EmulatedDeviceIndex::RightIndex) { if (device_index == EmulatedDeviceIndex::RightIndex) {
controller.right_polling_mode = polling_mode;
const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode); const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode); const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
@ -1261,12 +1263,22 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
return mapped_nfc_result; return mapped_nfc_result;
} }
controller.left_polling_mode = polling_mode;
controller.right_polling_mode = polling_mode;
left_output_device->SetPollingMode(polling_mode); left_output_device->SetPollingMode(polling_mode);
right_output_device->SetPollingMode(polling_mode); right_output_device->SetPollingMode(polling_mode);
nfc_output_device->SetPollingMode(polling_mode); nfc_output_device->SetPollingMode(polling_mode);
return Common::Input::DriverResult::Success; return Common::Input::DriverResult::Success;
} }
Common::Input::PollingMode EmulatedController::GetPollingMode(
EmulatedDeviceIndex device_index) const {
if (device_index == EmulatedDeviceIndex::LeftIndex) {
return controller.left_polling_mode;
}
return controller.right_polling_mode;
}
bool EmulatedController::SetCameraFormat( bool EmulatedController::SetCameraFormat(
Core::IrSensor::ImageTransferProcessorFormat camera_format) { Core::IrSensor::ImageTransferProcessorFormat camera_format) {
LOG_INFO(Service_HID, "Set camera format {}", camera_format); LOG_INFO(Service_HID, "Set camera format {}", camera_format);

View file

@ -143,6 +143,8 @@ struct ControllerStatus {
CameraState camera_state{}; CameraState camera_state{};
RingSensorForce ring_analog_state{}; RingSensorForce ring_analog_state{};
NfcState nfc_state{}; NfcState nfc_state{};
Common::Input::PollingMode left_polling_mode{};
Common::Input::PollingMode right_polling_mode{};
}; };
enum class ControllerTriggerType { enum class ControllerTriggerType {
@ -370,6 +372,12 @@ public:
*/ */
Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index, Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index,
Common::Input::PollingMode polling_mode); Common::Input::PollingMode polling_mode);
/**
* Get the current polling mode from a controller
* @param device_index index of the controller to set the polling mode
* @return current polling mode
*/
Common::Input::PollingMode GetPollingMode(EmulatedDeviceIndex device_index) const;
/** /**
* Sets the desired camera format to be polled from a controller * Sets the desired camera format to be polled from a controller

View file

@ -66,10 +66,6 @@ NfcDevice::~NfcDevice() {
}; };
void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
if (!is_initalized) {
return;
}
if (type == Core::HID::ControllerTriggerType::Connected) { if (type == Core::HID::ControllerTriggerType::Connected) {
Initialize(); Initialize();
availability_change_event->Signal(); availability_change_event->Signal();
@ -77,12 +73,12 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
} }
if (type == Core::HID::ControllerTriggerType::Disconnected) { if (type == Core::HID::ControllerTriggerType::Disconnected) {
device_state = DeviceState::Unavailable; Finalize();
availability_change_event->Signal(); availability_change_event->Signal();
return; return;
} }
if (type != Core::HID::ControllerTriggerType::Nfc) { if (!is_initalized) {
return; return;
} }
@ -90,6 +86,17 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
return; return;
} }
// Ensure nfc mode is always active
if (npad_device->GetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex) ==
Common::Input::PollingMode::Active) {
npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
Common::Input::PollingMode::NFC);
}
if (type != Core::HID::ControllerTriggerType::Nfc) {
return;
}
const auto nfc_status = npad_device->GetNfc(); const auto nfc_status = npad_device->GetNfc();
switch (nfc_status.state) { switch (nfc_status.state) {
case Common::Input::NfcState::NewAmiibo: case Common::Input::NfcState::NewAmiibo:
@ -207,12 +214,15 @@ void NfcDevice::Initialize() {
} }
void NfcDevice::Finalize() { void NfcDevice::Finalize() {
if (npad_device->IsConnected()) {
if (device_state == DeviceState::TagMounted) { if (device_state == DeviceState::TagMounted) {
Unmount(); Unmount();
} }
if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) { if (device_state == DeviceState::SearchingForTag ||
device_state == DeviceState::TagRemoved) {
StopDetection(); StopDetection();
} }
}
if (device_state != DeviceState::Unavailable) { if (device_state != DeviceState::Unavailable) {
npad_device->RemoveNfcHandle(); npad_device->RemoveNfcHandle();

View file

@ -599,6 +599,10 @@ void TextureCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t siz
[&](ImageId id, Image&) { deleted_images.push_back(id); }); [&](ImageId id, Image&) { deleted_images.push_back(id); });
for (const ImageId id : deleted_images) { for (const ImageId id : deleted_images) {
Image& image = slot_images[id]; Image& image = slot_images[id];
if (True(image.flags & ImageFlagBits::CpuModified)) {
continue;
}
image.flags |= ImageFlagBits::CpuModified;
if (True(image.flags & ImageFlagBits::Remapped)) { if (True(image.flags & ImageFlagBits::Remapped)) {
continue; continue;
} }

View file

@ -221,8 +221,8 @@ vk::Image MemoryAllocator::CreateImage(const VkImageCreateInfo& ci) const {
const VmaAllocationCreateInfo alloc_ci = { const VmaAllocationCreateInfo alloc_ci = {
.flags = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT, .flags = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT,
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, .usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, .requiredFlags = 0,
.preferredFlags = 0, .preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
.memoryTypeBits = 0, .memoryTypeBits = 0,
.pool = VK_NULL_HANDLE, .pool = VK_NULL_HANDLE,
.pUserData = nullptr, .pUserData = nullptr,

View file

@ -454,7 +454,7 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan
// the user through their desktop environment. // the user through their desktop environment.
//: TRANSLATORS: This string is shown to the user to explain why yuzu needs to prevent the //: TRANSLATORS: This string is shown to the user to explain why yuzu needs to prevent the
//: computer from sleeping //: computer from sleeping
QByteArray wakelock_reason = tr("Running a game").toLatin1(); QByteArray wakelock_reason = tr("Running a game").toUtf8();
SDL_SetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME, wakelock_reason.data()); SDL_SetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME, wakelock_reason.data());
// SDL disables the screen saver by default, and setting the hint // SDL disables the screen saver by default, and setting the hint