From 16e3af616c52db22638cacef60eb7dade73584bc Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Fri, 3 Jul 2015 15:03:01 +0600 Subject: [PATCH] Add hack hack_VIUpdateOnCIChange for Quake II. Quake II uses single buffer mode when underwater, so additional check gDP.colorImage.changed != 0 is necessary to detect frame change. This check may cause dummy buffers swaps, so now it is used for Quake II only. Fixed #592 --- src/Config.h | 1 + src/RSP.cpp | 2 ++ src/VI.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Config.h b/src/Config.h index fd58a30d8..f4d527926 100644 --- a/src/Config.h +++ b/src/Config.h @@ -120,6 +120,7 @@ struct Config #define hack_legoRacers (1<<7) //LEGO racers course map #define hack_blastCorps (1<<8) //Blast Corps black polygons #define hack_ignoreVIHeightChange (1<<9) //Do not reset FBO when VI height is changed. Space Invaders need it. +#define hack_VIUpdateOnCIChange (1<<10) //Update frame if color buffer changed. Needed for Quake II underwater. extern Config config; diff --git a/src/RSP.cpp b/src/RSP.cpp index 73acffa43..3d9b8cb76 100644 --- a/src/RSP.cpp +++ b/src/RSP.cpp @@ -330,6 +330,8 @@ void RSP_Init() config.generalEmulation.hacks |= hack_blastCorps; else if (strstr(RSP.romname, (const char *)"SPACE INVADERS") != NULL) config.generalEmulation.hacks |= hack_ignoreVIHeightChange; + else if (strstr(RSP.romname, (const char *)"QUAKE II") != NULL) + config.generalEmulation.hacks |= hack_VIUpdateOnCIChange; api().FindPluginPath(RSP.pluginpath); diff --git a/src/VI.cpp b/src/VI.cpp index bfac3b082..35965ce58 100644 --- a/src/VI.cpp +++ b/src/VI.cpp @@ -110,7 +110,7 @@ void VI_UpdateScreen() if (config.frameBufferEmulation.enable) { const bool bCFB = (gDP.changed&CHANGED_CPU_FB_WRITE) == CHANGED_CPU_FB_WRITE; - const bool bNeedUpdate = gDP.colorImage.changed != 0 || (bCFB ? true : (*REG.VI_ORIGIN != VI.lastOrigin)); + const bool bNeedUpdate = (bCFB ? true : (*REG.VI_ORIGIN != VI.lastOrigin)) || ((config.generalEmulation.hacks & hack_VIUpdateOnCIChange) != 0 && gDP.colorImage.changed != 0); if (bNeedUpdate) { if (bCFB) {