This commit is contained in:
Rim 2025-04-23 20:40:58 -04:00
parent acef9ed154
commit 3a5edef9e9
25 changed files with 8340 additions and 7939 deletions

6
app.js
View File

@ -20,8 +20,7 @@ const mimeTypes = {
".txt": "text/plain",
};
http
.createServer((req, res) => {
http.createServer((req, res) => {
// Parse the URL and extract just the pathname, ignoring query parameters
const parsedUrl = url.parse(req.url);
let filePath = "." + decodeURIComponent(parsedUrl.pathname);
@ -39,7 +38,6 @@ http
res.end(content);
}
});
})
.listen(port, host, () => {
}).listen(port, host, () => {
console.log(`Server running at http://${host}:${port}/`);
});

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,11 @@ var available_langs = {
ko_kr: { name: "한국어", file: "ko_kr.json", direction: "ltr" },
nl_nl: { name: "Nederlands", file: "nl_nl.json", direction: "ltr" },
pl_pl: { name: "Polski", file: "pl_pl.json", direction: "ltr" },
pt_br: { name: "Português do Brasil", file: "pt_br.json", direction: "ltr" },
pt_br: {
name: "Português do Brasil",
file: "pt_br.json",
direction: "ltr",
},
pt_pt: { name: "Português", file: "pt_pt.json", direction: "ltr" },
rs_rs: { name: "Srpski", file: "rs_rs.json", direction: "ltr" },
ru_ru: { name: "Русский", file: "ru_ru.json", direction: "ltr" },
@ -423,10 +427,23 @@ async function ds4_calibrate_sticks() {
) {
d1 = dec2hex32(data.getUint32(0, false));
d2 = dec2hex32(data2.getUint32(0, false));
la("ds4_calibrate_sticks_failed", { s: 2, i: i, d1: d1, d2: d2 });
la("ds4_calibrate_sticks_failed", {
s: 2,
i: i,
d1: d1,
d2: d2,
});
close_calibrate_window();
return show_popup(
err + l("Error 2") + " (" + d1 + ", " + d2 + " at i=" + i + ")",
err +
l("Error 2") +
" (" +
d1 +
", " +
d2 +
" at i=" +
i +
")",
);
}
@ -468,13 +485,19 @@ async function ds4_nvstatus() {
// 1: temporary, 0: permanent
ret = data.getUint8(1, false);
if (ret == 1) {
$("#d-nvstatus").html("<font color='green'>" + l("locked") + "</font>");
$("#d-nvstatus").html(
"<font color='green'>" + l("locked") + "</font>",
);
return 1;
} else if (ret == 0) {
$("#d-nvstatus").html("<font color='red'>" + l("unlocked") + "</font>");
$("#d-nvstatus").html(
"<font color='red'>" + l("unlocked") + "</font>",
);
return 0;
} else {
$("#d-nvstatus").html("<font color='purple'>unk " + ret + "</font>");
$("#d-nvstatus").html(
"<font color='purple'>unk " + ret + "</font>",
);
if (ret == 0 || ret == 1) return 2;
return ret;
}
@ -494,10 +517,14 @@ async function ds5_nvstatus() {
return 4;
}
if (ret == 0x03030201) {
$("#d-nvstatus").html("<font color='green'>" + l("locked") + "</font>");
$("#d-nvstatus").html(
"<font color='green'>" + l("locked") + "</font>",
);
return 1; // temporary
} else if (ret == 0x03030200) {
$("#d-nvstatus").html("<font color='red'>" + l("unlocked") + "</font>");
$("#d-nvstatus").html(
"<font color='red'>" + l("unlocked") + "</font>",
);
return 0; // permanent
} else {
$("#d-nvstatus").html(
@ -565,7 +592,9 @@ async function ds5_system_info(base, num, length, decode = true) {
return l("error");
} else {
if (decode)
return new TextDecoder().decode(pcba_id.buffer.slice(4, 4 + length));
return new TextDecoder().decode(
pcba_id.buffer.slice(4, 4 + length),
);
else return buf2hex(pcba_id.buffer.slice(4, 4 + length));
}
return l("Unknown");
@ -586,7 +615,9 @@ async function ds5_info() {
var hwinfo = view.getUint32(24, true);
var fwversion = view.getUint32(28, true);
var deviceinfo = new TextDecoder().decode(view.buffer.slice(32, 32 + 12));
var deviceinfo = new TextDecoder().decode(
view.buffer.slice(32, 32 + 12),
);
var updversion = view.getUint16(44, true);
var unk = view.getUint8(46, true);
@ -631,7 +662,11 @@ async function ds5_info() {
append_info(l("FW Version"), "0x" + dec2hex32(fwversion), "fw");
append_info(l("FW Update"), "0x" + dec2hex(updversion), "fw");
append_info_extra(l("FW Update Info"), "0x" + dec2hex8(unk), "fw");
append_info_extra(l("SBL FW Version"), "0x" + dec2hex32(fwversion1), "fw");
append_info_extra(
l("SBL FW Version"),
"0x" + dec2hex32(fwversion1),
"fw",
);
append_info_extra(
l("Venom FW Version"),
"0x" + dec2hex32(fwversion2),
@ -947,12 +982,18 @@ async function ds5_edge_flash_modules() {
modal.show();
if (device != null) {
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 6, 0, 11]));
await device.sendFeatureReport(
0x80,
alloc_req(0x80, [21, 6, 0, 11]),
);
await new Promise((r) => setTimeout(r, 200));
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 0]));
await new Promise((r) => setTimeout(r, 200));
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 6, 1, 11]));
await device.sendFeatureReport(
0x80,
alloc_req(0x80, [21, 6, 1, 11]),
);
await new Promise((r) => setTimeout(r, 200));
await device.sendFeatureReport(0x80, alloc_req(0x80, [21, 5, 1]));
await new Promise((r) => setTimeout(r, 200));
@ -1142,7 +1183,10 @@ async function ds5_finetune() {
data = await read_finetune_data();
if (data == null) return;
curModal = new bootstrap.Modal(document.getElementById("finetuneModal"), {});
curModal = new bootstrap.Modal(
document.getElementById("finetuneModal"),
{},
);
curModal.show();
list = [
@ -1335,10 +1379,13 @@ function refresh_stick_pos() {
function cc_to_color(cc) {
var dd = Math.sqrt(Math.pow(1.0 - cc, 2));
if (cc <= 1.0) hh = 220 - 220 * Math.min(1.0, Math.max(0, dd - 0.05) / 0.1);
if (cc <= 1.0)
hh = 220 - 220 * Math.min(1.0, Math.max(0, dd - 0.05) / 0.1);
else
hh =
(245 + (360 - 245) * Math.min(1.0, Math.max(0, dd - 0.05) / 0.15)) %
(245 +
(360 - 245) *
Math.min(1.0, Math.max(0, dd - 0.05) / 0.15)) %
360;
return hh;
}
@ -1430,7 +1477,9 @@ function refresh_stick_pos() {
if (enable_circ_test) {
var pld = Math.sqrt(plx * plx + ply * ply);
var pla =
(parseInt(Math.round((Math.atan2(ply, plx) * MAX_N) / 2.0 / Math.PI)) +
(parseInt(
Math.round((Math.atan2(ply, plx) * MAX_N) / 2.0 / Math.PI),
) +
MAX_N) %
MAX_N;
var old = ll_data[pla];
@ -1439,7 +1488,9 @@ function refresh_stick_pos() {
var prd = Math.sqrt(prx * prx + pry * pry);
var pra =
(parseInt(Math.round((Math.atan2(pry, prx) * MAX_N) / 2.0 / Math.PI)) +
(parseInt(
Math.round((Math.atan2(pry, prx) * MAX_N) / 2.0 / Math.PI),
) +
MAX_N) %
MAX_N;
var old = rr_data[pra];
@ -1996,7 +2047,10 @@ async function multi_calibrate_sticks() {
if (mode == 0) return;
set_progress(0);
curModal = new bootstrap.Modal(document.getElementById("calibrateModal"), {});
curModal = new bootstrap.Modal(
document.getElementById("calibrateModal"),
{},
);
curModal.show();
await new Promise((r) => setTimeout(r, 1000));