diff --git a/Source/Project64/N64 System/Mips/Memory Class.h b/Source/Project64/N64 System/Mips/Memory Class.h index 9994eb8e2..e10dc7302 100644 --- a/Source/Project64/N64 System/Mips/Memory Class.h +++ b/Source/Project64/N64 System/Mips/Memory Class.h @@ -48,7 +48,8 @@ public: virtual bool ValidVaddr ( DWORD VAddr ) const = 0; virtual int MemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer ) = 0; - + virtual void UpdateFieldSerration ( unsigned int interlaced ) = 0; + //Protect the Memory from being written to virtual void ProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0; virtual void UnProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0; diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp index f6335c9ba..2249b13de 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp @@ -31,6 +31,7 @@ CMipsMemoryVM::CMipsMemoryVM ( CMipsMemory_CallBack * CallBack, bool SavesReadOn m_RomWroteValue(0), m_HalfLine(0), m_HalfLineCheck(false), + m_FieldSerration(0), m_TempValue(0) { g_Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)RdramChanged); @@ -2633,8 +2634,6 @@ void CMipsMemoryVM::UpdateHalfLine (void) m_HalfLine = 0; return; } - m_HalfLine = (DWORD)(NextViTimer / g_System->ViRefreshRate()); - m_HalfLine &= ~1; int check_value = (int)(m_HalfLineCheck - NextViTimer); if (check_value > 0 && check_value < 40) @@ -2646,11 +2645,17 @@ void CMipsMemoryVM::UpdateHalfLine (void) } g_SystemTimer->UpdateTimers(); NextViTimer = g_SystemTimer->GetTimer(CSystemTimer::ViTimer); - m_HalfLine = (DWORD)(NextViTimer / g_System->ViRefreshRate()); - m_HalfLine &= ~1; } + m_HalfLine = (DWORD)(NextViTimer / g_System->ViRefreshRate()); + m_HalfLine &= ~1; + m_HalfLine |= m_FieldSerration; m_HalfLineCheck = NextViTimer; +} +void CMipsMemoryVM::UpdateFieldSerration (unsigned int interlaced) +{ + m_FieldSerration ^= 1; + m_FieldSerration &= interlaced; } void CMipsMemoryVM::ProtectMemory( DWORD StartVaddr, DWORD EndVaddr ) diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.h b/Source/Project64/N64 System/Mips/Memory Virtual Mem.h index 9e1f30ede..07aeafe39 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.h +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.h @@ -57,6 +57,7 @@ public: BOOL SD_PAddr ( DWORD PAddr, QWORD Value ); int MemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer ); + void UpdateFieldSerration (unsigned int interlaced); //Protect the Memory from being written to void ProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ); @@ -156,6 +157,7 @@ private: void UpdateHalfLine ( void ); DWORD m_HalfLine; DWORD m_HalfLineCheck; + DWORD m_FieldSerration; DWORD m_TempValue; //Initilizing and reseting information about the memory system diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 5e4705fd9..1399672ba 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -1797,6 +1797,8 @@ void CN64System::RefreshScreen ( void ) { WriteTrace(TraceError,__FUNCTION__ ": Exception caught"); } + g_MMU->UpdateFieldSerration((m_Reg.VI_STATUS_REG & 0x40) != 0); + if ((bBasicMode() || bLimitFPS() ) && !bSyncToAudio()) { if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_Idel); } DWORD FrameRate;