mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Check for fullscreen and state support
This commit is contained in:
parent
acf668a2f3
commit
daaf010b94
2 changed files with 37 additions and 3 deletions
|
@ -18,7 +18,9 @@ class EJS_GameManager {
|
||||||
getDiskCount: this.Module.cwrap('get_disk_count', 'number', []),
|
getDiskCount: this.Module.cwrap('get_disk_count', 'number', []),
|
||||||
getCurrentDisk: this.Module.cwrap('get_current_disk', 'number', []),
|
getCurrentDisk: this.Module.cwrap('get_current_disk', 'number', []),
|
||||||
setCurrentDisk: this.Module.cwrap('set_current_disk', 'null', ['number']),
|
setCurrentDisk: this.Module.cwrap('set_current_disk', 'null', ['number']),
|
||||||
setVolume: this.Module.cwrap('set_volume', 'null', ['number'])
|
getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []),
|
||||||
|
saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []),
|
||||||
|
supportsStates: this.Module.cwrap('supports_states', 'number', [])
|
||||||
}
|
}
|
||||||
this.mkdir("/home");
|
this.mkdir("/home");
|
||||||
this.mkdir("/home/web_user");
|
this.mkdir("/home/web_user");
|
||||||
|
@ -135,8 +137,14 @@ class EJS_GameManager {
|
||||||
setCurrentDisk(disk) {
|
setCurrentDisk(disk) {
|
||||||
this.functions.setCurrentDisk(disk);
|
this.functions.setCurrentDisk(disk);
|
||||||
}
|
}
|
||||||
setVolume(volume) {
|
getSaveFilePath() {
|
||||||
this.functions.setVolume(volume);
|
return this.functions.getSaveFilePath();
|
||||||
|
}
|
||||||
|
saveSaveFiles() {
|
||||||
|
this.functions.saveSaveFiles();
|
||||||
|
}
|
||||||
|
supportsStates() {
|
||||||
|
return !!this.functions.supportsStates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -635,6 +635,7 @@ class EmulatorJS {
|
||||||
this.virtualGamepad.style.display = "";
|
this.virtualGamepad.style.display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.checkSupportedOpts();
|
||||||
this.setupSettingsMenu();
|
this.setupSettingsMenu();
|
||||||
this.handleResize();
|
this.handleResize();
|
||||||
this.updateCheatUI();
|
this.updateCheatUI();
|
||||||
|
@ -667,6 +668,12 @@ class EmulatorJS {
|
||||||
this.gamepad.on('buttondown', this.gamepadEvent.bind(this));
|
this.gamepad.on('buttondown', this.gamepadEvent.bind(this));
|
||||||
this.gamepad.on('buttonup', this.gamepadEvent.bind(this));
|
this.gamepad.on('buttonup', this.gamepadEvent.bind(this));
|
||||||
}
|
}
|
||||||
|
checkSupportedOpts() {
|
||||||
|
if (!this.gameManager.supportsStates()) {
|
||||||
|
this.elements.bottomBar.saveState.setAttribute("hidden", "");
|
||||||
|
this.elements.bottomBar.loadState.setAttribute("hidden", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
updateGamepadLabels() {
|
updateGamepadLabels() {
|
||||||
for (let i=0; i<this.gamepadLabels.length; i++) {
|
for (let i=0; i<this.gamepadLabels.length; i++) {
|
||||||
if (this.gamepad.gamepads[i]) {
|
if (this.gamepad.gamepads[i]) {
|
||||||
|
@ -1107,6 +1114,25 @@ class EmulatorJS {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const hasFullscreen = !!(this.elements.parent.requestFullscreen || this.elements.parent.mozRequestFullScreen || this.elements.parent.webkitRequestFullscreen || this.elements.parent.msRequestFullscreen);
|
||||||
|
|
||||||
|
if (!hasFullscreen) {
|
||||||
|
exit.style.display = "none";
|
||||||
|
enter.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.elements.bottomBar = {
|
||||||
|
playPause: [pauseButton, playButton],
|
||||||
|
restart: [restartButton],
|
||||||
|
settings: [settingButton],
|
||||||
|
fullscreen: [enter, exit],
|
||||||
|
saveState: [saveState],
|
||||||
|
loadState: [loadState],
|
||||||
|
gamepad: [controlMenu],
|
||||||
|
cheat: [cheatMenu],
|
||||||
|
cacheManager: [cache]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.config.buttonOpts) {
|
if (this.config.buttonOpts) {
|
||||||
if (!this.config.buttonOpts.playPause) {
|
if (!this.config.buttonOpts.playPause) {
|
||||||
|
|
Loading…
Reference in a new issue