Guard against videomode DOS

This commit is contained in:
Will Scullin 2021-04-20 18:24:47 -07:00
parent 90fc5fb7fc
commit bf67d9dca4
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
2 changed files with 16 additions and 8 deletions

View File

@ -903,6 +903,7 @@ export class VideoModes2D implements VideoModes {
private _context: CanvasRenderingContext2D | null;
private _left: number;
private _top: number;
private _refreshFlag: boolean = true;
public ready = Promise.resolve();
@ -928,10 +929,7 @@ export class VideoModes2D implements VideoModes {
mixedDHRMode = this._flag == 2 && doubleHiresMode;
monoDHRMode = this._flag == 3 && doubleHiresMode;
this._grs[0].refresh();
this._grs[1].refresh();
this._hgrs[0].refresh();
this._hgrs[1].refresh();
this._refreshFlag = true;
}
refresh() {
@ -1092,6 +1090,12 @@ export class VideoModes2D implements VideoModes {
const hgr = this._hgrs[pageMode - 1];
const gr = this._grs[pageMode - 1];
if (this._refreshFlag) {
hgr.refresh();
gr.refresh();
this._refreshFlag = false;
}
if (altData) {
blitted = this.updateImage(
altData,

View File

@ -603,6 +603,7 @@ export class VideoModesGL implements VideoModes {
private _displayConfig: screenEmu.DisplayConfiguration;
private _monoMode: boolean = false;
private _scanlines: boolean = false;
private _refreshFlag: boolean = true;
public ready: Promise<void>
@ -663,10 +664,7 @@ export class VideoModesGL implements VideoModes {
private _refresh() {
doubleHiresMode = !an3 && hiresMode && _80colMode;
this._grs[0].refresh();
this._grs[1].refresh();
this._hgrs[0].refresh();
this._hgrs[1].refresh();
this._refreshFlag = true;
if (this._displayConfig) {
this._displayConfig.videoWhiteOnly = textMode || this._monoMode;
@ -817,6 +815,12 @@ export class VideoModesGL implements VideoModes {
const hgr = this._hgrs[pageMode - 1];
const gr = this._grs[pageMode - 1];
if (this._refreshFlag) {
hgr.refresh();
gr.refresh();
this._refreshFlag = false;
}
if (altData) {
blitted = this.updateImage(
altData,