Show not-genuin-sony-controller message also for DS5 when calibration can't be started

This commit is contained in:
Mathias Malmqvist
2025-10-28 01:41:36 +01:00
parent 1138440119
commit c8f7c40cb7
2 changed files with 6 additions and 6 deletions

View File

@@ -3,6 +3,8 @@
import { sleep, la } from './utils.js';
import { l } from './translations.js'
const NOT_GENUINE_SONY_CONTROLLER_MSG = "Your device might not be a genuine Sony controller. If it is not a clone then please report this issue.";
/**
* Controller Manager - Manages the current controller instance and provides unified interface
*/
@@ -211,7 +213,7 @@ class ControllerManager {
async calibrateSticksBegin() {
const res = await this.currentController.calibrateSticksBegin();
if (!res.ok) {
throw new Error(`${l("Stick calibration failed")}. ${res.error?.message}`, { cause: res.error });
throw new Error(l(NOT_GENUINE_SONY_CONTROLLER_MSG), { cause: res.error });
}
}
@@ -245,7 +247,7 @@ class ControllerManager {
async calibrateRangeBegin() {
const res = await this.currentController.calibrateRangeBegin();
if (!res.ok) {
throw new Error(`${l("Stick calibration failed")}. ${res.error?.message}`, { cause: res.error });
throw new Error(l(NOT_GENUINE_SONY_CONTROLLER_MSG), { cause: res.error });
}
}

View File

@@ -11,8 +11,6 @@ import {
} from '../utils.js';
import { l } from '../translations.js';
const NOT_GENUINE_SONY_CONTROLLER_MSG = "Your device might not be a genuine Sony controller. If it is not a clone then please report this issue.";
// DS4 Button mapping configuration
const DS4_BUTTON_MAP = [
{ name: 'up', byte: 4, mask: 0x0 }, // Dpad handled separately
@@ -256,7 +254,7 @@ class DS4Controller extends BaseController {
la("ds4_calibrate_range_begin_failed", {"d1": d1, "d2": d2});
return {
ok: false,
error: new Error(l(NOT_GENUINE_SONY_CONTROLLER_MSG)),
error: new Error(`Stick range calibration begin failed: ${d1}, ${d2}`),
code: 1, d1, d2
};
}
@@ -304,7 +302,7 @@ class DS4Controller extends BaseController {
la("ds4_calibrate_sticks_begin_failed", {"d1": d1, "d2": d2});
return {
ok: false,
error: new Error(l(NOT_GENUINE_SONY_CONTROLLER_MSG)),
error: new Error(`Stick center calibration begin failed: ${d1}, ${d2}`),
code: 1, d1, d2,
};
}