diff options
author | pineappleEA <pineaea@gmail.com> | 2024-02-24 21:13:44 +0100 |
---|---|---|
committer | pineappleEA <pineaea@gmail.com> | 2024-02-24 21:13:44 +0100 |
commit | 0cc974af92faa015598d614f6bec7d128d714774 (patch) | |
tree | 9ea422ee3aa3d8b57b3f9fecf5951b3985fbc1ec | |
parent | 3f40adbff571ae6c5a8d398d272a54edb8b66254 (diff) |
early-access version 4166EA-4166
-rwxr-xr-x | README.md | 2 | ||||
-rwxr-xr-x | src/core/hle/service/set/setting_formats/system_settings.cpp | 4 | ||||
-rwxr-xr-x | src/core/hle/service/set/system_settings_server.cpp | 5 | ||||
-rwxr-xr-x | src/input_common/drivers/android.cpp | 41 | ||||
-rwxr-xr-x | src/input_common/drivers/android.h | 10 | ||||
-rwxr-xr-x | src/input_common/drivers/sdl_driver.h | 5 | ||||
-rwxr-xr-x | src/input_common/input_engine.h | 5 | ||||
-rwxr-xr-x | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 4 |
8 files changed, 54 insertions, 22 deletions
@@ -1,7 +1,7 @@ | |||
1 | yuzu emulator early access | 1 | yuzu emulator early access |
2 | ============= | 2 | ============= |
3 | 3 | ||
4 | This is the source code for early-access 4165. | 4 | This is the source code for early-access 4166. |
5 | 5 | ||
6 | ## Legal Notice | 6 | ## Legal Notice |
7 | 7 | ||
diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp index 7231ff78e..caa30c2d5 100755 --- a/src/core/hle/service/set/setting_formats/system_settings.cpp +++ b/src/core/hle/service/set/setting_formats/system_settings.cpp | |||
@@ -52,6 +52,10 @@ SystemSettings DefaultSystemSettings() { | |||
52 | settings.battery_percentage_flag = true; | 52 | settings.battery_percentage_flag = true; |
53 | settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0; | 53 | settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0; |
54 | settings.vibration_master_volume = 1.0f; | 54 | settings.vibration_master_volume = 1.0f; |
55 | settings.touch_screen_mode = TouchScreenMode::Standard; | ||
56 | settings.nfc_enable_flag = true; | ||
57 | settings.bluetooth_enable_flag = true; | ||
58 | settings.wireless_lan_enable_flag = true; | ||
55 | 59 | ||
56 | const auto language_code = | 60 | const auto language_code = |
57 | available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; | 61 | available_language_codes[static_cast<s32>(::Settings::values.language_index.GetValue())]; |
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp index 45def67db..6a7ea83fd 100755 --- a/src/core/hle/service/set/system_settings_server.cpp +++ b/src/core/hle/service/set/system_settings_server.cpp | |||
@@ -26,7 +26,7 @@ | |||
26 | namespace Service::Set { | 26 | namespace Service::Set { |
27 | 27 | ||
28 | namespace { | 28 | namespace { |
29 | constexpr u32 SETTINGS_VERSION{3u}; | 29 | constexpr u32 SETTINGS_VERSION{4u}; |
30 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); | 30 | constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't'); |
31 | struct SettingsHeader { | 31 | struct SettingsHeader { |
32 | u64 magic; | 32 | u64 magic; |
@@ -307,6 +307,9 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_) | |||
307 | 307 | ||
308 | SetupSettings(); | 308 | SetupSettings(); |
309 | 309 | ||
310 | m_system_settings.region_code = | ||
311 | static_cast<SystemRegionCode>(Settings::values.region_index.GetValue()); | ||
312 | |||
310 | // TODO: Remove this when starter applet is fully functional | 313 | // TODO: Remove this when starter applet is fully functional |
311 | EulaVersion eula_version{ | 314 | EulaVersion eula_version{ |
312 | .version = 0x10000, | 315 | .version = 0x10000, |
diff --git a/src/input_common/drivers/android.cpp b/src/input_common/drivers/android.cpp index e859cc538..d40fa66ae 100755 --- a/src/input_common/drivers/android.cpp +++ b/src/input_common/drivers/android.cpp | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <set> | 4 | #include <set> |
5 | #include <common/settings_input.h> | 5 | #include <common/settings_input.h> |
6 | #include <common/thread.h> | ||
6 | #include <jni.h> | 7 | #include <jni.h> |
7 | #include "common/android/android_common.h" | 8 | #include "common/android/android_common.h" |
8 | #include "common/android/id_cache.h" | 9 | #include "common/android/id_cache.h" |
@@ -10,7 +11,18 @@ | |||
10 | 11 | ||
11 | namespace InputCommon { | 12 | namespace InputCommon { |
12 | 13 | ||
13 | Android::Android(std::string input_engine_) : InputEngine(std::move(input_engine_)) {} | 14 | Android::Android(std::string input_engine_) : InputEngine(std::move(input_engine_)) { |
15 | vibration_thread = std::jthread([this](std::stop_token token) { | ||
16 | Common::SetCurrentThreadName("Android_Vibration"); | ||
17 | auto env = Common::Android::GetEnvForThread(); | ||
18 | using namespace std::chrono_literals; | ||
19 | while (!token.stop_requested()) { | ||
20 | SendVibrations(env, token); | ||
21 | } | ||
22 | }); | ||
23 | } | ||
24 | |||
25 | Android::~Android() = default; | ||
14 | 26 | ||
15 | void Android::RegisterController(jobject j_input_device) { | 27 | void Android::RegisterController(jobject j_input_device) { |
16 | auto env = Common::Android::GetEnvForThread(); | 28 | auto env = Common::Android::GetEnvForThread(); |
@@ -57,17 +69,11 @@ void Android::SetMotionState(std::string guid, size_t port, u64 delta_timestamp, | |||
57 | Common::Input::DriverResult Android::SetVibration( | 69 | Common::Input::DriverResult Android::SetVibration( |
58 | [[maybe_unused]] const PadIdentifier& identifier, | 70 | [[maybe_unused]] const PadIdentifier& identifier, |
59 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { | 71 | [[maybe_unused]] const Common::Input::VibrationStatus& vibration) { |
60 | auto device = input_devices.find(identifier); | 72 | vibration_queue.Push(VibrationRequest{ |
61 | if (device != input_devices.end()) { | 73 | .identifier = identifier, |
62 | Common::Android::RunJNIOnFiber<void>([&](JNIEnv* env) { | 74 | .vibration = vibration, |
63 | float average_intensity = | 75 | }); |
64 | static_cast<float>((vibration.high_amplitude + vibration.low_amplitude) / 2.0); | 76 | return Common::Input::DriverResult::Success; |
65 | env->CallVoidMethod(device->second, Common::Android::GetYuzuDeviceVibrate(), | ||
66 | average_intensity); | ||
67 | }); | ||
68 | return Common::Input::DriverResult::Success; | ||
69 | } | ||
70 | return Common::Input::DriverResult::NotSupported; | ||
71 | } | 77 | } |
72 | 78 | ||
73 | bool Android::IsVibrationEnabled([[maybe_unused]] const PadIdentifier& identifier) { | 79 | bool Android::IsVibrationEnabled([[maybe_unused]] const PadIdentifier& identifier) { |
@@ -347,4 +353,15 @@ PadIdentifier Android::GetIdentifier(const std::string& guid, size_t port) const | |||
347 | }; | 353 | }; |
348 | } | 354 | } |
349 | 355 | ||
356 | void Android::SendVibrations(JNIEnv* env, std::stop_token token) { | ||
357 | VibrationRequest request = vibration_queue.PopWait(token); | ||
358 | auto device = input_devices.find(request.identifier); | ||
359 | if (device != input_devices.end()) { | ||
360 | float average_intensity = static_cast<float>( | ||
361 | (request.vibration.high_amplitude + request.vibration.low_amplitude) / 2.0); | ||
362 | env->CallVoidMethod(device->second, Common::Android::GetYuzuDeviceVibrate(), | ||
363 | average_intensity); | ||
364 | } | ||
365 | } | ||
366 | |||
350 | } // namespace InputCommon | 367 | } // namespace InputCommon |
diff --git a/src/input_common/drivers/android.h b/src/input_common/drivers/android.h index 8a386c1b1..03e2b2c98 100755 --- a/src/input_common/drivers/android.h +++ b/src/input_common/drivers/android.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #pragma once | 4 | #pragma once |
5 | 5 | ||
6 | #include <set> | 6 | #include <set> |
7 | #include <common/threadsafe_queue.h> | ||
7 | #include <jni.h> | 8 | #include <jni.h> |
8 | #include "input_common/input_engine.h" | 9 | #include "input_common/input_engine.h" |
9 | 10 | ||
@@ -16,6 +17,8 @@ class Android final : public InputEngine { | |||
16 | public: | 17 | public: |
17 | explicit Android(std::string input_engine_); | 18 | explicit Android(std::string input_engine_); |
18 | 19 | ||
20 | ~Android() override; | ||
21 | |||
19 | /** | 22 | /** |
20 | * Registers controller number to accept new inputs. | 23 | * Registers controller number to accept new inputs. |
21 | * @param j_input_device YuzuInputDevice object from the Android frontend to register. | 24 | * @param j_input_device YuzuInputDevice object from the Android frontend to register. |
@@ -89,6 +92,9 @@ private: | |||
89 | /// Returns the correct identifier corresponding to the player index | 92 | /// Returns the correct identifier corresponding to the player index |
90 | PadIdentifier GetIdentifier(const std::string& guid, size_t port) const; | 93 | PadIdentifier GetIdentifier(const std::string& guid, size_t port) const; |
91 | 94 | ||
95 | /// Takes all vibrations from the queue and sends the command to the controller | ||
96 | void SendVibrations(JNIEnv* env, std::stop_token token); | ||
97 | |||
92 | static constexpr s32 AXIS_X = 0; | 98 | static constexpr s32 AXIS_X = 0; |
93 | static constexpr s32 AXIS_Y = 1; | 99 | static constexpr s32 AXIS_Y = 1; |
94 | static constexpr s32 AXIS_Z = 11; | 100 | static constexpr s32 AXIS_Z = 11; |
@@ -133,6 +139,10 @@ private: | |||
133 | redmagic_vid, backbone_labs_vid, xbox_vid}; | 139 | redmagic_vid, backbone_labs_vid, xbox_vid}; |
134 | const std::vector<std::string> flipped_xy_vids{sony_vid, razer_vid, redmagic_vid, | 140 | const std::vector<std::string> flipped_xy_vids{sony_vid, razer_vid, redmagic_vid, |
135 | backbone_labs_vid, xbox_vid}; | 141 | backbone_labs_vid, xbox_vid}; |
142 | |||
143 | /// Queue of vibration request to controllers | ||
144 | Common::SPSCQueue<VibrationRequest> vibration_queue; | ||
145 | std::jthread vibration_thread; | ||
136 | }; | 146 | }; |
137 | 147 | ||
138 | } // namespace InputCommon | 148 | } // namespace InputCommon |
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index d1cc8c34b..a77e42e74 100755 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h | |||
@@ -69,11 +69,6 @@ public: | |||
69 | bool IsVibrationEnabled(const PadIdentifier& identifier) override; | 69 | bool IsVibrationEnabled(const PadIdentifier& identifier) override; |
70 | 70 | ||
71 | private: | 71 | private: |
72 | struct VibrationRequest { | ||
73 | PadIdentifier identifier; | ||
74 | Common::Input::VibrationStatus vibration; | ||
75 | }; | ||
76 | |||
77 | void InitJoystick(int joystick_index); | 72 | void InitJoystick(int joystick_index); |
78 | void CloseJoystick(SDL_Joystick* sdl_joystick); | 73 | void CloseJoystick(SDL_Joystick* sdl_joystick); |
79 | 74 | ||
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index 706a675c0..7ac351010 100755 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
@@ -46,6 +46,11 @@ enum class EngineInputType { | |||
46 | Nfc, | 46 | Nfc, |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct VibrationRequest { | ||
50 | PadIdentifier identifier; | ||
51 | Common::Input::VibrationStatus vibration; | ||
52 | }; | ||
53 | |||
49 | namespace std { | 54 | namespace std { |
50 | // Hash used to create lists from PadIdentifier data | 55 | // Hash used to create lists from PadIdentifier data |
51 | template <> | 56 | template <> |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 90b91f0be..b11cf9acd 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
@@ -125,11 +125,9 @@ VkRect2D GetScissorState(const Maxwell& regs, size_t index, u32 up_scale = 1, u3 | |||
125 | return value < 0 ? std::min<s32>(converted_value - acumm, -1) | 125 | return value < 0 ? std::min<s32>(converted_value - acumm, -1) |
126 | : std::max<s32>(converted_value + acumm, 1); | 126 | : std::max<s32>(converted_value + acumm, 1); |
127 | }; | 127 | }; |
128 | const bool lower_left = regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft; | ||
129 | const s32 y_adj = lower_left ? scale_up(regs.surface_clip.height - (src.max_y - src.min_y)) : 0; | ||
130 | if (src.enable) { | 128 | if (src.enable) { |
131 | scissor.offset.x = scale_up(static_cast<s32>(src.min_x)); | 129 | scissor.offset.x = scale_up(static_cast<s32>(src.min_x)); |
132 | scissor.offset.y = scale_up(static_cast<s32>(src.min_y)) + y_adj; | 130 | scissor.offset.y = scale_up(static_cast<s32>(src.min_y)); |
133 | scissor.extent.width = scale_up(src.max_x - src.min_x); | 131 | scissor.extent.width = scale_up(src.max_x - src.min_x); |
134 | scissor.extent.height = scale_up(src.max_y - src.min_y); | 132 | scissor.extent.height = scale_up(src.max_y - src.min_y); |
135 | } else { | 133 | } else { |