From f230c58bbfafcf6769834e4d9b6b77a932f35ac9 Mon Sep 17 00:00:00 2001 From: Ian Flanigan Date: Tue, 23 Mar 2021 21:02:31 +0100 Subject: [PATCH] Add green screen support for the GL renderer (#68) * Add green screen support for the GL renderer This adds a configuration that is equivalent to a Monitor II monitor (at least according to the Open Emulator Project) to GL renderer. This does not need a restart to take effect. * Update `package.json` to latest `apple2shader` version --- js/gl.ts | 47 ++++++++++++++++++++++++++++++++--------- package.json | 2 +- types/apple2shader.d.ts | 3 --- 3 files changed, 38 insertions(+), 14 deletions(-) delete mode 100644 types/apple2shader.d.ts diff --git a/js/gl.ts b/js/gl.ts index 246d98c..9b87621 100644 --- a/js/gl.ts +++ b/js/gl.ts @@ -13,6 +13,7 @@ import { byte, Color, memory, MemoryPages, rom } from './types'; import { allocMemPages } from './util'; import { screenEmu } from 'apple2shader'; + import { GraphicsState, HiresPage, @@ -664,7 +665,7 @@ export class VideoModesGL implements VideoModes { private _grs: LoresPage[]; private _hgrs: HiresPage[]; private _sv: any; - private _displayConfig: any; + private _displayConfig: screenEmu.DisplayConfiguration; private _monoMode: boolean = false; ready: Promise @@ -688,18 +689,43 @@ export class VideoModesGL implements VideoModes { (window as any)._sv = this._sv; - this._displayConfig = new screenEmu.DisplayConfiguration(); - this._displayConfig.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); - this._displayConfig.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); - this._displayConfig.displayScanlineLevel = 0.5; - this._displayConfig.videoWhiteOnly = true; - this._displayConfig.videoSaturation = 0.8; - this._displayConfig.videoSize = new screenEmu.Size(1.25, 1.15); - this._displayConfig.videoCenter = new screenEmu.Point(0.01, 0.02); - // this._displayConfig.videoDecoder = 'CANVAS_CXA2025AS'; + this._displayConfig = this.defaultMonitor(); this._sv.displayConfiguration = this._displayConfig; } + private defaultMonitor(): screenEmu.DisplayConfiguration { + let config = new screenEmu.DisplayConfiguration(); + config.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); + config.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); + config.displayScanlineLevel = 0.5; + config.videoWhiteOnly = true; + config.videoSaturation = 0.8; + config.videoSize = new screenEmu.Size(1.25, 1.15); + config.videoCenter = new screenEmu.Point(0.01, 0.02); + // config.videoDecoder = 'CANVAS_CXA2025AS'; + return config; + } + + private monitorII(): screenEmu.DisplayConfiguration { + // Values taken from openemulator/libemulation/res/library/Monitors/Apple Monitor II.xml + let config = new screenEmu.DisplayConfiguration(); + config.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); + config.displayResolution = new screenEmu.Size(this.canvas.width, this.canvas.height); + config.videoDecoder = 'CANVAS_MONOCHROME'; + config.videoBrightness = 0.15; + config.videoContrast = 0.8; + config.videoSaturation = 1.45; + config.videoHue = 0.27; + config.videoCenter = new screenEmu.Point(0, 0); + config.videoSize = new screenEmu.Size(1.05, 1.05); + config.videoBandwidth = 6000000; + config.displayBarrel = 0.1; + config.displayScanlineLevel = 0.5; + config.displayCenterLighting = 0.5; + config.displayLuninanceGain = 1.5; + return config; + } + private _refresh() { doubleHiresMode = !an3 && hiresMode && _80colMode; @@ -914,6 +940,7 @@ export class VideoModesGL implements VideoModes { this._hgrs[1].mono(on); this._monoMode = on; + this._displayConfig = on ? this.monitorII() : this.defaultMonitor(); this._refresh(); } diff --git a/package.json b/package.json index b950ccc..9a3c14a 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "webpack-dev-server": "^3.11.0" }, "dependencies": { - "apple2shader": "whscullin/apple2shader#e87a445148bbcc7f4dbfa2609902071631f96bbc", + "apple2shader": "whscullin/apple2shader#f42252d8c2ad7055e3e5f5c39e235a710804e7a6", "micromodal": "^0.4.2" } } diff --git a/types/apple2shader.d.ts b/types/apple2shader.d.ts deleted file mode 100644 index 5c0a057..0000000 --- a/types/apple2shader.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'apple2shader'; - -declare const apple2shader: any;