early-access version 2183

This commit is contained in:
pineappleEA 2021-11-04 16:14:42 +01:00
parent ba74a2d4fe
commit 01c118674c
14 changed files with 58 additions and 101 deletions

View file

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

View file

@ -15,6 +15,7 @@
namespace Common::Input { namespace Common::Input {
// Type of data that is expected to recieve or send
enum class InputType { enum class InputType {
None, None,
Battery, Battery,
@ -30,6 +31,7 @@ enum class InputType {
Ir, Ir,
}; };
// Internal battery charge level
enum class BatteryLevel : u32 { enum class BatteryLevel : u32 {
None, None,
Empty, Empty,
@ -41,13 +43,17 @@ enum class BatteryLevel : u32 {
}; };
enum class PollingMode { enum class PollingMode {
// Constant polling of buttons, analogs and motion data
Active, Active,
// Only update on button change, digital analogs
Pasive, Pasive,
Camera, // Enable near field communication polling
NCF, NFC,
// Enable infrared camera polling
IR, IR,
}; };
// Vibration reply from the controller
enum class VibrationError { enum class VibrationError {
None, None,
NotSupported, NotSupported,
@ -55,6 +61,7 @@ enum class VibrationError {
Unknown, Unknown,
}; };
// Polling mode reply from the controller
enum class PollingError { enum class PollingError {
None, None,
NotSupported, NotSupported,
@ -67,20 +74,28 @@ enum class VibrationAmplificationType {
Exponential, Exponential,
}; };
// Analog properties for calibration
struct AnalogProperties { struct AnalogProperties {
// Anything below this value will be detected as zero
float deadzone{}; float deadzone{};
// Anyting above this values will be detected as one
float range{1.0f}; float range{1.0f};
// Minimum value to be detected as active
float threshold{0.5f}; float threshold{0.5f};
// Drift correction applied to the raw data
float offset{}; float offset{};
// Invert direction of the sensor data
bool inverted{}; bool inverted{};
}; };
// Single analog sensor data
struct AnalogStatus { struct AnalogStatus {
float value{}; float value{};
float raw_value{}; float raw_value{};
AnalogProperties properties{}; AnalogProperties properties{};
}; };
// Button data
struct ButtonStatus { struct ButtonStatus {
Common::UUID uuid{}; Common::UUID uuid{};
bool value{}; bool value{};
@ -89,8 +104,10 @@ struct ButtonStatus {
bool locked{}; bool locked{};
}; };
// Internal battery data
using BatteryStatus = BatteryLevel; using BatteryStatus = BatteryLevel;
// Analog and digital joystick data
struct StickStatus { struct StickStatus {
Common::UUID uuid{}; Common::UUID uuid{};
AnalogStatus x{}; AnalogStatus x{};
@ -101,18 +118,21 @@ struct StickStatus {
bool down{}; bool down{};
}; };
// Analog and digital trigger data
struct TriggerStatus { struct TriggerStatus {
Common::UUID uuid{}; Common::UUID uuid{};
AnalogStatus analog{}; AnalogStatus analog{};
ButtonStatus pressed{}; ButtonStatus pressed{};
}; };
// 3D vector representing motion input
struct MotionSensor { struct MotionSensor {
AnalogStatus x{}; AnalogStatus x{};
AnalogStatus y{}; AnalogStatus y{};
AnalogStatus z{}; AnalogStatus z{};
}; };
// Motion data used to calculate controller orientation
struct MotionStatus { struct MotionStatus {
// Gyroscope vector measurement in radians/s. // Gyroscope vector measurement in radians/s.
MotionSensor gyro{}; MotionSensor gyro{};
@ -124,6 +144,7 @@ struct MotionStatus {
bool force_update{}; bool force_update{};
}; };
// Data of a single point on a touch screen
struct TouchStatus { struct TouchStatus {
ButtonStatus pressed{}; ButtonStatus pressed{};
AnalogStatus x{}; AnalogStatus x{};
@ -131,11 +152,13 @@ struct TouchStatus {
int id{}; int id{};
}; };
// Physical controller color in RGB format
struct BodyColorStatus { struct BodyColorStatus {
u32 body{}; u32 body{};
u32 buttons{}; u32 buttons{};
}; };
// HD rumble data
struct VibrationStatus { struct VibrationStatus {
f32 low_amplitude{}; f32 low_amplitude{};
f32 low_frequency{}; f32 low_frequency{};
@ -144,6 +167,7 @@ struct VibrationStatus {
VibrationAmplificationType type; VibrationAmplificationType type;
}; };
// Physical controller LED pattern
struct LedStatus { struct LedStatus {
bool led_1{}; bool led_1{};
bool led_2{}; bool led_2{};
@ -151,6 +175,7 @@ struct LedStatus {
bool led_4{}; bool led_4{};
}; };
// Callback data consisting of an input type and the equivalent data status
struct CallbackStatus { struct CallbackStatus {
InputType type{InputType::None}; InputType type{InputType::None};
ButtonStatus button_status{}; ButtonStatus button_status{};
@ -164,6 +189,7 @@ struct CallbackStatus {
VibrationStatus vibration_status{}; VibrationStatus vibration_status{};
}; };
// Triggered once every input change
struct InputCallback { struct InputCallback {
std::function<void(CallbackStatus)> on_change; std::function<void(CallbackStatus)> on_change;
}; };
@ -178,15 +204,17 @@ public:
return; return;
} }
// Force input device to update data regarless of the current state // Force input device to update data regardless of the current state
virtual void ForceUpdate() { virtual void ForceUpdate() {
return; return;
} }
// Sets the function to be triggered when input changes
void SetCallback(InputCallback callback_) { void SetCallback(InputCallback callback_) {
callback = std::move(callback_); callback = std::move(callback_);
} }
// Triggers the function set in the callback
void TriggerOnChange(CallbackStatus status) { void TriggerOnChange(CallbackStatus status) {
if (callback.on_change) { if (callback.on_change) {
callback.on_change(status); callback.on_change(status);

View file

@ -559,8 +559,6 @@ struct Values {
Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"};
Setting<bool> motion_enabled{true, "motion_enabled"}; Setting<bool> motion_enabled{true, "motion_enabled"};
BasicSetting<std::string> motion_device{"engine:motion_emu,update_period:100,sensitivity:0.01",
"motion_device"};
BasicSetting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; BasicSetting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"};
BasicSetting<bool> pause_tas_on_load{true, "pause_tas_on_load"}; BasicSetting<bool> pause_tas_on_load{true, "pause_tas_on_load"};
@ -583,7 +581,6 @@ struct Values {
TouchscreenInput touchscreen; TouchscreenInput touchscreen;
BasicSetting<bool> use_touch_from_button{false, "use_touch_from_button"};
BasicSetting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", BasicSetting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850",
"touch_device"}; "touch_device"};
BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"}; BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"};

View file

@ -11,7 +11,7 @@ EmulatedConsole::EmulatedConsole() = default;
EmulatedConsole::~EmulatedConsole() = default; EmulatedConsole::~EmulatedConsole() = default;
void EmulatedConsole::ReloadFromSettings() { void EmulatedConsole::ReloadFromSettings() {
// Using first motion device from player 1. No need to assign a special config at the moment // Using first motion device from player 1. No need to assign any unique config at the moment
const auto& player = Settings::values.players.GetValue()[0]; const auto& player = Settings::values.players.GetValue()[0];
motion_params = Common::ParamPackage(player.motions[0]); motion_params = Common::ParamPackage(player.motions[0]);
@ -33,6 +33,7 @@ void EmulatedConsole::SetTouchParams() {
static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue());
const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons; const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons;
// Map the rest of the fingers from touch from button configuration
for (const auto& config_entry : touch_buttons) { for (const auto& config_entry : touch_buttons) {
Common::ParamPackage params{config_entry}; Common::ParamPackage params{config_entry};
Common::ParamPackage touch_button_params; Common::ParamPackage touch_button_params;
@ -54,7 +55,9 @@ void EmulatedConsole::SetTouchParams() {
} }
void EmulatedConsole::ReloadInput() { void EmulatedConsole::ReloadInput() {
// If you load any device here add the equivalent to the UnloadInput() function
SetTouchParams(); SetTouchParams();
motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params); motion_devices = Common::Input::CreateDevice<Common::Input::InputDevice>(motion_params);
if (motion_devices) { if (motion_devices) {
Common::Input::InputCallback motion_callback{ Common::Input::InputCallback motion_callback{
@ -62,6 +65,7 @@ void EmulatedConsole::ReloadInput() {
motion_devices->SetCallback(motion_callback); motion_devices->SetCallback(motion_callback);
} }
// Unique index for identifying touch device source
std::size_t index = 0; std::size_t index = 0;
for (auto& touch_device : touch_devices) { for (auto& touch_device : touch_devices) {
touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]); touch_device = Common::Input::CreateDevice<Common::Input::InputDevice>(touch_params[index]);

View file

@ -826,6 +826,13 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
rb.Push(is_locked); rb.Push(is_locked);
} }
void Module::Interface::Unknown160(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
Common::UUID user_id = rp.PopRaw<Common::UUID>(); Common::UUID user_id = rp.PopRaw<Common::UUID>();

View file

@ -33,6 +33,7 @@ public:
void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx);
void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx);
void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx); void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx);
void Unknown160(Kernel::HLERequestContext& ctx);
void GetProfileEditor(Kernel::HLERequestContext& ctx); void GetProfileEditor(Kernel::HLERequestContext& ctx);
void ListQualifiedUsers(Kernel::HLERequestContext& ctx); void ListQualifiedUsers(Kernel::HLERequestContext& ctx);
void LoadOpenContext(Kernel::HLERequestContext& ctx); void LoadOpenContext(Kernel::HLERequestContext& ctx);

View file

@ -34,6 +34,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager>
{140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+ {140, &ACC_U0::InitializeApplicationInfoRestricted, "InitializeApplicationInfoRestricted"}, // 6.0.0+
{141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ {141, &ACC_U0::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+
{150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+ {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, // 6.0.0+
{160, &ACC_U0::Unknown160, "Unknown160"},
}; };
// clang-format on // clang-format on

View file

@ -606,6 +606,8 @@ public:
.raw_value = input_engine->GetAxis(identifier, axis_z), .raw_value = input_engine->GetAxis(identifier, axis_z),
.properties = properties_z, .properties = properties_z,
}; };
status.delta_timestamp = 5000;
status.force_update = true;
return status; return status;
} }

View file

@ -328,7 +328,6 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
} }
if (IsLegacyAttribute(attr)) { if (IsLegacyAttribute(attr)) {
if (attr == IR::Attribute::FogCoordinate) { if (attr == IR::Attribute::FogCoordinate) {
LOG_WARNING(Shader_SPIRV, "Get FogCoordinate Attribute called");
const Id attr_ptr{AttrPointer(ctx, ctx.input_f32, vertex, const Id attr_ptr{AttrPointer(ctx, ctx.input_f32, vertex,
ctx.InputLegacyAttribute(attr), ctx.Const(0u))}; ctx.InputLegacyAttribute(attr), ctx.Const(0u))};
return ctx.OpLoad(ctx.F32[1], attr_ptr); return ctx.OpLoad(ctx.F32[1], attr_ptr);

View file

@ -623,9 +623,7 @@ void Config::ReadMotionTouchValues() {
} }
qt_config->endArray(); qt_config->endArray();
ReadBasicSetting(Settings::values.motion_device);
ReadBasicSetting(Settings::values.touch_device); ReadBasicSetting(Settings::values.touch_device);
ReadBasicSetting(Settings::values.use_touch_from_button);
ReadBasicSetting(Settings::values.touch_from_button_map_index); ReadBasicSetting(Settings::values.touch_from_button_map_index);
Settings::values.touch_from_button_map_index = std::clamp( Settings::values.touch_from_button_map_index = std::clamp(
Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1);
@ -1131,9 +1129,7 @@ void Config::SaveTouchscreenValues() {
} }
void Config::SaveMotionTouchValues() { void Config::SaveMotionTouchValues() {
WriteBasicSetting(Settings::values.motion_device);
WriteBasicSetting(Settings::values.touch_device); WriteBasicSetting(Settings::values.touch_device);
WriteBasicSetting(Settings::values.use_touch_from_button);
WriteBasicSetting(Settings::values.touch_from_button_map_index); WriteBasicSetting(Settings::values.touch_from_button_map_index);
WriteBasicSetting(Settings::values.udp_input_servers); WriteBasicSetting(Settings::values.udp_input_servers);

View file

@ -93,6 +93,7 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
"using-a-controller-or-android-phone-for-motion-or-touch-input'><span " "using-a-controller-or-android-phone-for-motion-or-touch-input'><span "
"style=\"text-decoration: underline; color:#039be5;\">Learn More</span></a>")); "style=\"text-decoration: underline; color:#039be5;\">Learn More</span></a>"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
SetConfiguration(); SetConfiguration();
UpdateUiDisplay(); UpdateUiDisplay();
ConnectEvents(); ConnectEvents();
@ -101,17 +102,14 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
ConfigureMotionTouch::~ConfigureMotionTouch() = default; ConfigureMotionTouch::~ConfigureMotionTouch() = default;
void ConfigureMotionTouch::SetConfiguration() { void ConfigureMotionTouch::SetConfiguration() {
const Common::ParamPackage motion_param(Settings::values.motion_device.GetValue());
const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue());
ui->touch_from_button_checkbox->setChecked(Settings::values.use_touch_from_button.GetValue());
touch_from_button_maps = Settings::values.touch_from_button_maps; touch_from_button_maps = Settings::values.touch_from_button_maps;
for (const auto& touch_map : touch_from_button_maps) { for (const auto& touch_map : touch_from_button_maps) {
ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name)); ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name));
} }
ui->touch_from_button_map->setCurrentIndex( ui->touch_from_button_map->setCurrentIndex(
Settings::values.touch_from_button_map_index.GetValue()); Settings::values.touch_from_button_map_index.GetValue());
ui->motion_sensitivity->setValue(motion_param.Get("sensitivity", 0.01f));
min_x = touch_param.Get("min_x", 100); min_x = touch_param.Get("min_x", 100);
min_y = touch_param.Get("min_y", 50); min_y = touch_param.Get("min_y", 50);
@ -139,9 +137,6 @@ void ConfigureMotionTouch::SetConfiguration() {
void ConfigureMotionTouch::UpdateUiDisplay() { void ConfigureMotionTouch::UpdateUiDisplay() {
const QString cemuhook_udp = QStringLiteral("cemuhookudp"); const QString cemuhook_udp = QStringLiteral("cemuhookudp");
ui->motion_sensitivity_label->setVisible(true);
ui->motion_sensitivity->setVisible(true);
ui->touch_calibration->setVisible(true); ui->touch_calibration->setVisible(true);
ui->touch_calibration_config->setVisible(true); ui->touch_calibration_config->setVisible(true);
ui->touch_calibration_label->setVisible(true); ui->touch_calibration_label->setVisible(true);
@ -312,7 +307,6 @@ void ConfigureMotionTouch::ApplyConfiguration() {
touch_param.Set("max_y", max_y); touch_param.Set("max_y", max_y);
Settings::values.touch_device = touch_param.Serialize(); Settings::values.touch_device = touch_param.Serialize();
Settings::values.use_touch_from_button = ui->touch_from_button_checkbox->isChecked();
Settings::values.touch_from_button_map_index = ui->touch_from_button_map->currentIndex(); Settings::values.touch_from_button_map_index = ui->touch_from_button_map->currentIndex();
Settings::values.touch_from_button_maps = touch_from_button_maps; Settings::values.touch_from_button_maps = touch_from_button_maps;
Settings::values.udp_input_servers = GetUDPServerString(); Settings::values.udp_input_servers = GetUDPServerString();

View file

@ -2,14 +2,6 @@
<ui version="4.0"> <ui version="4.0">
<class>ConfigureMotionTouch</class> <class>ConfigureMotionTouch</class>
<widget class="QDialog" name="ConfigureMotionTouch"> <widget class="QDialog" name="ConfigureMotionTouch">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>482</height>
</rect>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Configure Motion / Touch</string> <string>Configure Motion / Touch</string>
</property> </property>
@ -17,48 +9,6 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="motion_group_box">
<property name="title">
<string>Mouse Motion</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="motion_sensitivity_label">
<property name="text">
<string>Sensitivity:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="motion_sensitivity">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="touch_group_box"> <widget class="QGroupBox" name="touch_group_box">
<property name="title"> <property name="title">
@ -101,19 +51,13 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout"> <layout class="QHBoxLayout">
<item> <item>
<widget class="QCheckBox" name="touch_from_button_checkbox"> <widget class="QLabel" name="touch_from_button_label">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <string>Touch from button profile:</string>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </widget>
</sizepolicy> </item>
</property>
<property name="text">
<string>Use button mapping:</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QComboBox" name="touch_from_button_map"/> <widget class="QComboBox" name="touch_from_button_map"/>
</item> </item>

View file

@ -292,8 +292,6 @@ void Config::ReadValues() {
Settings::values.mouse_buttons[i] = default_param; Settings::values.mouse_buttons[i] = default_param;
} }
ReadSetting("ControlsGeneral", Settings::values.motion_device);
ReadSetting("ControlsGeneral", Settings::values.touch_device); ReadSetting("ControlsGeneral", Settings::values.touch_device);
ReadSetting("ControlsGeneral", Settings::values.keyboard_enabled); ReadSetting("ControlsGeneral", Settings::values.keyboard_enabled);
@ -362,7 +360,6 @@ void Config::ReadValues() {
Settings::TouchFromButtonMap{"default", {}}); Settings::TouchFromButtonMap{"default", {}});
num_touch_from_button_maps = 1; num_touch_from_button_maps = 1;
} }
ReadSetting("ControlsGeneral", Settings::values.use_touch_from_button);
Settings::values.touch_from_button_map_index = std::clamp( Settings::values.touch_from_button_map_index = std::clamp(
Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1); Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1);

View file

@ -84,23 +84,10 @@ enable_accurate_vibrations=
# 0: Disabled, 1 (default): Enabled # 0: Disabled, 1 (default): Enabled
motion_enabled = motion_enabled =
# for motion input, the following devices are available: # Defines the udp device's touch screen coordinate system for cemuhookudp devices
# - "motion_emu" (default) for emulating motion input from mouse input. Required parameters: # - "min_x", "min_y", "max_x", "max_y"
# - "update_period": update period in milliseconds (default to 100)
# - "sensitivity": the coefficient converting mouse movement to tilting angle (default to 0.01)
# - "cemuhookudp" reads motion input from a udp server that uses cemuhook's udp protocol
motion_device=
# for touch input, the following devices are available:
# - "emu_window" (default) for emulating touch input from mouse input to the emulation window. No parameters required
# - "cemuhookudp" reads touch input from a udp server that uses cemuhook's udp protocol
# - "min_x", "min_y", "max_x", "max_y": defines the udp device's touch screen coordinate system
touch_device= touch_device=
# Whether to enable or disable touch input from button
# 0 (default): Disabled, 1: Enabled
use_touch_from_button=
# for mapping buttons to touch inputs. # for mapping buttons to touch inputs.
#touch_from_button_map=1 #touch_from_button_map=1
#touch_from_button_maps_0_name=default #touch_from_button_maps_0_name=default