A commit for review, there's some unclear counters code. Also added a more precise NTSC vsync rate.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@326 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
ramapcsx2 2008-11-14 16:36:40 +00:00 committed by Gregory Hainaut
parent 211cac44e5
commit 7c054f247a
4 changed files with 20 additions and 13 deletions

View File

@ -158,7 +158,7 @@ extern TESTRUNARGS g_TestRun;
HBlank 15.73426573 KHz */
//VBlanks per second
#define VBLANK_NTSC ((Config.PsxType & 2) ? 59.94 : 59.82)
#define VBLANK_NTSC ((Config.PsxType & 2) ? 59.94005994 : 59.82)
#define VBLANK_PAL ((Config.PsxType & 2) ? 50.00 : 49.76)
//HBlanks per second
@ -168,10 +168,10 @@ extern TESTRUNARGS g_TestRun;
//VBlank timers for EE, bit more accurate.
#define VBLANKCNT(count) ((u32)((Config.PsxType & 1) ? (VBLANKPALSELECT * count) : (VBLANKNTSCSELECT * count)))
#define VBLANKPALSELECT ((Config.PsxType & 2) ? (PS2CLK / 50.00) : (PS2CLK / 49.76))
#define VBLANKNTSCSELECT ((Config.PsxType & 2) ? (PS2CLK / 59.94) : (PS2CLK / 59.82))
#define VBLANKNTSCSELECT ((Config.PsxType & 2) ? (PS2CLK / 59.94005994) : (PS2CLK / 59.82))
//EE VBlank speeds
#define PS2VBLANK_NTSC_INT ((PS2CLK / 59.94))
#define PS2VBLANK_NTSC_INT ((PS2CLK / 59.94005994))
#define PS2VBLANK_NTSC ((PS2CLK / 59.82))
#define PS2VBLANK_PAL_INT ((PS2CLK / 50.00))
#define PS2VBLANK_PAL ((PS2CLK / 49.76))

View File

@ -73,13 +73,14 @@ static __forceinline void _rcntSet( int i )
}
static __forceinline void cpuRcntSet() {
int i;
// Calculate our target cycle deltas.
// This must be done regardless of if the hblank/vblank counters updated since
// cpuRegs.cycle changes, even if sCycle hasn't!
u32 counter4CycleT = ( counters[4].mode == MODE_HBLANK ) ? HBLANK_TIME_ : HRENDER_TIME_;
//fixme : HBLANK_TIME_ and HRENDER_TIME_ are both SCANLINE_NTSC (or _PAL) / 2.. was that intended? (rama)
//u32 counter4CycleT = ( counters[4].mode == MODE_HBLANK ) ? HBLANK_TIME_ : HRENDER_TIME_;
u32 counter4CycleT = HBLANK_TIME_;
u32 counter5CycleT = VSYNC_HALF_ - (cpuRegs.cycle - counters[5].sCycle);
counter4CycleT -= (cpuRegs.cycle - counters[4].sCycle);
@ -87,8 +88,10 @@ static __forceinline void cpuRcntSet() {
nextsCounter = cpuRegs.cycle;
for (i = 0; i < 4; i++)
_rcntSet( i );
_rcntSet( 0 );
_rcntSet( 1 );
_rcntSet( 2 );
_rcntSet( 3 );
}
void rcntInit() {

View File

@ -35,11 +35,13 @@ typedef struct {
//------------------------------------------------------------------
// NTSC Timing Information!!! (some scanline info is guessed)
//------------------------------------------------------------------
#define SCANLINE_NTSC (u32)(PS2CLK / 15734.25)//18743
#define SCANLINE_NTSC (u32)(PS2CLK / 15734.27)//18743
// fixme : Both, HRENDER_TIME_NTSC and HBLANK_TIME_NTSC the same?
// also see cpuRcntSet() and possibly hScanline() for this issue (rama)
#define HRENDER_TIME_NTSC (u32)(SCANLINE_NTSC / 2)//15528 //time from hblank end to hblank start (PS2CLK / 18991.368423051722991900181367568)
#define HBLANK_TIME_NTSC (u32)(SCANLINE_NTSC / 2)//3215 //time from hblank start to hblank end (PS2CLK / 91738.91105912572817760653181028)
#define VSYNC_NTSC (u32)(PS2CLK / 59.94) //hz
#define VSYNC_HALF_NTSC (u32)(VSYNC_NTSC / 2) //hz
#define VSYNC_NTSC (u32)(PS2CLK / 59.94005994) //hz
#define VSYNC_HALF_NTSC (u32)(VSYNC_NTSC / 2) //hz //should be 2460058 but rounding puts it to 2460060
#define SCANLINES_TOTAL_NTSC 525 // total number of scanlines
#define SCANLINES_VSYNC_NTSC 3 // scanlines that are used for syncing every half-frame
@ -53,6 +55,8 @@ typedef struct {
// PAL Timing Information!!! (some scanline info is guessed)
//------------------------------------------------------------------
#define SCANLINE_PAL (u32)(PS2CLK / 15625)//18874
// fixme : Both, HRENDER_TIME_PAL and HBLANK_TIME_PAL the same?
// also see cpuRcntSet() and possibly hScanline() for this issue (rama)
#define HRENDER_TIME_PAL (u32)(SCANLINE_PAL / 2)//15335 //time from hblank end to hblank start
#define HBLANK_TIME_PAL (u32)(SCANLINE_PAL / 2)//3539 //time from hblank start to hblank end
#define VSYNC_PAL (u32)(PS2CLK / 50) //hz

View File

@ -123,8 +123,8 @@ typedef struct {
int Hacks;
int GameFixes;
int CustomFrameSkip;
int CustomConsecutiveFrames;
int CustomConsecutiveSkip;
u8 CustomConsecutiveFrames;
u8 CustomConsecutiveSkip;
u32 sseMXCSR;
u32 sseVUMXCSR;
} PcsxConfig;