dolphin-emulator/Source/Core/VideoCommon
Michael Maltese d10d09ccc1 VideoCommon: rework anamorphic widescreen heuristic
Some widescreen hacks (see below) properly force anamorphic output, but
don't make the last projection in a frame 16:9, so Dolphin doesn't
display it correctly.

This changes the heuristic code to assume a frame is anamorphic based on
the total number of vertex flushes in 4:3 and 16:9 projections that
frame. It also adds a bit of "aspect ratio inertia" by making it harder
to switch aspect ratios, which takes care of aspect ratio flickering
that some games / widescreen hacks would be susceptible with the new
logic.

I've tested this on SSX Tricky's native anamorphic support, Tom Clancy's
Splinter Cell (it stayed in 4:3 the whole time), and on the following
widescreen hacks for which the heuristic doesn't currently work:

Paper Mario: The Thousand-Year Door (Gecko widescreen code from Nintendont)
C202F310 00000003
3DC08042 3DE03FD8
91EEF6D8 4E800020
60000000 00000000
04199598 4E800020
C200F500 00000004
3DE08082 3DC0402B
61CE12A2 91CFA1BC
60000000 387D015C
60000000 00000000
C200F508 00000004
3DE08082 3DC04063
61CEE8D3 91CFA1BC
60000000 7FC3F378
60000000 00000000

