MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / enableShader

Method enableShader

data/src/emulator.js:5903–5929  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

5901 }
5902
5903 enableShader(name) {
5904 if (!this.gameManager) return;
5905 try {
5906 this.Module.FS.unlink("/shader/shader.glslp");
5907 } catch(e) {}
5908
5909 if (name === "disabled" || !this.config.shaders[name]) {
5910 this.gameManager.toggleShader(0);
5911 return;
5912 }
5913
5914 const shaderConfig = this.config.shaders[name];
5915
5916 if (typeof shaderConfig === "string") {
5917 this.Module.FS.writeFile("/shader/shader.glslp", shaderConfig, {}, "w+");
5918 } else {
5919 const shader = shaderConfig.shader;
5920 this.Module.FS.writeFile("/shader/shader.glslp", shader.type === "base64" ? atob(shader.value) : shader.value, {}, "w+");
5921 if (shaderConfig.resources && shaderConfig.resources.length) {
5922 shaderConfig.resources.forEach(resource => {
5923 this.Module.FS.writeFile(`/shader/${resource.name}`, resource.type === "base64" ? atob(resource.value) : resource.value, {}, "w+");
5924 });
5925 }
5926 }
5927
5928 this.gameManager.toggleShader(1);
5929 }
5930
5931 screenshot(callback, source, format, upscale) {
5932 const imageFormat = format || this.getSettingValue("screenshotFormat") || this.capture.photo.format;

Callers 1

handleSpecialOptionsMethod · 0.95

Calls 2

toggleShaderMethod · 0.80
writeFileMethod · 0.80

Tested by

no test coverage detected