diff --git a/pcsx2/FiFo.cpp b/pcsx2/FiFo.cpp index baf15ba23f..d7a40fa090 100644 --- a/pcsx2/FiFo.cpp +++ b/pcsx2/FiFo.cpp @@ -87,7 +87,7 @@ void __fastcall ReadFIFO_page_7(u32 mem, u64 *out) // All addresses in this page map to 0x7000 and 0x7010: mem &= 0x10; - if( mem == 0 ) + if( mem == 0 ) // IPUout_FIFO { if( g_nIPU0Data > 0 ) { @@ -98,7 +98,7 @@ void __fastcall ReadFIFO_page_7(u32 mem, u64 *out) g_pIPU0Pointer += 16; } } - else + else // IPUin_FIFO ipu_fifo.out.readsingle((void*)out); } diff --git a/pcsx2/IPU/IPU.cpp b/pcsx2/IPU/IPU.cpp index 1448ce08df..5cee401836 100644 --- a/pcsx2/IPU/IPU.cpp +++ b/pcsx2/IPU/IPU.cpp @@ -154,22 +154,20 @@ void ipuShutdown() void ReportIPU() { - Console.WriteLn("g_nDMATransfer = 0x%x.", g_nDMATransfer._u32); - ipu_fifo.in.print(); - ipu_fifo.out.print(); - Console.WriteLn("g_BP = 0x%x.", g_BP); + Console.WriteLn(g_nDMATransfer.desc()); + Console.WriteLn(ipu_fifo.in.desc()); + Console.WriteLn(ipu_fifo.out.desc()); + Console.WriteLn(g_BP.desc()); Console.WriteLn("niq = 0x%x, iq = 0x%x.", niq, iq); Console.WriteLn("vqclut = 0x%x.", vqclut); Console.WriteLn("s_thresh = 0x%x.", s_thresh); Console.WriteLn("coded_block_pattern = 0x%x.", coded_block_pattern); Console.WriteLn("g_decoder = 0x%x.", g_decoder); - Console.WriteLn("mpeg2_scan_norm = 0x%x, mpeg2_scan_alt = 0x%x.", mpeg2_scan_norm, mpeg2_scan_alt); - Console.WriteLn("g_nCmdPos = 0x%x.", ipu_cmd.pos); - Console.WriteLn("g_nCmdIndex = 0x%x.", ipu_cmd.index); - Console.WriteLn("ipuCurCmd = 0x%x.", ipu_cmd.current); - Console.WriteLn("_readbits = 0x%x.", _readbits); - Console.WriteLn("temp will equal 0x%x.", readbits - _readbits); - Console.WriteLn(""); + Console.WriteLn("mpeg2: scan_norm = 0x%x, alt = 0x%x.", mpeg2_scan_norm, mpeg2_scan_alt); + Console.WriteLn(ipu_cmd.desc()); + Console.WriteLn("_readbits = 0x%x. readbits - _readbits, which is also frozen, is 0x%x.", + _readbits, readbits - _readbits); + Console.Newline(); } // fixme - ipuFreeze looks fairly broken. Should probably take a closer look at some point. @@ -177,6 +175,8 @@ void SaveStateBase::ipuFreeze() { IPUProcessInterrupt(); + // Get a report of the status of the ipu variables when saving and loading savestates. + //ReportIPU(); FreezeTag("IPU"); // old versions saved the IPU regs, but they're already saved as part of HW! @@ -259,7 +259,7 @@ __forceinline u32 ipuRead32(u32 mem) ipucase(IPU_BP): // IPU_BP ipuRegs->ipubp = g_BP.BP & 0x7f; ipuRegs->ipubp |= g_BP.IFC << 8; - ipuRegs->ipubp |= (g_BP.FP + g_BP.bufferhasnew) << 16; + ipuRegs->ipubp |= (g_BP.FP /*+ g_BP.bufferhasnew*/) << 16; IPU_LOG("Ipu read32: IPU_BP=0x%08X", *(u32*)&g_BP); return ipuRegs->ipubp; @@ -307,8 +307,7 @@ __forceinline u64 ipuRead64(u32 mem) void ipuSoftReset() { mpeg2_init(); - ipu_fifo.in.clear(); - ipu_fifo.out.clear(); + ipu_fifo.clear(); coded_block_pattern = 0; @@ -318,7 +317,7 @@ void ipuSoftReset() g_BP.BP = 0; g_BP.FP = 0; - g_BP.bufferhasnew = 0; + //g_BP.bufferhasnew = 0; } __forceinline void ipuWrite32(u32 mem, u32 value) @@ -394,7 +393,7 @@ static void ipuBCLR(u32 val) g_BP.BP = val & 0x7F; g_BP.FP = 0; - g_BP.bufferhasnew = 0; + //g_BP.bufferhasnew = 0; ipuRegs->ctrl.BUSY = 0; ipuRegs->cmd.BUSY = 0; memzero_ptr<80>(readbits); @@ -616,16 +615,8 @@ static __forceinline BOOL ipuSETVQ(u32 val) static BOOL __fastcall ipuCSC(u32 val) { tIPU_CMD_CSC csc(val); - - IPU_LOG("IPU CSC(Colorspace conversion from YCbCr) command (%d).", csc.MBC); - if (csc.OFM) - IPU_LOG("Output format is RGB16. "); - else - IPU_LOG("Output format is RGB32. "); - - if (csc.DTE) IPU_LOG("Dithering enabled."); - - //Console.WriteLn("CSC"); + csc.log_from_YCbCr(); + for (;ipu_cmd.index < (int)csc.MBC; ipu_cmd.index++) { @@ -669,17 +660,7 @@ static BOOL __fastcall ipuCSC(u32 val) static BOOL ipuPACK(u32 val) { tIPU_CMD_CSC csc(val); - - IPU_LOG("IPU PACK (Colorspace conversion from RGB32) command."); - - if (csc.OFM) - IPU_LOG("Output format is RGB16. "); - else - IPU_LOG("Output format is INDX4. "); - - if (csc.DTE) IPU_LOG("Dithering enabled."); - - IPU_LOG("Number of macroblocks to be converted: %d", csc.MBC); + csc.log_from_RGB32(); for (;ipu_cmd.index < (int)csc.MBC; ipu_cmd.index++) { diff --git a/pcsx2/IPU/IPU.h b/pcsx2/IPU/IPU.h index dcc3e4e085..0e08c8a358 100644 --- a/pcsx2/IPU/IPU.h +++ b/pcsx2/IPU/IPU.h @@ -46,18 +46,21 @@ // // Bitfield Structures // -union tIPU_CMD { - struct { - u32 OPTION : 28; // VDEC decoded value - u32 CMD : 4; // last command - u32 _BUSY; - }; - struct { - u32 DATA; - u32 BUSY; - }; -}; +struct tIPU_CMD +{ + union + { + struct + { + u32 OPTION : 28; // VDEC decoded value + u32 CMD : 4; // last command + }; + u32 DATA; + }; + u32 BUSY; +}; + union tIPU_CTRL { struct { u32 IFC : 4; // Input FIFO counter @@ -94,7 +97,11 @@ struct tIPU_BP { u32 BP; // Bit stream point u16 IFC; // Input FIFO counter u8 FP; // FIFO point - u8 bufferhasnew; + u8 bufferhasnew; // Always 0. + wxString desc() const + { + return wxsFormat(L"Ipu BP: bp = 0x%x, IFC = 0x%x, FP = 0x%x.", BP, IFC, FP); + } }; #ifdef _WIN32 @@ -214,6 +221,29 @@ union tIPU_CMD_CSC void set_flags(u32 flags) { _u32 |= flags; } void clear_flags(u32 flags) { _u32 &= ~flags; } void reset() { _u32 = 0; } + void log_from_YCbCr() + { + IPU_LOG("IPU CSC(Colorspace conversion from YCbCr) command (%d).", MBC); + if (OFM) + IPU_LOG("Output format is RGB16. "); + else + IPU_LOG("Output format is RGB32. "); + + if (DTE) IPU_LOG("Dithering enabled."); + } + void log_from_RGB32() + { + IPU_LOG("IPU PACK (Colorspace conversion from RGB32) command."); + + if (OFM) + IPU_LOG("Output format is RGB16. "); + else + IPU_LOG("Output format is INDX4. "); + + if (DTE) IPU_LOG("Dithering enabled."); + + IPU_LOG("Number of macroblocks to be converted: %d", MBC); + } }; union tIPU_DMA @@ -238,6 +268,23 @@ union tIPU_DMA void set_flags(u32 flags) { _u32 |= flags; } void clear_flags(u32 flags) { _u32 &= ~flags; } void reset() { _u32 = 0; } + wxString desc() const + { + wxString temp(L"g_nDMATransfer["); + + if (GIFSTALL) temp += L" GIFSTALL "; + if (TIE0) temp += L" TIE0 "; + if (TIE1) temp += L" TIE1 "; + if (ACTV1) temp += L" ACTV1 "; + if (DOTIE1) temp += L" DOTIE1 "; + if (FIREINT0) temp += L" FIREINT0 "; + if (FIREINT1) temp += L" FIREINT1 "; + if (VIFSTALL) temp += L" VIFSTALL "; + if (SIFSTALL) temp += L" SIFSTALL "; + + temp += L"]"; + return temp; + } }; enum SCE_IPU @@ -279,6 +326,11 @@ struct tIPU_cmd index = 0; current = 0xffffffff; } + wxString desc() const + { + return wxsFormat(L"Ipu cmd: index = 0x%x, current = 0x%x, pos[0] = 0x%x, pos[1] = 0x%x", + index, current, pos[0], pos[1]); + } }; //extern tIPU_cmd ipu_cmd; diff --git a/pcsx2/IPU/IPU_Fifo.cpp b/pcsx2/IPU/IPU_Fifo.cpp index c487fea59c..9dfd43728e 100644 --- a/pcsx2/IPU/IPU_Fifo.cpp +++ b/pcsx2/IPU/IPU_Fifo.cpp @@ -48,13 +48,20 @@ void IPU_Fifo_Output::clear() writepos = 0; } -void IPU_Fifo_Input::print() +void IPU_Fifo::clear() { - Console.WriteLn("IPU Fifo Input: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data); + in.clear(); + out.clear(); } -void IPU_Fifo_Output::print() + +wxString IPU_Fifo_Input::desc() const { - Console.WriteLn("IPU Fifo Output: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data); + return wxsFormat(L"IPU Fifo Input: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data); +} + +wxString IPU_Fifo_Output::desc() const +{ + return wxsFormat(L"IPU Fifo Output: readpos = 0x%x, writepos = 0x%x, data = 0x%x", readpos, writepos, data); } int IPU_Fifo_Input::write(u32* pMem, int size) diff --git a/pcsx2/IPU/IPU_Fifo.h b/pcsx2/IPU/IPU_Fifo.h index f50dcaeff0..425e34d017 100644 --- a/pcsx2/IPU/IPU_Fifo.h +++ b/pcsx2/IPU/IPU_Fifo.h @@ -26,7 +26,7 @@ class IPU_Fifo_Input int write(u32* pMem, int size); int read(void *value); void clear(); - void print(); + wxString desc() const; }; class IPU_Fifo_Output @@ -41,7 +41,7 @@ class IPU_Fifo_Output void read(void *value,int size); void readsingle(void *value); void clear(); - void print(); + wxString desc() const; private: void _readsingle(void *value); }; @@ -53,6 +53,7 @@ class IPU_Fifo IPU_Fifo_Output out; void init(); + void clear(); }; extern IPU_Fifo ipu_fifo; diff --git a/plugins/dev9null/DEV9.cpp b/plugins/dev9null/DEV9.cpp index 34beb00d8c..fc44a5b244 100644 --- a/plugins/dev9null/DEV9.cpp +++ b/plugins/dev9null/DEV9.cpp @@ -199,16 +199,16 @@ EXPORT_C_(void) DEV9write32(u32 addr, u32 value) } //#ifdef ENABLE_NEW_IOPDMA_DEV9 -EXPORT_C_(s32) DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed) +EXPORT_C_(s32) DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed) { - // You'll want to but your own DMA8 reading code here. + // You'll want to put your own DMA8 reading code here. // Time to interact with your fake (or real) hardware. Dev9Log.WriteLn("Reading DMA8 Mem."); *bytesProcessed = bytesLeft; return 0; } -EXPORT_C_(s32) DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed) +EXPORT_C_(s32) DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed) { // See above. Dev9Log.WriteLn("Writing DMA8 Mem."); @@ -223,7 +223,7 @@ EXPORT_C_(void) DEV9dmaInterrupt(s32 channel) //#else EXPORT_C_(void) DEV9readDMA8Mem(u32 *pMem, int size) { - // You'll want to but your own DMA8 reading code here. + // You'll want to put your own DMA8 reading code here. // Time to interact with your fake (or real) hardware. Dev9Log.WriteLn("Reading DMA8 Mem."); }