diff --git a/KeyDecoding.js b/KeyDecoding.js index 78c02a3..3047c11 100644 --- a/KeyDecoding.js +++ b/KeyDecoding.js @@ -10,20 +10,18 @@ const bgColor = BRUCE_BGCOLOR; const priColor = BRUCE_PRICOLOR; const secColor = BRUCE_SECCOLOR; -const version = "1.14.1"; +const version = "1.15.0"; // Version erhöht für Mirror-Key Update -var logo = new Uint8Array([0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x07,0x00,0xfe,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x0f,0x00,0xcf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0e,0x00,0x87,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0c,0x00,0x83,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0e,0x00,0x87,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x0e,0x00,0xc7,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0xf8,0x07,0x00,0xfe,0x01,0xe0,0x01,0x00,0x00,0x00,0x00,0xfc,0x01,0xf0,0x03,0x00,0xfc,0x00,0xf8,0x03,0x00,0x00,0x00,0x00,0xfe,0x03,0xe0,0x07,0x00,0x7e,0x00,0xfc,0x07,0x00,0x00,0x00,0x00,0x87,0x03,0x00,0x0e,0x00,0x07,0x00,0x1c,0x0e,0x00,0x00,0x00,0x00,0x07,0x03,0x00,0x1c,0x80,0x03,0x00,0x0c,0x0e,0x00,0x00,0x00,0x00,0x07,0x03,0x00,0x38,0xc0,0x01,0x00,0x0c,0x0e,0x00,0x00,0x00,0x00,0x87,0x03,0x00,0x70,0xe0,0x00,0x00,0x1c,0x0e,0x00,0x00,0x00,0x00,0xfe,0x03,0x00,0x70,0xe0,0x00,0x00,0xfc,0x07,0x00,0x00,0x00,0x00,0xfc,0x03,0x00,0x70,0xe0,0x00,0x00,0xfc,0x03,0x00,0x00,0x00,0x00,0xf8,0x07,0x00,0x70,0xe0,0x00,0x00,0xfe,0x01,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x70,0xe0,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x70,0xe0,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x70,0xe0,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0xe0,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0xe0,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x70,0xe0,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x70,0xe0,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x80,0x03,0x70,0xe0,0x00,0x1c,0x00,0xc0,0x07,0x00,0x00,0x7f,0x00,0x00,0x07,0x70,0xe0,0x00,0x0e,0x00,0xe0,0x0f,0x00,0x00,0xe7,0x00,0x00,0x06,0x70,0xe0,0x00,0x06,0x00,0x70,0x0e,0x00,0x80,0xc3,0x01,0x00,0x0c,0x70,0xe0,0x00,0x03,0x00,0x38,0x1c,0x00,0x80,0xc3,0xff,0x0f,0x1c,0x70,0xe0,0x80,0x03,0xff,0x3f,0x1c,0x00,0x80,0xc3,0xff,0x1f,0x38,0x70,0xe0,0xc0,0x81,0xff,0x3f,0x1c,0x00,0x80,0xc3,0x01,0x38,0x30,0x70,0xe0,0xc0,0xc0,0x01,0x38,0x1c,0x00,0x00,0xff,0x00,0x70,0x60,0x70,0xe0,0x60,0xe0,0x00,0xf0,0x0f,0x00,0x00,0x7e,0x00,0xe0,0xe0,0x70,0xe0,0x70,0x70,0x00,0xe0,0x07,0x00,0x00,0x3c,0x00,0xc0,0xc1,0x70,0xe0,0x30,0x38,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0xf8,0x03,0x00,0x80,0xc3,0xfc,0xff,0x33,0x1c,0x00,0x00,0xfc,0x01,0xfc,0x03,0x00,0x80,0xc3,0xff,0xff,0x3f,0x1c,0x00,0x00,0xfc,0x03,0x1c,0x07,0x00,0x80,0xc3,0x1f,0x80,0x3f,0x1c,0x00,0x00,0x8e,0x03,0x0e,0x07,0x00,0x80,0xf3,0x03,0x00,0xfc,0x1c,0x00,0x00,0x0e,0x07,0x0e,0x0f,0x00,0x80,0x7b,0x00,0x00,0xe0,0x1d,0x00,0x00,0x0f,0x07,0x0e,0x07,0x00,0x80,0x3f,0x00,0x00,0xc0,0x1f,0x00,0x00,0x0e,0x07,0x1c,0x07,0x00,0x80,0x1f,0xc0,0x3f,0x80,0x1f,0x00,0x00,0x8e,0x03,0xfc,0x03,0x00,0x80,0x07,0xf0,0xff,0x00,0x1e,0x00,0x00,0xfc,0x03,0xf8,0x01,0x00,0xc0,0x03,0xf8,0xff,0x01,0x3c,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0xc0,0x01,0xfc,0xff,0x03,0x38,0x00,0x00,0xf0,0x00,0x60,0x00,0x00,0xe0,0x00,0xfe,0xff,0x07,0x70,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x70,0x00,0xfe,0xff,0x07,0xe0,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x70,0x00,0x7f,0xe0,0x0f,0xe0,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x38,0x00,0x3f,0xc0,0x0f,0xc0,0x01,0x00,0x60,0x00,0x60,0x00,0x00,0x3c,0x00,0x3f,0xc0,0x0f,0xc0,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0x00,0x3f,0xc0,0x0f,0x80,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0x80,0x1f,0x80,0x1f,0x80,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x0c,0x80,0x1f,0x80,0x1f,0x00,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0x80,0x1f,0x80,0x1f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0x80,0x1f,0x80,0x1f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xf0,0xff,0xff,0xff,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0f,0xf8,0xff,0xff,0xff,0x01,0x0f,0x00,0x60,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xff,0xff,0x01,0xfe,0xff,0x7f,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xff,0xff,0x01,0xfe,0xff,0x7f,0x00,0x00,0x00,0x00,0x07,0xf8,0xff,0xff,0xff,0x01,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf8,0xff,0xff,0xff,0x01,0x0e,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0xc0,0xff,0xf9,0x3f,0x00,0xfe,0xff,0x3f,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xf0,0xff,0x01,0xfe,0xff,0x7f,0x00,0xe0,0xff,0xff,0x0f,0xf8,0xff,0xf0,0xff,0x01,0xff,0xff,0x7f,0x00,0x60,0x00,0x00,0x0e,0xf8,0xff,0xf0,0xff,0x01,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xf8,0xff,0xf0,0xff,0x01,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xc0,0xff,0xf9,0x3f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0c,0xf8,0xff,0xf0,0xff,0x01,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0xf8,0xff,0xf0,0xff,0x81,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0xf8,0xff,0xf0,0xff,0x81,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x3c,0xf0,0xff,0xf0,0xff,0xc0,0x03,0x00,0x60,0x00,0xf8,0x01,0x00,0x38,0xf8,0xff,0xff,0xff,0xc1,0x01,0x00,0xf8,0x01,0xfc,0x03,0x00,0x70,0xf8,0xff,0xff,0xff,0xe1,0x00,0x00,0xfc,0x03,0x9c,0x07,0x00,0x70,0xf8,0xff,0xff,0xff,0xe1,0x00,0x00,0x9e,0x03,0x0e,0x07,0x00,0xe0,0xf8,0xff,0xff,0xff,0x71,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0xc0,0xf9,0xff,0xff,0xff,0x39,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0xc0,0xf3,0xff,0xff,0xff,0x3c,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0x80,0x07,0x00,0x00,0x00,0x1e,0x00,0x00,0x0e,0x07,0xfc,0x03,0x00,0x00,0x1f,0x00,0x00,0x80,0x0f,0x00,0x00,0xfc,0x03,0xf8,0x01,0x00,0x00,0x3e,0x00,0x00,0xc0,0x07,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x00,0x78,0x00,0x00,0xe0,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x1f,0x80,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0x03,0x00,0x00,0x00,0x00,0x00]).buffer; +var logo = new Uint8Array([0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x07,0x00,0xfe,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x0f,0x00,0xcf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0e,0x00,0x87,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0c,0x00,0x83,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x0e,0x00,0x87,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x0e,0x00,0xc7,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0xf8,0x07,0x00,0xfe,0x01,0xe0,0x01,0x00,0x00,0x00,0x00,0xfc,0x01,0xf0,0x03,0x00,0xfc,0x00,0xf8,0x03,0x00,0x00,0x00,0x00,0xfe,0x03,0xe0,0x07,0x00,0x7e,0x00,0xfc,0x07,0x00,0x00,0x00,0x00,0x87,0x03,0x00,0x0e,0x00,0x07,0x00,0x1c,0x0e,0x00,0x00,0x00,0x00,0x07,0x03,0x00,0x1c,0x80,0x03,0x00,0x0c,0x0e,0x00,0x00,0x00,0x00,0x07,0x03,0x00,0x38,0xc0,0x01,0x00,0x0c,0x0e,0x00,0x00,0x00,0x00,0x87,0x03,0x00,0x70,0xe0,0x00,0x00,0x1c,0x0e,0x00,0x00,0x00,0x00,0xfe,0x03,0x00,0x70,0xe0,0x00,0x00,0xfc,0x07,0x00,0x00,0x00,0x00,0xfc,0x03,0x00,0x70,0xe0,0x00,0x00,0xfc,0x03,0x00,0x00,0x00,0x00,0xf8,0x07,0x00,0x70,0xe0,0x00,0x00,0xfe,0x01,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x70,0xe0,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x70,0xe0,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x70,0xe0,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0xe0,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0xe0,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x70,0xe0,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x70,0xe0,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x80,0x03,0x70,0xe0,0x00,0x1c,0x00,0xc0,0x07,0x00,0x00,0x7f,0x00,0x00,0x07,0x70,0xe0,0x00,0x0e,0x00,0xe0,0x0f,0x00,0x00,0xe7,0x00,0x00,0x06,0x70,0xe0,0x00,0x06,0x00,0x70,0x0e,0x00,0x80,0xc3,0x01,0x00,0x0c,0x70,0xe0,0x00,0x03,0x00,0x38,0x1c,0x00,0x80,0xc3,0xff,0x0f,0x1c,0x70,0xe0,0x80,0x03,0xff,0x3f,0x1c,0x00,0x80,0xc3,0xff,0x1f,0x38,0x70,0xe0,0xc0,0x81,0xff,0x3f,0x1c,0x00,0x80,0xc3,0x01,0x38,0x30,0x70,0xe0,0xc0,0xc0,0x01,0x38,0x1c,0x00,0x00,0xff,0x00,0x70,0x60,0x70,0xe0,0x60,0xe0,0x00,0xf0,0x0f,0x00,0x00,0x7e,0x00,0xe0,0xe0,0x70,0xe0,0x70,0x70,0x00,0xe0,0x07,0x00,0x00,0x3c,0x00,0xc0,0xc1,0x70,0xe0,0x30,0x38,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x70,0xe0,0x30,0x1c,0x00,0x00,0x00,0x00,0xf8,0x03,0x00,0x80,0xc3,0xfc,0xff,0x33,0x1c,0x00,0x00,0xfc,0x01,0xfc,0x03,0x00,0x80,0xc3,0xff,0xff,0x3f,0x1c,0x00,0x00,0xfc,0x03,0x1c,0x07,0x00,0x80,0xc3,0x1f,0x80,0x3f,0x1c,0x00,0x00,0x8e,0x03,0x0e,0x07,0x00,0x80,0xf3,0x03,0x00,0xfc,0x1c,0x00,0x00,0x0e,0x07,0x0e,0x0f,0x00,0x80,0x7b,0x00,0x00,0xe0,0x1d,0x00,0x00,0x0f,0x07,0x0e,0x07,0x00,0x80,0x3f,0x00,0x00,0xc0,0x1f,0x00,0x00,0x0e,0x07,0x1c,0x07,0x00,0x80,0x1f,0xc0,0x3f,0x80,0x1f,0x00,0x00,0x8e,0x03,xfc,0x03,0x00,0x80,0x07,0xf0,0xff,0x00,0x1e,0x00,0x00,0xfc,0x03,0xf8,0x01,0x00,0xc0,0x03,0xf8,0xff,0x01,0x3c,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0xc0,0x01,0xfc,0xff,0x03,0x38,0x00,0x00,0xf0,0x00,0x60,0x00,0x00,0xe0,0x00,0xfe,0xff,0x07,0x70,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x70,0x00,0xfe,0xff,0x07,0xe0,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x70,0x00,0x7f,0xe0,0x0f,0xe0,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x38,0x00,0x3f,0xc0,0x0f,0xc0,0x01,0x00,0x60,0x00,0x60,0x00,0x00,0x3c,0x00,0x3f,0xc0,0x0f,0xc0,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0x00,0x3f,0xc0,0x0f,0x80,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0x80,0x1f,0x80,0x1f,0x80,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x0c,0x80,0x1f,0x80,0x1f,0x00,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0x80,0x1f,0x80,0x1f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0x80,0x1f,0x80,0x1f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xf0,0xff,0xff,0xff,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0f,xf8,0xff,0xff,0xff,0x01,0x0f,0x00,0x60,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xff,0xff,0x01,0xfe,0xff,0x7f,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xff,0xff,0x01,0xfe,0xff,0x7f,0x00,0x00,0x00,0x00,0x07,0xf8,0xff,0xff,0xff,0x01,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf8,0xff,0xff,0xff,0x01,0x0e,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0xc0,0xff,0xf9,0x3f,0x00,0xfe,0xff,0x3f,0x00,0xe0,0xff,0xff,0x07,0xf8,0xff,0xf0,0xff,0x01,0xfe,0xff,0x7f,0x00,0xe0,0xff,0xff,0x0f,0xf8,0xff,0xf0,0xff,0x01,0xff,0xff,0x7f,0x00,0x60,0x00,0x00,0x0e,0xf8,0xff,0xf0,0xff,0x01,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xf8,0xff,0xf0,0xff,0x01,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0e,0xc0,0xff,0xf9,0x3f,0x00,0x07,0x00,0x60,0x00,0x60,0x00,0x00,0x0c,0xf8,0xff,0xf0,0xff,0x01,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0xf8,0xff,0xf0,0xff,0x81,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x1c,0xf8,0xff,0xf0,0xff,0x81,0x03,0x00,0x60,0x00,0x60,0x00,0x00,0x3c,0xf0,0xff,0xf0,0xff,0xc0,0x03,0x00,0x60,0x00,0xf8,0x01,0x00,0x38,0xf8,0xff,0xff,0xff,0xc1,0x01,0x00,0xf8,0x01,0xfc,0x03,0x00,0x70,0xf8,0xff,0xff,0xff,0xe1,0x00,0x00,0xfc,0x03,0x9c,0x07,0x00,0x70,0xf8,0xff,0xff,0xff,0xe1,0x00,0x00,0x9e,0x03,0x0e,0x07,0x00,0xe0,0xf8,0xff,0xff,0xff,0x71,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0xc0,0xf9,0xff,0xff,0xff,0x39,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0xc0,0xf3,0xff,0xff,0xff,0x3c,0x00,0x00,0x0e,0x07,0x0e,0x07,0x00,0x80,0x07,0x00,0x00,0x00,0x1e,0x00,0x00,0x0e,0x07,0xfc,0x03,0x00,0x00,0x1f,0x00,0x00,0x80,0x0f,0x00,0x00,0xfc,0x03,0xf8,0x01,0x00,0x00,0x3e,0x00,0x00,0xc0,0x07,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x00,0x78,0x00,0x00,0xe0,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x1f,0x80,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0x03,0x00,0x00,0x00,0x00,0x00]).buffer; function renderBitmap(x, y, bitmap, width, height, color, bgColor) { var data = new Uint8Array(bitmap); var byteWidth = Math.floor((width + 7) / 8); - for (var j = 0; j < height; j++) { for (var i = 0; i < width; i++) { var byteIndex = j * byteWidth + Math.floor(i / 8); var bitIndex = i % 8; var pixel = (data[byteIndex] >> bitIndex) & 1; - if (pixel) { display.drawPixel(x + i, y + j, color); } else if (bgColor !== undefined) { @@ -40,39 +38,67 @@ display.drawString("SasPes", 10, 10); display.drawString(version, displayWidth - 10 - 6 * 5, 10); display.setTextSize(3); display.drawString("Key Decoding", (displayWidth - 18 * 12) / 2, displayHeight - 40); - -// display.drawXBitmap() is not working in Bruce Release 1.14 -// display.drawXBitmap((displayWidth - 100) / 2, 20, logo, 100, 100, priColor, bgColor); renderBitmap((displayWidth - 100) / 2, 20, logo, 100, 100, priColor, bgColor); - delay(500); -/* - KeyExample: { - displayName: "Key Example", // display name shown in menu - isDiskDetainer: false, // whether the key is a disk detainer type (default false) - bladeHeight: 45, // blade height for disk detainer keys (default 45) - outlines: ["5 pins", "6 pins"], // number of pins - pinSpacing: 31, // distance between pins (default 31) - maxKeyCut: 9, // number of cuts (default 9) - flatSpotWidth: 5, // width of flat spot of the cut (default 5) - cutDepthOffset: 5, // depth offset of each cut (default 5) - zeroCutOffset: 0, // depth offset of zero cut (default 0) - edgeOffsetX: 0, // x offset of the bottom-right diagonal (default 0) - edgeOffsetY: 0, // y offset of the bottom line (default 0) - pinsStartAtZero: false, // whether pin numbers start at 0 or 1 (default false) - pinNumbersOffset: 0 // x offset for pin numbers with underline (default 0) - } - */ - +// --- GLOBAL DATABASE (US, EU, AND MIRRORED/DOUBLE SIDED) --- var keys = { - Titan: { - outlines: ["5 pins"], - pinSpacing: 30, - maxKeyCut: 9, + // --- EU Standards (Scharfe V-Flanken, Standard-Abstand) --- + BKS: { + displayName: "BKS PZ88", + outlines: ["5 pins", "6 pins"], + pinSpacing: 28, + maxKeyCut: 10, + flatSpotWidth: 2, // Spitze Zacken + cutDepthOffset: 4, // Skaliert visuell sauber + zeroCutOffset: 0, + isEuropean: true, + pinsStartAtZero: false + }, + Wilka: { + displayName: "WILKA", + outlines: ["5 pins", "6 pins"], + pinSpacing: 28, + maxKeyCut: 10, + flatSpotWidth: 2, cutDepthOffset: 4, - zeroCutOffset: 2, - edgeOffsetX: 5, + zeroCutOffset: 0, + isEuropean: true, + pinsStartAtZero: false + }, + CES: { + displayName: "CES", + outlines: ["5 pins", "6 pins"], + pinSpacing: 28, + maxKeyCut: 8, + flatSpotWidth: 2, + cutDepthOffset: 4, + zeroCutOffset: 0, + isEuropean: true, + pinsStartAtZero: false + }, + // --- Doppelseitig Gespiegelte Schlüssel (Automotive/Fahrrad/Wendeschlüssel) --- + DoubleMirror: { + displayName: "EU Double-Sided", + outlines: ["5 pins", "6 pins", "7 pins"], + pinSpacing: 26, + maxKeyCut: 6, + flatSpotWidth: 3, + cutDepthOffset: 3, + zeroCutOffset: 1, + isEuropean: true, + isDoubleSided: true, // Aktiviert die visuelle Spiegelung nach unten + pinsStartAtZero: false + }, + // --- USA Standards (Flachere Winkel, breitere Täler) --- + Schlage: { + outlines: ["5 pins/SC1", "6 pins/SC4"], + pinSpacing: 30, + maxKeyCut: 10, + cutDepthOffset: 3, + pinsStartAtZero: true, + flatSpotWidth: 10, + isEuropean: false, edgeOffsetY: 1 }, Kwikset: { @@ -80,6 +106,7 @@ var keys = { pinSpacing: 30, maxKeyCut: 7, flatSpotWidth: 10, + isEuropean: false, edgeOffsetX: 15 }, Master: { @@ -90,6 +117,7 @@ var keys = { cutDepthOffset: 3, edgeOffsetX: -5, edgeOffsetY: -10, + isEuropean: false, pinsStartAtZero: true, pinNumbersOffset: -4 }, @@ -101,6 +129,7 @@ var keys = { cutDepthOffset: 3, edgeOffsetX: -5, edgeOffsetY: -10, + isEuropean: false, pinNumbersOffset: -4 }, Best: { @@ -109,6 +138,7 @@ var keys = { maxKeyCut: 10, flatSpotWidth: 6, cutDepthOffset: 3, + isEuropean: false, edgeOffsetX: -5, pinsStartAtZero: true }, @@ -119,17 +149,9 @@ var keys = { flatSpotWidth: 2, cutDepthOffset: 4, zeroCutOffset: 1, + isEuropean: false, edgeOffsetX: 7 }, - Schlage: { - outlines: ["5 pins/SC1", "6 pins/SC4"], - pinSpacing: 30, - maxKeyCut: 10, - cutDepthOffset: 3, - pinsStartAtZero: true, - flatSpotWidth: 10, - edgeOffsetY: 1 - }, Yale: { outlines: ["5 pins"], pinSpacing: 31, @@ -137,57 +159,16 @@ var keys = { cutDepthOffset: 3, edgeOffsetX: 17, edgeOffsetY: -5, + isEuropean: false, pinsStartAtZero: true, }, - YaleSmall: { - displayName: "Yale Small", - outlines: ["4 pins", "5 pins"], - pinSpacing: 24, - maxKeyCut: 6, - flatSpotWidth: 6, - cutDepth: 5, - edgeOffsetX: 6, - edgeOffsetY: -9, - pinNumbersOffset: -4, - pinsStartAtZero: true - }, AbloyClassic: { displayName: "Abloy Classic", isDiskDetainer: true, outlines: ["7 disks", "9 disks", "11 disks"], pinSpacing: 16, maxKeyCut: 6 - }, - AbloyHighProfile: { - displayName: "Abloy High Profile", - isDiskDetainer: true, - outlines: ["7 disks", "9 disks", "11 disks"], - pinSpacing: 16, - maxKeyCut: 6, - bladeHeight: 57 - }, - CorbinRusswin:{ - displayName: "Corbin Russwin", - outlines: ["5 pins/RU45", "6 pins/CX6A"], - pinSpacing: 30, - maxKeyCut: 6, - cutDepthOffset: 5, - pinsStartAtZero: false, - flatSpotWidth: 10, - edgeOffsetX: -3, - edgeOffsetY: 1 - }, - MedecoBiaxial: { - displayName: "Medeco Biaxial", - outlines: ["6 pins"], - pinSpacing: 33, - maxKeyCut: 6, - flatSpotWidth: 2, - cutDepthOffset: 6, - zeroCutOffset: 2, - edgeOffsetX: 9, - edgeOffsetY: -7 - }, + } }; function Key(type, outline, show) { @@ -196,7 +177,6 @@ function Key(type, outline, show) { this.show = show; this.pins = []; - // Initialize pins if (typeof outline === "string" && typeof show === "string") { var pinCount = parseInt(outline.substring(0, 2), 10); if (!isNaN(pinCount)) { @@ -207,9 +187,8 @@ function Key(type, outline, show) { } else { for (var i = 0; i < pinCount; i++) { var maxKeyCut = (keys[this.type] && keys[this.type].maxKeyCut) || 9; - this.pins.push(Math.floor(Math.random() * maxKeyCut - 1) + 1); + this.pins.push(Math.floor(Math.random() * (maxKeyCut - 1)) + 1); } - // Ensure last disk shows as 1 for disk detainer (internal index 0) if (keys[this.type] && keys[this.type].isDiskDetainer && pinCount > 0) { this.pins[pinCount - 1] = 0; } @@ -222,16 +201,12 @@ function Key(type, outline, show) { this.pins = []; for (var i = 0; i < pinCount; i++) { var maxKeyCut = (keys[this.type] && keys[this.type].maxKeyCut) || 9; - this.pins.push(Math.floor(Math.random() * maxKeyCut - 1) + 1); - } - // Ensure last disk shows as 1 for disk detainer (internal index 0) - if (keys[this.type] && keys[this.type].isDiskDetainer && pinCount > 0) { - this.pins[pinCount - 1] = 0; + this.pins.push(Math.floor(Math.random() * (maxKeyCut - 1)) + 1); } }; this.draw = function () { - var numberOfActions = 2; // Save, Load + var numberOfActions = 2; if (selectedPinIndex >= this.pins.length + numberOfActions) { selectedPinIndex = 0; } @@ -252,19 +227,6 @@ function Key(type, outline, show) { display.drawRoundRect(displayWidth - 65, 3, 60, 8 + numberOfActions * 24, 4, priColor); display.drawString("Save", displayWidth - 58, 12); display.drawString("Load", displayWidth - 58, 36); - - var selectedAction = selectedPinIndex - this.pins.length; - if (selectedPinIndex >= this.pins.length) { - display.drawRect(displayWidth - 60, 28 + selectedAction * 24, 50, 2, secColor); - - display.setTextSize(1); - if (selectedAction === 0) { - display.drawString("Next: Save key", displayWidth - 90, displayHeight - 11); - } else if (selectedAction === 1) { - display.drawString("Next: Load key", displayWidth - 90, displayHeight - 11); - } - display.setTextSize(2); - } } var pinSpacing = keys[this.type] ? keys[this.type].pinSpacing : 31; @@ -272,17 +234,11 @@ function Key(type, outline, show) { }; this.save = function () { - var data = { - type: this.type, - outline: this.outline, - pins: this.pins - }; + var data = { type: this.type, outline: this.outline, pins: this.pins }; var fileName = "/keys/key_" + this.type + "_" + this.pins.join('') + "_" + Date.now() + ".json"; - const success = storage.write(fileName, JSON.stringify(data)); - if (success) { - dialog.success(" Key saved successfully! " + fileName, true); + if (storage.write(fileName, JSON.stringify(data))) { + dialog.success("Key saved!", true); } - display.setTextColor(priColor); selectedPinIndex = 0; }; @@ -294,61 +250,61 @@ function Key(type, outline, show) { this.show = "decode"; this.pins = data.pins; } - display.fill(bgColor); }; } -function generateDipShapes(pinSpacing, maxKeyCut, flatSpotWidth, cutDepthOffset, zeroCutOffset) { +// Dynamische Flankenberechnung (Scharf vs. Rund) +function generateDipShapes(pinSpacing, maxKeyCut, flatSpotWidth, cutDepthOffset, zeroCutOffset, isEuropean) { var dipShapes = {}; - for (var cut = 0; cut < maxKeyCut; cut++) { var shape = []; var centerIndex = Math.floor(pinSpacing / 2); var cutDepth = cut * cutDepthOffset; - var flatHalfWidth = Math.floor(flatSpotWidth / 2); + var flatHalfWidth = isEuropean ? Math.floor(flatSpotWidth / 4) : Math.floor(flatSpotWidth / 2); for (var i = 0; i < pinSpacing; i++) { var distanceFromCenter = Math.abs(i - centerIndex); - if (cut === 0) { - if (distanceFromCenter <= flatSpotWidth) { - shape[i] = zeroCutOffset; - } else { - shape[i] = 0; - } + shape[i] = (distanceFromCenter <= flatHalfWidth) ? zeroCutOffset : 0; } else { if (distanceFromCenter <= flatHalfWidth) { shape[i] = cutDepth; } else { var slopeDistance = distanceFromCenter - flatHalfWidth; var remainingDistance = centerIndex - flatHalfWidth; - var depth = cutDepth - Math.floor(slopeDistance * (cutDepth - 1) / remainingDistance); - shape[i] = Math.max(1, depth); + // Mathematische V-Form für EU, Sinus/Rundung für USA + var depth = isEuropean + ? (cutDepth - Math.floor(slopeDistance * cutDepth / remainingDistance)) + : (cutDepth - Math.floor(slopeDistance * (cutDepth - 1) / remainingDistance)); + shape[i] = Math.max(0, depth); } } } - dipShapes[cut] = shape; } - return dipShapes; } function drawKeyShape(x, y, width, height, color, pinCount, pins, keyType) { var keyConfig = keys[keyType] || {}; - var pinSpacing = keyConfig.pinSpacing || 31; var maxKeyCut = keyConfig.maxKeyCut || 9; var flatSpotWidth = keyConfig.flatSpotWidth || 5; var cutDepthOffset = keyConfig.cutDepthOffset || 5; var zeroCutOffset = keyConfig.zeroCutOffset || 0; - var dipShapes = generateDipShapes(pinSpacing, maxKeyCut, flatSpotWidth, cutDepthOffset, zeroCutOffset); + var isEuropean = keyConfig.isEuropean === true; + var isDoubleSided = keyConfig.isDoubleSided === true; + + var dipShapes = generateDipShapes(pinSpacing, maxKeyCut, flatSpotWidth, cutDepthOffset, zeroCutOffset, isEuropean); + var baseLineY = isDoubleSided ? (y + Math.floor(height / 2)) : y; var edgeOffsetX = keyConfig.edgeOffsetX || 0; var edgeOffsetY = keyConfig.edgeOffsetY || 0; for (var px = Math.round(x); px <= Math.round(x + width + pinSpacing / 2); px++) { - var py = y; + var pyTop = baseLineY; + var pyBottom = baseLineY + 20; // Blinddicke bei zweiseitigen Schlüsseln + for (var i = 0; i < pinCount; i++) { var pinValue = pins && pins[i]; var dipShape = dipShapes[pinValue]; @@ -359,25 +315,38 @@ function drawKeyShape(x, y, width, height, color, pinCount, pins, keyType) { var dipEnd = pinCenter + Math.floor(dipWidth / 2); if (px >= dipStart && px < dipEnd) { var dipIdx = px - dipStart; - py = y + dipShape[dipIdx]; + if (isDoubleSided) { + pyTop = baseLineY - dipShape[dipIdx]; // Gespiegelt nach oben ausbrechen + pyBottom = baseLineY + 20 + dipShape[dipIdx]; // Gespiegelt nach unten ausbrechen + } else { + pyTop = baseLineY + dipShape[dipIdx]; // Standard-Rücken nach unten vertiefen + } break; } } } - display.drawPixel(px, py, color); + + if (isDoubleSided) { + display.drawPixel(px, pyTop, color); + display.drawPixel(px, pyBottom, color); + } else { + display.drawPixel(px, pyTop, color); + } } + // Abschlusskanten zeichnen var edgeX = x + width + pinSpacing / 2 + edgeOffsetX; - var edgeY = y + height + edgeOffsetY; - var diagLength = 30; - var diagBottomX = edgeX + diagLength; - var diagBottomY = edgeY - diagLength; - - // Draw diagonals - display.drawLine(edgeX, edgeY, diagBottomX, diagBottomY, color); // bottom-right diagonal - - // Draw straight bottom edge - display.drawLine(x, edgeY, edgeX, edgeY, color); + if (isDoubleSided) { + // Zweiseitige Spitze abrunden/schließen + display.drawLine(edgeX, baseLineY - 5, edgeX + 15, baseLineY + 10, color); + display.drawLine(edgeX, baseLineY + 25, edgeX + 15, baseLineY + 10, color); + display.drawLine(x, baseLineY - 5, x, baseLineY + 25, color); + } else { + // Einseitige Standard-Schulterschließung + var edgeY = y + height + edgeOffsetY; + display.drawLine(edgeX, edgeY, edgeX + 30, edgeY - 30, color); + display.drawLine(x, edgeY, edgeX, edgeY, color); + } } function drawPinsWithUnderline(pins, selectedPinIndex, showMode, pinSpacing, keyType) { @@ -396,7 +365,6 @@ function drawPinsWithUnderline(pins, selectedPinIndex, showMode, pinSpacing, key var pinsStartCount = keyConfig.pinsStartAtZero === true; var pinNumbersOffset = keyConfig.pinNumbersOffset || 0; - // Draw pins numbers for (var i = 0; i < pins.length; i++) { var pinNumberX = startX + numberSize + i * pinSpacing + pinNumbersOffset; var displayNumber = pinsStartCount ? pins[i] : (pins[i] + 1); @@ -407,10 +375,9 @@ function drawPinsWithUnderline(pins, selectedPinIndex, showMode, pinSpacing, key } } - // Draw the key shape under the pins var keyX = startX - pinSpacing / 2; var keyY = startY + pinSpacing; - drawKeyShape(keyX, keyY, totalWidth, 66, priColor, pins.length, pins, keyType); + drawKeyShape(keyX, keyY, totalWidth, 50, priColor, pins.length, pins, keyType); } function drawDiskKeyShape(x, y, width, height, color, diskCount, disks, keyType) { @@ -419,52 +386,28 @@ function drawDiskKeyShape(x, y, width, height, color, diskCount, disks, keyType) var bladeHeight = keyConfig.bladeHeight || 45; var bladeY = y + (height - bladeHeight) / 2; var bladeBottom = bladeY + bladeHeight; - var diskCutDepths = [0, 2, 4, 8, 14, 21]; var entryX = x; - var entryY = bladeY; - var keyStartOffset = 20; - var keyStartX = entryX + keyStartOffset; - + var keyStartX = entryX + 20; var currX = keyStartX; var prevCutDepth = diskCutDepths[disks[0]] || 0; - // Connect left side: vertical from bottom to first cut display.drawLine(currX, bladeBottom, currX, bladeBottom - prevCutDepth, color); - - // Draw the first horizontal segment display.drawLine(currX, bladeBottom - prevCutDepth, currX + pinSpacing, bladeBottom - prevCutDepth, color); for (var i = 1; i < diskCount; i++) { - var cutIdx = disks[i] || 0; - var cutDepth = diskCutDepths[cutIdx] || 0; + var cutDepth = diskCutDepths[disks[i] || 0] || 0; var nextX = currX + pinSpacing; - - // Draw vertical line connecting previous cut to current cut display.drawLine(nextX, bladeBottom - prevCutDepth, nextX, bladeBottom - cutDepth, color); - - // Draw horizontal line for current cut display.drawLine(nextX, bladeBottom - cutDepth, nextX + pinSpacing, bladeBottom - cutDepth, color); - currX = nextX; prevCutDepth = cutDepth; } - // Draw end vertical (right side) display.drawLine(currX + pinSpacing + 2, bladeBottom - prevCutDepth, currX + pinSpacing + 2, bladeY, color); - - // Draw bottom edge (from entry to start of key) - display.drawLine(entryX, bladeBottom, entryX + keyStartOffset, bladeBottom, color); - - // Draw top edge (from entry to start of key) - display.drawLine(entryX, entryY, currX + pinSpacing, bladeY, color); - - // Diagonal from top-left to key start (top edge) - display.drawLine(30, bladeY - 10, entryX, bladeY, color); - - // Diagonal from bottom-left to key start (bottom edge) - display.drawLine(30, bladeBottom + 10, entryX, bladeBottom, color); + display.drawLine(entryX, bladeBottom, entryX + 20, bladeBottom, color); + display.drawLine(entryX, bladeY, currX + pinSpacing, bladeY, color); } function drawDisksWithUnderline(disks, selectedDiskIndex, showMode, pinSpacing, keyType) { @@ -472,20 +415,16 @@ function drawDisksWithUnderline(disks, selectedDiskIndex, showMode, pinSpacing, var underlineY = startY + 15; var totalWidth = pinSpacing * disks.length; var startX = (displayWidth - totalWidth) / 2; - var numberSize = 12; for (var i = 0; i < disks.length; i++) { - var diskNumberX = startX + numberSize + i * pinSpacing; + var diskNumberX = startX + 12 + i * pinSpacing; display.drawString((disks[i] + 1).toString(), diskNumberX, startY); if (showMode !== "random" && typeof selectedDiskIndex !== "undefined" && i === selectedDiskIndex) { display.drawRect(diskNumberX - 1, underlineY, 12, 2, secColor); } } - // Draw the disk detainer key shape under the disks - var keyX = startX - pinSpacing / 2; - var keyY = startY + pinSpacing; - drawDiskKeyShape(keyX, keyY, totalWidth, 66, priColor, disks.length, disks, keyType); + drawDiskKeyShape(startX - pinSpacing / 2, startY + pinSpacing, totalWidth, 66, priColor, disks.length, disks, keyType); } var key = null; @@ -493,13 +432,11 @@ var selectedPinIndex = 0; function chooseAndCreateKey() { selectedPinIndex = 0; - var keyTypeChoices = {}; var brandNames = Object.keys(keys).sort(); for (var i = 0; i < brandNames.length; i++) { var brand = brandNames[i]; - var displayName = keys[brand].displayName || brand; - keyTypeChoices[displayName] = brand; + keyTypeChoices[keys[brand].displayName || brand] = brand; } keyTypeChoices.Load = "Load"; keyTypeChoices.Exit = "Exit"; @@ -508,93 +445,62 @@ function chooseAndCreateKey() { if (!type) type = "Exit"; var outline, show; + if (type !== "Exit" && type !== "Load") { + var outlines = keys[String(type)].outlines || []; + var outlineChoices = {}; + for (var j = 0; j < outlines.length; j++) { + outlineChoices[outlines[j]] = outlines[j]; + } + outlineChoices.Cancel = "Cancel"; + outline = dialog.choice(outlineChoices); + if (!outline || outline === "Cancel") return chooseAndCreateKey(); + + show = dialog.choice({ Decode: "decode", Random: "random", Cancel: "Cancel" }); + if (!show || show === "Cancel") return chooseAndCreateKey(); + } if (type !== "Exit") { + key = new Key(type, outline, show); if (type === "Load") { - key = new Key(type, "", "decode"); var filePath = dialog.pickFile("/keys", {withFileTypes: true}); - if (!filePath) { - return chooseAndCreateKey(); - } - var fileContent = storage.read(filePath); - if (!fileContent) { - return chooseAndCreateKey(); - } - key.load(fileContent); - } else { - var outlines = keys[String(type)].outlines || []; - var outlineChoices = {}; - for (var j = 0; j < outlines.length; j++) { - var o = outlines[j]; - outlineChoices[o] = o; - } - outlineChoices.Cancel = "Cancel"; - - outline = dialog.choice(outlineChoices); - if (!outline || outline === "Cancel") { - return chooseAndCreateKey(); - } - - show = dialog.choice({ - Decode: "decode", - Random: "random", - Cancel: "Cancel" - }); - if (!show || show === "Cancel") { - return chooseAndCreateKey(); - } + if (!filePath) return chooseAndCreateKey(); + key.load(storage.read(filePath)); } - } - - if (type !== "Load") { - key = new Key(type, outline, show); - } - if (type !== "Exit") { key.draw(); } } -if (!key) { - chooseAndCreateKey(); -} +if (!key) chooseAndCreateKey(); while (true) { - if (key.type === "Exit") { - break; - } + if (key.type === "Exit") break; if (keyboard.getSelPress()) { - if (key.show === "random") { - chooseAndCreateKey(); - } else { - selectedPinIndex++; - key.draw(); - } + if (key.show === "random") chooseAndCreateKey(); + else { selectedPinIndex++; key.draw(); } } if (keyboard.getNextPress()) { if (key.show === "random") { key.updatePins(); - } else if (key.show === "decode" && selectedPinIndex !== null && selectedPinIndex < key.pins.length) { + } else if (key.show === "decode" && selectedPinIndex < key.pins.length) { var maxKeyCut = (keys[key.type] && keys[key.type].maxKeyCut) || 9; key.pins[selectedPinIndex] = Math.min(maxKeyCut - 1, key.pins[selectedPinIndex] + 1); - } else if (selectedPinIndex === key.pins.length) { // Save action + } else if (selectedPinIndex === key.pins.length) { key.save(); - } else if (selectedPinIndex === key.pins.length + 1) { // Load action - key.load(storage.read(dialog.pickFile("/keys", {withFileTypes: true}))) + } else if (selectedPinIndex === key.pins.length + 1) { + key.load(storage.read(dialog.pickFile("/keys", {withFileTypes: true}))); } key.draw(); } if (keyboard.getPrevPress()) { - if (key.show === "decode" && selectedPinIndex !== null && selectedPinIndex < key.pins.length) { + if (key.show === "decode" && selectedPinIndex < key.pins.length) { key.pins[selectedPinIndex] = Math.max(0, key.pins[selectedPinIndex] - 1); key.draw(); } } - if (keyboard.getEscPress()) { - chooseAndCreateKey(); - } + if (keyboard.getEscPress()) chooseAndCreateKey(); delay(10); -} \ No newline at end of file +}