Counters: Move interlace detection code to SetGsCrt

* More accurate to PS2 behavior and avoids an useless SMODE write function, it makes sense to also move this as video mode specific colorburst detection was already moved to SetGsCrt.
This commit is contained in:
Akash 2016-08-18 19:37:35 +05:30
parent fa249a3f78
commit 95d70db153
4 changed files with 9 additions and 17 deletions

View File

@ -34,7 +34,6 @@
using namespace Threading;
extern u8 psxhblankgate;
extern bool gsIsInterlaced;
static const uint EECNT_FUTURE_TARGET = 0x10000000;
static int gates = 0;

View File

@ -32,8 +32,6 @@ void gsOnModeChanged( Fixed100 framerate, u32 newTickrate )
GetMTGS().SendSimplePacket( GS_RINGTYPE_MODECHANGE, framerate.Raw, newTickrate, 0 );
}
bool gsIsInterlaced = false;
void gsSetVideoMode(GS_VideoMode mode )
{
@ -154,12 +152,6 @@ __fi void gsWrite8(u32 mem, u8 value)
GIF_LOG("GS write 8 at %8.8lx with data %8.8lx", mem, value);
}
static void _gsSMODEwrite( u32 mem, u32 value )
{
if(mem == GS_SMODE2)
gsIsInterlaced = (value & 0x1);
}
//////////////////////////////////////////////////////////////////////////
// GS Write 16 bit
@ -167,8 +159,6 @@ __fi void gsWrite16(u32 mem, u16 value)
{
GIF_LOG("GS write 16 at %8.8lx with data %8.8lx", mem, value);
_gsSMODEwrite( mem, value );
switch (mem)
{
// See note above about CSR 8 bit writes, and handling them as zero'd bits
@ -198,8 +188,6 @@ __fi void gsWrite32(u32 mem, u32 value)
pxAssume( (mem & 3) == 0 );
GIF_LOG("GS write 32 at %8.8lx with data %8.8lx", mem, value);
_gsSMODEwrite( mem, value );
switch (mem)
{
case GS_CSR:
@ -228,7 +216,6 @@ void __fastcall gsWrite64_generic( u32 mem, const mem64_t* value )
void __fastcall gsWrite64_page_00( u32 mem, const mem64_t* value )
{
gsWrite64_generic( mem, value );
_gsSMODEwrite( mem, (u32)value[0] );
}
void __fastcall gsWrite64_page_01( u32 mem, const mem64_t* value )
@ -280,7 +267,6 @@ void __fastcall gsWrite64_page_01( u32 mem, const mem64_t* value )
void __fastcall gsWrite128_page_00( u32 mem, const mem128_t* value )
{
gsWrite128_generic( mem, value );
_gsSMODEwrite( mem, (u32)value[0] );
}
void __fastcall gsWrite128_page_01( u32 mem, const mem128_t* value )

View File

@ -233,6 +233,7 @@ enum class GS_VideoMode : int
};
extern GS_VideoMode gsVideoMode;
extern bool gsIsInterlaced;
/////////////////////////////////////////////////////////////////////////////
// MTGS Threaded Class Declaration

View File

@ -25,6 +25,7 @@
#include "GS.h"
GS_VideoMode gsVideoMode = GS_VideoMode::Uninitialized;
bool gsIsInterlaced = false;
static __fi bool _add64_Overflow( s64 x, s64 y, s64 &ret )
{
@ -884,8 +885,13 @@ void SYSCALL()
switch (call) {
case 2: {
const char* inter = (cpuRegs.GPR.n.a0.UL[0] & 1) ? "Interlaced" : "Progressive";
const char* field = (cpuRegs.GPR.n.a2.UL[0] & 1) ? "FRAME" : "FIELD";
//Function "SetGsCrt(Interlace, Mode, Field)"
//Useful for fetching information of interlace/video/field display parameters of the Graphics Synthesizer
gsIsInterlaced = cpuRegs.GPR.n.a0.UL[0] & 1;
bool gsIsFrameMode = cpuRegs.GPR.n.a2.UL[0] & 1;
const char* inter = (gsIsInterlaced) ? "Interlaced" : "Progressive";
const char* field = (gsIsFrameMode) ? "FRAME" : "FIELD";
std::string mode;
// Warning info might be incorrect!
switch (cpuRegs.GPR.n.a1.UC[0])