From b599c69c18f4a175f70b10f489cdb74b186c9b65 Mon Sep 17 00:00:00 2001 From: beirich Date: Mon, 25 Jun 2012 02:50:34 +0000 Subject: [PATCH] Add VirtualWidth to IVideoProvider and the (numerous) implementations. This is just phase 1, client needs to be updated to utilize this information, and some cores (especially PCE) should be updated in a more involved way to provide better TV emulation. --- BizHawk.Emulation/Consoles/Atari/2600/TIA.cs | 3 ++- BizHawk.Emulation/Consoles/Calculator/TI83.cs | 1 + .../Consoles/Coleco/ColecoVision.cs | 3 ++- BizHawk.Emulation/Consoles/Coleco/VDP.cs | 3 ++- BizHawk.Emulation/Consoles/GB/GB.cs | 2 +- BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs | 3 ++- .../Consoles/Nintendo/NES/NES.cs | 1 + .../Consoles/PC Engine/VDC.Render.cs | 23 ++++--------------- BizHawk.Emulation/Consoles/PC Engine/VPC.cs | 23 ++++--------------- .../Consoles/Sega/Genesis/GenVDP.cs | 2 ++ BizHawk.Emulation/Consoles/Sega/SMS/VDP.cs | 1 + .../Base Implementations/NullEmulator.cs | 3 ++- .../Interfaces/IVideoProvider.cs | 2 ++ BizHawk.MultiClient/AviWriter.cs | 1 + .../DisplayManager/DisplayManager.cs | 11 --------- 15 files changed, 29 insertions(+), 53 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs index 57653ab2f8..3fff844911 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs @@ -420,7 +420,8 @@ namespace BizHawk.Emulation.Consoles.Atari public int[] frameBuffer = new int[320 * 262]; public int[] GetVideoBuffer() { return frameBuffer; } - public int BufferWidth { get { return 320; } } + public int VirtualWidth { get { return 320; } } + public int BufferWidth { get { return 320; } } public int BufferHeight { get { return 262; } } public int BackgroundColor { get { return 0; } } diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index 640299a2a7..7f9c1e5e9d 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -384,6 +384,7 @@ namespace BizHawk.Emulation.Consoles.Calculator } return pixels; } + public int VirtualWidth { get { return 96; } } public int BufferWidth { get { return 96; } } public int BufferHeight { get { return 64; } } public int BackgroundColor { get { return 0; } } diff --git a/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs index cd1f4945f9..800aa60046 100644 --- a/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs @@ -87,7 +87,8 @@ namespace BizHawk.Emulation.Consoles.Coleco } public int[] GetVideoBuffer() { return frameBuffer; } - public int BufferWidth { get { return 256; } } + public int VirtualWidth { get { return 256; } } + public int BufferWidth { get { return 256; } } public int BufferHeight { get { return 192; } } public int BackgroundColor { get { return 0; } } public void GetSamples(short[] samples) diff --git a/BizHawk.Emulation/Consoles/Coleco/VDP.cs b/BizHawk.Emulation/Consoles/Coleco/VDP.cs index da20897566..e77f5af4d6 100644 --- a/BizHawk.Emulation/Consoles/Coleco/VDP.cs +++ b/BizHawk.Emulation/Consoles/Coleco/VDP.cs @@ -499,7 +499,8 @@ namespace BizHawk.Emulation.Consoles.Coleco return mode == VdpMode.SMS ? FrameBuffer : GameGearFrameBuffer; } - public int BufferWidth + public int VirtualWidth { get { return BufferWidth; } } + public int BufferWidth { get { return mode == VdpMode.SMS ? 256 : 160; } } diff --git a/BizHawk.Emulation/Consoles/GB/GB.cs b/BizHawk.Emulation/Consoles/GB/GB.cs index 3c1780daf1..b997a490f2 100644 --- a/BizHawk.Emulation/Consoles/GB/GB.cs +++ b/BizHawk.Emulation/Consoles/GB/GB.cs @@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Consoles.GB inBIOS = !skipBIOS; HardReset(); } - + public int VirtualWidth { get { return 160; } } public int BufferWidth { get { return 160; } } public int BufferHeight { get { return 144; } } public int BackgroundColor { get { return 0; } } diff --git a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs index f89a15227d..a47aa595ae 100644 --- a/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs +++ b/BizHawk.Emulation/Consoles/Gameboy/Gameboy.cs @@ -754,7 +754,8 @@ namespace BizHawk.Emulation.Consoles.Gameboy return buf; } - public int BufferWidth { get { return 160; } } + public int VirtualWidth { get { return 160; } } + public int BufferWidth { get { return 160; } } public int BufferHeight { get { return 144; } } public int BackgroundColor { get { return 0; } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index c7ca1f9c56..d318b18034 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -150,6 +150,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo } return pixels; } + public int VirtualWidth { get { return BufferWidth; } } public int BufferWidth { get { return right - left + 1; } } public int BufferHeight { get { return bottom - top + 1; } } public int BackgroundColor { get { return 0; } } diff --git a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs index 3c87f3ff13..844aabd046 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VDC.Render.cs @@ -343,24 +343,11 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx int FrameHeight = 240; int[] FrameBuffer = new int[256 * 240]; - public int[] GetVideoBuffer() - { - return FrameBuffer; - } + public int[] GetVideoBuffer() { return FrameBuffer; } - public int BufferWidth - { - get { return FramePitch; } - } - - public int BufferHeight - { - get { return FrameHeight; } - } - - public int BackgroundColor - { - get { return vce.Palette[256]; } - } + public int VirtualWidth { get { return FramePitch; } } + public int BufferWidth { get { return FramePitch; } } + public int BufferHeight { get { return FrameHeight; } } + public int BackgroundColor { get { return vce.Palette[256]; } } } } diff --git a/BizHawk.Emulation/Consoles/PC Engine/VPC.cs b/BizHawk.Emulation/Consoles/PC Engine/VPC.cs index 274196da72..ab713cfaa4 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/VPC.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/VPC.cs @@ -498,24 +498,11 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx } } - public int[] GetVideoBuffer() - { - return FrameBuffer; - } + public int[] GetVideoBuffer() { return FrameBuffer; } - public int BufferWidth - { - get { return FrameWidth; } - } - - public int BufferHeight - { - get { return FrameHeight; } - } - - public int BackgroundColor - { - get { return VCE.Palette[0]; } - } + public int VirtualWidth { get { return FrameWidth; } } + public int BufferWidth { get { return FrameWidth; } } + public int BufferHeight { get { return FrameHeight; } } + public int BackgroundColor { get { return VCE.Palette[0]; } } } } diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/GenVDP.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/GenVDP.cs index 851d5c313c..bdaf91a43b 100644 --- a/BizHawk.Emulation/Consoles/Sega/Genesis/GenVDP.cs +++ b/BizHawk.Emulation/Consoles/Sega/Genesis/GenVDP.cs @@ -314,6 +314,8 @@ namespace BizHawk.Emulation.Consoles.Sega return FrameBuffer; } + public int VirtualWidth { get { return 320; } } + public int BufferWidth { get { return FrameWidth; } diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/VDP.cs b/BizHawk.Emulation/Consoles/Sega/SMS/VDP.cs index 00e9e834a2..2317a02439 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/VDP.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/VDP.cs @@ -494,6 +494,7 @@ namespace BizHawk.Emulation.Consoles.Sega return mode == VdpMode.SMS ? FrameBuffer : GameGearFrameBuffer; } + public int VirtualWidth { get { return BufferWidth; } } public int BufferWidth { get { return mode == VdpMode.SMS ? 256 : 160; } diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs index 839115c44d..73e30f3d4e 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs @@ -50,7 +50,8 @@ namespace BizHawk public void LoadStateBinary(BinaryReader reader) { } public byte[] SaveStateBinary() { return new byte[1]; } public int[] GetVideoBuffer() { return frameBuffer; } - public int BufferWidth { get { return 256; } } + public int VirtualWidth { get { return 256; } } + public int BufferWidth { get { return 256; } } public int BufferHeight { get { return 192; } } public int BackgroundColor { get { return 0; } } public void GetSamples(short[] samples) { } diff --git a/BizHawk.Emulation/Interfaces/IVideoProvider.cs b/BizHawk.Emulation/Interfaces/IVideoProvider.cs index 2826e2e198..6fd536ef5e 100644 --- a/BizHawk.Emulation/Interfaces/IVideoProvider.cs +++ b/BizHawk.Emulation/Interfaces/IVideoProvider.cs @@ -4,6 +4,8 @@ { int[] GetVideoBuffer(); + int VirtualWidth { get; } // Used for controlling aspect ratio. Just return BufferWidth if you dont know what to do with this. + int BufferWidth { get; } int BufferHeight { get; } int BackgroundColor { get; } diff --git a/BizHawk.MultiClient/AviWriter.cs b/BizHawk.MultiClient/AviWriter.cs index a6e5554003..642cec570f 100644 --- a/BizHawk.MultiClient/AviWriter.cs +++ b/BizHawk.MultiClient/AviWriter.cs @@ -91,6 +91,7 @@ namespace BizHawk.MultiClient { int[] vb; int bw, bh, bc; + public int VirtualWidth { get { return bw; } } public int BufferWidth { get {return bw;} } public int BufferHeight { get { return bh; } } public int BackgroundColor { get { return bc; } } diff --git a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs index 18bee888bf..b395058895 100644 --- a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs +++ b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs @@ -556,17 +556,6 @@ namespace BizHawk.MultiClient } } - public class VideoProviderData : IVideoProvider - { - public int[] VideoBuffer; - - public int BufferWidth { get; set; } - public int BufferHeight { get; set; } - public int BackgroundColor { get; set; } - - public int[] GetVideoBuffer() { return VideoBuffer; } - } - public class DisplayManager : IDisposable { public DisplayManager()