A couple misc changes. Converted a few more lines to the new register format, fixed spelling in a few comments, and so on...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1997 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-10-11 08:40:44 +00:00
parent 4b6e67eff8
commit e0cef88d54
6 changed files with 75 additions and 69 deletions

View File

@ -120,7 +120,7 @@ FILE *_cdvdOpenNVM()
nvmfile.SetExt( L"nvm" );
const wxCharBuffer file( nvmfile.GetFullPath().ToUTF8() );
// if file doesnt exist, create empty one
// if file doesn't exist, create empty one
fd = fopen(file.data(), "r+b");
if (fd == NULL)
{
@ -266,13 +266,13 @@ s32 cdvdReadConfig(u8* config)
switch (cdvd.COffset)
{
case 0:
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config0));
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config0));
break;
case 2:
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config2));
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config2));
break;
default:
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config1));
return getNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config1));
}
}
s32 cdvdWriteConfig(const u8* config)
@ -291,7 +291,7 @@ s32 cdvdWriteConfig(const u8* config)
switch (cdvd.COffset)
{
case 0:
return setNvmData(config, (cdvd.CBlockIndex++)*16, 16,offsetof(NVMLayout, config0));
return setNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config0));
break;
case 2:
return setNvmData(config, (cdvd.CBlockIndex++)*16, 16, offsetof(NVMLayout, config2));
@ -301,6 +301,16 @@ s32 cdvdWriteConfig(const u8* config)
}
}
void reloadElfInfo(const char* str)
{
// Now's a good time to reload the ELF info...
if (ElfCRC == 0)
{
ElfCRC = loadElfCRC( str );
ElfApplyPatches();
mtgsThread.SendGameCRC( ElfCRC );
}
}
void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
wxString fname;
@ -345,40 +355,36 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
key[ 3] = (key_0_3&0xFF000000)>>24;
key[ 4] = key_4;
if(arg2 == 75)
{
key[14] = key_14;
key[15] = 0x05;
}
else if(arg2 == 3075)
{
key[15] = 0x01;
}
else if(arg2 == 4246)
{
// 0x0001F2F707 = sector 0x0001F2F7 dec 0x07
key[ 0] = 0x07;
key[ 1] = 0xF7;
key[ 2] = 0xF2;
key[ 3] = 0x01;
key[ 4] = 0x00;
key[15] = 0x01;
}
else
{
key[15] = 0x01;
}
switch (arg2)
{
case 75:
key[14] = key_14;
key[15] = 0x05;
break;
// case 3075:
// key[15] = 0x01;
// break;
case 4246:
// 0x0001F2F707 = sector 0x0001F2F7 dec 0x07
key[ 0] = 0x07;
key[ 1] = 0xF7;
key[ 2] = 0xF2;
key[ 3] = 0x01;
key[ 4] = 0x00;
key[15] = 0x01;
break;
default:
key[15] = 0x01;
break;
}
Console.WriteLn( "CDVD.KEY = %02X,%02X,%02X,%02X,%02X,%02X,%02X",
cdvd.Key[0],cdvd.Key[1],cdvd.Key[2],cdvd.Key[3],cdvd.Key[4],cdvd.Key[14],cdvd.Key[15] );
// Now's a good time to reload the ELF info...
if( IsPs2 && (ElfCRC == 0) )
{
ElfCRC = loadElfCRC( str );
ElfApplyPatches();
mtgsThread.SendGameCRC( ElfCRC );
}
if (IsPs2) reloadElfInfo(str);
}
s32 cdvdGetToc(void* toc)
@ -505,13 +511,7 @@ void cdvdDetectDisk()
wxString str;
bool IsPs2 = (GetPS2ElfName(str) == 2);
// Now's a good time to reload the ELF info...
if( IsPs2 && (ElfCRC == 0) )
{
ElfCRC = loadElfCRC( str.ToAscii().data() );
ElfApplyPatches();
mtgsThread.SendGameCRC( ElfCRC );
}
if (IsPs2) reloadElfInfo(str.ToAscii().data());
}
void cdvdNewDiskCB()

View File

