mirror of
https://github.com/PCSX2/pcsx2-sourceforge.git
synced 2026-02-04 03:11:18 +01:00
couple of mods to the timing changes (not 100% sure on the effect, what ive observed its for the better), implemented a more logical method of cdvd timing which wont make x24 cd reading 6 times faster than a dvd at x4 :p
This commit is contained in:
16
pcsx2/CDVD.c
16
pcsx2/CDVD.c
@@ -672,14 +672,22 @@ void cdvdReset()
|
||||
|
||||
}
|
||||
void cdvdReadTimeRcnt(int mode){ // Mode 0 is DVD, Mode 1 is CD
|
||||
int readsize = 0; // 1 Sector size
|
||||
int readspeed = 0; // 1 Sector size
|
||||
int amount = 0; // Total bytes transfered at 1x speed
|
||||
//if(mode) amount = 153600;
|
||||
//else
|
||||
amount = 1280000;
|
||||
amount = cdvd.BlockSize; // in Bytes
|
||||
if(mode == 0)
|
||||
readspeed = ((PSXCLK /1382400)/* 1 Byte Time @ x1 */ * amount) / cdvd.Speed; //1350KB = dvd x 1
|
||||
else
|
||||
readspeed = ((PSXCLK /153600)/* 1 Byte Time @ x1 */ * amount) / cdvd.Speed; //150KB = cd x 1
|
||||
|
||||
readsize = amount / cdvd.BlockSize; // Time taken for 1 sector to be read
|
||||
cdvdReadTime = ((PSXCLK / readsize)) / cdvd.Speed;
|
||||
//amount = 1280000;
|
||||
|
||||
|
||||
//readsize = amount / cdvd.BlockSize; // Time taken for 1 sector to be read
|
||||
cdvdReadTime = readspeed; //(PSXCLK / readspeed); /// amount;
|
||||
//SysPrintf("CDVD Cnt Time = %x\n", cdvdReadTime);
|
||||
}
|
||||
|
||||
int cdvdFreeze(gzFile f, int Mode) {
|
||||
|
||||
@@ -165,9 +165,10 @@ void UpdateVSyncRate() {
|
||||
if(Config.PsxType & 2)counters[5].rate = PS2VBLANK_NTSC_INT;
|
||||
else counters[5].rate = PS2VBLANK_NTSC;
|
||||
}
|
||||
rcntUpdTarget(4);
|
||||
counters[4].CycleT = PS2HBLANKEND;
|
||||
counters[4].Cycle = counters[4].rate-PS2HBLANKEND;
|
||||
|
||||
rcntUpdTarget(5);
|
||||
counters[5].CycleT = PS2VBLANKEND;
|
||||
counters[5].Cycle = counters[5].rate-PS2VBLANKEND;
|
||||
|
||||
@@ -177,7 +178,7 @@ void UpdateVSyncRate() {
|
||||
iTicks = GetTickFrequency()/vsyncs;
|
||||
SysPrintf("Framelimiter rate updated (UpdateVSyncRate): %d fps\n",vsyncs);
|
||||
}
|
||||
|
||||
rcntSet();
|
||||
}
|
||||
|
||||
void FrameLimiter()
|
||||
@@ -459,7 +460,10 @@ void rcntUpdate()
|
||||
|
||||
if ((s64)(counters[i].target - counters[i].count) <= 0 /*&& (counters[i].target & 0xffff) > 0*/) { // Target interrupt
|
||||
|
||||
|
||||
if((counters[i].target > 0xffff)) {
|
||||
//SysPrintf("EE Correcting target %x after reset on target\n", i);
|
||||
counters[i].target &= 0xffff;
|
||||
}
|
||||
if(counters[i].mode & 0x100 ) {
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE counter %d target reached mode %x count %x target %x\n", i, counters[i].mode, counters[i].count, counters[i].target);
|
||||
@@ -468,13 +472,10 @@ void rcntUpdate()
|
||||
counters[i].mode|= 0x0400; // Target flag
|
||||
hwIntcIrq(counters[i].interrupt);
|
||||
if (counters[i].mode & 0x40) { //The PS2 only resets if the interrupt is enabled - Tested on PS2
|
||||
if((counters[i].target > 0xffff)) {
|
||||
//SysPrintf("EE Correcting target %x after reset on target\n", i);
|
||||
counters[i].target &= 0xffff;
|
||||
}
|
||||
|
||||
counters[i].count = 0; // Reset on target
|
||||
}
|
||||
else counters[i].target += 0x10000;
|
||||
else counters[i].target += 0x10000000;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -587,10 +588,10 @@ void rcntWmode(int index, u32 value)
|
||||
}
|
||||
else gates &= ~(1<<index);
|
||||
|
||||
if((counters[index].target > 0xffff) && (counters[index].target & 0xffff) > rcntCycle(index)) {
|
||||
/*if((counters[index].target > 0xffff) && (counters[index].target & 0xffff) > rcntCycle(index)) {
|
||||
//SysPrintf("EE Correcting target %x after mode write\n", index);
|
||||
counters[index].target &= 0xffff;
|
||||
}
|
||||
}*/
|
||||
rcntSet();
|
||||
|
||||
}
|
||||
@@ -662,7 +663,7 @@ void rcntWtarget(int index, u32 value) {
|
||||
counters[index].target = value & 0xffff;
|
||||
if(counters[index].target <= rcntCycle(index)/* && counters[index].target != 0*/) {
|
||||
//SysPrintf("EE Saving target %d from early trigger, target = %x, count = %x\n", index, counters[index].target, rcntCycle(index));
|
||||
counters[index].target += 0x10000;
|
||||
counters[index].target += 0x10000000;
|
||||
}
|
||||
rcntSet();
|
||||
}
|
||||
@@ -682,7 +683,9 @@ u16 rcntRcount(int index) {
|
||||
}else{
|
||||
ret = counters[index].count;
|
||||
}
|
||||
|
||||
#ifdef EECNT_LOG
|
||||
EECNT_LOG("EE count read %d value %x\n", index, ret);
|
||||
#endif
|
||||
return (u16)ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ void _testRcnt16target(int i) {
|
||||
if (psxCounters[i].mode & 0x08) { // Reset on target
|
||||
psxCounters[i].count = 0;
|
||||
|
||||
} else psxCounters[i].target += 0x10000;
|
||||
} else psxCounters[i].target += 0x1000000000;
|
||||
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ void _testRcnt32target(int i) {
|
||||
if (psxCounters[i].mode & 0x08) { // Reset on target
|
||||
psxCounters[i].count = 0;
|
||||
|
||||
} else psxCounters[i].target += 0x100000000;
|
||||
} else psxCounters[i].target += 0x1000000000;
|
||||
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ void psxRcntWtarget16(int index, u32 value) {
|
||||
psxCounters[index].target = value & 0xffff;
|
||||
if(psxCounters[index].target <= psxRcntCycles(index)/* && psxCounters[index].target != 0*/) {
|
||||
//SysPrintf("IOP 16 Saving %x target from early trigger target = %x, count = %I64x\n", index, psxCounters[index].target, psxRcntCycles(index));
|
||||
psxCounters[index].target += 0x10000;
|
||||
psxCounters[index].target += 0x1000000000;
|
||||
}
|
||||
|
||||
psxRcntSet();
|
||||
@@ -674,7 +674,7 @@ void psxRcntWtarget32(int index, u32 value) {
|
||||
psxCounters[index].target = value;
|
||||
if(psxCounters[index].target <= psxRcntCycles(index)/* && psxCounters[index].target != 0*/) {
|
||||
//SysPrintf("IOP 32 Saving %x target from early trigger target = %x, count = %I64x\n", index, psxCounters[index].target, psxRcntCycles(index));
|
||||
psxCounters[index].target += 0x100000000;
|
||||
psxCounters[index].target += 0x1000000000;
|
||||
}
|
||||
|
||||
psxRcntSet();
|
||||
|
||||
Reference in New Issue
Block a user