From bccb86158b5c69697e4663d91ff32934c44830a0 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:58:52 -0600 Subject: [PATCH] Add vsync option --- data/GameManager.js | 6 +++++- data/emulator.js | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/GameManager.js b/data/GameManager.js index b05f407..cd9e53f 100644 --- a/data/GameManager.js +++ b/data/GameManager.js @@ -28,7 +28,8 @@ class EJS_GameManager { setRewindGranularity: this.Module.cwrap('set_rewind_granularity', 'null', ['number']), toggleSlowMotion: this.Module.cwrap('toggle_slow_motion', 'null', ['number']), setSlowMotionRatio: this.Module.cwrap('set_sm_ratio', 'null', ['number']), - getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']) + getFrameNum: this.Module.cwrap('get_current_frame_count', 'number', ['']), + setVSync: this.Module.cwrap('set_vsync', 'null', ['number']) } this.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n'); this.writeFile("/home/web_user/retroarch/userdata/config/MAME 2003 (0.78)/MAME 2003 (0.78).opt", 'mame2003_skip_disclaimer = "enabled"\nmame2003_skip_warnings = "enabled"\n'); @@ -305,6 +306,9 @@ class EJS_GameManager { }, null, false, {responseType: "arraybuffer", method: "GET"}); }) } + setVSync(enabled) { + this.functions.setVSync(enabled); + } toggleMainLoop(playing) { this.functions.toggleMainLoop(playing); } diff --git a/data/emulator.js b/data/emulator.js index ff97cdb..fd74c0a 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -3932,6 +3932,8 @@ class EmulatorJS { if (this.rewindEnabled) { this.gameManager.setRewindGranularity(parseInt(value)); } + } else if (option === "vsync") { + this.gameManager.setVSync(value === "enabled"); } this.gameManager.setVariable(option, value); this.saveSettings(); @@ -4285,6 +4287,11 @@ class EmulatorJS { 'hide': this.localization("hide") }, 'hide'); + addToMenu(this.localization("VSync"), "vsync", { + 'enabled': this.localization("Enabled"), + 'disabled': this.localization("Disabled") + }, "disabled"); + addToMenu(this.localization('Fast Forward Ratio'), 'ff-ratio', [ "1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "6.0", "6.5", "7.0", "7.5", "8.0", "8.5", "9.0", "9.5", "10.0", "unlimited" ], "3.0");