@ -65,7 +65,11 @@ __forceinline void gsInterrupt()
if (Path3progress != IMAGE_MODE) vif1Regs->stat.VGW = 0;
}
if (Path3progress == STOPPED_MODE) gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH); // OPH=0 | APATH=0
if (Path3progress == STOPPED_MODE)
{
gifRegs->stat.clear(GIF_STAT_APATH3 | GIF_STAT_OPH);
}
if ((gif->qwc > 0) || (!gspath3done))
{
if (!dmacRegs->ctrl.DMAE)
@ -94,8 +98,9 @@ __forceinline void gsInterrupt()
}
static u32 WRITERING_DMA(u32 *pMem, u32 qwc)
{
psHu32(GIF_STAT) |= GIF_STAT_APATH3 | GIF_STAT_OPH;
{
gifRegs->stat.APATH = GIF_APATH3;
gifRegs->stat.OPH = 1;
int size = mtgsThread.PrepDataPacket(GIF_PATH_3, pMem, qwc);
u8* pgsmem = mtgsThread.GetDataPacketPtr();
@ -490,7 +495,7 @@ void mfifoGIFtransfer(int qwc)
{
SPR_LOG("dmaIrq Set");
gifstate = GIF_STATE_DONE;
gifmfifoirq = TRUE;
gifmfifoirq = true;
}
}
@ -511,7 +516,12 @@ void mfifoGIFtransfer(int qwc)
void gifMFIFOInterrupt()
{
mfifocycles = 0;
if (Path3progress == STOPPED_MODE) psHu32(GIF_STAT)&= ~(GIF_STAT_APATH3 | GIF_STAT_OPH); // OPH=0 | APATH=0
if (Path3progress == STOPPED_MODE)
{
gifRegs->stat.APATH = GIF_APATH_IDLE;
gifRegs->stat.OPH = 0;
}
if ((spr0->chcr.STR) && (spr0->qwc == 0))
{

View File

@ -188,7 +188,7 @@ __forceinline void SIF0Dma()
if (eesifbusy[0]) // If EE SIF enabled and there's something to transfer
{
int size = sif0dma->qwc;
if (dmacRegs->ctrl.STS == STS_SIF0) // STS == fromSIF0
if (dmacRegs->ctrl.STS == STS_SIF0)
{
SIF_LOG("SIF0 stall control");
}
@ -217,7 +217,8 @@ __forceinline void SIF0Dma()
if (sif0dma->qwc == 0)
{
// Stop if TIE & the IRQ are set, or at the end. (I'll try to convert this to use the tags code later.)
if (((sif0dma->chcr._u32 & 0x80000080) == 0x80000080) || (sif0.end))
//if (((sif0dma->chcr._u32 & 0x80000080) == 0x80000080) || (sif0.end))
if ((sif0dma->chcr.TIE & Tag::IRQ(sif0dma->chcr._u32)) || sif0.end)
{
if (sif0.end)
SIF_LOG(" EE SIF end");
@ -242,11 +243,10 @@ __forceinline void SIF0Dma()
// (tag[0] >> 28) & 3? Surely this is supposed to be (tag[0] >> 28) & 7? --arcum42
if ((dmacRegs->ctrl.STS != NO_STS) && ((tag[0] >> 28) & 3) == 0)
psHu32(DMAC_STADR) = sif0dma->madr + (sif0dma->qwc * 16);
dmacRegs->stadr.ADDR = sif0dma->madr + (sif0dma->qwc * 16);
sif0.chain = 1;
if (tag[0] & 0x40000000) sif0.end = 1;
done = false;
}
}
}
@ -263,7 +263,6 @@ __forceinline void SIF1Dma()
{
if (eesifbusy[1]) // If EE SIF1 is enabled
{
if (dmacRegs->ctrl.STD == STD_SIF1)
SIF_LOG("SIF1 stall control"); // STD == fromSIF1
@ -286,8 +285,6 @@ __forceinline void SIF1Dma()
ptag = _dmaGetAddr(sif1dma, sif1dma->tadr, DMAC_SIF1);
if (ptag == NULL) return;
//_dmaGetAddr(sif1dma, *ptag, sif1dma->tadr, DMAC_SIF1);
sif1dma->chcr._u32 = (sif1dma->chcr._u32 & 0xFFFF) | ((*ptag) & 0xFFFF0000); // Copy the tag
sif1dma->qwc = (u16)ptag[0];
@ -352,8 +349,6 @@ __forceinline void SIF1Dma()
data = _dmaGetAddr(sif1dma, sif1dma->madr, DMAC_SIF1);
if (data == NULL) return;
//_dmaGetAddr(sif1dma, *data, sif1dma->madr, DMAC_SIF1);
if (qwTransfer > (FIFO_SIF1_W - sif1.fifoSize) / 4) // Copy part of sif1dma into FIFO
qwTransfer = (FIFO_SIF1_W - sif1.fifoSize) / 4;
@ -451,6 +446,7 @@ __forceinline void dmaSIF0()
psHu32(SBUS_F240) |= 0x2000;
eesifbusy[0] = true;
if (iopsifbusy[0])
{
FreezeXMMRegs(1);
@ -474,6 +470,7 @@ __forceinline void dmaSIF1()
psHu32(SBUS_F240) |= 0x4000;
eesifbusy[1] = true;
if (iopsifbusy[1])
{
FreezeXMMRegs(1);

View File

@ -635,6 +635,7 @@ void vifMFIFOInterrupt()
vif1Regs->stat.INT = 1;
hwIntcIrq(INTC_VIF1);
--vif1.irq;
if (vif1Regs->stat.test(VIF1_STAT_VSS | VIF1_STAT_VIS | VIF1_STAT_VFS))
{
vif1Regs->stat.FQC = 0; // FQC=0
@ -645,12 +646,10 @@ void vifMFIFOInterrupt()
if (vif1.done == false || vif1ch->qwc)
{
switch(vif1.inprogress & 1)
{
case 0: //Set up transfer
if (vif1ch->tadr == spr0->madr)
if (vif1ch->tadr == spr0->madr)
{
// Console.WriteLn("Empty 1");
vifqwc = 0;
@ -660,13 +659,14 @@ void vifMFIFOInterrupt()
return;
}
mfifoVIF1transfer(0);
if ((vif1ch->madr >= dmacRegs->rbor.ADDR) && (vif1ch->madr <= (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK)))
CPU_INT(10, 0);
else
mfifoVIF1transfer(0);
if ((vif1ch->madr >= dmacRegs->rbor.ADDR) && (vif1ch->madr <= (dmacRegs->rbor.ADDR + dmacRegs->rbsr.RMSK)))
CPU_INT(10, 0);
else
CPU_INT(10, vif1ch->qwc * BIAS);
return;
case 1: //Transfer data
mfifo_VIF1chain();
CPU_INT(10, 0);
@ -689,6 +689,5 @@ void vifMFIFOInterrupt()
hwDmacIrq(DMAC_VIF1);
VIF_LOG("vif mfifo dma end");
vif1Regs->stat.FQC = 0; // FQC=0
vif1Regs->stat.FQC = 0;
}

View File

@ -123,7 +123,7 @@ struct GifPathStruct
// and raise a gsIrq. If CSR is already *set*, then ignore all subsequent drawing operations
// and writes to general purpose registers to the GS. (note: I'm pretty sure this includes
// direct GS and GSreg accesses, as well as those coming through the GIFpath -- but that
// behavior isn't confirmed yet). Privlidged writes are still active.
// behavior isn't confirmed yet). Privileged writes are still active.
//
// Ignorance continues until the SIGNAL bit in CSR is manually cleared by the EE. And here's
// the tricky part: the interrupt from the second SIGNAL is still pending, and should be
@ -222,7 +222,7 @@ __forceinline bool GIFPath::StepReg()
__forceinline u8 GIFPath::GetReg() { return regs[curreg]; }
// unpack the registers - registers are stored as a sequence of 4 bit values in the
// Unpack the registers - registers are stored as a sequence of 4 bit values in the
// upper 64 bits of the GIFTAG. That sucks for us when handling partialized GIF packets
// coming in from paths 2 and 3, so we unpack them into an 8 bit array here.
//
@ -393,7 +393,7 @@ void GIFPath_Reset()
}
// This is a hackfix tool provided for "canceling" the contents of the GIFpath when
// invalid GIFdma states are encountered (tpyically needed for PATH3 only).
// invalid GIFdma states are encountered (typically needed for PATH3 only).
__forceinline void GIFPath_Clear( GIF_PATH pathidx )
{
memzero(s_gifPath.path[pathidx]);

View File

@ -662,7 +662,7 @@ static __forceinline s32 recExecuteBlock( s32 eeCycles )
// We should be able to rely on GAS syntax (the register clobber list) as a
// replacement for manual push/pop of unpreserved registers.
//
// EBP note: As I feared, EBP is "required" for C++ excepion handling in Linux, and trying
// EBP note: As I feared, EBP is "required" for C++ exception handling in Linux, and trying
// to issue a clobber specifier for it causes an error. We really need to find a way to
// disable EBP regalloc in iCore. --air