Merge pull request #1896 from ssakash/counterstuff

PCSX2-Counters: Detect DVD variant videomodes
This commit is contained in:
refractionpcsx2 2017-04-21 10:26:58 +01:00 committed by GitHub
commit cca6e1dcae
4 changed files with 52 additions and 59 deletions

View File

@ -253,16 +253,17 @@ static const char* ReportVideoMode()
{ {
switch (gsVideoMode) switch (gsVideoMode)
{ {
case GS_VideoMode::PAL: return "PAL"; case GS_VideoMode::PAL: return "PAL";
case GS_VideoMode::NTSC: return "NTSC"; case GS_VideoMode::NTSC: return "NTSC";
case GS_VideoMode::VESA: return "VESA"; case GS_VideoMode::DVD_NTSC: return "DVD NTSC";
case GS_VideoMode::BIOS: return "BIOS"; case GS_VideoMode::DVD_PAL: return "DVD PAL";
case GS_VideoMode::HDTV_480P: return "HDTV 480p"; case GS_VideoMode::VESA: return "VESA";
case GS_VideoMode::HDTV_576P: return "HDTV 576p"; case GS_VideoMode::HDTV_480P: return "HDTV 480p";
case GS_VideoMode::HDTV_720P: return "HDTV 720p"; case GS_VideoMode::HDTV_576P: return "HDTV 576p";
case GS_VideoMode::HDTV_1080I: return "HDTV 1080i"; case GS_VideoMode::HDTV_720P: return "HDTV 720p";
case GS_VideoMode::HDTV_1080P: return "HDTV 1080p"; case GS_VideoMode::HDTV_1080I: return "HDTV 1080i";
default: return "Unknown"; case GS_VideoMode::HDTV_1080P: return "HDTV 1080p";
default: return "Unknown";
} }
} }
@ -273,8 +274,10 @@ Fixed100 GetVerticalFrequency()
case GS_VideoMode::Uninitialized: // SYSCALL instruction hasn't executed yet, give some temporary values. case GS_VideoMode::Uninitialized: // SYSCALL instruction hasn't executed yet, give some temporary values.
return 60; return 60;
case GS_VideoMode::PAL: case GS_VideoMode::PAL:
case GS_VideoMode::DVD_PAL:
return EmuConfig.GS.FrameratePAL; return EmuConfig.GS.FrameratePAL;
case GS_VideoMode::NTSC: case GS_VideoMode::NTSC:
case GS_VideoMode::DVD_NTSC:
return EmuConfig.GS.FramerateNTSC; return EmuConfig.GS.FramerateNTSC;
case GS_VideoMode::HDTV_480P: case GS_VideoMode::HDTV_480P:
return 59.94; return 59.94;
@ -283,7 +286,6 @@ Fixed100 GetVerticalFrequency()
case GS_VideoMode::HDTV_576P: case GS_VideoMode::HDTV_576P:
case GS_VideoMode::HDTV_720P: case GS_VideoMode::HDTV_720P:
case GS_VideoMode::VESA: case GS_VideoMode::VESA:
case GS_VideoMode::BIOS:
return 60; return 60;
default: default:
// Pass NTSC vertical frequency value when unknown video mode is detected. // Pass NTSC vertical frequency value when unknown video mode is detected.
@ -311,12 +313,14 @@ u32 UpdateVSyncRate()
break; break;
case GS_VideoMode::PAL: case GS_VideoMode::PAL:
case GS_VideoMode::DVD_PAL:
isCustom = (EmuConfig.GS.FrameratePAL != 50.0); isCustom = (EmuConfig.GS.FrameratePAL != 50.0);
scanlines = SCANLINES_TOTAL_PAL; scanlines = SCANLINES_TOTAL_PAL;
if (!gsIsInterlaced) scanlines += 3; if (!gsIsInterlaced) scanlines += 3;
break; break;
case GS_VideoMode::NTSC: case GS_VideoMode::NTSC:
case GS_VideoMode::DVD_NTSC:
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94); isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
scanlines = SCANLINES_TOTAL_NTSC; scanlines = SCANLINES_TOTAL_NTSC;
if (!gsIsInterlaced) scanlines += 1; if (!gsIsInterlaced) scanlines += 1;
@ -328,7 +332,6 @@ u32 UpdateVSyncRate()
case GS_VideoMode::HDTV_576P: case GS_VideoMode::HDTV_576P:
case GS_VideoMode::HDTV_720P: case GS_VideoMode::HDTV_720P:
case GS_VideoMode::VESA: case GS_VideoMode::VESA:
case GS_VideoMode::BIOS:
scanlines = SCANLINES_TOTAL_NTSC; scanlines = SCANLINES_TOTAL_NTSC;
break; break;

View File

