Fix SharedArrayBuffer check & video rotation without reload (#923)

* video_roation without reload

* fix SharedArrayBuffer check

* remove notCoreOption check
This commit is contained in:
Allan Niles 2024-12-21 11:39:08 -07:00 committed by GitHub
parent 39c9ec9e6c
commit 35639bb896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View File

@ -29,7 +29,8 @@ class EJS_GameManager {
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', ['']),
setVSync: this.Module.cwrap('set_vsync', 'null', ['number'])
setVSync: this.Module.cwrap('set_vsync', 'null', ['number']),
setVideoRoation: this.Module.cwrap('set_video_rotation', 'null', ['number'])
}
this.writeFile("/home/web_user/retroarch/userdata/retroarch.cfg", this.getRetroArchCfg());
@ -421,6 +422,13 @@ class EJS_GameManager {
getFrameNum() {
return this.functions.getFrameNum();
}
setVideoRotation(rotation) {
try {
this.functions.setVideoRoation(rotation);
} catch(e) {
console.warn(e);
}
}
}
window.EJS_GameManager = EJS_GameManager;

View File

@ -557,7 +557,7 @@ class EmulatorJS {
this.webgl2Enabled = true;
}
let threads = false;
if (SharedArrayBuffer instanceof Function) {
if (typeof window.SharedArrayBuffer === "function") {
const opt = this.preGetSetting("ejs_threads");
if (opt) {
threads = (opt === "enabled");
@ -3986,6 +3986,8 @@ class EmulatorJS {
}
} else if (option === "vsync") {
this.gameManager.setVSync(value === "enabled");
} else if (option === "videoRotation") {
this.gameManager.setVideoRotation(value);
}
}
menuOptionChanged(option, value) {
@ -4392,7 +4394,7 @@ class EmulatorJS {
if (core && core.length > 1) {
addToMenu(this.localization("Core" + " (" + this.localization('Requires restart') + ")"), 'retroarch_core', core, this.getCore(), home);
}
if (SharedArrayBuffer instanceof Function && !this.requiresThreads(this.getCore())) {
if (typeof window.SharedArrayBuffer === "function" && !this.requiresThreads(this.getCore())) {
addToMenu(this.localization("Threads"), "ejs_threads", {
'enabled': this.localization("Enabled"),
'disabled': this.localization("Disabled")
@ -4448,7 +4450,7 @@ class EmulatorJS {
'disabled': this.localization("Disabled")
}, "enabled", graphicsOptions, true);
addToMenu(this.localization("Video Rotation" + " (" + this.localization('Requires restart') + ")"), 'videoRotation', {
addToMenu(this.localization('Video Rotation'), 'videoRotation', {
'0': "0 deg",
'1': "90 deg",
'2': "180 deg",
@ -4530,6 +4532,7 @@ class EmulatorJS {
true);
})
}
/*
this.retroarchOpts = [