Fixed SIF bugs introduced in Persona, also reverted the VIF change that caused problems with the graphics.

Fixed savestate loading in MTGS thanks to Rama1.
Tweaked the MCD manager so it doesnt infinate loop in places, also no longer auto populates the list if the memcard is corrupt, which caused it to crash.
This commit is contained in:
refractionpcsx2
2008-03-28 20:01:15 +00:00
parent aa5b2607b4
commit 380d7a360f
6 changed files with 40 additions and 39 deletions

View File

@@ -465,15 +465,12 @@ void VSync()
//SysPrintf("vif: %d\n", (((LARGE_INTEGER*)g_nCounters)->QuadPart * 1000000) / lfreq.QuadPart);
//memset(g_nCounters, 0, 16);
counters[5].mode|= 0x10000;
if ((CSRw & 0x8)){
GSCSRr|= 0x8;
if (!(GSIMR&0x800) )
if ((CSRw & 0x8))
GSCSRr|= 0x8;
if (!(GSIMR&0x800) )
gsIrq();
}
hwIntcIrq(2);
psxVSyncStart();
@@ -508,14 +505,13 @@ void rcntUpdate()
if ((u32)(cpuRegs.cycle - counters[4].sCycleT) >= (u32)counters[4].CycleT && hblankend == 1){
if ((CSRw & 0x4)){
if ((CSRw & 0x4))
GSCSRr |= 4; // signal
if (!(GSIMR&0x400) )
gsIrq();
}
if(gates)rcntEndGate(0);
if(psxhblankgate)psxCheckEndGate(0);
hblankend = 0;

View File

@@ -716,30 +716,31 @@ void gsIrq() {
static void GSRegHandlerSIGNAL(u32* data)
{
#ifdef GIF_LOG
GIF_LOG("GS SIGNAL data %x_%x CSRw %x\n",data[0], data[1], CSRw);
#endif
GSSIGLBLID->SIGID = (GSSIGLBLID->SIGID&~data[1])|(data[0]&data[1]);
if ((CSRw & 0x1)) {
if (!(GSIMR&0x100) )
gsIrq();
if ((CSRw & 0x1))
GSCSRr |= 1; // signal
//CSRw &= ~1;
}
if (!(GSIMR&0x100) )
gsIrq();
}
static void GSRegHandlerFINISH(u32* data)
{
if ((CSRw & 0x2)) {
if (!(GSIMR&0x200) )
gsIrq();
//CSRw &= ~2;
#ifdef GIF_LOG
GIF_LOG("GS FINISH data %x_%x CSRw %x\n",data[0], data[1], CSRw);
#endif
if ((CSRw & 0x2))
GSCSRr |= 2; // finish
}
if (!(GSIMR&0x200) )
gsIrq();
}

View File

@@ -712,7 +712,7 @@ int LoadState(char *file) {
if( CHECK_MULTIGS ) {
// have to call in thread, otherwise weird stuff will start happening
uptr uf = (uptr)f;
GSRingBufSimplePacket(GS_RINGTYPE_SAVE, (int)(uf&0xffffffff), (int)(uf>>32), 0);
GSRingBufSimplePacket(GS_RINGTYPE_LOAD, (int)(uf&0xffffffff), (int)(uf>>32), 0);
gsWaitGS();
}
else {

View File

@@ -293,7 +293,8 @@ void SIF0Dma()
notDone = 1;
//}
}
else
if(sif0dma->qwc == 0)
{
if((sif0dma->chcr & 0x80000080) == 0x80000080) // Stop on tag IRQ
{
@@ -345,7 +346,7 @@ void SIF0Dma()
}
}
}
}while(notDone);
}while(iopsifbusy[0] == 1 && eesifbusy[0] == 1);
FreezeMMXRegs(0);
}
@@ -448,7 +449,8 @@ void SIF1Dma()
}
}
}
else // There's some data ready to transfer into the fifo..
if(sif1dma->qwc > 0) // There's some data ready to transfer into the fifo..
{
int qwTransfer = sif1dma->qwc;
u32 *data;
@@ -540,7 +542,7 @@ void SIF1Dma()
}
}
}
}while(notDone);
}while(iopsifbusy[1] == 1 && eesifbusy[1] == 1);
}