@ -39,9 +39,7 @@ void gsSetVideoMode(GS_VideoMode mode )
if( gsVideoMode == mode ) if( gsVideoMode == mode )
return; return;
// SetGsCrt doesn't seem to work for PSX games and they're left with the initial bios mode gsVideoMode = mode;
// At such cases, let's use the colorburst to detect the video mode.
gsVideoMode = (mode == GS_VideoMode::BIOS) ? s_ColorBurst : mode;
UpdateVSyncRate(); UpdateVSyncRate();
} }
@ -142,14 +140,6 @@ __fi void gsWrite8(u32 mem, u8 value)
GIF_LOG("GS write 8 at %8.8lx with data %8.8lx", mem, value); GIF_LOG("GS write 8 at %8.8lx with data %8.8lx", mem, value);
} }
static void GetColorBurst(u64 value)
{
GSRegSMODE1 Register;
Register.SMODE1 = value;
if(Register.CMOD)
s_ColorBurst = (Register.CMOD == 3) ? GS_VideoMode::PAL : GS_VideoMode::NTSC;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// GS Write 16 bit // GS Write 16 bit
@ -213,8 +203,6 @@ void __fastcall gsWrite64_generic( u32 mem, const mem64_t* value )
void __fastcall gsWrite64_page_00( u32 mem, const mem64_t* value ) void __fastcall gsWrite64_page_00( u32 mem, const mem64_t* value )
{ {
if (mem == GS_SMODE1)
GetColorBurst(*value);
gsWrite64_generic( mem, value ); gsWrite64_generic( mem, value );
} }

View File

@ -202,37 +202,38 @@ union tGS_IMR
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// GSRegSMODE1 // GSRegSMODE1
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// Currently it's only used to get the CMOD bit from the SMODE1 register value. // Previously, the union was used to get the CMOD bit of the SMODE1 register
union GSRegSMODE1 // Commenting it out as it's unused right now. (Might potentially be useful in the future)
{ //union GSRegSMODE1
struct //{
{ // struct
u32 RC : 3; // {
u32 LC : 7; // u32 RC : 3;
u32 T1248 : 2; // u32 LC : 7;
u32 SLCK : 1; // u32 T1248 : 2;
u32 CMOD : 2; // u32 SLCK : 1;
u32 EX : 1; // u32 CMOD : 2;
u32 PRST : 1; // u32 EX : 1;
u32 SINT : 1; // u32 PRST : 1;
u32 XPCK : 1; // u32 SINT : 1;
u32 PCK2 : 2; // u32 XPCK : 1;
u32 SPML : 4; // u32 PCK2 : 2;
u32 GCONT : 1; // u32 SPML : 4;
u32 PHS : 1; // u32 GCONT : 1;
u32 PVS : 1; // u32 PHS : 1;
u32 PEHS : 1; // u32 PVS : 1;
u32 PEVS : 1; // u32 PEHS : 1;
u32 CLKSEL : 2; // u32 PEVS : 1;
u32 NVCK : 1; // u32 CLKSEL : 2;
u32 SLCK2 : 1; // u32 NVCK : 1;
u32 VCKSEL : 2; // u32 SLCK2 : 1;
u32 VHP : 1; // u32 VCKSEL : 2;
u32 _PAD1 : 27; // u32 VHP : 1;
}; // u32 _PAD1 : 27;
// };
u64 SMODE1; //
}; // u64 SMODE1;
//};
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// GSRegSIGBLID // GSRegSIGBLID
@ -264,7 +265,8 @@ enum class GS_VideoMode : int
HDTV_720P, HDTV_720P,
HDTV_1080I, HDTV_1080I,
HDTV_1080P, HDTV_1080P,
BIOS DVD_NTSC,
DVD_PAL
}; };
extern GS_VideoMode gsVideoMode; extern GS_VideoMode gsVideoMode;

View File

@ -932,8 +932,8 @@ void SYSCALL()
case 0x53: mode = "HDTV 768x576 @ ??.???"; gsSetVideoMode(GS_VideoMode::HDTV_576P); break; case 0x53: mode = "HDTV 768x576 @ ??.???"; gsSetVideoMode(GS_VideoMode::HDTV_576P); break;
case 0x54: mode = "HDTV 1920x1080 @ ??.???"; gsSetVideoMode(GS_VideoMode::HDTV_1080P); break; case 0x54: mode = "HDTV 1920x1080 @ ??.???"; gsSetVideoMode(GS_VideoMode::HDTV_1080P); break;
case 0x72: mode = "DVD NTSC 640x448 @ ??.???"; gsSetVideoMode(GS_VideoMode::BIOS); break; case 0x72: mode = "DVD NTSC 640x448 @ ??.???"; gsSetVideoMode(GS_VideoMode::DVD_NTSC); break;
case 0x73: mode = "DVD PAL 720x480 @ ??.???"; gsSetVideoMode(GS_VideoMode::BIOS); break; case 0x73: mode = "DVD PAL 720x480 @ ??.???"; gsSetVideoMode(GS_VideoMode::DVD_PAL); break;
default: default:
DevCon.Error("Mode %x is not supported. Report me upstream", cpuRegs.GPR.n.a1.UC[0]); DevCon.Error("Mode %x is not supported. Report me upstream", cpuRegs.GPR.n.a1.UC[0]);