diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs
index 2acc5b6b6f..028abd337f 100644
--- a/BizHawk.Client.Common/config/Config.cs
+++ b/BizHawk.Client.Common/config/Config.cs
@@ -49,7 +49,7 @@ namespace BizHawk.Client.Common
public int Input_Hotkey_OverrideOptions = 0;
public bool StackOSDMessages = true;
public int TargetZoomFactor = 2;
- public int TargetScanlineFilterIntensity = 0; // choose between 0 and 256
+ public int TargetScanlineFilterIntensity = 128; // choose between 0 and 256
public int TargetDisplayFilter = 0;
public RecentFiles RecentRoms = new RecentFiles(8);
public bool PauseWhenMenuActivated = true;
diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
index 29ed0c81ac..b69f8f3693 100644
--- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
+++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
@@ -470,12 +470,6 @@
-
- Form
-
-
- ScanlineSlider.cs
-
Form
@@ -1003,9 +997,6 @@
Resources.resx
True
-
- ScanlineSlider.cs
-
BatchRun.cs
@@ -1161,6 +1152,7 @@
WatchEditor.cs
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
index 77d0d807df..c5e0797dbb 100644
--- a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
+++ b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
@@ -49,9 +49,15 @@ namespace BizHawk.Client.EmuHawk
RetroShader_Hq2x = new Bizware.BizwareGL.Drivers.OpenTK.RetroShader(GL, str);
}
+ using (var stream = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Client.EmuHawk.DisplayManager.Filters.BizScanlines.glsl"))
+ {
+ var str = new System.IO.StreamReader(stream).ReadToEnd();
+ RetroShader_BizScanlines = new Bizware.BizwareGL.Drivers.OpenTK.RetroShader(GL, str);
+ }
+
}
- Bizware.BizwareGL.Drivers.OpenTK.RetroShader RetroShader_Hq2x;
+ Bizware.BizwareGL.Drivers.OpenTK.RetroShader RetroShader_Hq2x, RetroShader_BizScanlines;
public bool Disposed { get; private set; }
@@ -112,6 +118,7 @@ namespace BizHawk.Client.EmuHawk
luaEmuTexture = LuaEmuTextureFrugalizer.Get(luaEmuSurface);
+ //TargetScanlineFilterIntensity
//apply filter chain (currently, over-simplified)
Texture2d currentTexture = videoTexture;
if (Global.Config.TargetDisplayFilter == 1)
@@ -122,6 +129,16 @@ namespace BizHawk.Client.EmuHawk
RetroShader_Hq2x.Run(videoTexture, videoTexture.Size, outSize, true);
currentTexture = rt.Texture2d;
}
+ if (Global.Config.TargetDisplayFilter == 2)
+ {
+ var rt = Video2xFrugalizer.Get(videoTexture.IntWidth*2,videoTexture.IntHeight*2);
+ rt.Bind();
+ Size outSize = new Size(videoTexture.IntWidth * 2, videoTexture.IntHeight * 2);
+ RetroShader_BizScanlines.Bind();
+ RetroShader_BizScanlines.Pipeline["uIntensity"].Set(1.0f - Global.Config.TargetScanlineFilterIntensity / 256.0f);
+ RetroShader_BizScanlines.Run(videoTexture, videoTexture.Size, outSize, true);
+ currentTexture = rt.Texture2d;
+ }
//begin drawing to the PresentationPanel:
GraphicsControl.Begin();
diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/BizScanlines.glsl b/BizHawk.Client.EmuHawk/DisplayManager/Filters/BizScanlines.glsl
new file mode 100644
index 0000000000..bd5123caac
--- /dev/null
+++ b/BizHawk.Client.EmuHawk/DisplayManager/Filters/BizScanlines.glsl
@@ -0,0 +1,76 @@
+#if defined(VERTEX)
+
+#if __VERSION__ >= 130
+#define COMPAT_VARYING out
+#define COMPAT_ATTRIBUTE in
+#define COMPAT_TEXTURE texture
+#else
+#define COMPAT_VARYING varying
+#define COMPAT_ATTRIBUTE attribute
+#define COMPAT_TEXTURE texture2D
+#endif
+
+#ifdef GL_ES
+#define COMPAT_PRECISION mediump
+#else
+#define COMPAT_PRECISION
+#endif
+
+COMPAT_ATTRIBUTE vec4 VertexCoord;
+COMPAT_ATTRIBUTE vec4 COLOR;
+COMPAT_ATTRIBUTE vec4 TexCoord;
+
+COMPAT_VARYING vec2 vTexCoord0;
+
+uniform mat4 MVPMatrix;
+uniform int FrameDirection;
+uniform int FrameCount;
+uniform COMPAT_PRECISION vec2 OutputSize;
+uniform COMPAT_PRECISION vec2 TextureSize;
+uniform COMPAT_PRECISION vec2 InputSize;
+
+void main()
+{
+ gl_Position = MVPMatrix * VertexCoord;
+ vTexCoord0 = TexCoord;
+}
+
+#elif defined(FRAGMENT)
+
+#if __VERSION__ >= 130
+#define COMPAT_VARYING in
+#define COMPAT_TEXTURE texture
+out vec4 FragColor;
+#else
+#define COMPAT_VARYING varying
+#define FragColor gl_FragColor
+#define COMPAT_TEXTURE texture2D
+#endif
+
+#ifdef GL_ES
+#ifdef GL_FRAGMENT_PRECISION_HIGH
+precision highp float;
+#else
+precision mediump float;
+#endif
+#define COMPAT_PRECISION mediump
+#else
+#define COMPAT_PRECISION
+#endif
+
+COMPAT_VARYING vec2 vTexCoord0;
+uniform sampler2D Texture;
+uniform int FrameDirection;
+uniform int FrameCount;
+uniform COMPAT_PRECISION vec2 OutputSize;
+uniform COMPAT_PRECISION vec2 TextureSize;
+uniform COMPAT_PRECISION vec2 InputSize;
+uniform float uIntensity;
+
+void main()
+{
+ vec4 temp = texture2D(Texture,vTexCoord0);
+ if(((int)gl_FragCoord.y)%2==1) temp.rgb *= uIntensity;
+ FragColor = temp;
+}
+#endif
diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Hq2x.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Hq2x.cs
deleted file mode 100644
index fd062f1ac3..0000000000
--- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Hq2x.cs
+++ /dev/null
@@ -1,536 +0,0 @@
-using System;
-using System.Text;
-using System.Threading;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-
-//what license is this?? who knows??
-//ref: http://vba-rerecording.googlecode.com/svn/trunk/src/2xsai.cpp
-
-namespace BizHawk.Client.EmuHawk
-{
-
- class Hq2xBase_2xSai : Hq2xBase {}
- class Hq2xBase_Super2xSai : Hq2xBase { }
- class Hq2xBase_SuperEagle : Hq2xBase { }
-
- public abstract class Hq2xBase : IDisplayFilter
- {
- public DisplayFilterAnalysisReport Analyze(Size sourceSize)
- {
- var ret = new DisplayFilterAnalysisReport();
- ret.Success = true;
- ret.OutputSize = new Size(sourceSize.Width * 2, sourceSize.Height * 2);
- return ret;
- }
-
- public unsafe DisplaySurface Execute(DisplaySurface surface)
- {
- int w = surface.Width;
- int h = surface.Height;
- var ret = new DisplaySurface(w * 2, h * 2);
- using (var padded = surface.ToPaddedSurface(1, 1, 2, 2))
- {
- if(this is Hq2xBase_2xSai) _2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
- if (this is Hq2xBase_Super2xSai) Super2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
- if (this is Hq2xBase_SuperEagle) SuperEagle32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
- padded.Dispose();
- }
- return ret;
- }
-
- static int GetResult1 (uint A, uint B, uint C, uint D, uint E )
- {
- int x = 0;
- int y = 0;
- int r = 0;
-
- if (A == C)
- x += 1;
- else if (B == C)
- y += 1;
- if (A == D)
- x += 1;
- else if (B == D)
- y += 1;
- if (x <= 1)
- r += 1;
- if (y <= 1)
- r -= 1;
- return r;
- }
-
-
- static int GetResult2 (uint A, uint B, uint C, uint D, uint E )
- {
- int x = 0;
- int y = 0;
- int r = 0;
-
- if (A == C)
- x += 1;
- else if (B == C)
- y += 1;
- if (A == D)
- x += 1;
- else if (B == D)
- y += 1;
- if (x <= 1)
- r -= 1;
- if (y <= 1)
- r += 1;
- return r;
- }
-
- static int GetResult (uint A, uint B, uint C, uint D)
- {
- int x = 0;
- int y = 0;
- int r = 0;
-
- if (A == C)
- x += 1;
- else if (B == C)
- y += 1;
- if (A == D)
- x += 1;
- else if (B == D)
- y += 1;
- if (x <= 1)
- r += 1;
- if (y <= 1)
- r -= 1;
- return r;
- }
-
- const uint colorMask = 0xfefefe;
- const uint lowPixelMask = 0x010101;
- const uint qcolorMask = 0xfcfcfc;
- const uint qlowpixelMask = 0x030303;
- const uint redblueMask = 0xF81F;
- const uint greenMask = 0x7E0;
-
-static uint INTERPOLATE (uint A, uint B)
-{
- if (A != B) {
- return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) +
- (A & B & lowPixelMask));
- } else
- return A;
-}
-
-static uint Q_INTERPOLATE(uint A, uint B, uint C, uint D)
-{
- uint x = ((A & qcolorMask) >> 2) +
- ((B & qcolorMask) >> 2) +
- ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
- uint y = (A & qlowpixelMask) +
- (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask);
-
- y = (y >> 2) & qlowpixelMask;
- return x + y;
-}
-
-
-unsafe static void _2xSaI32 (byte *srcPtr, uint srcPitch, byte * deltaPtr ,
- byte *dstPtr, uint dstPitch, uint width, uint height)
-{
- uint *dP;
- uint *bP;
- uint inc_bP = 1;
-
- uint Nextline = srcPitch >> 2;
-
- for (; height!=0; height--) {
- bP = (uint *) srcPtr;
- dP = (uint *) dstPtr;
-
- for (uint finish = width; finish!=0; finish -= inc_bP) {
- uint colorA, colorB;
- uint colorC, colorD,
- colorE, colorF, colorG, colorH,
- colorI, colorJ, colorK, colorL,
-
- colorM, colorN, colorO, colorP;
- uint product, product1, product2;
-
- //---------------------------------------
- // Map of the pixels: I|E F|J
- // G|A B|K
- // H|C D|L
- // M|N O|P
- colorI = *(bP - Nextline - 1);
- colorE = *(bP - Nextline);
- colorF = *(bP - Nextline + 1);
- colorJ = *(bP - Nextline + 2);
-
- colorG = *(bP - 1);
- colorA = *(bP);
- colorB = *(bP + 1);
- colorK = *(bP + 2);
-
- colorH = *(bP + Nextline - 1);
- colorC = *(bP + Nextline);
- colorD = *(bP + Nextline + 1);
- colorL = *(bP + Nextline + 2);
-
- colorM = *(bP + Nextline + Nextline - 1);
- colorN = *(bP + Nextline + Nextline);
- colorO = *(bP + Nextline + Nextline + 1);
- colorP = *(bP + Nextline + Nextline + 2);
-
- if ((colorA == colorD) && (colorB != colorC)) {
- if (((colorA == colorE) && (colorB == colorL)) ||
- ((colorA == colorC) && (colorA == colorF)
- && (colorB != colorE) && (colorB == colorJ))) {
- product = colorA;
- } else {
- product = INTERPOLATE (colorA, colorB);
- }
-
- if (((colorA == colorG) && (colorC == colorO)) ||
- ((colorA == colorB) && (colorA == colorH)
- && (colorG != colorC) && (colorC == colorM))) {
- product1 = colorA;
- } else {
- product1 = INTERPOLATE (colorA, colorC);
- }
- product2 = colorA;
- } else if ((colorB == colorC) && (colorA != colorD)) {
- if (((colorB == colorF) && (colorA == colorH)) ||
- ((colorB == colorE) && (colorB == colorD)
- && (colorA != colorF) && (colorA == colorI))) {
- product = colorB;
- } else {
- product = INTERPOLATE (colorA, colorB);
- }
-
- if (((colorC == colorH) && (colorA == colorF)) ||
- ((colorC == colorG) && (colorC == colorD)
- && (colorA != colorH) && (colorA == colorI))) {
- product1 = colorC;
- } else {
- product1 = INTERPOLATE (colorA, colorC);
- }
- product2 = colorB;
- } else if ((colorA == colorD) && (colorB == colorC)) {
- if (colorA == colorB) {
- product = colorA;
- product1 = colorA;
- product2 = colorA;
- } else {
- int r = 0;
-
- product1 = INTERPOLATE (colorA, colorC);
- product = INTERPOLATE (colorA, colorB);
-
- r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
- r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
- r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
- r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
-
- if (r > 0)
- product2 = colorA;
- else if (r < 0)
- product2 = colorB;
- else {
- product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD);
- }
- }
- } else {
- product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD);
-
- if ((colorA == colorC) && (colorA == colorF)
- && (colorB != colorE) && (colorB == colorJ)) {
- product = colorA;
- } else if ((colorB == colorE) && (colorB == colorD)
- && (colorA != colorF) && (colorA == colorI)) {
- product = colorB;
- } else {
- product = INTERPOLATE (colorA, colorB);
- }
-
- if ((colorA == colorB) && (colorA == colorH)
- && (colorG != colorC) && (colorC == colorM)) {
- product1 = colorA;
- } else if ((colorC == colorG) && (colorC == colorD)
- && (colorA != colorH) && (colorA == colorI)) {
- product1 = colorC;
- } else {
- product1 = INTERPOLATE (colorA, colorC);
- }
- }
- *(dP) = colorA | 0xFF000000;
- *(dP + 1) = product | 0xFF000000;
- *(dP + (dstPitch >> 2)) = product1 | 0xFF000000;
- *(dP + (dstPitch >> 2) + 1) = product2 | 0xFF000000;
-
- bP += inc_bP;
- dP += 2;
- } // end of for ( finish= width etc..)
-
- srcPtr += srcPitch;
- dstPtr += dstPitch * 2;
-// deltaPtr += srcPitch;
- } // endof: for (height; height; height--)
-}
-
-
-unsafe void SuperEagle32 (byte *srcPtr, uint srcPitch, byte * deltaPtr,
- byte* dstPtr, uint dstPitch, uint width, uint height)
-{
- uint *dP;
- uint *bP;
-// uint *xP;
- uint inc_bP;
-
- inc_bP = 1;
-
- uint Nextline = srcPitch >> 2;
-
- for (; height!=0; height--) {
- bP = (uint *) srcPtr;
-// xP = (uint *) deltaPtr;
- dP = (uint *)dstPtr;
- for (uint finish = width; finish!=0; finish -= inc_bP) {
- uint color4, color5, color6;
- uint color1, color2, color3;
- uint colorA1, colorA2, colorB1, colorB2, colorS1, colorS2;
- uint product1a, product1b, product2a, product2b;
-
- colorB1 = *(bP - Nextline);
- colorB2 = *(bP - Nextline + 1);
-
- color4 = *(bP - 1);
- color5 = *(bP);
- color6 = *(bP + 1);
- colorS2 = *(bP + 2);
-
- color1 = *(bP + Nextline - 1);
- color2 = *(bP + Nextline);
- color3 = *(bP + Nextline + 1);
- colorS1 = *(bP + Nextline + 2);
-
- colorA1 = *(bP + Nextline + Nextline);
- colorA2 = *(bP + Nextline + Nextline + 1);
-
- // --------------------------------------
- if (color2 == color6 && color5 != color3) {
- product1b = product2a = color2;
- if ((color1 == color2) || (color6 == colorB2)) {
- product1a = INTERPOLATE (color2, color5);
- product1a = INTERPOLATE (color2, product1a);
- // product1a = color2;
- } else {
- product1a = INTERPOLATE (color5, color6);
- }
-
- if ((color6 == colorS2) || (color2 == colorA1)) {
- product2b = INTERPOLATE (color2, color3);
- product2b = INTERPOLATE (color2, product2b);
- // product2b = color2;
- } else {
- product2b = INTERPOLATE (color2, color3);
- }
- } else if (color5 == color3 && color2 != color6) {
- product2b = product1a = color5;
-
- if ((colorB1 == color5) || (color3 == colorS1)) {
- product1b = INTERPOLATE (color5, color6);
- product1b = INTERPOLATE (color5, product1b);
- // product1b = color5;
- } else {
- product1b = INTERPOLATE (color5, color6);
- }
-
- if ((color3 == colorA2) || (color4 == color5)) {
- product2a = INTERPOLATE (color5, color2);
- product2a = INTERPOLATE (color5, product2a);
- // product2a = color5;
- } else {
- product2a = INTERPOLATE (color2, color3);
- }
-
- } else if (color5 == color3 && color2 == color6) {
- int r = 0;
-
- r += GetResult (color6, color5, color1, colorA1);
- r += GetResult (color6, color5, color4, colorB1);
- r += GetResult (color6, color5, colorA2, colorS1);
- r += GetResult (color6, color5, colorB2, colorS2);
-
- if (r > 0) {
- product1b = product2a = color2;
- product1a = product2b = INTERPOLATE (color5, color6);
- } else if (r < 0) {
- product2b = product1a = color5;
- product1b = product2a = INTERPOLATE (color5, color6);
- } else {
- product2b = product1a = color5;
- product1b = product2a = color2;
- }
- } else {
- product2b = product1a = INTERPOLATE (color2, color6);
- product2b =
- Q_INTERPOLATE (color3, color3, color3, product2b);
- product1a =
- Q_INTERPOLATE (color5, color5, color5, product1a);
-
- product2a = product1b = INTERPOLATE (color5, color3);
- product2a =
- Q_INTERPOLATE (color2, color2, color2, product2a);
- product1b =
- Q_INTERPOLATE (color6, color6, color6, product1b);
-
- // product1a = color5;
- // product1b = color6;
- // product2a = color2;
- // product2b = color3;
- }
- *(dP) = product1a | 0xFF000000;
- *(dP+1) = product1b | 0xFF000000;
- *(dP + (dstPitch >> 2)) = product2a | 0xFF000000;
- *(dP + (dstPitch >> 2) +1) = product2b | 0xFF000000;
-// *xP = color5;
-
- bP += inc_bP;
-// xP += inc_bP;
- dP += 2;
- } // end of for ( finish= width etc..)
-
- srcPtr += srcPitch;
- dstPtr += dstPitch * 2;
-// deltaPtr += srcPitch;
- } // endof: for (height; height; height--)
-}
-
-
-unsafe void Super2xSaI32 (byte *srcPtr, uint srcPitch,
- byte * deltaPtr , byte *dstPtr, uint dstPitch,
- uint width, uint height)
-{
- uint *bP;
- uint *dP;
- uint inc_bP;
- uint Nextline = srcPitch >> 2;
- inc_bP = 1;
-
- for (; height!=0; height--) {
- bP = (uint *) srcPtr;
- dP = (uint *) dstPtr;
-
- for (uint finish = width; finish!=0; finish -= inc_bP) {
- uint color4, color5, color6;
- uint color1, color2, color3;
- uint colorA0, colorA1, colorA2, colorA3,
- colorB0, colorB1, colorB2, colorB3, colorS1, colorS2;
- uint product1a, product1b, product2a, product2b;
-
- //--------------------------------------- B1 B2
- // 4 5 6 S2
- // 1 2 3 S1
- // A1 A2
-
- colorB0 = *(bP - Nextline - 1);
- colorB1 = *(bP - Nextline);
- colorB2 = *(bP - Nextline + 1);
- colorB3 = *(bP - Nextline + 2);
-
- color4 = *(bP - 1);
- color5 = *(bP);
- color6 = *(bP + 1);
- colorS2 = *(bP + 2);
-
- color1 = *(bP + Nextline - 1);
- color2 = *(bP + Nextline);
- color3 = *(bP + Nextline + 1);
- colorS1 = *(bP + Nextline + 2);
-
- colorA0 = *(bP + Nextline + Nextline - 1);
- colorA1 = *(bP + Nextline + Nextline);
- colorA2 = *(bP + Nextline + Nextline + 1);
- colorA3 = *(bP + Nextline + Nextline + 2);
-
- //--------------------------------------
- if (color2 == color6 && color5 != color3) {
- product2b = product1b = color2;
- } else if (color5 == color3 && color2 != color6) {
- product2b = product1b = color5;
- } else if (color5 == color3 && color2 == color6) {
- int r = 0;
-
- r += GetResult (color6, color5, color1, colorA1);
- r += GetResult (color6, color5, color4, colorB1);
- r += GetResult (color6, color5, colorA2, colorS1);
- r += GetResult (color6, color5, colorB2, colorS2);
-
- if (r > 0)
- product2b = product1b = color6;
- else if (r < 0)
- product2b = product1b = color5;
- else {
- product2b = product1b = INTERPOLATE (color5, color6);
- }
- } else {
- if (color6 == color3 && color3 == colorA1
- && color2 != colorA2 && color3 != colorA0)
- product2b =
- Q_INTERPOLATE (color3, color3, color3, color2);
- else if (color5 == color2 && color2 == colorA2
- && colorA1 != color3 && color2 != colorA3)
- product2b =
- Q_INTERPOLATE (color2, color2, color2, color3);
- else
- product2b = INTERPOLATE (color2, color3);
-
- if (color6 == color3 && color6 == colorB1
- && color5 != colorB2 && color6 != colorB0)
- product1b =
- Q_INTERPOLATE (color6, color6, color6, color5);
- else if (color5 == color2 && color5 == colorB2
- && colorB1 != color6 && color5 != colorB3)
- product1b =
- Q_INTERPOLATE (color6, color5, color5, color5);
- else
- product1b = INTERPOLATE (color5, color6);
- }
-
- if (color5 == color3 && color2 != color6 && color4 == color5
- && color5 != colorA2)
- product2a = INTERPOLATE (color2, color5);
- else
- if (color5 == color1 && color6 == color5
- && color4 != color2 && color5 != colorA0)
- product2a = INTERPOLATE (color2, color5);
- else
- product2a = color2;
-
- if (color2 == color6 && color5 != color3 && color1 == color2
- && color2 != colorB2)
- product1a = INTERPOLATE (color2, color5);
- else
- if (color4 == color2 && color3 == color2
- && color1 != color5 && color2 != colorB0)
- product1a = INTERPOLATE (color2, color5);
- else
- product1a = color5;
- *(dP) = product1a | 0xFF000000;
- *(dP + 1) = product1b | 0xFF000000;
- *(dP + (dstPitch >> 2)) = product2a | 0xFF000000;
- *(dP + (dstPitch >> 2) + 1) = product2b | 0xFF000000;
-
- bP += inc_bP;
- dP += 2;
- } // end of for ( finish= width etc..)
-
- srcPtr += srcPitch;
- dstPtr += dstPitch * 2;
-// deltaPtr += srcPitch;
- } // endof: for (; height; height--)
-}
-
- }
-}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Scanlines.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Scanlines.cs
deleted file mode 100644
index e4aaeb50b3..0000000000
--- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Scanlines.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using System.Text;
-using System.Threading;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using BizHawk.Client.Common;
-
-//what license is this?? who knows??
-//ref: http://vba-rerecording.googlecode.com/svn/trunk/src/2xsai.cpp
-
-namespace BizHawk.Client.EmuHawk
-{
- public class Scanlines2x : IDisplayFilter
- {
- public DisplayFilterAnalysisReport Analyze(Size sourceSize)
- {
- var ret = new DisplayFilterAnalysisReport();
- ret.Success = true;
- ret.OutputSize = new Size(sourceSize.Width * 2, sourceSize.Height * 2);
- return ret;
- }
-
- public unsafe DisplaySurface Execute(DisplaySurface surface)
- {
- int w = surface.Width;
- int h = surface.Height;
- var ret = new DisplaySurface(w * 2, h * 2);
- RunScanlines((byte*)surface.PixelPtr, surface.Stride, (byte*)ret.PixelPtr, ret.Stride, w, h);
- return ret;
- }
-
- unsafe static void RunScanlines(byte* srcPtr, int srcPitch, byte* destPtr, int dstPitch, int width, int height)
- {
- int intensity = Global.Config.TargetScanlineFilterIntensity;
-
- byte* srcLine = srcPtr;
- for (int y = 0; y < height; y++)
- {
- byte *s = srcLine;
- //first copied line (2x width)
- for (int x = 0; x < width; x++)
- {
- *destPtr++ = s[0];
- *destPtr++ = s[1];
- *destPtr++ = s[2];
- *destPtr++ = s[3];
- *destPtr++ = s[0];
- *destPtr++ = s[1];
- *destPtr++ = s[2];
- *destPtr++ = s[3];
- s += 4;
- }
-
- destPtr += dstPitch - width*2 * 4;
- s = srcLine;
- //second copied line (2x width, dimmed)
- for (int x = 0; x < width; x++)
- {
- *destPtr++ = (byte)((s[0] * intensity) >> 8);
- *destPtr++ = (byte)((s[1] * intensity) >> 8);
- *destPtr++ = (byte)((s[2] * intensity) >> 8);
- *destPtr++ = s[3];
- *destPtr++ = (byte)((s[0] * intensity) >> 8);
- *destPtr++ = (byte)((s[1] * intensity) >> 8);
- *destPtr++ = (byte)((s[2] * intensity) >> 8);
- *destPtr++ = s[3];
- s += 4;
- }
- srcLine += srcPitch;
- destPtr += dstPitch - width * 2 * 4;
- }
-
- }
-
-
-
- }
-}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/ScanlineSlider.Designer.cs b/BizHawk.Client.EmuHawk/ScanlineSlider.Designer.cs
deleted file mode 100644
index b27f2f3a24..0000000000
--- a/BizHawk.Client.EmuHawk/ScanlineSlider.Designer.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-namespace BizHawk.Client.EmuHawk
-{
- partial class ScanlineSlider
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.scanlinetrackbar = new System.Windows.Forms.TrackBar();
- this.label1 = new System.Windows.Forms.Label();
- ((System.ComponentModel.ISupportInitialize)(this.scanlinetrackbar)).BeginInit();
- this.SuspendLayout();
- //
- // scanlinetrackbar
- //
- this.scanlinetrackbar.Location = new System.Drawing.Point(2, 7);
- this.scanlinetrackbar.Maximum = 100;
- this.scanlinetrackbar.Name = "scanlinetrackbar";
- this.scanlinetrackbar.Size = new System.Drawing.Size(207, 45);
- this.scanlinetrackbar.TabIndex = 0;
- this.scanlinetrackbar.TickFrequency = 5;
- this.scanlinetrackbar.TickStyle = System.Windows.Forms.TickStyle.Both;
- this.scanlinetrackbar.Scroll += new System.EventHandler(this.scanlinetrackbar_Scroll);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(206, 20);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(21, 13);
- this.label1.TabIndex = 1;
- this.label1.Text = "0%";
- //
- // ScanlineSlider
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(237, 58);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.scanlinetrackbar);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "ScanlineSlider";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Scanline Intensity";
- this.Load += new System.EventHandler(this.ScanlineSlider_Load);
- ((System.ComponentModel.ISupportInitialize)(this.scanlinetrackbar)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.TrackBar scanlinetrackbar;
- private System.Windows.Forms.Label label1;
- }
-}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/ScanlineSlider.cs b/BizHawk.Client.EmuHawk/ScanlineSlider.cs
deleted file mode 100644
index 456a422918..0000000000
--- a/BizHawk.Client.EmuHawk/ScanlineSlider.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using BizHawk.Client.Common;
-
-namespace BizHawk.Client.EmuHawk
-{
- public partial class ScanlineSlider : Form
- {
- public ScanlineSlider()
- {
- InitializeComponent();
- }
-
- private void scanlinetrackbar_Scroll(object sender, EventArgs e)
- {
- label1.Text = scanlinetrackbar.Value.ToString() + "%";
- Global.Config.TargetScanlineFilterIntensity = 256 - (256 * scanlinetrackbar.Value / 100);
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
- private void ScanlineSlider_Load(object sender, EventArgs e)
- {
- float intensity = (256 - (float)Global.Config.TargetScanlineFilterIntensity) / 256 * 100;
- scanlinetrackbar.Value = (int)intensity;
- label1.Text = scanlinetrackbar.Value.ToString() + "%";
- }
-
- }
-}
diff --git a/BizHawk.Client.EmuHawk/ScanlineSlider.resx b/BizHawk.Client.EmuHawk/ScanlineSlider.resx
deleted file mode 100644
index 29dcb1b3a3..0000000000
--- a/BizHawk.Client.EmuHawk/ScanlineSlider.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs
index 2b0b88ae48..686809cae7 100644
--- a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs
+++ b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.Designer.cs
@@ -36,7 +36,9 @@
this.rbHq2x = new System.Windows.Forms.RadioButton();
this.rbScanlines = new System.Windows.Forms.RadioButton();
this.rbNone = new System.Windows.Forms.RadioButton();
+ this.tbScanlineIntensity = new System.Windows.Forms.TrackBar();
this.groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.tbScanlineIntensity)).BeginInit();
this.SuspendLayout();
//
// btnCancel
@@ -64,7 +66,7 @@
// checkBilinearFilter
//
this.checkBilinearFilter.AutoSize = true;
- this.checkBilinearFilter.Location = new System.Drawing.Point(12, 143);
+ this.checkBilinearFilter.Location = new System.Drawing.Point(12, 145);
this.checkBilinearFilter.Name = "checkBilinearFilter";
this.checkBilinearFilter.Size = new System.Drawing.Size(85, 17);
this.checkBilinearFilter.TabIndex = 0;
@@ -82,12 +84,13 @@
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.tbScanlineIntensity);
this.groupBox1.Controls.Add(this.rbNone);
this.groupBox1.Controls.Add(this.rbScanlines);
this.groupBox1.Controls.Add(this.rbHq2x);
this.groupBox1.Location = new System.Drawing.Point(12, 34);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(200, 92);
+ this.groupBox1.Size = new System.Drawing.Size(200, 105);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Filter";
@@ -95,7 +98,7 @@
// rbHq2x
//
this.rbHq2x.AutoSize = true;
- this.rbHq2x.Location = new System.Drawing.Point(14, 42);
+ this.rbHq2x.Location = new System.Drawing.Point(6, 42);
this.rbHq2x.Name = "rbHq2x";
this.rbHq2x.Size = new System.Drawing.Size(50, 17);
this.rbHq2x.TabIndex = 0;
@@ -106,7 +109,7 @@
// rbScanlines
//
this.rbScanlines.AutoSize = true;
- this.rbScanlines.Location = new System.Drawing.Point(14, 65);
+ this.rbScanlines.Location = new System.Drawing.Point(6, 65);
this.rbScanlines.Name = "rbScanlines";
this.rbScanlines.Size = new System.Drawing.Size(71, 17);
this.rbScanlines.TabIndex = 1;
@@ -117,7 +120,7 @@
// rbNone
//
this.rbNone.AutoSize = true;
- this.rbNone.Location = new System.Drawing.Point(14, 19);
+ this.rbNone.Location = new System.Drawing.Point(6, 19);
this.rbNone.Name = "rbNone";
this.rbNone.Size = new System.Drawing.Size(51, 17);
this.rbNone.TabIndex = 2;
@@ -125,6 +128,17 @@
this.rbNone.Text = "None";
this.rbNone.UseVisualStyleBackColor = true;
//
+ // tbScanlineIntensity
+ //
+ this.tbScanlineIntensity.LargeChange = 32;
+ this.tbScanlineIntensity.Location = new System.Drawing.Point(83, 55);
+ this.tbScanlineIntensity.Maximum = 255;
+ this.tbScanlineIntensity.Name = "tbScanlineIntensity";
+ this.tbScanlineIntensity.Size = new System.Drawing.Size(70, 42);
+ this.tbScanlineIntensity.TabIndex = 3;
+ this.tbScanlineIntensity.TickFrequency = 32;
+ this.tbScanlineIntensity.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
+ //
// DisplayConfigLite
//
this.AcceptButton = this.btnOk;
@@ -142,6 +156,7 @@
this.Text = "Display Configuration";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.tbScanlineIntensity)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -157,5 +172,6 @@
private System.Windows.Forms.RadioButton rbNone;
private System.Windows.Forms.RadioButton rbScanlines;
private System.Windows.Forms.RadioButton rbHq2x;
+ private System.Windows.Forms.TrackBar tbScanlineIntensity;
}
}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs
index c39ad50ebc..1b6aef02c7 100644
--- a/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs
+++ b/BizHawk.Client.EmuHawk/config/DisplayConfigLite.cs
@@ -22,6 +22,7 @@ namespace BizHawk.Client.EmuHawk.config
rbHq2x.Checked = Global.Config.TargetDisplayFilter == 1;
rbScanlines.Checked = Global.Config.TargetDisplayFilter == 2;
checkBilinearFilter.Checked = Global.Config.DispBlurry;
+ tbScanlineIntensity.Value = Global.Config.TargetScanlineFilterIntensity;
}
private void btnOk_Click(object sender, EventArgs e)
@@ -34,6 +35,7 @@ namespace BizHawk.Client.EmuHawk.config
Global.Config.TargetDisplayFilter = 2;
Global.Config.DispBlurry = checkBilinearFilter.Checked;
+ Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
DialogResult = System.Windows.Forms.DialogResult.OK;
Close();
diff --git a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/RetroShader.cs b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/RetroShader.cs
index d4d86d0fbe..303ee9f172 100644
--- a/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/RetroShader.cs
+++ b/Bizware/BizHawk.Bizware.BizwareGL.OpenTK/RetroShader.cs
@@ -36,10 +36,16 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
VertexLayout = null;
}
+ public void Bind()
+ {
+ //lame...
+ Owner.BindPipeline(Pipeline);
+ }
+
public unsafe void Run(Texture2d tex, Size InputSize, Size OutputSize, bool flip)
{
//ack! make sure to set the pipeline before setting
- Owner.BindPipeline(Pipeline);
+ Bind();
Pipeline["InputSize"].Set(new Vector2(InputSize.Width,InputSize.Height));
Pipeline["TextureSize"].Set(new Vector2(InputSize.Width, InputSize.Height));