View File

@@ -1822,7 +1822,7 @@ static void Vif1CMDSTMod(){ // STMOD
}
static void Vif1CMDMskPath3(){ // MSKPATH3
int qwc;
vif1Regs->mskpath3 = (vif1Regs->code >> 15) & 0x1;
//SysPrintf("VIF MSKPATH3 %x\n", vif1Regs->mskpath3);
#ifdef GSPATH3FIX
@@ -1830,9 +1830,9 @@ static void Vif1CMDMskPath3(){ // MSKPATH3
if ( (vif1Regs->code >> 15) & 0x1 ) {
while((gif->chcr & 0x100)){ //Can be done 2 different ways, depends on the game/company
if(path3hack == 0)if(Path3transfer == 0 && gif->qwc == 0) break;
qwc = gif->qwc;
gsInterrupt();
g_vifCycles += qwc - gif->qwc;
if(path3hack == 1)if(gif->qwc == 0) break; //add games not working with it to elfheader.c to enable this instead
}
//while(gif->chcr & 0x100) gsInterrupt(); // Finish the transfer first
@@ -1859,15 +1859,14 @@ static void Vif1CMDMark(){ // MARK
vif1.cmd &= ~0x7f;
}
static void Vif1CMDFlush(){ // FLUSH/E/A
int qwc;
vif1FLUSH();
if((vif1.cmd & 0x7f) == 0x13) {
//SysPrintf("FlushA\n");
while((gif->chcr & 0x100)){
if(Path3transfer == 0 && gif->qwc == 0) break;
qwc = gif->qwc;
gsInterrupt();
g_vifCycles += qwc - gif->qwc;
}
}

View File

@@ -740,10 +740,11 @@ class MemoryCard
void Read(u32 cluster, Dir *d)
{
int i;
s8 file1[512], file2[512];
Dir D1, D2;
for(;;)
for(i = 0; i < 0xffff; i++)
{
// Read first page containing the first dir
@@ -1089,6 +1090,7 @@ class MemoryCard
void SaveRootDir(Dir *Di)
{
// Open memcard
int i;
fclose(fp);
fp = fopen(FileName, "rb+");
if(fp == NULL)
@@ -1102,7 +1104,7 @@ class MemoryCard
//s8 file1[256], file2[256];
int Lenght = Root.Sons[0].Lenght;
for(;;)
for(i = 0; i < 0xffff; i++)
{
// Get next cluster from the FAT table
oldcluster = cluster;
@@ -1287,6 +1289,7 @@ class MemoryCard
void SaveRootDir(char *name)
{
int i;
// Open memcard
fclose(fp);
fp = fopen(FileName, "rb+");
@@ -1301,7 +1304,7 @@ class MemoryCard
//s8 file1[256], file2[256];
int Lenght = Root.Sons[0].Lenght;
for(;;)
for(i = 0; i < 0xffff; i++)
{
// Get next cluster from the FAT table
oldcluster = cluster;
@@ -1627,14 +1630,14 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
Edit_SetText(GetDlgItem(hW,IDC_MCD1), Config.Mcd1);
Edit_SetText(GetDlgItem(hW,IDC_MCD2), Config.Mcd2);
MC1.Load(Config.Mcd1);
MC2.Load(Config.Mcd2);
//MC1.Load(Config.Mcd1);
//MC2.Load(Config.Mcd2);
//MC1.AddCardToTreeView(GetDlgItem(hW, IDC_TREE1));
//MC2.AddCardToTreeView(GetDlgItem(hW, IDC_TREE2));
MC1.AddToListView(GetDlgItem(hW,IDC_LIST1));
MC2.AddToListView(GetDlgItem(hW,IDC_LIST2));
//MC1.AddToListView(GetDlgItem(hW,IDC_LIST1));
//MC2.AddToListView(GetDlgItem(hW,IDC_LIST2));
return TRUE;