forked from etc/pineapple-src
early-access version 2660
This commit is contained in:
parent
eebb1e910d
commit
635c062db0
5 changed files with 46 additions and 47 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2659.
|
This is the source code for early-access 2660.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -197,27 +197,27 @@ void EmulatedConsole::SetTouch(const Common::Input::CallbackStatus& callback, st
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMotionValues EmulatedConsole::GetMotionValues() const {
|
ConsoleMotionValues EmulatedConsole::GetMotionValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return console.motion_values;
|
return console.motion_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchValues EmulatedConsole::GetTouchValues() const {
|
TouchValues EmulatedConsole::GetTouchValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return console.touch_values;
|
return console.touch_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMotion EmulatedConsole::GetMotion() const {
|
ConsoleMotion EmulatedConsole::GetMotion() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return console.motion_state;
|
return console.motion_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchFingerState EmulatedConsole::GetTouch() const {
|
TouchFingerState EmulatedConsole::GetTouch() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return console.touch_state;
|
return console.touch_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) {
|
void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
for (const auto& poller_pair : callback_list) {
|
for (const auto& poller_pair : callback_list) {
|
||||||
const ConsoleUpdateCallback& poller = poller_pair.second;
|
const ConsoleUpdateCallback& poller = poller_pair.second;
|
||||||
if (poller.on_change) {
|
if (poller.on_change) {
|
||||||
|
@ -227,13 +227,13 @@ void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
|
int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
callback_list.insert_or_assign(last_callback_key, update_callback);
|
callback_list.insert_or_assign(last_callback_key, update_callback);
|
||||||
return last_callback_key++;
|
return last_callback_key++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedConsole::DeleteCallback(int key) {
|
void EmulatedConsole::DeleteCallback(int key) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
const auto& iterator = callback_list.find(key);
|
const auto& iterator = callback_list.find(key);
|
||||||
if (iterator == callback_list.end()) {
|
if (iterator == callback_list.end()) {
|
||||||
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
||||||
|
|
|
@ -353,17 +353,17 @@ void EmulatedController::DisableConfiguration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::EnableSystemButtons() {
|
void EmulatedController::EnableSystemButtons() {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
system_buttons_enabled = true;
|
system_buttons_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::DisableSystemButtons() {
|
void EmulatedController::DisableSystemButtons() {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
system_buttons_enabled = false;
|
system_buttons_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::ResetSystemButtons() {
|
void EmulatedController::ResetSystemButtons() {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
controller.home_button_state.home.Assign(false);
|
controller.home_button_state.home.Assign(false);
|
||||||
controller.capture_button_state.capture.Assign(false);
|
controller.capture_button_state.capture.Assign(false);
|
||||||
}
|
}
|
||||||
|
@ -946,7 +946,7 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const {
|
bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NpadStyleIndex::ProController:
|
case NpadStyleIndex::ProController:
|
||||||
|
@ -962,7 +962,7 @@ bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
|
bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NpadStyleIndex::ProController:
|
case NpadStyleIndex::ProController:
|
||||||
|
@ -1002,6 +1002,7 @@ void EmulatedController::Connect(bool use_temporary_value) {
|
||||||
std::unique_lock lock{mutex};
|
std::unique_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
tmp_is_connected = true;
|
tmp_is_connected = true;
|
||||||
|
lock.unlock();
|
||||||
TriggerOnChange(ControllerTriggerType::Connected, false);
|
TriggerOnChange(ControllerTriggerType::Connected, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1035,7 @@ void EmulatedController::Disconnect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::IsConnected(bool get_temporary_value) const {
|
bool EmulatedController::IsConnected(bool get_temporary_value) const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (get_temporary_value && is_configuring) {
|
if (get_temporary_value && is_configuring) {
|
||||||
return tmp_is_connected;
|
return tmp_is_connected;
|
||||||
}
|
}
|
||||||
|
@ -1048,12 +1049,12 @@ bool EmulatedController::IsVibrationEnabled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadIdType EmulatedController::GetNpadIdType() const {
|
NpadIdType EmulatedController::GetNpadIdType() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return npad_id_type;
|
return npad_id_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const {
|
NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (get_temporary_value && is_configuring) {
|
if (get_temporary_value && is_configuring) {
|
||||||
return tmp_npad_type;
|
return tmp_npad_type;
|
||||||
}
|
}
|
||||||
|
@ -1110,37 +1111,37 @@ LedPattern EmulatedController::GetLedPattern() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonValues EmulatedController::GetButtonsValues() const {
|
ButtonValues EmulatedController::GetButtonsValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.button_values;
|
return controller.button_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
SticksValues EmulatedController::GetSticksValues() const {
|
SticksValues EmulatedController::GetSticksValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.stick_values;
|
return controller.stick_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerValues EmulatedController::GetTriggersValues() const {
|
TriggerValues EmulatedController::GetTriggersValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.trigger_values;
|
return controller.trigger_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerMotionValues EmulatedController::GetMotionValues() const {
|
ControllerMotionValues EmulatedController::GetMotionValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.motion_values;
|
return controller.motion_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorValues EmulatedController::GetColorsValues() const {
|
ColorValues EmulatedController::GetColorsValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.color_values;
|
return controller.color_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
BatteryValues EmulatedController::GetBatteryValues() const {
|
BatteryValues EmulatedController::GetBatteryValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.battery_values;
|
return controller.battery_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeButtonState EmulatedController::GetHomeButtons() const {
|
HomeButtonState EmulatedController::GetHomeButtons() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1149,7 @@ HomeButtonState EmulatedController::GetHomeButtons() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
CaptureButtonState EmulatedController::GetCaptureButtons() const {
|
CaptureButtonState EmulatedController::GetCaptureButtons() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1157,7 @@ CaptureButtonState EmulatedController::GetCaptureButtons() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadButtonState EmulatedController::GetNpadButtons() const {
|
NpadButtonState EmulatedController::GetNpadButtons() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1165,7 @@ NpadButtonState EmulatedController::GetNpadButtons() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugPadButton EmulatedController::GetDebugPadButtons() const {
|
DebugPadButton EmulatedController::GetDebugPadButtons() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1172,7 +1173,7 @@ DebugPadButton EmulatedController::GetDebugPadButtons() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalogSticks EmulatedController::GetSticks() const {
|
AnalogSticks EmulatedController::GetSticks() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1188,7 @@ AnalogSticks EmulatedController::GetSticks() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadGcTriggerState EmulatedController::GetTriggers() const {
|
NpadGcTriggerState EmulatedController::GetTriggers() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -1195,7 +1196,7 @@ NpadGcTriggerState EmulatedController::GetTriggers() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionState EmulatedController::GetMotions() const {
|
MotionState EmulatedController::GetMotions() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
if (force_update_motion) {
|
if (force_update_motion) {
|
||||||
for (auto& device : motion_devices) {
|
for (auto& device : motion_devices) {
|
||||||
if (!device) {
|
if (!device) {
|
||||||
|
@ -1208,17 +1209,17 @@ MotionState EmulatedController::GetMotions() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerColors EmulatedController::GetColors() const {
|
ControllerColors EmulatedController::GetColors() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.colors_state;
|
return controller.colors_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
BatteryLevelState EmulatedController::GetBattery() const {
|
BatteryLevelState EmulatedController::GetBattery() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return controller.battery_state;
|
return controller.battery_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) {
|
void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
for (const auto& poller_pair : callback_list) {
|
for (const auto& poller_pair : callback_list) {
|
||||||
const ControllerUpdateCallback& poller = poller_pair.second;
|
const ControllerUpdateCallback& poller = poller_pair.second;
|
||||||
if (!is_npad_service_update && poller.is_npad_service) {
|
if (!is_npad_service_update && poller.is_npad_service) {
|
||||||
|
@ -1231,13 +1232,13 @@ void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npa
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) {
|
int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
callback_list.insert_or_assign(last_callback_key, std::move(update_callback));
|
callback_list.insert_or_assign(last_callback_key, std::move(update_callback));
|
||||||
return last_callback_key++;
|
return last_callback_key++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::DeleteCallback(int key) {
|
void EmulatedController::DeleteCallback(int key) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
const auto& iterator = callback_list.find(key);
|
const auto& iterator = callback_list.find(key);
|
||||||
if (iterator == callback_list.end()) {
|
if (iterator == callback_list.end()) {
|
||||||
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
||||||
|
|
|
@ -448,17 +448,17 @@ void EmulatedDevices::SetRingAnalog(const Common::Input::CallbackStatus& callbac
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardValues EmulatedDevices::GetKeyboardValues() const {
|
KeyboardValues EmulatedDevices::GetKeyboardValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.keyboard_values;
|
return device_status.keyboard_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardModifierValues EmulatedDevices::GetKeyboardModdifierValues() const {
|
KeyboardModifierValues EmulatedDevices::GetKeyboardModdifierValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.keyboard_moddifier_values;
|
return device_status.keyboard_moddifier_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseButtonValues EmulatedDevices::GetMouseButtonsValues() const {
|
MouseButtonValues EmulatedDevices::GetMouseButtonsValues() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.mouse_button_values;
|
return device_status.mouse_button_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,27 +467,27 @@ RingAnalogValue EmulatedDevices::GetRingSensorValues() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardKey EmulatedDevices::GetKeyboard() const {
|
KeyboardKey EmulatedDevices::GetKeyboard() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.keyboard_state;
|
return device_status.keyboard_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardModifier EmulatedDevices::GetKeyboardModifier() const {
|
KeyboardModifier EmulatedDevices::GetKeyboardModifier() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.keyboard_moddifier_state;
|
return device_status.keyboard_moddifier_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseButton EmulatedDevices::GetMouseButtons() const {
|
MouseButton EmulatedDevices::GetMouseButtons() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.mouse_button_state;
|
return device_status.mouse_button_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
MousePosition EmulatedDevices::GetMousePosition() const {
|
MousePosition EmulatedDevices::GetMousePosition() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.mouse_position_state;
|
return device_status.mouse_position_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalogStickState EmulatedDevices::GetMouseWheel() const {
|
AnalogStickState EmulatedDevices::GetMouseWheel() const {
|
||||||
std::lock_guard lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
return device_status.mouse_wheel_state;
|
return device_status.mouse_wheel_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ RingSensorForce EmulatedDevices::GetRingSensorForce() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) {
|
void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
for (const auto& poller_pair : callback_list) {
|
for (const auto& poller_pair : callback_list) {
|
||||||
const InterfaceUpdateCallback& poller = poller_pair.second;
|
const InterfaceUpdateCallback& poller = poller_pair.second;
|
||||||
if (poller.on_change) {
|
if (poller.on_change) {
|
||||||
|
@ -506,13 +506,13 @@ void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) {
|
int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
callback_list.insert_or_assign(last_callback_key, std::move(update_callback));
|
callback_list.insert_or_assign(last_callback_key, std::move(update_callback));
|
||||||
return last_callback_key++;
|
return last_callback_key++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedDevices::DeleteCallback(int key) {
|
void EmulatedDevices::DeleteCallback(int key) {
|
||||||
std::lock_guard lock{callback_mutex};
|
std::scoped_lock lock{callback_mutex};
|
||||||
const auto& iterator = callback_list.find(key);
|
const auto& iterator = callback_list.find(key);
|
||||||
if (iterator == callback_list.end()) {
|
if (iterator == callback_list.end()) {
|
||||||
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
// Parts of this implementation were base on:
|
// Parts of this implementation were base on:
|
||||||
// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/libs/gui/IGraphicBufferProducer.cpp
|
// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/libs/gui/IGraphicBufferProducer.cpp
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core/hle/service/nvflinger/graphic_buffer_producer.h"
|
#include "core/hle/service/nvflinger/graphic_buffer_producer.h"
|
||||||
#include "core/hle/service/nvflinger/parcel.h"
|
#include "core/hle/service/nvflinger/parcel.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue