Add vsync option

This commit is contained in:
Ethan O'Brien 2024-03-07 13:58:52 -06:00
parent 8fbba189cb
commit bccb86158b
2 changed files with 12 additions and 1 deletions

View file

@ -28,7 +28,8 @@ class EJS_GameManager {
setRewindGranularity: this.Module.cwrap('set_rewind_granularity', 'null', ['number']), setRewindGranularity: this.Module.cwrap('set_rewind_granularity', 'null', ['number']),
toggleSlowMotion: this.Module.cwrap('toggle_slow_motion', 'null', ['number']), toggleSlowMotion: this.Module.cwrap('toggle_slow_motion', 'null', ['number']),
setSlowMotionRatio: this.Module.cwrap('set_sm_ratio', '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/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'); 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"}); }, null, false, {responseType: "arraybuffer", method: "GET"});
}) })
} }
setVSync(enabled) {
this.functions.setVSync(enabled);
}
toggleMainLoop(playing) { toggleMainLoop(playing) {
this.functions.toggleMainLoop(playing); this.functions.toggleMainLoop(playing);
} }

View file

@ -3932,6 +3932,8 @@ class EmulatorJS {
if (this.rewindEnabled) { if (this.rewindEnabled) {
this.gameManager.setRewindGranularity(parseInt(value)); this.gameManager.setRewindGranularity(parseInt(value));
} }
} else if (option === "vsync") {
this.gameManager.setVSync(value === "enabled");
} }
this.gameManager.setVariable(option, value); this.gameManager.setVariable(option, value);
this.saveSettings(); this.saveSettings();
@ -4285,6 +4287,11 @@ class EmulatorJS {
'hide': this.localization("hide") 'hide': this.localization("hide")
}, 'hide'); }, 'hide');
addToMenu(this.localization("VSync"), "vsync", {
'enabled': this.localization("Enabled"),
'disabled': this.localization("Disabled")
}, "disabled");
addToMenu(this.localization('Fast Forward Ratio'), 'ff-ratio', [ 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" "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"); ], "3.0");