MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / createControlSettingMenu

Method createControlSettingMenu

data/src/emulator.js:2396–3080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 = [

Callers 1

bindListenersMethod · 0.95

Calls 13

createPopupMethod · 0.95
setupKeysMethod · 0.95
saveSettingsMethod · 0.95
getControlSchemeMethod · 0.95
localizationMethod · 0.95
getCoreMethod · 0.95
createElementMethod · 0.95
addEventListenerMethod · 0.95
updateGamepadLabelsMethod · 0.95
onMethod · 0.95
getSettingValueMethod · 0.95
isChildMethod · 0.95

Tested by

no test coverage detected