()
| 2394 | } |
| 2395 | } |
| 2396 | createControlSettingMenu() { |
| 2397 | let buttonListeners = []; |
| 2398 | this.checkGamepadInputs = () => buttonListeners.forEach(elem => elem()); |
| 2399 | this.gamepadLabels = []; |
| 2400 | this.gamepadSelection = []; |
| 2401 | this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); |
| 2402 | const body = this.createPopup("Control Settings", { |
| 2403 | "Reset": () => { |
| 2404 | this.controls = JSON.parse(JSON.stringify(this.defaultControllers)); |
| 2405 | this.setupKeys(); |
| 2406 | this.checkGamepadInputs(); |
| 2407 | this.saveSettings(); |
| 2408 | }, |
| 2409 | "Clear": () => { |
| 2410 | this.controls = { 0: {}, 1: {}, 2: {}, 3: {} }; |
| 2411 | this.setupKeys(); |
| 2412 | this.checkGamepadInputs(); |
| 2413 | this.saveSettings(); |
| 2414 | }, |
| 2415 | "Close": () => { |
| 2416 | this.controlMenu.style.display = "none"; |
| 2417 | } |
| 2418 | }, true); |
| 2419 | this.setupKeys(); |
| 2420 | this.controlMenu = body.parentElement; |
| 2421 | body.classList.add("ejs_control_body"); |
| 2422 | |
| 2423 | let buttons; |
| 2424 | if ("gb" === this.getControlScheme()) { |
| 2425 | buttons = [ |
| 2426 | { id: 8, label: this.localization("A") }, |
| 2427 | { id: 0, label: this.localization("B") }, |
| 2428 | { id: 2, label: this.localization("SELECT") }, |
| 2429 | { id: 3, label: this.localization("START") }, |
| 2430 | { id: 4, label: this.localization("UP") }, |
| 2431 | { id: 5, label: this.localization("DOWN") }, |
| 2432 | { id: 6, label: this.localization("LEFT") }, |
| 2433 | { id: 7, label: this.localization("RIGHT") }, |
| 2434 | ]; |
| 2435 | } else if ("nes" === this.getControlScheme()) { |
| 2436 | buttons = [ |
| 2437 | { id: 8, label: this.localization("A") }, |
| 2438 | { id: 0, label: this.localization("B") }, |
| 2439 | { id: 2, label: this.localization("SELECT") }, |
| 2440 | { id: 3, label: this.localization("START") }, |
| 2441 | { id: 4, label: this.localization("UP") }, |
| 2442 | { id: 5, label: this.localization("DOWN") }, |
| 2443 | { id: 6, label: this.localization("LEFT") }, |
| 2444 | { id: 7, label: this.localization("RIGHT") }, |
| 2445 | ]; |
| 2446 | if (this.getCore() === "nestopia") { |
| 2447 | buttons.push({ id: 10, label: this.localization("SWAP DISKS") }); |
| 2448 | } else { |
| 2449 | buttons.push({ id: 10, label: this.localization("SWAP DISKS") }); |
| 2450 | buttons.push({ id: 11, label: this.localization("EJECT/INSERT DISK") }); |
| 2451 | } |
| 2452 | } else if ("snes" === this.getControlScheme()) { |
| 2453 | buttons = [ |
no test coverage detected