summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/input.h18
-rw-r--r--src/common/x64/cpu_detect.cpp12
2 files changed, 6 insertions, 24 deletions
diff --git a/src/common/input.h b/src/common/input.h
index eaee0bdea..f775a4c01 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -227,7 +227,7 @@ struct CallbackStatus {
227 227
228// Triggered once every input change 228// Triggered once every input change
229struct InputCallback { 229struct InputCallback {
230 std::function<void(CallbackStatus)> on_change; 230 std::function<void(const CallbackStatus&)> on_change;
231}; 231};
232 232
233/// An abstract class template for an input device (a button, an analog input, etc.). 233/// An abstract class template for an input device (a button, an analog input, etc.).
@@ -236,14 +236,10 @@ public:
236 virtual ~InputDevice() = default; 236 virtual ~InputDevice() = default;
237 237
238 // Request input device to update if necessary 238 // Request input device to update if necessary
239 virtual void SoftUpdate() { 239 virtual void SoftUpdate() {}
240 return;
241 }
242 240
243 // Force input device to update data regardless of the current state 241 // Force input device to update data regardless of the current state
244 virtual void ForceUpdate() { 242 virtual void ForceUpdate() {}
245 return;
246 }
247 243
248 // Sets the function to be triggered when input changes 244 // Sets the function to be triggered when input changes
249 void SetCallback(InputCallback callback_) { 245 void SetCallback(InputCallback callback_) {
@@ -251,7 +247,7 @@ public:
251 } 247 }
252 248
253 // Triggers the function set in the callback 249 // Triggers the function set in the callback
254 void TriggerOnChange(CallbackStatus status) { 250 void TriggerOnChange(const CallbackStatus& status) {
255 if (callback.on_change) { 251 if (callback.on_change) {
256 callback.on_change(status); 252 callback.on_change(status);
257 } 253 }
@@ -266,11 +262,9 @@ class OutputDevice {
266public: 262public:
267 virtual ~OutputDevice() = default; 263 virtual ~OutputDevice() = default;
268 264
269 virtual void SetLED([[maybe_unused]] LedStatus led_status) { 265 virtual void SetLED([[maybe_unused]] const LedStatus& led_status) {}
270 return;
271 }
272 266
273 virtual VibrationError SetVibration([[maybe_unused]] VibrationStatus vibration_status) { 267 virtual VibrationError SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) {
274 return VibrationError::NotSupported; 268 return VibrationError::NotSupported;
275 } 269 }
276 270
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index fccd2eee5..fbeacc7e2 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -71,9 +71,6 @@ static CPUCaps Detect() {
71 else 71 else
72 caps.manufacturer = Manufacturer::Unknown; 72 caps.manufacturer = Manufacturer::Unknown;
73 73
74 u32 family = {};
75 u32 model = {};
76
77 __cpuid(cpu_id, 0x80000000); 74 __cpuid(cpu_id, 0x80000000);
78 75
79 u32 max_ex_fn = cpu_id[0]; 76 u32 max_ex_fn = cpu_id[0];
@@ -84,15 +81,6 @@ static CPUCaps Detect() {
84 // Detect family and other miscellaneous features 81 // Detect family and other miscellaneous features
85 if (max_std_fn >= 1) { 82 if (max_std_fn >= 1) {
86 __cpuid(cpu_id, 0x00000001); 83 __cpuid(cpu_id, 0x00000001);
87 family = (cpu_id[0] >> 8) & 0xf;
88 model = (cpu_id[0] >> 4) & 0xf;
89 if (family == 0xf) {
90 family += (cpu_id[0] >> 20) & 0xff;
91 }
92 if (family >= 6) {
93 model += ((cpu_id[0] >> 16) & 0xf) << 4;
94 }
95
96 if ((cpu_id[3] >> 25) & 1) 84 if ((cpu_id[3] >> 25) & 1)
97 caps.sse = true; 85 caps.sse = true;
98 if ((cpu_id[3] >> 26) & 1) 86 if ((cpu_id[3] >> 26) & 1)