Add support for the SMSPlus-GX core (#774)

* Add support for the SMSPlus-GX core

* Added settings.json file to tell the live preview VS Code plugin to set the correct headers for threads

* Updated using the @ethanaobrien's suggestions
This commit is contained in:
Michael Green 2024-02-12 14:31:03 +11:00 committed by GitHub
parent 2b22ec14c3
commit 0dd28d6d57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 8 deletions

3
.gitignore vendored
View file

@ -1,6 +1,5 @@
**/node_modules/ **/node_modules/
*.db *.db
.vscode/settings.json
data/minify/package-lock.json data/minify/package-lock.json
package-lock.json package-lock.json
yarn.lock yarn.lock
@ -8,4 +7,4 @@ roms/
data/emulator.min.js data/emulator.min.js
data/emulator.min.css data/emulator.min.css
data/cores data/cores
.DS_Store .DS_Store

7
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"livePreview.httpHeaders": {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
"Accept-Ranges": "bytes"
}
}

View file

@ -60,7 +60,7 @@ class EmulatorJS {
'jaguar': 'virtualjaguar', 'jaguar': 'virtualjaguar',
'lynx': 'handy', 'lynx': 'handy',
'segaSaturn': 'yabause', 'segaSaturn': 'yabause',
'segaMS': 'genesis_plus_gx', 'segaMS': 'smsplus',
'segaMD': 'genesis_plus_gx', 'segaMD': 'genesis_plus_gx',
'segaGG': 'genesis_plus_gx', 'segaGG': 'genesis_plus_gx',
'segaCD': 'genesis_plus_gx', 'segaCD': 'genesis_plus_gx',
@ -132,6 +132,7 @@ class EmulatorJS {
'picodrive': ['bin', 'gen', 'smd', 'md', '32x', 'cue', 'iso', 'sms', '68k', 'chd'], 'picodrive': ['bin', 'gen', 'smd', 'md', '32x', 'cue', 'iso', 'sms', '68k', 'chd'],
'ppsspp': ['elf', 'iso', 'cso', 'prx', 'pbp'], 'ppsspp': ['elf', 'iso', 'cso', 'prx', 'pbp'],
'prosystem': ['a78', 'bin'], 'prosystem': ['a78', 'bin'],
'smsplus': ['m3u', 'mdx', 'md', 'smd', 'gen', 'bin', 'cue', 'iso', 'chd', 'bms', 'sms', 'gg', 'sg', '68k', 'sgd'],
'snes9x': ['smc', 'sfc', 'swc', 'fig', 'bs', 'st'], 'snes9x': ['smc', 'sfc', 'swc', 'fig', 'bs', 'st'],
'stella2014': ['a26', 'bin', 'zip'], 'stella2014': ['a26', 'bin', 'zip'],
'vice_x64': ['d64', 'd6z', 'd71', 'd7z', 'd80', 'd81', 'd82', 'd8z', 'g64', 'g6z', 'g41', 'g4z', 'x64', 'x6z', 'nib', 'nbz', 'd2m', 'd4m', 't64', 'tap', 'tcrt', 'prg', 'p00', 'crt', 'bin', 'cmd', 'm3u', 'vfl', 'vsf', 'zip', '7z', 'gz', '20', '40', '60', 'a0', 'b0', 'rom'], 'vice_x64': ['d64', 'd6z', 'd71', 'd7z', 'd80', 'd81', 'd82', 'd8z', 'g64', 'g6z', 'g41', 'g4z', 'x64', 'x6z', 'nib', 'nbz', 'd2m', 'd4m', 't64', 'tap', 'tcrt', 'prg', 'p00', 'crt', 'bin', 'cmd', 'm3u', 'vfl', 'vsf', 'zip', '7z', 'gz', '20', '40', '60', 'a0', 'b0', 'rom'],
@ -944,7 +945,7 @@ class EmulatorJS {
const altName = this.getBaseFileName(true); const altName = this.getBaseFileName(true);
let disableCue = false; let disableCue = false;
if (['pcsx_rearmed', 'genesis_plus_gx', 'picodrive', 'mednafen_pce', 'vice_x64', 'vice_x64sc', 'vice_x128', 'vice_xvic', 'vice_xplus4', 'vice_xpet'].includes(this.getCore()) && this.config.disableCue === undefined) { if (['pcsx_rearmed', 'genesis_plus_gx', 'picodrive', 'mednafen_pce', 'smsplus', 'vice_x64', 'vice_x64sc', 'vice_x128', 'vice_xvic', 'vice_xplus4', 'vice_xpet'].includes(this.getCore()) && this.config.disableCue === undefined) {
disableCue = true; disableCue = true;
} else { } else {
disableCue = this.config.disableCue; disableCue = this.config.disableCue;

View file

@ -106,17 +106,28 @@
</div> </div>
<script> <script>
var enableDebug = false; let enableDebug = false;
let enableThreads = false;
const queryString = window.location.search; const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
if (urlParams.get('debug') == 1) if (urlParams.get('debug') == 1) {
enableDebug = true; enableDebug = true;
if (enableDebug == true) {
console.log("Debug is enabled"); console.log("Debug is enabled");
} else { } else {
console.log("Debug is disabled"); console.log("Debug is disabled");
} }
if (urlParams.get('threads') == 1) {
if (window.SharedArrayBuffer) {
enableThreads = true;
console.log("Threads are enabled");
} else {
console.warn("Threads are disabled as SharedArrayBuffer is not available. Threads requires two headers to be set when sending you html page. See https://stackoverflow.com/a/68630724");
console.log("Threads are disabled");
}
} else {
console.log("Threads are disabled");
}
input.onchange = async () => { input.onchange = async () => {
const url = new Blob([input.files[0]]) const url = new Blob([input.files[0]])
@ -232,6 +243,7 @@
window.EJS_startOnLoaded = true; window.EJS_startOnLoaded = true;
window.EJS_DEBUG_XX = enableDebug; window.EJS_DEBUG_XX = enableDebug;
window.EJS_disableDatabases = true; window.EJS_disableDatabases = true;
window.EJS_threads = enableThreads;
script.src = "data/loader.js"; script.src = "data/loader.js";
document.body.appendChild(script); document.body.appendChild(script);