Fix BDAddr for DS4/DS5

This commit is contained in:
dualshock-tools 2024-04-17 21:50:00 +02:00
parent 75177f7072
commit e67bb8349e

18
core.js
View File

@ -307,7 +307,19 @@ async function ds5_nvstatus() {
} }
async function ds4_getbdaddr() { async function ds4_getbdaddr() {
return "not implemented"; try {
data = await device.receiveFeatureReport(0x12)
out = ""
for(i=0;i<6;i++) {
if(i >= 1) out += ":";
out += dec2hex8(data.getUint8(i, false));
}
$("#d-bdaddr").text(out);
return out;
} catch(e) {
$("#d-bdaddr").html("<font color='red'>" + l("error") + "</font>");
return "error";
}
} }
async function ds5_getbdaddr() { async function ds5_getbdaddr() {
@ -317,7 +329,7 @@ async function ds5_getbdaddr() {
out = "" out = ""
for(i=0;i<6;i++) { for(i=0;i<6;i++) {
if(i >= 1) out += ":"; if(i >= 1) out += ":";
out += dec2hex8(data.getUint8(4 + i, false)); out += dec2hex8(data.getUint8(4 + 5 - i, false));
} }
$("#d-bdaddr").text(out); $("#d-bdaddr").text(out);
return out; return out;
@ -1080,6 +1092,7 @@ function lang_reset_page() {
} }
$("#authorMsg").html(""); $("#authorMsg").html("");
$("#curLang").html("English"); $("#curLang").html("English");
document.title = lang_orig_text[".title"];
} }
function l(text) { function l(text) {
@ -1120,6 +1133,7 @@ function lang_translate(target_file, target_lang) {
$(item).html(tnew[0]); $(item).html(tnew[0]);
} else { } else {
console.log("Cannot find mapping for " + old); console.log("Cannot find mapping for " + old);
$(item).html(old);
} }
} }
var old_title = lang_orig_text[".title"]; var old_title = lang_orig_text[".title"];