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

Method handleSpecialOptions

data/src/emulator.js:4252–4333  ·  view source on GitHub ↗
(option, value)

Source from the content-addressed store, hash-verified

4250 }
4251 }
4252 handleSpecialOptions(option, value) {
4253 if (option === "shader") {
4254 this.enableShader(value);
4255 } else if (option === "disk") {
4256 this.gameManager.setCurrentDisk(value);
4257 } else if (option === "virtual-gamepad") {
4258 this.toggleVirtualGamepad(value !== "disabled");
4259 } else if (option === "menu-bar-button") {
4260 this.elements.menuToggle.style.display = "";
4261 this.elements.menuToggle.style.opacity = value === "visible" ? 0.5 : 0;
4262 } else if (option === "virtual-gamepad-left-handed-mode") {
4263 this.toggleVirtualGamepadLeftHanded(value !== "disabled");
4264 } else if (option === "ff-ratio") {
4265 if (this.isFastForward) this.gameManager.toggleFastForward(0);
4266 if (value === "unlimited") {
4267 this.gameManager.setFastForwardRatio(0);
4268 } else if (!isNaN(value)) {
4269 this.gameManager.setFastForwardRatio(parseFloat(value));
4270 }
4271 setTimeout(() => {
4272 if (this.isFastForward) this.gameManager.toggleFastForward(1);
4273 }, 10)
4274 } else if (option === "fastForward") {
4275 if (value === "enabled") {
4276 this.isFastForward = true;
4277 this.gameManager.toggleFastForward(1);
4278 } else if (value === "disabled") {
4279 this.isFastForward = false;
4280 this.gameManager.toggleFastForward(0);
4281 }
4282 } else if (option === "sm-ratio") {
4283 if (this.isSlowMotion) this.gameManager.toggleSlowMotion(0);
4284 this.gameManager.setSlowMotionRatio(parseFloat(value));
4285 setTimeout(() => {
4286 if (this.isSlowMotion) this.gameManager.toggleSlowMotion(1);
4287 }, 10);
4288 } else if (option === "slowMotion") {
4289 if (value === "enabled") {
4290 this.isSlowMotion = true;
4291 this.gameManager.toggleSlowMotion(1);
4292 } else if (value === "disabled") {
4293 this.isSlowMotion = false;
4294 this.gameManager.toggleSlowMotion(0);
4295 }
4296 } else if (option === "rewind-granularity") {
4297 if (this.rewindEnabled) {
4298 this.gameManager.setRewindGranularity(parseInt(value));
4299 }
4300 } else if (option === "vsync") {
4301 this.gameManager.setVSync(value === "enabled");
4302 } else if (option === "videoRotation") {
4303 value = parseInt(value);
4304 if (this.videoRotationChanged === true || value !== 0) {
4305 this.gameManager.setVideoRotation(value);
4306 this.videoRotationChanged = true;
4307 } else if (this.videoRotationChanged === true && value === 0) {
4308 this.gameManager.setVideoRotation(0);
4309 this.videoRotationChanged = true;

Callers 1

menuOptionChangedMethod · 0.95

Calls 12

enableShaderMethod · 0.95
setCurrentDiskMethod · 0.80
toggleFastForwardMethod · 0.80
setFastForwardRatioMethod · 0.80
toggleSlowMotionMethod · 0.80
setSlowMotionRatioMethod · 0.80
setRewindGranularityMethod · 0.80
setVSyncMethod · 0.80
setVideoRotationMethod · 0.80
saveSaveFilesMethod · 0.80
setKeyboardEnabledMethod · 0.80
setAltKeyEnabledMethod · 0.80

Tested by

no test coverage detected