The Simpsons: Hit & Run (AR widescreen code from the wiki)
04004600 C002A604
04004604 C09F0014
04004608 FC002040
0400460C 4082000C
04004610 C002A608
04004614 EC630032
04004618 48220508
04041A5C 38600001
04224344 C002A60C
04224B1C 4BDDFAE4
044786B0 3FAAAAAB
04479F28 3FA33333
2017-04-05 17:23:16 -07:00
..
AsyncRequests.cpp VideoCommon: Eliminate static state in Renderer 2017-03-04 16:39:50 +10:00
AsyncRequests.h specify custom brace style to fix unions 2017-01-05 12:55:13 +01:00
AVIDump.cpp Appease linter. 2017-03-05 17:29:46 -08:00
AVIDump.h AVIDump: Rename CloseFile to CloseVideoFile 2017-01-29 22:05:12 -05:00
BoundingBox.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
BoundingBox.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
BPFunctions.cpp VideoCommon: Eliminate static state in Renderer 2017-03-04 16:39:50 +10:00
BPFunctions.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
BPMemory.cpp BPMemory: Eliminate union type punning 2017-01-23 16:05:32 -05:00
BPMemory.h BPMemory: Add const specifier to member functions where applicable 2017-01-23 16:07:03 -05:00
BPStructs.cpp Merge pull request #4935 from Armada651/depth-range-fix 2017-03-10 18:05:52 +01:00
BPStructs.h VideoCommon: Header cleanup 2016-01-17 20:11:45 -05:00
CMakeLists.txt CMakeLists: Normalize whitespace 2017-03-01 14:53:23 -05:00
CommandProcessor.cpp CommandProcessor: Limit scope of ugly SCPFifoStruct. 2017-01-27 19:04:56 +01:00
CommandProcessor.h CommandProcessor: Limit scope of ugly SCPFifoStruct. 2017-01-27 19:04:56 +01:00
ConstantManager.h Add configurable toggle that rounds vertices to the nearest pixel when 2017-04-04 09:52:18 -05:00
CPMemory.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
CPMemory.h specify custom brace style to fix unions 2017-01-05 12:55:13 +01:00
DataReader.h Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
Debugger.cpp Further fixes to the formatting change. WX sucks. 2016-06-24 12:16:10 +02:00
Debugger.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
DriverDetails.cpp Merge pull request #4951 from waddlesplash/haiku-2 2017-03-28 17:19:35 +13:00
DriverDetails.h Initial support for Haiku. 2017-03-27 23:46:19 -04:00
Fifo.cpp Fifo: Remove unnecessary integral casts 2017-03-28 10:35:26 -04:00
Fifo.h Fifo: const correctness 2017-03-26 23:08:33 -04:00
FPSCounter.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
FPSCounter.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
FramebufferManagerBase.cpp VideoCommon: Fix crash at startup with virtual XFB enabled 2017-03-09 23:39:48 +10:00
FramebufferManagerBase.h VideoCommon: Fix crash at startup with virtual XFB enabled 2017-03-09 23:39:48 +10:00
GeometryShaderGen.cpp ShaderGenCommon: Remove unnecessary includes 2017-02-01 12:19:55 -05:00
GeometryShaderGen.h ShaderGenCommon: Remove unnecessary includes 2017-02-01 12:19:55 -05:00
GeometryShaderManager.cpp ShaderManagers: Use aggregate initialization for some variables. 2016-12-10 17:33:51 -05:00
GeometryShaderManager.h VideoBackends: Merge Initialize and Shutdown functions. 2016-06-26 12:34:59 +02:00
HiresTextures.cpp Unify the way of setting game ID, title ID, revision 2017-03-09 15:34:14 +01:00
HiresTextures.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
ImageWrite.cpp ImageWriter: Don't use inplace alpha truncation. 2016-10-08 12:02:49 +02:00
ImageWrite.h ImageWriter: Don't use inplace alpha truncation. 2016-10-08 12:02:49 +02:00
IndexGenerator.cpp OpcodeDecoding: Convert #defines into enum constants 2017-02-08 00:05:17 -05:00
IndexGenerator.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
LightingShaderGen.cpp ShaderGenCommon: Remove unnecessary includes 2017-02-01 12:19:55 -05:00
LightingShaderGen.h LightingShaderGen: Remove unnecessary includes 2017-02-01 01:06:00 -05:00
LookUpTables.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
MainBase.cpp Merge pull request #4618 from Helios747/bounding_box_check 2017-02-06 21:58:19 +01:00
NativeVertexFormat.h Shader UID change: Only store the two bits of components we need. 2016-06-26 16:13:19 +12:00
OnScreenDisplay.cpp Revert "Merge pull request #4286 from shuffle2/Aestek-clean-osd" 2016-10-15 12:44:37 +02:00
OnScreenDisplay.h Revert "Merge pull request #4286 from shuffle2/Aestek-clean-osd" 2016-10-15 12:44:37 +02:00
OpcodeDecoding.cpp CommandProcessor: Limit scope of ugly SCPFifoStruct. 2017-01-27 19:04:56 +01:00
OpcodeDecoding.h OpcodeDecoding: Convert #defines into enum constants 2017-02-08 00:05:17 -05:00
PerfQueryBase.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
PerfQueryBase.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
PixelEngine.cpp PixelEngine: Use a DirectRead for the token. 2017-01-27 07:49:47 +01:00
PixelEngine.h PixelEngine: Move enum constants into the PixelEngine namespace 2017-02-28 07:01:50 -05:00
PixelShaderGen.cpp videoconfig: add BBoxPreferStencilImplementation 2017-03-15 17:41:33 -07:00
PixelShaderGen.h VideoCommon: Make dst_alpha state implicit. 2017-01-04 20:02:31 +01:00
PixelShaderManager.cpp VideoCommon: Move last EFB scale handling to CalculateTargetSize 2017-03-04 16:53:07 +10:00
PixelShaderManager.h VideoCommon: Move last EFB scale handling to CalculateTargetSize 2017-03-04 16:53:07 +10:00
PostProcessing.cpp Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
PostProcessing.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
RenderBase.cpp VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
RenderBase.h VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
RenderState.cpp BlendState: Use masking as a fastpath for the logic op NO_OP. 2017-01-06 14:01:39 +01:00
RenderState.h VideoCommon: Assembly blending state in a shared state object. 2017-01-06 14:01:36 +01:00
SamplerCommon.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
sfont.inc
ShaderGenCommon.h Add configurable toggle that rounds vertices to the nearest pixel when 2017-04-04 09:52:18 -05:00
Statistics.cpp VertexLoaderManager: Return debug strings by value 2017-03-26 23:50:09 -04:00
Statistics.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
TextureCacheBase.cpp TextureCacheBase: fix custom textures not being loaded 2017-04-04 14:34:46 -07:00
TextureCacheBase.h VideoCommon: Changes to TextureCache to support decoding in backend 2017-04-01 12:32:10 +10:00
TextureConversionShader.cpp VideoCommon: Add texture decoding shader generators 2017-04-01 12:32:10 +10:00
TextureConversionShader.h VideoCommon: Add texture decoding shader generators 2017-04-01 12:32:10 +10:00
TextureDecoder.h TextureDecoder: Deduplicate some utility code 2017-01-15 20:23:26 +11:00
TextureDecoder_Common.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
TextureDecoder_Generic.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
TextureDecoder_Util.h TextureDecoder: Deduplicate some utility code 2017-01-15 20:23:26 +11:00
TextureDecoder_x64.cpp Merge pull request #4548 from stenzek/gcc-sse 2017-03-13 14:28:01 +01:00
VertexLoader.cpp VertexLoaderJit: Fix out-of-bounds access for zfreeze. 2016-09-17 16:47:12 +02:00
VertexLoader.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
VertexLoader_Color.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_Color.h VideoCommon: Header cleanup 2016-01-17 20:11:45 -05:00
VertexLoader_Normal.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_Normal.h Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_Position.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_Position.h Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_TextCoord.cpp Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoader_TextCoord.h Common: Move byte swapping utilities into their own header 2017-03-03 17:18:18 -05:00
VertexLoaderARM64.cpp Merge pull request #4210 from degasus/arm 2016-09-27 18:45:14 +02:00
VertexLoaderARM64.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
VertexLoaderBase.cpp VertexLoaderBase: Return debug strings by value 2017-03-26 23:49:59 -04:00
VertexLoaderBase.h VertexLoaderBase: Return debug strings by value 2017-03-26 23:49:59 -04:00
VertexLoaderManager.cpp VertexLoaderManager: Return debug strings by value 2017-03-26 23:50:09 -04:00
VertexLoaderManager.h VertexLoaderManager: Return debug strings by value 2017-03-26 23:50:09 -04:00
VertexLoaderUtils.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
VertexLoaderX64.cpp VertexLoaderBase: Return debug strings by value 2017-03-26 23:49:59 -04:00
VertexLoaderX64.h Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
VertexManagerBase.cpp VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
VertexManagerBase.h VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
VertexShaderGen.cpp VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
VertexShaderGen.h Add configurable toggle that rounds vertices to the nearest pixel when 2017-04-04 09:52:18 -05:00
VertexShaderManager.cpp VideoCommon: rework anamorphic widescreen heuristic 2017-04-05 17:23:16 -07:00
VertexShaderManager.h VideoBackends: Merge Initialize and Shutdown functions. 2016-06-26 12:34:59 +02:00
VideoBackendBase.cpp Don't build Vulkan video backend on macOS 2016-10-06 16:53:55 -07:00
VideoBackendBase.h CommandProcessor: Limit scope of ugly SCPFifoStruct. 2017-01-27 19:04:56 +01:00
VideoCommon.h VideoCommon: Add APIType entry for Vulkan 2016-10-01 01:09:11 +10:00
VideoCommon.vcxproj VideoCommon: Assembly blending state in a shared state object. 2017-01-06 14:01:36 +01:00
VideoCommon.vcxproj.filters TextureDecoder: Deduplicate some utility code 2017-01-15 20:23:26 +11:00
VideoConfig.cpp Add configurable toggle that rounds vertices to the nearest pixel when 2017-04-04 09:52:18 -05:00
VideoConfig.h Add configurable toggle that rounds vertices to the nearest pixel when 2017-04-04 09:52:18 -05:00
VideoState.cpp VertexManagerBase: Get rid of static behavior 2016-08-21 23:30:38 -04:00
VideoState.h VideoBackends: Merge Initialize and Shutdown functions. 2016-06-26 12:34:59 +02:00
XFMemory.cpp VideoCommon: Header cleanup 2016-01-17 20:11:45 -05:00
XFMemory.h specify custom brace style to fix unions 2017-01-05 12:55:13 +01:00
XFStructs.cpp XFStructs: Get rid of an unnecessary pointer cast 2017-03-26 23:09:30 -04:00
XFStructs.h