diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 0165f772b3..7daaf5451c 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -150,8 +150,14 @@ public: static void SetManualBusyCursor( BusyCursorType busytype ); }; +////////////////////////////////////////////////////////////////////////////////////////////// extern bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos ); extern wxRect wxGetDisplayArea(); +extern wxString pxFormatToolTipText( wxWindow* wind, const wxString& src ); +extern void pxSetToolTip( wxWindow* wind, const wxString& src ); +extern void pxSetToolTip( wxWindow& wind, const wxString& src ); + + #endif diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index 7587595d59..f0df4937c1 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -203,27 +203,34 @@ const wxCursor& MoreStockCursors::GetArrowWait() MoreStockCursors StockCursors; // -------------------------------------------------------------------------------------- -// pxSetToolTip +// pxFormatToolTipText / pxSetToolTip // -------------------------------------------------------------------------------------- // This is the preferred way to assign tooltips to wxWindow-based objects, as it performs the // necessary text wrapping on platforms that need it. On windows tooltips are wrapped at 600 // pixels, or 66% of the screen width, whichever is smaller. GTK and MAC perform internal // wrapping, so this function does a regular assignment there. -void pxSetToolTip( wxWindow* wind, const wxString& src ) -{ - if( !pxAssert( wind != NULL ) ) return; +wxString pxFormatToolTipText( wxWindow* wind, const wxString& src ) +{ // Windows needs manual tooltip word wrapping (sigh). // GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all // half the time because of some other bug .. sigh) + #ifdef __WXMSW__ + if( wind == NULL ) return src; // Silently ignore nulls int whee = wxGetDisplaySize().GetWidth() * 0.75; - wind->SetToolTip( pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult() ); + return pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult(); #else - wind->SetToolTip( src ); + return src; #endif } +void pxSetToolTip( wxWindow* wind, const wxString& src ) +{ + if( wind == NULL ) return; // Silently ignore nulls + wind->SetToolTip( pxFormatToolTipText(wind, src) ); +} + void pxSetToolTip( wxWindow& wind, const wxString& src ) { pxSetToolTip( &wind, src ); diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 0436ea727d..cca5dbde4e 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -543,11 +543,11 @@ static void mechaDecryptBytes( u32 madr, int size ) int cdvdReadSector() { s32 bcr; - CDR_LOG("SECTOR %d (BCR %x;%x)", cdvd.Sector, HW_DMA3_BCR_H16, HW_DMA3_BCR_L16); + CDVD_LOG("SECTOR %d (BCR %x;%x)", cdvd.Sector, HW_DMA3_BCR_H16, HW_DMA3_BCR_L16); bcr = (HW_DMA3_BCR_H16 * HW_DMA3_BCR_L16) *4; if (bcr < cdvd.BlockSize) { - CDR_LOG( "READBLOCK: bcr < cdvd.BlockSize; %x < %x", bcr, cdvd.BlockSize ); + CDVD_LOG( "READBLOCK: bcr < cdvd.BlockSize; %x < %x", bcr, cdvd.BlockSize ); if (HW_DMA3_CHCR & 0x01000000) { HW_DMA3_CHCR &= ~0x01000000; psxDmaInterrupt(3); @@ -693,7 +693,7 @@ __forceinline void cdvdReadInterrupt() cdvd.Status = CDVD_STATUS_SEEK_COMPLETE; cdvd.Sector = cdvd.SeekToSector; - CDR_LOG( "Cdvd Seek Complete > Scheduling block read interrupt at iopcycle=%8.8x.", + CDVD_LOG( "Cdvd Seek Complete > Scheduling block read interrupt at iopcycle=%8.8x.", psxRegs.cycle + cdvd.ReadTime ); CDVDREAD_INT(cdvd.ReadTime); @@ -786,7 +786,7 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode ) if( !cdvd.Spinning ) { - CDR_LOG( "CdSpinUp > Simulating CdRom Spinup Time, and seek to sector %d", cdvd.SeekToSector ); + CDVD_LOG( "CdSpinUp > Simulating CdRom Spinup Time, and seek to sector %d", cdvd.SeekToSector ); seektime = PSXCLK / 3; // 333ms delay cdvd.Spinning = true; } @@ -797,18 +797,18 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode ) if( delta >= tbl_FastSeekDelta[mode] ) { // Full Seek - CDR_LOG( "CdSeek Begin > to sector %d, from %d - delta=%d [FULL]", cdvd.SeekToSector, cdvd.Sector, delta ); + CDVD_LOG( "CdSeek Begin > to sector %d, from %d - delta=%d [FULL]", cdvd.SeekToSector, cdvd.Sector, delta ); seektime = Cdvd_FullSeek_Cycles; } else { - CDR_LOG( "CdSeek Begin > to sector %d, from %d - delta=%d [FAST]", cdvd.SeekToSector, cdvd.Sector, delta ); + CDVD_LOG( "CdSeek Begin > to sector %d, from %d - delta=%d [FAST]", cdvd.SeekToSector, cdvd.Sector, delta ); seektime = Cdvd_FastSeek_Cycles; } } else { - CDR_LOG( "CdSeek Begin > Contiguous block without seek - delta=%d sectors", delta ); + CDVD_LOG( "CdSeek Begin > Contiguous block without seek - delta=%d sectors", delta ); // seektime is the time it takes to read to the destination block: seektime = delta * cdvd.ReadTime; @@ -872,7 +872,7 @@ static __forceinline u8 cdvdRead18(void) // SDATAOUT if (cdvd.ResultP >= cdvd.ResultC) cdvd.sDataIn|= 0x40; ret = cdvd.Result[cdvd.ResultP-1]; } - CDR_LOG("cdvdRead18(SDataOut) %x (ResultC=%d, ResultP=%d)", ret, cdvd.ResultC, cdvd.ResultP); + CDVD_LOG("cdvdRead18(SDataOut) %x (ResultC=%d, ResultP=%d)", ret, cdvd.ResultC, cdvd.ResultP); return ret; } @@ -882,80 +882,80 @@ u8 cdvdRead(u8 key) switch (key) { case 0x04: // NCOMMAND - CDR_LOG("cdvdRead04(NCMD) %x", cdvd.nCommand); + CDVD_LOG("cdvdRead04(NCMD) %x", cdvd.nCommand); return cdvd.nCommand; break; case 0x05: // N-READY - CDR_LOG("cdvdRead05(NReady) %x", cdvd.Ready); + CDVD_LOG("cdvdRead05(NReady) %x", cdvd.Ready); return cdvd.Ready; break; case 0x06: // ERROR - CDR_LOG("cdvdRead06(Error) %x", cdvd.Error); + CDVD_LOG("cdvdRead06(Error) %x", cdvd.Error); return cdvd.Error; break; case 0x07: // BREAK - CDR_LOG("cdvdRead07(Break) %x", 0); + CDVD_LOG("cdvdRead07(Break) %x", 0); return 0; break; case 0x08: // STATUS - CDR_LOG("cdvdRead08(Status) %x", cdvd.Status); + CDVD_LOG("cdvdRead08(Status) %x", cdvd.Status); return cdvd.Status; break; case 0x0A: // STATUS - CDR_LOG("cdvdRead0A(Status) %x", cdvd.Status); + CDVD_LOG("cdvdRead0A(Status) %x", cdvd.Status); return cdvd.Status; break; case 0x0B: // TRAY-STATE (if tray has been opened) { u8 tray = cdvdGetTrayStatus(); - CDR_LOG("cdvdRead0B(Tray) %x", tray); + CDVD_LOG("cdvdRead0B(Tray) %x", tray); return tray; break; } case 0x0C: // CRT MINUTE - CDR_LOG("cdvdRead0C(Min) %x", itob((u8)(cdvd.Sector/(60*75)))); + CDVD_LOG("cdvdRead0C(Min) %x", itob((u8)(cdvd.Sector/(60*75)))); return itob((u8)(cdvd.Sector/(60*75))); break; case 0x0D: // CRT SECOND - CDR_LOG("cdvdRead0D(Sec) %x", itob((u8)((cdvd.Sector/75)%60)+2)); + CDVD_LOG("cdvdRead0D(Sec) %x", itob((u8)((cdvd.Sector/75)%60)+2)); return itob((u8)((cdvd.Sector/75)%60)+2); break; case 0x0E: // CRT FRAME - CDR_LOG("cdvdRead0E(Frame) %x", itob((u8)(cdvd.Sector%75))); + CDVD_LOG("cdvdRead0E(Frame) %x", itob((u8)(cdvd.Sector%75))); return itob((u8)(cdvd.Sector%75)); break; case 0x0F: // TYPE - CDR_LOG("cdvdRead0F(Disc Type) %x", cdvd.Type); + CDVD_LOG("cdvdRead0F(Disc Type) %x", cdvd.Type); cdvdGetDiskType(); return cdvd.Type; break; case 0x13: // UNKNOWN - CDR_LOG("cdvdRead13(Unknown) %x", 4); + CDVD_LOG("cdvdRead13(Unknown) %x", 4); return 4; break; case 0x15: // RSV - CDR_LOG("cdvdRead15(RSV)"); + CDVD_LOG("cdvdRead15(RSV)"); return 0x01; // | 0x80 for ATAPI mode break; case 0x16: // SCOMMAND - CDR_LOG("cdvdRead16(SCMD) %x", cdvd.sCommand); + CDVD_LOG("cdvdRead16(SCMD) %x", cdvd.sCommand); return cdvd.sCommand; break; case 0x17: // SREADY - CDR_LOG("cdvdRead17(SReady) %x", cdvd.sDataIn); + CDVD_LOG("cdvdRead17(SReady) %x", cdvd.sDataIn); return cdvd.sDataIn; break; @@ -971,7 +971,7 @@ u8 cdvdRead(u8 key) { int temp = key - 0x20; - CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); + CDVD_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } @@ -983,7 +983,7 @@ u8 cdvdRead(u8 key) { int temp = key - 0x23; - CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); + CDVD_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } @@ -996,25 +996,25 @@ u8 cdvdRead(u8 key) { int temp = key - 0x26; - CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); + CDVD_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } case 0x38: // valid parts of key data (first and last are valid) - CDR_LOG("cdvdRead38(KeysValid) %x", cdvd.Key[15]); + CDVD_LOG("cdvdRead38(KeysValid) %x", cdvd.Key[15]); return cdvd.Key[15]; break; case 0x39: // KEY-XOR - CDR_LOG("cdvdRead39(KeyXor) %x", cdvd.KeyXor); + CDVD_LOG("cdvdRead39(KeyXor) %x", cdvd.KeyXor); return cdvd.KeyXor; break; case 0x3A: // DEC_SET - CDR_LOG("cdvdRead3A(DecSet) %x", cdvd.decSet); + CDVD_LOG("cdvdRead3A(DecSet) %x", cdvd.decSet); Console.WriteLn("DecSet Read: %02X", cdvd.decSet); return cdvd.decSet; @@ -1030,7 +1030,7 @@ u8 cdvdRead(u8 key) } static void cdvdWrite04(u8 rt) { // NCOMMAND - CDR_LOG("cdvdWrite04: NCMD %s (%x) (ParamP = %x)", nCmdName[rt], rt, cdvd.ParamP); + CDVD_LOG("cdvdWrite04: NCMD %s (%x) (ParamP = %x)", nCmdName[rt], rt, cdvd.ParamP); cdvd.nCommand = rt; cdvd.Status = CDVD_STATUS_NONE; @@ -1084,7 +1084,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND default: cdvd.ReadMode = CDVD_MODE_2048; cdvd.BlockSize = 2048; break; } - CDR_LOG( "CdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)", + CDVD_LOG( "CdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)", cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074)); if( EmuConfig.CdvdVerboseReads ) @@ -1132,7 +1132,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND case 0: cdvd.ReadMode = CDVD_MODE_2352; cdvd.BlockSize = 2352; break; } - CDR_LOG( "CdReadCDDA > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%xx(%x), ReadMode=%x(%x) (1074=%x)", + CDVD_LOG( "CdReadCDDA > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%xx(%x), ReadMode=%x(%x) (1074=%x)", cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074)); if( EmuConfig.CdvdVerboseReads ) @@ -1168,7 +1168,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND cdvd.ReadMode = CDVD_MODE_2048; cdvd.BlockSize = 2064; // Why oh why was it 2064 - CDR_LOG( "DvdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)", + CDVD_LOG( "DvdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)", cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074)); if( EmuConfig.CdvdVerboseReads ) @@ -1229,7 +1229,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND } static __forceinline void cdvdWrite05(u8 rt) { // NDATAIN - CDR_LOG("cdvdWrite05(NDataIn) %x", rt); + CDVD_LOG("cdvdWrite05(NDataIn) %x", rt); if (cdvd.ParamP < 32) { cdvd.Param[cdvd.ParamP++] = rt; @@ -1238,13 +1238,13 @@ static __forceinline void cdvdWrite05(u8 rt) { // NDATAIN } static __forceinline void cdvdWrite06(u8 rt) { // HOWTO - CDR_LOG("cdvdWrite06(HowTo) %x", rt); + CDVD_LOG("cdvdWrite06(HowTo) %x", rt); cdvd.HowTo = rt; } static __forceinline void cdvdWrite07(u8 rt) // BREAK { - CDR_LOG("cdvdWrite07(Break) %x", rt); + CDVD_LOG("cdvdWrite07(Break) %x", rt); // If we're already in a Ready state or already Breaking, then do nothing: if ((cdvd.Ready != CDVD_NOTREADY) || (cdvd.Action == cdvdAction_Break)) return; @@ -1267,16 +1267,16 @@ static __forceinline void cdvdWrite07(u8 rt) // BREAK } static __forceinline void cdvdWrite08(u8 rt) { // INTR_STAT - CDR_LOG("cdvdWrite08(IntrReason) = ACK(%x)", rt); + CDVD_LOG("cdvdWrite08(IntrReason) = ACK(%x)", rt); cdvd.PwOff &= ~rt; } static __forceinline void cdvdWrite0A(u8 rt) { // STATUS - CDR_LOG("cdvdWrite0A(Status) %x", rt); + CDVD_LOG("cdvdWrite0A(Status) %x", rt); } static __forceinline void cdvdWrite0F(u8 rt) { // TYPE - CDR_LOG("cdvdWrite0F(Type) %x", rt); + CDVD_LOG("cdvdWrite0F(Type) %x", rt); DevCon.WriteLn("*PCSX2*: CDVD TYPE %x", rt); } @@ -1308,7 +1308,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND int address; u8 tmp; - CDR_LOG("cdvdWrite16: SCMD %s (%x) (ParamP = %x)", sCmdName[rt], rt, cdvd.ParamP); + CDVD_LOG("cdvdWrite16: SCMD %s (%x) (ParamP = %x)", sCmdName[rt], rt, cdvd.ParamP); cdvd.sCommand = rt; switch (rt) { @@ -1897,7 +1897,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND } static __forceinline void cdvdWrite17(u8 rt) { // SDATAIN - CDR_LOG("cdvdWrite17(SDataIn) %x", rt); + CDVD_LOG("cdvdWrite17(SDataIn) %x", rt); if (cdvd.ParamP < 32) { cdvd.Param[cdvd.ParamP++] = rt; @@ -1906,12 +1906,12 @@ static __forceinline void cdvdWrite17(u8 rt) { // SDATAIN } static __forceinline void cdvdWrite18(u8 rt) { // SDATAOUT - CDR_LOG("cdvdWrite18(SDataOut) %x", rt); + CDVD_LOG("cdvdWrite18(SDataOut) %x", rt); Console.WriteLn("*PCSX2* SDATAOUT"); } static __forceinline void cdvdWrite3A(u8 rt) { // DEC-SET - CDR_LOG("cdvdWrite3A(DecSet) %x", rt); + CDVD_LOG("cdvdWrite3A(DecSet) %x", rt); cdvd.decSet = rt; Console.WriteLn("DecSet Write: %02X", cdvd.decSet); } diff --git a/pcsx2/CDVD/CdRom.cpp b/pcsx2/CDVD/CdRom.cpp index 5fffdb7e01..c760c437e7 100644 --- a/pcsx2/CDVD/CdRom.cpp +++ b/pcsx2/CDVD/CdRom.cpp @@ -121,7 +121,7 @@ static void ReadTrack() { cdr.Prev[1] = itob(cdr.SetSector[1]); cdr.Prev[2] = itob(cdr.SetSector[2]); - CDR_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]); + CDVD_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]); cdr.RErr = DoCDVDreadTrack(msf_to_lsn(cdr.SetSector), CDVD_MODE_2340); } @@ -475,7 +475,7 @@ void cdrInterrupt() { if (cdr.Stat != NoIntr && cdr.Reg2 != 0x18) psxHu32(0x1070)|= 0x4; - CDR_LOG("Cdr Interrupt %x\n", Irq); + CDVD_LOG("Cdr Interrupt %x\n", Irq); } void cdrReadInterrupt() { @@ -488,7 +488,7 @@ void cdrReadInterrupt() { return; } - CDR_LOG("KEY END"); + CDVD_LOG("KEY END"); cdr.OCUP = 1; SetResultSize(1); @@ -507,7 +507,7 @@ void cdrReadInterrupt() { if (cdr.RErr == -1) { - CDR_LOG(" err\n"); + CDVD_LOG(" err\n"); memzero(cdr.Transfer); cdr.Stat = DiskError; cdr.Result[0] |= 0x01; @@ -518,7 +518,7 @@ void cdrReadInterrupt() { cdr.Stat = DataReady; - CDR_LOG(" %x:%x:%x", cdr.Transfer[0], cdr.Transfer[1], cdr.Transfer[2]); + CDVD_LOG(" %x:%x:%x", cdr.Transfer[0], cdr.Transfer[1], cdr.Transfer[2]); cdr.SetSector[2]++; @@ -534,7 +534,7 @@ void cdrReadInterrupt() { cdr.Readed = 0; if ((cdr.Transfer[4+2] & 0x80) && (cdr.Mode & 0x2)) { // EOF - CDR_LOG("AutoPausing Read"); + CDVD_LOG("AutoPausing Read"); AddIrqQueue(CdlPause, 0x800); } else { @@ -572,7 +572,7 @@ u8 cdrRead0(void) { // what means the 0x10 and the 0x08 bits? i only saw it used by the bios cdr.Ctrl|=0x18; - CDR_LOG("CD0 Read: %x", cdr.Ctrl); + CDVD_LOG("CD0 Read: %x", cdr.Ctrl); return psxHu8(0x1800) = cdr.Ctrl; } @@ -582,7 +582,7 @@ cdrWrite0: */ void cdrWrite0(u8 rt) { - CDR_LOG("CD0 write: %x", rt); + CDVD_LOG("CD0 write: %x", rt); cdr.Ctrl = rt | (cdr.Ctrl & ~0x3); @@ -601,14 +601,14 @@ u8 cdrRead1(void) { else psxHu8(0x1801) = 0; - CDR_LOG("CD1 Read: %x", psxHu8(0x1801)); + CDVD_LOG("CD1 Read: %x", psxHu8(0x1801)); return psxHu8(0x1801); } void cdrWrite1(u8 rt) { int i; - CDR_LOG("CD1 write: %x (%s)", rt, CmdName[rt]); + CDVD_LOG("CD1 write: %x (%s)", rt, CmdName[rt]); cdr.Cmd = rt; cdr.OCUP = 0; @@ -733,7 +733,7 @@ void cdrWrite1(u8 rt) { break; case CdlSetmode: - CDR_LOG("Setmode %x", cdr.Param[0]); + CDVD_LOG("Setmode %x", cdr.Param[0]); cdr.Mode = cdr.Param[0]; cdr.Ctrl|= 0x80; @@ -812,7 +812,7 @@ void cdrWrite1(u8 rt) { break; default: - CDR_LOG("Unknown Cmd: %x\n", cdr.Cmd); + CDVD_LOG("Unknown Cmd: %x\n", cdr.Cmd); return; } if (cdr.Stat != NoIntr) @@ -828,12 +828,12 @@ u8 cdrRead2(void) { ret = *cdr.pTransfer++; } - CDR_LOG("CD2 Read: %x", ret); + CDVD_LOG("CD2 Read: %x", ret); return ret; } void cdrWrite2(u8 rt) { - CDR_LOG("CD2 write: %x", rt); + CDVD_LOG("CD2 write: %x", rt); if (cdr.Ctrl & 0x1) { switch (rt) { @@ -866,12 +866,12 @@ u8 cdrRead3(void) { psxHu8(0x1803) = 0xff; } else psxHu8(0x1803) = 0; - CDR_LOG("CD3 Read: %x", psxHu8(0x1803)); + CDVD_LOG("CD3 Read: %x", psxHu8(0x1803)); return psxHu8(0x1803); } void cdrWrite3(u8 rt) { - CDR_LOG("CD3 write: %x", rt); + CDVD_LOG("CD3 write: %x", rt); if (rt == 0x07 && cdr.Ctrl & 0x1) { cdr.Stat = 0; @@ -898,13 +898,13 @@ void cdrWrite3(u8 rt) { void psxDma3(u32 madr, u32 bcr, u32 chcr) { u32 cdsize; - CDR_LOG("*** DMA 3 *** %lx addr = %lx size = %lx", chcr, madr, bcr); + CDVD_LOG("*** DMA 3 *** %lx addr = %lx size = %lx", chcr, madr, bcr); switch (chcr) { case 0x11000000: case 0x11400100: if (cdr.Readed == 0) { - CDR_LOG("*** DMA 3 *** NOT READY"); + CDVD_LOG("*** DMA 3 *** NOT READY"); return; } @@ -919,7 +919,7 @@ void psxDma3(u32 madr, u32 bcr, u32 chcr) { return; default: - CDR_LOG("Unknown cddma %lx", chcr); + CDVD_LOG("Unknown cddma %lx", chcr); break; } HW_DMA3_CHCR &= ~0x01000000; @@ -933,7 +933,7 @@ s32 cdvdDmaRead(s32 channel, u32* data, u32 wordsLeft, u32* wordsProcessed) if (cdr.Readed == 0) { - //CDR_LOG("*** DMA 3 *** NOT READY"); + //CDVD_LOG("*** DMA 3 *** NOT READY"); wordsProcessed = 0; return 10000; } diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 1e11f3ba78..69e8461563 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -54,6 +54,207 @@ enum PluginsEnum_t #define DEFAULT_sseMXCSR 0xffc0 //FPU rounding > DaZ, FtZ, "chop" #define DEFAULT_sseVUMXCSR 0xffc0 //VU rounding > DaZ, FtZ, "chop" +// -------------------------------------------------------------------------------------- +// TraceFiltersEE +// -------------------------------------------------------------------------------------- +struct TraceFiltersEE +{ + BITFIELD32() + bool + m_EnableAll :1, // Master Enable switch (if false, no logs at all) + + m_Bios :1, // SYSCALL, RPCs, etc. + m_Memory :1, // memory accesses (*all* loads and stores) + m_Cache :1, // Data Cache (Unimplemented) + m_SysCtrl :1, // TLB logs, PERF logs, Debug register logs + + m_VIFunpack :1, + m_GIFtag :1, + + m_EnableDisasm :1, + m_R5900 :1, // instructions, branches, and exception vectors (includes COP0) + m_COP0 :1, // System Control instructions + m_COP1 :1, // EE FPU instructions + m_COP2 :1, // VU0 macro mode instructions and pipeline states + m_VU0micro :1, + m_VU1micro :1, + + m_EnableHardware:1, + m_KnownHw :1, // Known and handled HW Registers + m_UnknownHw :1, // Unknown/Unhandled Hardware Registers + m_DMA :1, // DMA Log filter, to allow for filtering HW separate of the verbose Known Registers. + + m_EnableEvents :1, // Enables logging of event-driven activity -- counters, DMAs, etc. + m_Counters :1, // EE's counters! + m_VIF :1, + m_GIF :1, + m_IPU :1, + m_SPR :1; // Scratchpad Ram DMA + BITFIELD_END + + bool Enabled() const { return m_EnableAll; } + bool DisasmEnabled() const { return m_EnableAll && m_EnableDisasm; } + bool HwEnabled() const { return m_EnableAll && m_EnableHardware; } + bool EventsEnabled() const { return m_EnableAll && m_EnableEvents; } + + bool Bios() const { return m_EnableAll && m_Bios; } + bool Memory() const { return m_EnableAll && m_Memory; } + bool Cache() const { return m_EnableAll && m_Cache; } + bool SysCtrl() const { return m_EnableAll && m_SysCtrl; } + + bool GIFtag() const { return m_EnableAll && m_GIFtag; } + bool VIFunpack() const { return m_EnableAll && m_VIFunpack; } + + bool Counters() const { return EventsEnabled() && m_Counters; } + bool VIF() const { return EventsEnabled() && m_VIF; } + bool GIF() const { return EventsEnabled() && m_GIF; } + bool IPU() const { return EventsEnabled() && m_IPU; } + bool SPR() const { return EventsEnabled() && m_SPR; } + + bool R5900() const { return DisasmEnabled() && m_R5900; } + bool COP0() const { return DisasmEnabled() && m_COP0; } + bool COP1() const { return DisasmEnabled() && m_COP1; } + bool COP2() const { return DisasmEnabled() && m_COP2; } + bool VU0micro() const { return DisasmEnabled() && m_VU0micro; } + bool VU1micro() const { return DisasmEnabled() && m_VU1micro; } + + bool KnownHw() const { return HwEnabled() && m_KnownHw; } + bool UnknownHw() const { return HwEnabled() && m_UnknownHw; } + bool DMA() const { return HwEnabled() && m_DMA; } + + TraceFiltersEE() + { + bitset = 0; + } + + void LoadSave( IniInterface& conf ); + + bool operator ==( const TraceFiltersEE& right ) const + { + return OpEqu( bitset ); + } + + bool operator !=( const TraceFiltersEE& right ) const + { + return !this->operator ==( right ); + } +}; + +// -------------------------------------------------------------------------------------- +// TraceFiltersIOP +// -------------------------------------------------------------------------------------- +struct TraceFiltersIOP +{ + BITFIELD32() + bool + m_EnableAll :1, // Master Enable switch (if false, no logs at all) + m_Bios :1, // SYSCALL, RPCs, etc. + m_Memory :1, // memory accesses (*all* loads and stores) + + m_EnableDisasm :1, + m_R3000A :1, // instructions. branches, and exception vectors + m_COP2 :1, // PS1 Triangle helper (disabled in PS2 mode) + + m_EnableHardware:1, + m_KnownHw :1, // Known and handled HW Registers + m_UnknownHw :1, // Unknown/Unhandled Hardware Registers + m_DMA :1, // DMA Log filter, to allow for filtering HW separate of the verbose Known Registers. + + m_EnableEvents :1, // Enables logging of event-driven activity -- counters, DMAs, etc. + m_Counters :1, // IOP's counters! + m_Memcards :1, + m_PAD :1, + m_SPU2 :1, + m_USB :1, + m_FW :1, + m_CDVD :1, // CDROM or CDVD activity (depends on game media type) + + m_GPU :1; // PS1's GPU (currently unimplemented and uncategorized) + BITFIELD_END + + bool Enabled() const { return m_EnableAll; } + bool DisasmEnabled() const { return m_EnableAll && m_EnableDisasm; } + bool HwEnabled() const { return m_EnableAll && m_EnableHardware; } + bool EventsEnabled() const { return m_EnableAll && m_EnableEvents; } + + bool Bios() const { return m_EnableAll && m_Bios; } + bool Memory() const { return m_EnableAll && m_Memory; } + + bool Counters() const { return EventsEnabled() && m_Counters; } + bool Memcards() const { return EventsEnabled() && m_Memcards; } + bool PAD() const { return EventsEnabled() && m_PAD; } + bool SPU2() const { return EventsEnabled() && m_SPU2; } + bool USB() const { return EventsEnabled() && m_USB; } + bool FW() const { return EventsEnabled() && m_FW; } + bool CDVD() const { return EventsEnabled() && m_CDVD; } + + bool R3000A() const { return DisasmEnabled() && m_R3000A; } + bool COP2() const { return DisasmEnabled() && m_COP2; } + + bool KnownHw() const { return HwEnabled() && m_KnownHw; } + bool UnknownHw() const { return HwEnabled() && m_UnknownHw; } + bool DMA() const { return HwEnabled() && m_DMA; } + + TraceFiltersIOP() + { + bitset = 0; + } + + void LoadSave( IniInterface& conf ); + + bool operator ==( const TraceFiltersIOP& right ) const + { + return OpEqu( bitset ); + } + + bool operator !=( const TraceFiltersIOP& right ) const + { + return !this->operator ==( right ); + } +}; + +// -------------------------------------------------------------------------------------- +// TraceLogFilters +// -------------------------------------------------------------------------------------- +struct TraceLogFilters +{ + // Enabled - global toggle for high volume logging. This is effectively the equivalent to + // (EE.Enabled() || IOP.Enabled() || SIF) -- it's cached so that we can use the macros + // below to inline the conditional check. This is desirable because these logs are + // *very* high volume, and debug builds get noticably slower if they have to invoke + // methods/accessors to test the log enable bits. Debug builds are slow enough already, + // so I prefer this to help keep them usable. + bool Enabled; + + bool SIF; // SIF DMA Activity (both EE and IOP sides) + + TraceFiltersEE EE; + TraceFiltersIOP IOP; + + TraceLogFilters() + { + Enabled = false; + SIF = false; + } + + void LoadSave( IniInterface& conf ); + + bool operator ==( const TraceLogFilters& right ) const + { + return OpEqu( Enabled ) && OpEqu( SIF ) && OpEqu( EE ) && OpEqu( IOP ); + } + + bool operator !=( const TraceLogFilters& right ) const + { + return !this->operator ==( right ); + } +}; + +struct ConsoleLogFilters +{ + bool ELF; +}; + // -------------------------------------------------------------------------------------- // Pcsx2Config class // -------------------------------------------------------------------------------------- @@ -67,9 +268,8 @@ enum PluginsEnum_t // use the provided functions to lock the emulation into a safe state and then apply // chances on the necessary scope (see Core_Pause, Core_ApplySettings, and Core_Resume). // -class Pcsx2Config +struct Pcsx2Config { -public: struct ProfilerOptions { BITFIELD32() @@ -208,14 +408,14 @@ public: { BITFIELD32() bool - VuAddSubHack:1, // Fix for Tri-ace games, they use an encryption algorithm that requires VU ADDI opcode to be bit-accurate. - VuClipFlagHack:1, // Fix for Persona games, maybe others. It's to do with the VU clip flag (again). - FpuCompareHack:1, // Fix for Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu. - FpuMulHack:1, // Fix for Tales of Destiny hangs. - FpuNegDivHack:1, // Fix for Gundam games messed up camera-view. - DMAExeHack:1, // Fix for Fatal Frame; breaks Gust and Tri-Ace games. - XgKickHack:1, // Fix for Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others. - MpegHack:1; // Fix for Mana Khemia 1, breaks Digital Devil Saga. + VuAddSubHack :1, // Tri-ace games, they use an encryption algorithm that requires VU ADDI opcode to be bit-accurate. + VuClipFlagHack :1, // Persona games, maybe others. It's to do with the VU clip flag (again). + FpuCompareHack :1, // Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu. + FpuMulHack :1, // Tales of Destiny hangs. + FpuNegDivHack :1, // Gundam games messed up camera-view. + DMAExeHack :1, // Fatal Frame; breaks Gust and Tri-Ace games. + XgKickHack :1, // Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics, but breaks Tri-ace games and others. + MpegHack :1; // Mana Khemia 1, breaks Digital Devil Saga. BITFIELD_END // all gamefixes are disabled by default. @@ -238,11 +438,11 @@ public: { BITFIELD32() bool - IopCycleRate_X2:1, // enables the x2 multiplier of the IOP cyclerate - IntcStat:1, // tells Pcsx2 to fast-forward through intc_stat waits. - BIFC0:1, // enables BIFC0 detection and fast-forwarding - vuFlagHack:1, // microVU specific flag hack; Can cause Infinite loops, SPS, etc... - vuMinMax:1; // microVU specific MinMax hack; Can cause SPS, Black Screens, etc... + IopCycleRate_X2 :1, // enables the x2 multiplier of the IOP cyclerate + IntcStat :1, // tells Pcsx2 to fast-forward through intc_stat waits. + BIFC0 :1, // enables BIFC0 detection and fast-forwarding + vuFlagHack :1, // microVU specific flag hack; Can cause Infinite loops, SPS, etc... + vuMinMax :1; // microVU specific MinMax hack; Can cause SPS, Black Screens, etc... BITFIELD_END u8 EECycleRate; // EE cycle rate selector (1.0, 1.5, 2.0) @@ -261,9 +461,7 @@ public: return !this->operator ==( right ); } }; - -public: - + BITFIELD32() bool CdvdVerboseReads:1, // enables cdvd read activity verbosely dumped to the console @@ -286,6 +484,9 @@ public: GamefixOptions Gamefixes; ProfilerOptions Profiler; + ConsoleLogFilters Log; + TraceLogFilters Trace; + wxFileName BiosFilename; Pcsx2Config(); diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index 8521564697..f3b725388e 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -66,50 +66,9 @@ namespace R3000A } #ifdef PCSX2_DEVBUILD -extern bool enableLogging; -struct LogSources -{ - bool - R5900:1, // instructions and exception vectors for the R5900 (EE) - R3000A:1, // instructions and exception vectors for the R3000a (IOP) - - Memory:1, // memory accesses (loads and stores) - Hardware:1, - DMA:1, - Bios:1, - ELF:1, - IsoFS:1, // Iso Filesystem support - VU0:1, - COP0:1, // TLB logs, PERF logs, Debug register logs - VIF:1, - VIFUnpack:1, - SPR:1, // Scratchpad - GIF:1, - SIF:1, - IPU:1, - VUMacro:1, // VU macro mode logs (pipelines) - RPC:1, - Counters:1, // EE's counters! - - IopMemory:1, - IopHardware:1, - IopBios:1, - IopDMA:1, - IopCnt:1, - Memcards:1, - Pad:1, - CDR:1, - CDVD:1, - GPU:1, // PS1's GPU (currently unimplemented) - Cache:1, // Unimplemented. - LogToConsole:1; -}; - -extern LogSources varLog; - -void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...); -void __Log( const char* fmt, ... ); +extern void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...); +extern void __Log( const char* fmt, ... ); extern bool SrcLog_CPU( const char* fmt, ... ); extern bool SrcLog_COP0( const char* fmt, ... ); @@ -118,7 +77,6 @@ extern bool SrcLog_MEM( const char* fmt, ... ); extern bool SrcLog_HW( const char* fmt, ... ); extern bool SrcLog_DMA( const char* fmt, ... ); extern bool SrcLog_BIOS( const char* fmt, ... ); -extern bool SrcLog_ELF( const char* fmt, ... ); extern bool SrcLog_VU0( const char* fmt, ... ); extern bool SrcLog_VIF( const char* fmt, ... ); @@ -146,39 +104,44 @@ extern bool SrcLog_CDVD( const char* fmt, ... ); extern bool SrcLog_GPU( const char* fmt, ... ); extern bool SrcLog_CACHE( const char* fmt, ... ); -#define CPU_LOG (varLog.R5900) && SrcLog_CPU -#define MEM_LOG (varLog.Memory) && SrcLog_MEM -#define HW_LOG (varLog.Hardware) && SrcLog_HW -#define DMA_LOG (varLog.DMA) && SrcLog_DMA -#define BIOS_LOG (varLog.Bios) && SrcLog_BIOS -#define ELF_LOG (varLog.ELF) && SrcLog_ELF -#define VU0_LOG (varLog.VU0) && SrcLog_VU0 -#define COP0_LOG (varLog.COP0) && SrcLog_COP0 -#define VIF_LOG (varLog.VIF) && SrcLog_VIF -#define VIFUNPACK_LOG (varLog.VIFUnpack) && SrcLog_VIFUNPACK -#define SPR_LOG (varLog.SPR) && SrcLog_SPR -#define GIF_LOG (varLog.GIF) && SrcLog_GIF -#define SIF_LOG (varLog.SIF) && SrcLog_SIF -#define IPU_LOG (varLog.IPU) && SrcLog_IPU -#define VUM_LOG (varLog.VUMacro) && SrcLog_VUM -#define RPC_LOG (varLog.RPC) && SrcLog_RPC -#define EECNT_LOG (varLog.Counters) && SrcLog_EECNT -#define ISOFS_LOG (varLog.IsoFS) && SrcLog_ISOFS +// Helper macro for cut&paste. Note that we intentionally use a top-level *inline* bitcheck +// against Trace.Enabled, to avoid extra overhead in Debug builds when logging is disabled. +#define macTrace EmuConfig.Trace.Enabled && EmuConfig.Trace -#define PSXCPU_LOG (varLog.R3000A) && SrcLog_PSXCPU -#define PSXMEM_LOG (varLog.IopMemory) && SrcLog_PSXMEM -#define PSXHW_LOG (varLog.IopHardware) && SrcLog_PSXHW -#define PSXBIOS_LOG (varLog.IopBios) && SrcLog_PSXBIOS -#define PSXDMA_LOG (varLog.IopDMA) && SrcLog_PSXDMA -#define PSXCNT_LOG (varLog.IopCnt) && SrcLog_PSXCNT +#define CPU_LOG (macTrace.EE.R5900()) && SrcLog_CPU +#define MEM_LOG (macTrace.EE.Memory()) && SrcLog_MEM +#define CACHE_LOG (macTrace.EE.Cache) && SrcLog_CACHE +#define HW_LOG (macTrace.EE.KnownHw()) && SrcLog_HW +#define UnknownHW_LOG (macTrace.EE.KnownHw()) && SrcLog_HW +#define DMA_LOG (macTrace.EE.DMA()) && SrcLog_DMA -#define MEMCARDS_LOG (varLog.Memcards) && SrcLog_MEMCARDS -#define PAD_LOG (varLog.Pad) && SrcLog_PAD -#define CDR_LOG (varLog.CDR) && SrcLog_CDR -#define GPU_LOG (varLog.GPU) && SrcLog_GPU -#define CDVD_LOG (varLog.CDVD) && SrcLog_CDVD +#define BIOS_LOG (macTrace.EE.Bios()) && SrcLog_BIOS +#define VU0_LOG (macTrace.EE.VU0()) && SrcLog_VU0 +#define SysCtrl_LOG (macTrace.EE.SysCtrl()) && SrcLog_COP0 +#define COP0_LOG (macTrace.EE.COP0()) && SrcLog_COP0 +#define VIF_LOG (macTrace.EE.VIF()) && SrcLog_VIF +#define SPR_LOG (macTrace.EE.SPR()) && SrcLog_SPR +#define GIF_LOG (macTrace.EE.GIF()) && SrcLog_GIF +#define SIF_LOG (macTrace.SIF) && SrcLog_SIF +#define IPU_LOG (macTrace.EE.IPU()) && SrcLog_IPU +#define VUM_LOG (macTrace.EE.COP2()) && SrcLog_VUM -#define CACHE_LOG (varLog.Cache) && SrcLog_CACHE +#define EECNT_LOG (macTrace.EE.Counters()) && SrcLog_EECNT +#define VIFUNPACK_LOG (macTrace.EE.VIFunpack()) && SrcLog_VIFUNPACK + + +#define PSXCPU_LOG (macTrace.IOP.R3000A()) && SrcLog_PSXCPU +#define PSXMEM_LOG (macTrace.IOP.Memory()) && SrcLog_PSXMEM +#define PSXHW_LOG (macTrace.IOP.KnownHw()) && SrcLog_PSXHW +#define PSXUnkHW_LOG (macTrace.IOP.UnknownHw()) && SrcLog_PSXHW +#define PSXBIOS_LOG (macTrace.IOP.Bios()) && SrcLog_PSXBIOS +#define PSXDMA_LOG (macTrace.IOP.DMA()) && SrcLog_PSXDMA +#define PSXCNT_LOG (macTrace.IOP.Counters()) && SrcLog_PSXCNT + +#define MEMCARDS_LOG (macTrace.IOP.Memcards()) && SrcLog_MEMCARDS +#define PAD_LOG (macTrace.IOP.PAD()) && SrcLog_PAD +#define GPU_LOG (macTrace.IOP.GPU()) && SrcLog_GPU +#define CDVD_LOG (macTrace.IOP.CDVD()) && SrcLog_CDVD #else // PCSX2_DEVBUILD @@ -189,11 +152,10 @@ extern bool SrcLog_CACHE( const char* fmt, ... ); #define HW_LOG 0&& #define DMA_LOG 0&& #define BIOS_LOG 0&& -#define ELF_LOG 0&& #define FPU_LOG 0&& #define MMI_LOG 0&& #define VU0_LOG 0&& -#define COP0_LOG 0&& +#define SysCtrl_LOG 0&& #define VIF_LOG 0&& #define VIFUNPACK_LOG 0&& #define SPR_LOG 0&& @@ -220,3 +182,5 @@ extern bool SrcLog_CACHE( const char* fmt, ... ); #define CACHE_LOG 0&& #define MEMCARDS_LOG 0&& #endif + +#define ELF_LOG (EmuConfig.Log.ELF) && DevCon.WriteLn diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 00f56d69f9..1b27136390 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -250,14 +250,14 @@ struct ElfObject // Destructor! // C++ does all the cleanup automagically for us. - virtual ~ElfObject() { } + virtual ~ElfObject() throw() { } - ElfObject( const wxString& srcfile, uint hdrsize ) : - filename( srcfile ) - , data( hdrsize, L"ELF headers" ) - , header( *(ELF_HEADER*)data.GetPtr() ) - , proghead( NULL ) - , secthead( NULL ) + ElfObject( const wxString& srcfile, uint hdrsize ) + : filename( srcfile ) + , data( hdrsize, L"ELF headers" ) + , header( *(ELF_HEADER*)data.GetPtr() ) + , proghead( NULL ) + , secthead( NULL ) { readFile(); @@ -268,45 +268,43 @@ struct ElfObject secthead = (ELF_SHR*)&data[header.e_shoff]; if ( ( header.e_shnum > 0 ) && ( header.e_shentsize != sizeof(ELF_SHR) ) ) - Console.Error( "ElfLoader Warning > Size of section headers is not standard" ); + Console.Error( "(ELF) Size of section headers is not standard" ); if ( ( header.e_phnum > 0 ) && ( header.e_phentsize != sizeof(ELF_PHR) ) ) - Console.Error( "ElfLoader Warning > Size of program headers is not standard" ); + Console.Error( "(ELF) Size of program headers is not standard" ); - ELF_LOG( "type: " ); + const char* elftype = NULL; switch( header.e_type ) { default: - ELF_LOG( "unknown %x", header.e_type ); - break; + ELF_LOG( "type: unknown = %x", header.e_type ); + break; - case 0x0: - ELF_LOG( "no file type" ); - break; - - case 0x1: - ELF_LOG( "relocatable" ); - break; - - case 0x2: - ELF_LOG( "executable" ); - break; + case 0x0: elftype = "no file type"; break; + case 0x1: elftype = "relocatable"; break; + case 0x2: elftype = "executable"; break; } - ELF_LOG( "\n" ); - ELF_LOG( "machine: " ); + if( elftype != NULL ) ELF_LOG( "type: %s", elftype ); + const char* machine = NULL; switch ( header.e_machine ) { + case 1: machine = "AT&T WE 32100"; break; + case 2: machine = "SPARC"; break; + case 3: machine = "Intel 80386"; break; + case 4: machine = "Motorola 68000"; break; + case 5: machine = "Motorola 88000"; break; + case 7: machine = "Intel 80860"; break; + case 8: machine = "mips_rs3000"; break; + default: - ELF_LOG( "unknown" ); - break; - - case 0x8: - ELF_LOG( "mips_rs3000" ); - break; + ELF_LOG( "machine: unknown = %x", header.e_machine ); + break; } - ELF_LOG("\n"); + if( machine != NULL ) + ELF_LOG( "machine: %s", machine ); + ELF_LOG("version: %d",header.e_version); ELF_LOG("entry: %08x",header.e_entry); ELF_LOG("flags: %08x",header.e_flags); @@ -407,8 +405,8 @@ struct ElfObject } ELF_LOG("\n"); - ELF_LOG("offset: %08x",(int)proghead[i].p_offset); - ELF_LOG("vaddr: %08x",(int)proghead[i].p_vaddr); + ELF_LOG("offset: %08x",proghead[i].p_offset); + ELF_LOG("vaddr: %08x",proghead[i].p_vaddr); ELF_LOG("paddr: %08x",proghead[i].p_paddr); ELF_LOG("file size: %08x",proghead[i].p_filesz); ELF_LOG("mem size: %08x",proghead[i].p_memsz); @@ -430,29 +428,31 @@ struct ElfObject for( int i = 0 ; i < header.e_shnum ; i++ ) { - ELF_LOG( "Elf32 Section Header [%x] %s", i, §ions_names[ secthead[ i ].sh_name ] ); + ELF_LOG( "ELF32 Section Header [%x] %s", i, §ions_names[ secthead[ i ].sh_name ] ); // used by parseCommandLine //if ( secthead[i].sh_flags & 0x2 ) // args_ptr = min( args_ptr, secthead[ i ].sh_addr & 0x1ffffff ); -#ifdef PCSX2_DEVBULD ELF_LOG("\n"); - ELF_LOG("type: "); + const char* sectype = NULL; switch ( secthead[ i ].sh_type ) { - case 0x0: ELF_LOG("null"); break; - case 0x1: ELF_LOG("progbits"); break; - case 0x2: ELF_LOG("symtab"); break; - case 0x3: ELF_LOG("strtab"); break; - case 0x4: ELF_LOG("rela"); break; - case 0x8: ELF_LOG("no bits"); break; - case 0x9: ELF_LOG("rel"); break; - default: ELF_LOG("unknown %08x",secthead[i].sh_type); break; + case 0x0: sectype = "null"; break; + case 0x1: sectype = "progbits"; break; + case 0x2: sectype = "symtab"; break; + case 0x3: sectype = "strtab"; break; + case 0x4: sectype = "rela"; break; + case 0x8: sectype = "no bits"; break; + case 0x9: sectype = "rel"; break; + + default: + ELF_LOG("type: unknown %08x",secthead[i].sh_type); + break; } - ELF_LOG("\n"); + ELF_LOG("type: %s", sectype); ELF_LOG("flags: %08x", secthead[i].sh_flags); ELF_LOG("addr: %08x", secthead[i].sh_addr); ELF_LOG("offset: %08x", secthead[i].sh_offset); @@ -468,7 +468,6 @@ struct ElfObject i_st = i; i_dt = secthead[i].sh_link; } -#endif } if( ( i_st >= 0 ) && ( i_dt >= 0 ) ) diff --git a/pcsx2/HwRead.cpp b/pcsx2/HwRead.cpp index 9560523fd6..ec509f737d 100644 --- a/pcsx2/HwRead.cpp +++ b/pcsx2/HwRead.cpp @@ -108,7 +108,7 @@ __forceinline mem8_t hwRead8(u32 mem) } ret = psHu8(mem); - HW_LOG("Unknown Hardware Read 8 from 0x%x = 0x%x", mem, ret); + UnknownHW_LOG("Hardware Read 8 from 0x%x = 0x%x", mem, ret); break; } @@ -168,7 +168,7 @@ __forceinline mem16_t hwRead16(u32 mem) return (u16)ret; } ret = psHu16(mem); - HW_LOG("Hardware Read16 at 0x%x, value= 0x%x", ret, mem); + UnknownHW_LOG("Hardware Read16 at 0x%x, value= 0x%x", ret, mem); break; } return ret; @@ -375,13 +375,13 @@ void __fastcall hwRead64_generic_INTC_HACK(u32 mem, mem64_t* result ) if (mem == INTC_STAT) IntCHackCheck(); *result = psHu64(mem); - HW_LOG("Unknown Hardware Read 64 at %x",mem); + UnknownHW_LOG("Hardware Read 64 at %x",mem); } void __fastcall hwRead64_generic(u32 mem, mem64_t* result ) { *result = psHu64(mem); - HW_LOG("Unknown Hardware Read 64 at %x",mem); + UnknownHW_LOG("Hardware Read 64 at %x",mem); } ///////////////////////////////////////////////////////////////////////// @@ -402,7 +402,7 @@ void __fastcall hwRead128_page_01(u32 mem, mem128_t* result ) void __fastcall hwRead128_page_02(u32 mem, mem128_t* result ) { // IPU is currently unhandled in 128 bit mode. - HW_LOG("Unknown Hardware Read 128 at %x (IPU)",mem); + HW_LOG("Hardware Read 128 at %x (IPU)",mem); } void __fastcall hwRead128_generic(u32 mem, mem128_t* out) @@ -410,5 +410,5 @@ void __fastcall hwRead128_generic(u32 mem, mem128_t* out) out[0] = psHu64(mem); out[1] = psHu64(mem+8); - HW_LOG("Unknown Hardware Read 128 at %x",mem); + UnknownHW_LOG("Hardware Read 128 at %x",mem); } diff --git a/pcsx2/HwWrite.cpp b/pcsx2/HwWrite.cpp index d6dfa2fdae..d19913c555 100644 --- a/pcsx2/HwWrite.cpp +++ b/pcsx2/HwWrite.cpp @@ -659,7 +659,7 @@ __forceinline void hwWrite16(u32 mem, u16 value) default: psHu16(mem) = value; - HW_LOG("Unknown Hardware write 16 at %x with value %x",mem,value); + UnknownHW_LOG("Unknown Hardware write 16 at %x with value %x",mem,value); } } @@ -913,7 +913,7 @@ void __fastcall hwWrite32_page_0F( u32 mem, u32 value ) //------------------------------------------------------------------ case HELPSWITCH(SIO_ISR): case HELPSWITCH(0x1000f410): - HW_LOG("Unknown Hardware write 32 at %x with value %x (%x)", mem, value, cpuRegs.CP0.n.Status.val); + UnknownHW_LOG("Unknown Hardware write 32 at %x with value %x (%x)", mem, value, cpuRegs.CP0.n.Status.val); break; default: @@ -1190,7 +1190,7 @@ void __fastcall hwWrite64_generic( u32 mem, const mem64_t* srcval ) default: psHu64(mem) = value; - HW_LOG("Unknown Hardware write 64 at %x with value %x (status=%x)",mem,value, cpuRegs.CP0.n.Status.val); + UnknownHW_LOG("Unknown Hardware write 64 at %x with value %x (status=%x)",mem,value, cpuRegs.CP0.n.Status.val); break; } } @@ -1230,7 +1230,7 @@ void __fastcall hwWrite128_generic(u32 mem, const mem128_t *srcval) psHu64(mem ) = srcval[0]; psHu64(mem+8) = srcval[1]; - HW_LOG("Unknown Hardware write 128 at %x with value %x_%x (status=%x)", mem, srcval[1], srcval[0], cpuRegs.CP0.n.Status.val); + UnknownHW_LOG("Unknown Hardware write 128 at %x with value %x_%x (status=%x)", mem, srcval[1], srcval[0], cpuRegs.CP0.n.Status.val); break; } } diff --git a/pcsx2/IopHw.cpp b/pcsx2/IopHw.cpp index bfcf3e827f..9ce00fad21 100644 --- a/pcsx2/IopHw.cpp +++ b/pcsx2/IopHw.cpp @@ -36,1281 +36,6 @@ void psxHwReset() { //sio2Reset(); } -u8 psxHwRead8(u32 add) { - u8 hard; - - if (add >= HW_USB_START && add < HW_USB_END) { - return USBread8(add); - } - - switch (add) { - case 0x1f801040: hard = sioRead8();break; - // case 0x1f801050: hard = serial_read8(); break;//for use of serial port ignore for now - - case 0x1f80146e: // DEV9_R_REV - return DEV9read8(add); - -#ifdef PCSX2_DEVBUILD - case IOP_T0_COUNT: - case IOP_T0_MODE: - case IOP_T0_TARGET: - case IOP_T1_COUNT: - case IOP_T1_MODE: - case IOP_T1_TARGET: - case IOP_T2_COUNT: - case IOP_T2_MODE: - case IOP_T2_TARGET: - case IOP_T3_COUNT: - case IOP_T3_MODE: - case IOP_T3_TARGET: - case IOP_T4_COUNT: - case IOP_T4_MODE: - case IOP_T4_TARGET: - case IOP_T5_COUNT: - case IOP_T5_MODE: - case IOP_T5_TARGET: - DevCon.Warning( "IOP Counter Read8 from addr0x%x = 0x%x", add, psxHu8(add) ); - return psxHu8(add); -#endif - - case 0x1f801800: hard = cdrRead0(); break; - case 0x1f801801: hard = cdrRead1(); break; - case 0x1f801802: hard = cdrRead2(); break; - case 0x1f801803: hard = cdrRead3(); break; - - case 0x1f803100: // PS/EE/IOP conf related - hard = 0x10; // Dram 2M - break; - - case 0x1F808264: - hard = sio2_fifoOut();//sio2 serial data feed/fifo_out - PSXHW_LOG("SIO2 read8 DATAOUT %08X", hard); - return hard; - - default: - hard = psxHu8(add); - PSXHW_LOG("*Unknown 8bit read at address %lx", add); - return hard; - } - - PSXHW_LOG("*Known 8bit read at address %lx value %x", add, hard); - return hard; -} - -u16 psxHwRead16(u32 add) { - u16 hard; - - if (add >= HW_USB_START && add < HW_USB_END) { - return USBread16(add); - } - - switch (add) { - - case 0x1f801070: PSXHW_LOG("IREG 16bit read %x", psxHu16(0x1070)); - return psxHu16(0x1070); - case 0x1f801074: PSXHW_LOG("IMASK 16bit read %x", psxHu16(0x1074)); - return psxHu16(0x1074); - - case 0x1f801040: - hard = sioRead8(); - hard|= sioRead8() << 8; - PAD_LOG("sio read16 %lx; ret = %x", add&0xf, hard); - return hard; - case 0x1f801044: - hard = sio.StatReg; - PAD_LOG("sio read16 %lx; ret = %x", add&0xf, hard); - return hard; - case 0x1f801048: - hard = sio.ModeReg; - PAD_LOG("sio read16 %lx; ret = %x", add&0xf, hard); - return hard; - case 0x1f80104a: - hard = sio.CtrlReg; - PAD_LOG("sio read16 %lx; ret = %x", add&0xf, hard); - return hard; - case 0x1f80104e: - hard = sio.BaudReg; - PAD_LOG("sio read16 %lx; ret = %x", add&0xf, hard); - return hard; - - //Serial port stuff not support now ;P -// case 0x1f801050: hard = serial_read16(); break; -// case 0x1f801054: hard = serial_status_read(); break; -// case 0x1f80105a: hard = serial_control_read(); break; -// case 0x1f80105e: hard = serial_baud_read(); break; - - case IOP_T0_COUNT: - hard = (u16)psxRcntRcount16(0); - PSXCNT_LOG("T0 count read16: %x", hard); - return hard; - case IOP_T0_MODE: - hard = psxCounters[0].mode; - psxCounters[0].mode &= ~0x1800; - psxCounters[0].mode |= 0x400; - PSXCNT_LOG("T0 mode read16: %x", hard); - return hard; - case IOP_T0_TARGET: - hard = psxCounters[0].target; - PSXCNT_LOG("T0 target read16: %x", hard); - return hard; - case IOP_T1_COUNT: - hard = (u16)psxRcntRcount16(1); - PSXCNT_LOG("T1 count read16: %x", hard); - return hard; - case IOP_T1_MODE: - hard = psxCounters[1].mode; - psxCounters[1].mode &= ~0x1800; - psxCounters[1].mode |= 0x400; - PSXCNT_LOG("T1 mode read16: %x", hard); - return hard; - case IOP_T1_TARGET: - hard = psxCounters[1].target; - PSXCNT_LOG("T1 target read16: %x", hard); - return hard; - case IOP_T2_COUNT: - hard = (u16)psxRcntRcount16(2); - PSXCNT_LOG("T2 count read16: %x", hard); - return hard; - case IOP_T2_MODE: - hard = psxCounters[2].mode; - psxCounters[2].mode &= ~0x1800; - psxCounters[2].mode |= 0x400; - PSXCNT_LOG("T2 mode read16: %x", hard); - return hard; - case IOP_T2_TARGET: - hard = psxCounters[2].target; - PSXCNT_LOG("T2 target read16: %x", hard); - return hard; - - case 0x1f80146e: // DEV9_R_REV - return DEV9read16(add); - - case IOP_T3_COUNT: - hard = (u16)psxRcntRcount32(3); - PSXCNT_LOG("T3 count read16: %lx", hard); - return hard; - case IOP_T3_MODE: - hard = psxCounters[3].mode; - psxCounters[3].mode &= ~0x1800; - psxCounters[3].mode |= 0x400; - PSXCNT_LOG("T3 mode read16: %lx", hard); - return hard; - case IOP_T3_TARGET: - hard = psxCounters[3].target; - PSXCNT_LOG("T3 target read16: %lx", hard); - return hard; - case IOP_T4_COUNT: - hard = (u16)psxRcntRcount32(4); - PSXCNT_LOG("T4 count read16: %lx", hard); - return hard; - case IOP_T4_MODE: - hard = psxCounters[4].mode; - psxCounters[4].mode &= ~0x1800; - psxCounters[4].mode |= 0x400; - PSXCNT_LOG("T4 mode read16: %lx", hard); - return hard; - case IOP_T4_TARGET: - hard = psxCounters[4].target; - PSXCNT_LOG("T4 target read16: %lx", hard); - return hard; - case IOP_T5_COUNT: - hard = (u16)psxRcntRcount32(5); - PSXCNT_LOG("T5 count read16: %lx", hard); - return hard; - case IOP_T5_MODE: - hard = psxCounters[5].mode; - psxCounters[5].mode &= ~0x1800; - psxCounters[5].mode |= 0x400; - PSXCNT_LOG("T5 mode read16: %lx", hard); - return hard; - case IOP_T5_TARGET: - hard = psxCounters[5].target; - PSXCNT_LOG("T5 target read16: %lx", hard); - return hard; - - case 0x1f801504: - hard = psxHu16(0x1504); - PSXHW_LOG("DMA7 BCR_size 16bit read %lx", hard); - return hard; - case 0x1f801506: - hard = psxHu16(0x1506); - PSXHW_LOG("DMA7 BCR_count 16bit read %lx", hard); - return hard; -// case 0x1f802030: hard = //int_2000???? -// case 0x1f802040: hard =//dip switches...?? - - default: - if (add>=HW_SPU2_START && add= HW_USB_START && add < HW_USB_END) { - return USBread32(add); - } - if (add >= HW_FW_START && add <= HW_FW_END) {//the size is a complete guess.. - return FWread32(add); - } - - switch (add) { - case 0x1f801040: - hard = sioRead8(); - hard|= sioRead8() << 8; - hard|= sioRead8() << 16; - hard|= sioRead8() << 24; - PAD_LOG("sio read32 ;ret = %lx", hard); - return hard; - -// case 0x1f801050: hard = serial_read32(); break;//serial port - case 0x1f801060: - PSXHW_LOG("RAM size read %lx", psxHu32(0x1060)); - return psxHu32(0x1060); - case 0x1f801070: PSXHW_LOG("IREG 32bit read %x", psxHu32(0x1070)); - return psxHu32(0x1070); - case 0x1f801074: PSXHW_LOG("IMASK 32bit read %x", psxHu32(0x1074)); - return psxHu32(0x1074); - case 0x1f801078: - PSXHW_LOG("ICTRL 32bit read %x", psxHu32(0x1078)); - hard = psxHu32(0x1078); - psxHu32(0x1078) = 0; - return hard; - -// case 0x1f801810: -// hard = GPU_readData(); -// PSXHW_LOG("GPU DATA 32bit read %lx", hard); -// return hard; -// case 0x1f801814: -// hard = GPU_readStatus(); -// PSXHW_LOG("GPU STATUS 32bit read %lx", hard); -// return hard; -// -// case 0x1f801820: hard = mdecRead0(); break; -// case 0x1f801824: hard = mdecRead1(); break; - - case 0x1f8010a0: - PSXHW_LOG("DMA2 MADR 32bit read %lx", psxHu32(0x10a0)); - return HW_DMA2_MADR; - case 0x1f8010a4: - PSXHW_LOG("DMA2 BCR 32bit read %lx", psxHu32(0x10a4)); - return HW_DMA2_BCR; - case 0x1f8010a8: - PSXHW_LOG("DMA2 CHCR 32bit read %lx", psxHu32(0x10a8)); - return HW_DMA2_CHCR; - - case 0x1f8010b0: - PSXHW_LOG("DMA3 MADR 32bit read %lx", psxHu32(0x10b0)); - return HW_DMA3_MADR; - case 0x1f8010b4: - PSXHW_LOG("DMA3 BCR 32bit read %lx", psxHu32(0x10b4)); - return HW_DMA3_BCR; - case 0x1f8010b8: - PSXHW_LOG("DMA3 CHCR 32bit read %lx", psxHu32(0x10b8)); - return HW_DMA3_CHCR; - - case 0x1f801520: - PSXHW_LOG("DMA9 MADR 32bit read %lx", HW_DMA9_MADR); - return HW_DMA9_MADR; - case 0x1f801524: - PSXHW_LOG("DMA9 BCR 32bit read %lx", HW_DMA9_BCR); - return HW_DMA9_BCR; - case 0x1f801528: - PSXHW_LOG("DMA9 CHCR 32bit read %lx", HW_DMA9_CHCR); - return HW_DMA9_CHCR; - case 0x1f80152C: - PSXHW_LOG("DMA9 TADR 32bit read %lx", HW_DMA9_TADR); - return HW_DMA9_TADR; - - case 0x1f801530: - PSXHW_LOG("DMA10 MADR 32bit read %lx", HW_DMA10_MADR); - return HW_DMA10_MADR; - case 0x1f801534: - PSXHW_LOG("DMA10 BCR 32bit read %lx", HW_DMA10_BCR); - return HW_DMA10_BCR; - case 0x1f801538: - PSXHW_LOG("DMA10 CHCR 32bit read %lx", HW_DMA10_CHCR); - return HW_DMA10_CHCR; - -// case 0x1f8010f0: PSXHW_LOG("DMA PCR 32bit read " << psxHu32(0x10f0)); -// return HW_DMA_PCR; // dma rest channel - - case 0x1f8010f4: - PSXHW_LOG("DMA ICR 32bit read %lx", HW_DMA_ICR); - return HW_DMA_ICR; - - //SSBus registers - case 0x1f801000: - hard = psxHu32(0x1000); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f801004: - hard = psxHu32(0x1004); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f801008: - hard = psxHu32(0x1008); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f80100C: - hard = psxHu32(0x100C); - PSXHW_LOG("SSBUS dev1_delay 32bit read %lx", hard); - return hard; - case 0x1f801010: - hard = psxHu32(0x1010); - PSXHW_LOG("SSBUS rom_delay 32bit read %lx", hard); - return hard; - case 0x1f801014: - hard = psxHu32(0x1014); - PSXHW_LOG("SSBUS spu_delay 32bit read %lx", hard); - return hard; - case 0x1f801018: - hard = psxHu32(0x1018); - PSXHW_LOG("SSBUS dev5_delay 32bit read %lx", hard); - return hard; - case 0x1f80101C: - hard = psxHu32(0x101C); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f801020: - hard = psxHu32(0x1020); - PSXHW_LOG("SSBUS com_delay 32bit read %lx", hard); - return hard; - case 0x1f801400: - hard = psxHu32(0x1400); - PSXHW_LOG("SSBUS dev1_addr 32bit read %lx", hard); - return hard; - case 0x1f801404: - hard = psxHu32(0x1404); - PSXHW_LOG("SSBUS spu_addr 32bit read %lx", hard); - return hard; - case 0x1f801408: - hard = psxHu32(0x1408); - PSXHW_LOG("SSBUS dev5_addr 32bit read %lx", hard); - return hard; - case 0x1f80140C: - hard = psxHu32(0x140C); - PSXHW_LOG("SSBUS spu1_addr 32bit read %lx", hard); - return hard; - case 0x1f801410: - hard = psxHu32(0x1410); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f801414: - hard = psxHu32(0x1414); - PSXHW_LOG("SSBUS spu1_delay 32bit read %lx", hard); - return hard; - case 0x1f801418: - hard = psxHu32(0x1418); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f80141C: - hard = psxHu32(0x141C); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - case 0x1f801420: - hard = psxHu32(0x1420); - PSXHW_LOG("SSBUS 32bit read %lx", hard); - return hard; - - case 0x1f8010f0: - PSXHW_LOG("DMA PCR 32bit read %lx", HW_DMA_PCR); - return HW_DMA_PCR; - - case 0x1f8010c8: - PSXHW_LOG("DMA4 CHCR 32bit read %lx", HW_DMA4_CHCR); - return HW_DMA4_CHCR; // DMA4 chcr (SPU DMA) - - // time for rootcounters :) - case IOP_T0_COUNT: - hard = (u16)psxRcntRcount16(0); - PSXCNT_LOG("T0 count read32: %lx", hard); - return hard; - case IOP_T0_MODE: - hard = (u16)psxCounters[0].mode; - PSXCNT_LOG("T0 mode read32: %lx", hard); - return hard; - case IOP_T0_TARGET: - hard = psxCounters[0].target; - PSXCNT_LOG("T0 target read32: %lx", hard); - return hard; - case IOP_T1_COUNT: - hard = (u16)psxRcntRcount16(1); - PSXCNT_LOG("T1 count read32: %lx", hard); - return hard; - case IOP_T1_MODE: - hard = (u16)psxCounters[1].mode; - PSXCNT_LOG("T1 mode read32: %lx", hard); - return hard; - case IOP_T1_TARGET: - hard = psxCounters[1].target; - PSXCNT_LOG("T1 target read32: %lx", hard); - return hard; - case IOP_T2_COUNT: - hard = (u16)psxRcntRcount16(2); - PSXCNT_LOG("T2 count read32: %lx", hard); - return hard; - case IOP_T2_MODE: - hard = (u16)psxCounters[2].mode; - PSXCNT_LOG("T2 mode read32: %lx", hard); - return hard; - case IOP_T2_TARGET: - hard = psxCounters[2].target; - PSXCNT_LOG("T2 target read32: %lx", hard); - return hard; - case IOP_T3_COUNT: - hard = (u32)psxRcntRcount32(3); - PSXCNT_LOG("T3 count read32: %lx", hard); - return hard; - case IOP_T3_MODE: - hard = (u16)psxCounters[3].mode; - PSXCNT_LOG("T3 mode read32: %lx", hard); - return hard; - case IOP_T3_TARGET: - hard = psxCounters[3].target; - PSXCNT_LOG("T3 target read32: %lx", hard); - return hard; - case IOP_T4_COUNT: - hard = (u32)psxRcntRcount32(4); - PSXCNT_LOG("T4 count read32: %lx", hard); - return hard; - case IOP_T4_MODE: - hard = (u16)psxCounters[4].mode; - PSXCNT_LOG("T4 mode read32: %lx", hard); - return hard; - case IOP_T4_TARGET: - hard = psxCounters[4].target; - PSXCNT_LOG("T4 target read32: %lx", hard); - return hard; - case IOP_T5_COUNT: - hard = (u32)psxRcntRcount32(5); - PSXCNT_LOG("T5 count read32: %lx", hard); - return hard; - case IOP_T5_MODE: - hard = (u16)psxCounters[5].mode; - PSXCNT_LOG("T5 mode read32: %lx", hard); - return hard; - case IOP_T5_TARGET: - hard = psxCounters[5].target; - PSXCNT_LOG("T5 target read32: %lx", hard); - return hard; - - case 0x1f801450: - hard = psxHu32(add); - PSXHW_LOG("%08X ICFG 32bit read %x", psxRegs.pc, hard); - return hard; - - - case 0x1F8010C0: - HW_DMA4_MADR = SPU2ReadMemAddr(0); - return HW_DMA4_MADR; - - case 0x1f801500: - HW_DMA7_MADR = SPU2ReadMemAddr(1); - PSXHW_LOG("DMA7 MADR 32bit read %lx", HW_DMA7_MADR); - return HW_DMA7_MADR; // DMA7 madr - case 0x1f801504: - PSXHW_LOG("DMA7 BCR 32bit read %lx", HW_DMA7_BCR); - return HW_DMA7_BCR; // DMA7 bcr - - case 0x1f801508: - PSXHW_LOG("DMA7 CHCR 32bit read %lx", HW_DMA7_CHCR); - return HW_DMA7_CHCR; // DMA7 chcr (SPU2) - - case 0x1f801570: - hard = psxHu32(0x1570); - PSXHW_LOG("DMA PCR2 32bit read %lx", hard); - return hard; - case 0x1f801574: - PSXHW_LOG("DMA ICR2 32bit read %lx", HW_DMA_ICR2); - return HW_DMA_ICR2; - - case 0x1F808200: - case 0x1F808204: - case 0x1F808208: - case 0x1F80820C: - case 0x1F808210: - case 0x1F808214: - case 0x1F808218: - case 0x1F80821C: - case 0x1F808220: - case 0x1F808224: - case 0x1F808228: - case 0x1F80822C: - case 0x1F808230: - case 0x1F808234: - case 0x1F808238: - case 0x1F80823C: - hard=sio2_getSend3((add-0x1F808200)/4); - PSXHW_LOG("SIO2 read param[%d] (%lx)", (add-0x1F808200)/4, hard); - return hard; - - case 0x1F808240: - case 0x1F808248: - case 0x1F808250: - case 0x1F808258: - hard=sio2_getSend1((add-0x1F808240)/8); - PSXHW_LOG("SIO2 read send1[%d] (%lx)", (add-0x1F808240)/8, hard); - return hard; - - case 0x1F808244: - case 0x1F80824C: - case 0x1F808254: - case 0x1F80825C: - hard=sio2_getSend2((add-0x1F808244)/8); - PSXHW_LOG("SIO2 read send2[%d] (%lx)", (add-0x1F808244)/8, hard); - return hard; - - case 0x1F808268: - hard=sio2_getCtrl(); - PSXHW_LOG("SIO2 read CTRL (%lx)", hard); - return hard; - - case 0x1F80826C: - hard=sio2_getRecv1(); - PSXHW_LOG("SIO2 read Recv1 (%lx)", hard); - return hard; - - case 0x1F808270: - hard=sio2_getRecv2(); - PSXHW_LOG("SIO2 read Recv2 (%lx)", hard); - return hard; - - case 0x1F808274: - hard=sio2_getRecv3(); - PSXHW_LOG("SIO2 read Recv3 (%lx)", hard); - return hard; - - case 0x1F808278: - hard=sio2_get8278(); - PSXHW_LOG("SIO2 read [8278] (%lx)", hard); - return hard; - - case 0x1F80827C: - hard=sio2_get827C(); - PSXHW_LOG("SIO2 read [827C] (%lx)", hard); - return hard; - - case 0x1F808280: - hard=sio2_getIntr(); - PSXHW_LOG("SIO2 read INTR (%lx)", hard); - return hard; - - default: - hard = psxHu32(add); - PSXHW_LOG("*Unknown 32bit read at address %lx: %lx", add, hard); - return hard; - } - PSXHW_LOG("*Known 32bit read at address %lx: %lx", add, hard); - return hard; -} - -// A buffer that stores messages until it gets a /n or the number of chars (g_pbufi) is more then 1023. -static char g_pbuf[1024]; -static int g_pbufi; -void psxHwWrite8(u32 add, u8 value) { - if (add >= HW_USB_START && add < HW_USB_END) { - USBwrite8(add, value); return; - } - if((add & 0xf) == 0xa) - Console.Error("8bit write (possible chcr set) to addr 0x%x = 0x%x", add, value ); - - switch (add) { - case 0x1f801040: - sioWrite8(value); - break; -// case 0x1f801050: serial_write8(value); break;//serial port - - case IOP_T0_COUNT: - case IOP_T0_MODE: - case IOP_T0_TARGET: - case IOP_T1_COUNT: - case IOP_T1_MODE: - case IOP_T1_TARGET: - case IOP_T2_COUNT: - case IOP_T2_MODE: - case IOP_T2_TARGET: - case IOP_T3_COUNT: - case IOP_T3_MODE: - case IOP_T3_TARGET: - case IOP_T4_COUNT: - case IOP_T4_MODE: - case IOP_T4_TARGET: - case IOP_T5_COUNT: - case IOP_T5_MODE: - case IOP_T5_TARGET: - DevCon.Warning( "IOP Counter Write8 to addr 0x%x = 0x%x", add, value ); - psxHu8(add) = value; - return; - - case 0x1f801450: - if (value) { PSXHW_LOG("%08X ICFG 8bit write %lx", psxRegs.pc, value); } - psxHu8(0x1450) = value; - return; - - case 0x1f801800: cdrWrite0(value); break; - case 0x1f801801: cdrWrite1(value); break; - case 0x1f801802: cdrWrite2(value); break; - case 0x1f801803: cdrWrite3(value); break; - - case 0x1f80380c: - { - //bool flush = false; - - // Terminate lines on CR or full buffers, and ignore \n's if the string contents - // are empty (otherwise terminate on \n too!) - if( ( value == '\r' ) || ( g_pbufi == 1023 ) || - ( value == '\n' && g_pbufi != 0 ) ) - { - g_pbuf[g_pbufi] = 0; - Console.WriteLn( ConColor_IOP, "%s", g_pbuf ); - g_pbufi = 0; - } - else if( value != '\n' ) - { - g_pbuf[g_pbufi++] = value; - } - psxHu8(add) = value; - } - return; - - case 0x1F808260: - PSXHW_LOG("SIO2 write8 DATAIN <- %08X", value); - sio2_serialIn(value); - return;//serial data feed/fifo - - default: - psxHu8(add) = value; - PSXHW_LOG("*Unknown 8bit write at address %lx value %x", add, value); - return; - } - psxHu8(add) = value; - PSXHW_LOG("*Known 8bit write at address %lx value %x", add, value); -} - -void psxHwWrite16(u32 add, u16 value) { - if (add >= HW_USB_START && add < HW_USB_END) { - USBwrite16(add, value); return; - } - - if((add & 0xf) == 0x9) DevCon.WriteLn("16bit write (possible chcr set) %x value %x", add, value); - - switch (add) { - case 0x1f801040: - sioWrite8((u8)value); - sioWrite8((u8)(value>>8)); - PAD_LOG ("sio write16 %lx, %x", add&0xf, value); - return; - case 0x1f801044: - PAD_LOG ("sio write16 %lx, %x", add&0xf, value); - return; - case 0x1f801048: - sio.ModeReg = value; - PAD_LOG ("sio write16 %lx, %x", add&0xf, value); - return; - case 0x1f80104a: // control register - sioWriteCtrl16(value); - PAD_LOG ("sio write16 %lx, %x", add&0xf, value); - return; - case 0x1f80104e: // baudrate register - sio.BaudReg = value; - PAD_LOG ("sio write16 %lx, %x", add&0xf, value); - return; - - //serial port ;P -// case 0x1f801050: serial_write16(value); break; -// case 0x1f80105a: serial_control_write(value);break; -// case 0x1f80105e: serial_baud_write(value); break; -// case 0x1f801054: serial_status_write(value); break; - - case 0x1f801070: - PSXHW_LOG("IREG 16bit write %x", value); -// if (Config.Sio) psxHu16(0x1070) |= 0x80; -// if (Config.SpuIrq) psxHu16(0x1070) |= 0x200; - psxHu16(0x1070) &= value; - return; - - case 0x1f801074: - PSXHW_LOG("IMASK 16bit write %x", value); - psxHu16(0x1074) = value; - iopTestIntc(); - return; - - case 0x1f801078: // see the 32-bit version for notes! - PSXHW_LOG("ICTRL 16bit write %n", value); - psxHu16(0x1078) = value; - iopTestIntc(); - return; - - case 0x1f8010c4: - PSXHW_LOG("DMA4 BCR_size 16bit write %lx", value); - psxHu16(0x10c4) = value; - return; // DMA4 bcr_size - - case 0x1f8010c6: - PSXHW_LOG("DMA4 BCR_count 16bit write %lx", value); - psxHu16(0x10c6) = value; return; // DMA4 bcr_count - - case IOP_T0_COUNT: - PSXCNT_LOG("COUNTER 0 COUNT 16bit write %x", value); - psxRcntWcount16(0, value); return; - case IOP_T0_MODE: - PSXCNT_LOG("COUNTER 0 MODE 16bit write %x", value); - psxRcntWmode16(0, value); return; - case IOP_T0_TARGET: - PSXCNT_LOG("COUNTER 0 TARGET 16bit write %x", value); - psxRcntWtarget16(0, value); return; - - case IOP_T1_COUNT: - PSXCNT_LOG("COUNTER 1 COUNT 16bit write %x", value); - psxRcntWcount16(1, value); return; - case IOP_T1_MODE: - PSXCNT_LOG("COUNTER 1 MODE 16bit write %x", value); - psxRcntWmode16(1, value); return; - case IOP_T1_TARGET: - PSXCNT_LOG("COUNTER 1 TARGET 16bit write %x", value); - psxRcntWtarget16(1, value); return; - - case IOP_T2_COUNT: - PSXCNT_LOG("COUNTER 2 COUNT 16bit write %x", value); - psxRcntWcount16(2, value); return; - case IOP_T2_MODE: - PSXCNT_LOG("COUNTER 2 MODE 16bit write %x", value); - psxRcntWmode16(2, value); return; - case IOP_T2_TARGET: - PSXCNT_LOG("COUNTER 2 TARGET 16bit write %x", value); - psxRcntWtarget16(2, value); return; - - case 0x1f801450: - if (value) { PSXHW_LOG("%08X ICFG 16bit write %lx", psxRegs.pc, value); } - psxHu16(0x1450) = value/* & (~0x8)*/; - return; - - case IOP_T3_COUNT: - PSXCNT_LOG("COUNTER 3 COUNT 16bit write %lx", value); - psxRcntWcount32(3, value); return; - case IOP_T3_MODE: - PSXCNT_LOG("COUNTER 3 MODE 16bit write %lx", value); - psxRcntWmode32(3, value); return; - case IOP_T3_TARGET: - PSXCNT_LOG("COUNTER 3 TARGET 16bit write %lx", value); - psxRcntWtarget32(3, value); return; - - case IOP_T4_COUNT: - PSXCNT_LOG("COUNTER 4 COUNT 16bit write %lx", value); - psxRcntWcount32(4, value); return; - case IOP_T4_MODE: - PSXCNT_LOG("COUNTER 4 MODE 16bit write %lx", value); - psxRcntWmode32(4, value); return; - case IOP_T4_TARGET: - PSXCNT_LOG("COUNTER 4 TARGET 16bit write %lx", value); - psxRcntWtarget32(4, value); return; - - case IOP_T5_COUNT: - PSXCNT_LOG("COUNTER 5 COUNT 16bit write %lx", value); - psxRcntWcount32(5, value); return; - case IOP_T5_MODE: - PSXCNT_LOG("COUNTER 5 MODE 16bit write %lx", value); - psxRcntWmode32(5, value); return; - case IOP_T5_TARGET: - PSXCNT_LOG("COUNTER 5 TARGET 16bit write %lx", value); - psxRcntWtarget32(5, value); return; - - case 0x1f801504: - psxHu16(0x1504) = value; - PSXHW_LOG("DMA7 BCR_size 16bit write %lx", value); - return; - case 0x1f801506: - psxHu16(0x1506) = value; - PSXHW_LOG("DMA7 BCR_count 16bit write %lx", value); - return; - default: - if (add>=HW_SPU2_START && add= HW_USB_START && add < HW_USB_END) { - USBwrite32(add, value); return; - } - if (add >= HW_FW_START && add <= HW_FW_END) { - FWwrite32(add, value); return; - } - switch (add) { - case 0x1f801040: - sioWrite8((u8)value); - sioWrite8((u8)((value&0xff) >> 8)); - sioWrite8((u8)((value&0xff) >> 16)); - sioWrite8((u8)((value&0xff) >> 24)); - PAD_LOG("sio write32 %lx", value); - return; - // case 0x1f801050: serial_write32(value); break;//serial port - case 0x1f801060: - PSXHW_LOG("RAM size write %lx", value); - psxHu32(add) = value; - return; // Ram size - -//------------------------------------------------------------------ - case 0x1f801070: - PSXHW_LOG("IREG 32bit write %lx", value); -// if (Config.Sio) psxHu32(0x1070) |= 0x80; -// if (Config.SpuIrq) psxHu32(0x1070) |= 0x200; - psxHu32(0x1070) &= value; - return; - - case 0x1f801074: - PSXHW_LOG("IMASK 32bit write %lx", value); - psxHu32(0x1074) = value; - iopTestIntc(); - return; - - case 0x1f801078: - PSXHW_LOG("ICTRL 32bit write %lx", value); - psxHu32(0x1078) = value; //1; //According to pSXAuthor this always becomes 1 on write, but MHPB won't boot if value is not writen ;p - iopTestIntc(); - return; - -//------------------------------------------------------------------ - //SSBus registers - case 0x1f801000: - psxHu32(0x1000) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f801004: - psxHu32(0x1004) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f801008: - psxHu32(0x1008) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f80100C: - psxHu32(0x100C) = value; - PSXHW_LOG("SSBUS dev1_delay 32bit write %lx", value); - return; - case 0x1f801010: - psxHu32(0x1010) = value; - PSXHW_LOG("SSBUS rom_delay 32bit write %lx", value); - return; - case 0x1f801014: - psxHu32(0x1014) = value; - PSXHW_LOG("SSBUS spu_delay 32bit write %lx", value); - return; - case 0x1f801018: - psxHu32(0x1018) = value; - PSXHW_LOG("SSBUS dev5_delay 32bit write %lx", value); - return; - case 0x1f80101C: - psxHu32(0x101C) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f801020: - psxHu32(0x1020) = value; - PSXHW_LOG("SSBUS com_delay 32bit write %lx", value); - return; - case 0x1f801400: - psxHu32(0x1400) = value; - PSXHW_LOG("SSBUS dev1_addr 32bit write %lx", value); - return; - case 0x1f801404: - psxHu32(0x1404) = value; - PSXHW_LOG("SSBUS spu_addr 32bit write %lx", value); - return; - case 0x1f801408: - psxHu32(0x1408) = value; - PSXHW_LOG("SSBUS dev5_addr 32bit write %lx", value); - return; - case 0x1f80140C: - psxHu32(0x140C) = value; - PSXHW_LOG("SSBUS spu1_addr 32bit write %lx", value); - return; - case 0x1f801410: - psxHu32(0x1410) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f801414: - psxHu32(0x1414) = value; - PSXHW_LOG("SSBUS spu1_delay 32bit write %lx", value); - return; - case 0x1f801418: - psxHu32(0x1418) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f80141C: - psxHu32(0x141C) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - case 0x1f801420: - psxHu32(0x1420) = value; - PSXHW_LOG("SSBUS 32bit write %lx", value); - return; - -//------------------------------------------------------------------ - case 0x1f801080: - PSXHW_LOG("DMA0 MADR 32bit write %lx", value); - HW_DMA0_MADR = value; return; // DMA0 madr - case 0x1f801084: - PSXHW_LOG("DMA0 BCR 32bit write %lx", value); - HW_DMA0_BCR = value; return; // DMA0 bcr - case 0x1f801088: - PSXHW_LOG("DMA0 CHCR 32bit write %lx", value); - HW_DMA0_CHCR = value; // DMA0 chcr (MDEC in DMA) -// DmaExec(0); - return; - -//------------------------------------------------------------------ - case 0x1f801090: - PSXHW_LOG("DMA1 MADR 32bit write %lx", value); - HW_DMA1_MADR = value; return; // DMA1 madr - case 0x1f801094: - PSXHW_LOG("DMA1 BCR 32bit write %lx", value); - HW_DMA1_BCR = value; return; // DMA1 bcr - case 0x1f801098: - PSXHW_LOG("DMA1 CHCR 32bit write %lx", value); - HW_DMA1_CHCR = value; // DMA1 chcr (MDEC out DMA) -// DmaExec(1); - return; - -//------------------------------------------------------------------ - case 0x1f8010a0: - PSXHW_LOG("DMA2 MADR 32bit write %lx", value); - HW_DMA2_MADR = value; return; // DMA2 madr - case 0x1f8010a4: - PSXHW_LOG("DMA2 BCR 32bit write %lx", value); - HW_DMA2_BCR = value; return; // DMA2 bcr - case 0x1f8010a8: - PSXHW_LOG("DMA2 CHCR 32bit write %lx", value); - HW_DMA2_CHCR = value; // DMA2 chcr (GPU DMA) - DmaExec(2); - return; - -//------------------------------------------------------------------ - case 0x1f8010b0: - PSXHW_LOG("DMA3 MADR 32bit write %lx", value); - HW_DMA3_MADR = value; return; // DMA3 madr - case 0x1f8010b4: - PSXHW_LOG("DMA3 BCR 32bit write %lx", value); - HW_DMA3_BCR = value; return; // DMA3 bcr - case 0x1f8010b8: - PSXHW_LOG("DMA3 CHCR 32bit write %lx", value); - HW_DMA3_CHCR = value; // DMA3 chcr (CDROM DMA) - DmaExec(3); - - return; - -//------------------------------------------------------------------ - case 0x1f8010c0: - PSXHW_LOG("DMA4 MADR 32bit write %lx", value); - SPU2WriteMemAddr(0,value); - HW_DMA4_MADR = value; return; // DMA4 madr - case 0x1f8010c4: - PSXHW_LOG("DMA4 BCR 32bit write %lx", value); - HW_DMA4_BCR = value; return; // DMA4 bcr - case 0x1f8010c8: - PSXHW_LOG("DMA4 CHCR 32bit write %lx", value); - HW_DMA4_CHCR = value; // DMA4 chcr (SPU DMA) - DmaExecNew(4); - return; - -//------------------------------------------------------------------ -#if 0 - case 0x1f8010d0: break; //DMA5write_madr(); - case 0x1f8010d4: break; //DMA5write_bcr(); - case 0x1f8010d8: break; //DMA5write_chcr(); // Not yet needed?? -#endif - - case 0x1f8010e0: - PSXHW_LOG("DMA6 MADR 32bit write %lx", value); - HW_DMA6_MADR = value; return; // DMA6 madr - case 0x1f8010e4: - PSXHW_LOG("DMA6 BCR 32bit write %lx", value); - HW_DMA6_BCR = value; return; // DMA6 bcr - case 0x1f8010e8: - PSXHW_LOG("DMA6 CHCR 32bit write %lx", value); - HW_DMA6_CHCR = value; // DMA6 chcr (OT clear) - DmaExec(6); - return; - -//------------------------------------------------------------------ - case 0x1f801500: - PSXHW_LOG("DMA7 MADR 32bit write %lx", value); - SPU2WriteMemAddr(1,value); - HW_DMA7_MADR = value; return; // DMA7 madr - case 0x1f801504: - PSXHW_LOG("DMA7 BCR 32bit write %lx", value); - HW_DMA7_BCR = value; return; // DMA7 bcr - case 0x1f801508: - PSXHW_LOG("DMA7 CHCR 32bit write %lx", value); - HW_DMA7_CHCR = value; // DMA7 chcr (SPU2) - DmaExecNew2(7); - return; - -//------------------------------------------------------------------ - case 0x1f801510: - PSXHW_LOG("DMA8 MADR 32bit write %lx", value); - HW_DMA8_MADR = value; return; // DMA8 madr - case 0x1f801514: - PSXHW_LOG("DMA8 BCR 32bit write %lx", value); - HW_DMA8_BCR = value; return; // DMA8 bcr - case 0x1f801518: - PSXHW_LOG("DMA8 CHCR 32bit write %lx", value); - HW_DMA8_CHCR = value; // DMA8 chcr (DEV9) - DmaExec2(8); - return; - -//------------------------------------------------------------------ - case 0x1f801520: - PSXHW_LOG("DMA9 MADR 32bit write %lx", value); - HW_DMA9_MADR = value; return; // DMA9 madr - case 0x1f801524: - PSXHW_LOG("DMA9 BCR 32bit write %lx", value); - HW_DMA9_BCR = value; return; // DMA9 bcr - case 0x1f801528: - PSXHW_LOG("DMA9 CHCR 32bit write %lx", value); - HW_DMA9_CHCR = value; // DMA9 chcr (SIF0) - DmaExec2(9); - return; - case 0x1f80152c: - PSXHW_LOG("DMA9 TADR 32bit write %lx", value); - HW_DMA9_TADR = value; return; // DMA9 tadr - -//------------------------------------------------------------------ - case 0x1f801530: - PSXHW_LOG("DMA10 MADR 32bit write %lx", value); - HW_DMA10_MADR = value; return; // DMA10 madr - case 0x1f801534: - PSXHW_LOG("DMA10 BCR 32bit write %lx", value); - HW_DMA10_BCR = value; return; // DMA10 bcr - case 0x1f801538: - PSXHW_LOG("DMA10 CHCR 32bit write %lx", value); - HW_DMA10_CHCR = value; // DMA10 chcr (SIF1) - DmaExec2(10); - return; - -//------------------------------------------------------------------ - case 0x1f801540: - PSXHW_LOG("DMA11 SIO2in MADR 32bit write %lx", value); - HW_DMA11_MADR = value; return; - - case 0x1f801544: - PSXHW_LOG("DMA11 SIO2in BCR 32bit write %lx", value); - HW_DMA11_BCR = value; return; - case 0x1f801548: - PSXHW_LOG("DMA11 SIO2in CHCR 32bit write %lx", value); - HW_DMA11_CHCR = value; // DMA11 chcr (SIO2 in) - DmaExec2(11); - return; - -//------------------------------------------------------------------ - case 0x1f801550: - PSXHW_LOG("DMA12 SIO2out MADR 32bit write %lx", value); - HW_DMA12_MADR = value; return; - - case 0x1f801554: - PSXHW_LOG("DMA12 SIO2out BCR 32bit write %lx", value); - HW_DMA12_BCR = value; return; - case 0x1f801558: - PSXHW_LOG("DMA12 SIO2out CHCR 32bit write %lx", value); - HW_DMA12_CHCR = value; // DMA12 chcr (SIO2 out) - DmaExec2(12); - return; - -//------------------------------------------------------------------ - case 0x1f801570: - psxHu32(0x1570) = value; - PSXHW_LOG("DMA PCR2 32bit write %lx", value); - return; - case 0x1f8010f0: - PSXHW_LOG("DMA PCR 32bit write %lx", value); - HW_DMA_PCR = value; - return; - - case 0x1f8010f4: - PSXHW_LOG("DMA ICR 32bit write %lx", value); - { - u32 tmp = (~value) & HW_DMA_ICR; - HW_DMA_ICR = ((tmp ^ value) & 0xffffff) ^ tmp; - } - return; - - case 0x1f801574: - PSXHW_LOG("DMA ICR2 32bit write %lx", value); - { - u32 tmp = (~value) & HW_DMA_ICR2; - HW_DMA_ICR2 = ((tmp ^ value) & 0xffffff) ^ tmp; - } - return; - -//------------------------------------------------------------------ -/* case 0x1f801810: - PSXHW_LOG("GPU DATA 32bit write %lx", value); - GPU_writeData(value); return; - case 0x1f801814: - PSXHW_LOG("GPU STATUS 32bit write %lx", value); - GPU_writeStatus(value); return; -*/ -/* case 0x1f801820: - mdecWrite0(value); break; - case 0x1f801824: - mdecWrite1(value); break; -*/ - case IOP_T0_COUNT: - PSXCNT_LOG("COUNTER 0 COUNT 32bit write %lx", value); - psxRcntWcount16(0, value ); return; - case IOP_T0_MODE: - PSXCNT_LOG("COUNTER 0 MODE 32bit write %lx", value); - psxRcntWmode16(0, value); return; - case IOP_T0_TARGET: - PSXCNT_LOG("COUNTER 0 TARGET 32bit write %lx", value); - psxRcntWtarget16(0, value ); return; - - case IOP_T1_COUNT: - PSXCNT_LOG("COUNTER 1 COUNT 32bit write %lx", value); - psxRcntWcount16(1, value ); return; - case IOP_T1_MODE: - PSXCNT_LOG("COUNTER 1 MODE 32bit write %lx", value); - psxRcntWmode16(1, value); return; - case IOP_T1_TARGET: - PSXCNT_LOG("COUNTER 1 TARGET 32bit write %lx", value); - psxRcntWtarget16(1, value ); return; - - case IOP_T2_COUNT: - PSXCNT_LOG("COUNTER 2 COUNT 32bit write %lx", value); - psxRcntWcount16(2, value ); return; - case IOP_T2_MODE: - PSXCNT_LOG("COUNTER 2 MODE 32bit write %lx", value); - psxRcntWmode16(0, value); return; - case IOP_T2_TARGET: - PSXCNT_LOG("COUNTER 2 TARGET 32bit write %lx", value); - psxRcntWtarget16(2, value); return; - - case IOP_T3_COUNT: - PSXCNT_LOG("COUNTER 3 COUNT 32bit write %lx", value); - psxRcntWcount32(3, value); return; - case IOP_T3_MODE: - PSXCNT_LOG("COUNTER 3 MODE 32bit write %lx", value); - psxRcntWmode32(3, value); return; - case IOP_T3_TARGET: - PSXCNT_LOG("COUNTER 3 TARGET 32bit write %lx", value); - psxRcntWtarget32(3, value); return; - - case IOP_T4_COUNT: - PSXCNT_LOG("COUNTER 4 COUNT 32bit write %lx", value); - psxRcntWcount32(4, value); return; - case IOP_T4_MODE: - PSXCNT_LOG("COUNTER 4 MODE 32bit write %lx", value); - psxRcntWmode32(4, value); return; - case IOP_T4_TARGET: - PSXCNT_LOG("COUNTER 4 TARGET 32bit write %lx", value); - psxRcntWtarget32(4, value); return; - - case IOP_T5_COUNT: - PSXCNT_LOG("COUNTER 5 COUNT 32bit write %lx", value); - psxRcntWcount32(5, value); return; - case IOP_T5_MODE: - PSXCNT_LOG("COUNTER 5 MODE 32bit write %lx", value); - psxRcntWmode32(5, value); return; - case IOP_T5_TARGET: - PSXCNT_LOG("COUNTER 5 TARGET 32bit write %lx", value); - psxRcntWtarget32(5, value); return; - -//------------------------------------------------------------------ - case 0x1f8014c0: - PSXHW_LOG("RTC_HOLDMODE 32bit write %lx", value); - Console.Warning("** RTC_HOLDMODE 32bit write %lx", value); - break; - - case 0x1f801450: - if (value) { PSXHW_LOG("%08X ICFG 32bit write %lx", psxRegs.pc, value); } -/* if (value && - psxSu32(0x20) == 0x20000 && - (psxSu32(0x30) == 0x20000 || - psxSu32(0x30) == 0x40000)) { // don't ask me why :P - psxSu32(0x20) = 0x10000; - psxSu32(0x30) = 0x10000; - }*/ - psxHu32(0x1450) = /*(*/value/* & (~0x8)) | (psxHu32(0x1450) & 0x8)*/; - return; - -//------------------------------------------------------------------ - case 0x1F808200: - case 0x1F808204: - case 0x1F808208: - case 0x1F80820C: - case 0x1F808210: - case 0x1F808214: - case 0x1F808218: - case 0x1F80821C: - case 0x1F808220: - case 0x1F808224: - case 0x1F808228: - case 0x1F80822C: - case 0x1F808230: - case 0x1F808234: - case 0x1F808238: - case 0x1F80823C: - PSXHW_LOG("SIO2 write param[%d] <- %lx", (add-0x1F808200)/4, value); - sio2_setSend3((add-0x1F808200)/4, value); return; - - case 0x1F808240: - case 0x1F808248: - case 0x1F808250: - case 0x1F808258: - PSXHW_LOG("SIO2 write send1[%d] <- %lx", (add-0x1F808240)/8, value); - sio2_setSend1((add-0x1F808240)/8, value); return; - - case 0x1F808244: - case 0x1F80824C: - case 0x1F808254: - case 0x1F80825C: - PSXHW_LOG("SIO2 write send2[%d] <- %lx", (add-0x1F808244)/8, value); - sio2_setSend2((add-0x1F808244)/8, value); return; - - case 0x1F808268: - PSXHW_LOG("SIO2 write CTRL <- %lx", value); - sio2_setCtrl(value); return; - - case 0x1F808278: - PSXHW_LOG("SIO2 write [8278] <- %lx", value); - sio2_set8278(value); return; - - case 0x1F80827C: - PSXHW_LOG("SIO2 write [827C] <- %lx", value); - sio2_set827C(value); return; - - case 0x1F808280: - PSXHW_LOG("SIO2 write INTR <- %lx", value); - sio2_setIntr(value); return; - -//------------------------------------------------------------------ - default: - psxHu32(add) = value; - PSXHW_LOG("*Unknown 32bit write at address %lx value %lx", add, value); - return; - } - psxHu32(add) = value; - PSXHW_LOG("*Known 32bit write at address %lx value %lx", add, value); -} - __forceinline u8 psxHw4Read8(u32 add) { u16 mem = add & 0xFF; diff --git a/pcsx2/IopHw.h b/pcsx2/IopHw.h index ef95fde6e5..ea7abbb55a 100644 --- a/pcsx2/IopHw.h +++ b/pcsx2/IopHw.h @@ -289,16 +289,6 @@ extern void psxSetNextBranchDelta( s32 delta ); extern int iopTestCycle( u32 startCycle, s32 delta ); extern void _iopTestInterrupts(); -// Depreciated : Use iopHwRead* functions defined in IopMem.h instead. -u8 psxHwRead8 (u32 add); -u16 psxHwRead16(u32 add); -u32 psxHwRead32(u32 add); - -// Depreciated : Use iopHwWrite* functions defined in IopMem.h instead. -void psxHwWrite8 (u32 add, u8 value); -void psxHwWrite16(u32 add, u16 value); -void psxHwWrite32(u32 add, u32 value); - extern void psxHwReset(); extern u8 psxHw4Read8 (u32 add); extern void psxHw4Write8(u32 add, u8 value); diff --git a/pcsx2/IopMem.cpp b/pcsx2/IopMem.cpp index 0356106c46..a30dd4682d 100644 --- a/pcsx2/IopMem.cpp +++ b/pcsx2/IopMem.cpp @@ -128,12 +128,6 @@ u8 __fastcall iopMemRead8(u32 mem) case 0x3000: return IopMemory::iopHwRead8_Page3(mem); case 0x8000: return IopMemory::iopHwRead8_Page8(mem); - // code for regression testing -- selectively enable these to help narrow out - // which register became buggy with the new Hw handlers. - //case 0x1000: return psxHwRead8(mem); - //case 0x3000: return psxHwRead8(mem); - //case 0x8000: return psxHwRead8(mem); - default: return psxHu8(mem); } @@ -172,12 +166,6 @@ u16 __fastcall iopMemRead16(u32 mem) case 0x3000: return IopMemory::iopHwRead16_Page3(mem); case 0x8000: return IopMemory::iopHwRead16_Page8(mem); - // code for regression testing -- selectively enable these to help narrow out - // which register became buggy with the new Hw handlers. - //case 0x1000: return psxHwRead16(mem); - //case 0x3000: return psxHwRead16(mem); - //case 0x8000: return psxHwRead16(mem); - default: return psxHu16(mem); } @@ -238,12 +226,6 @@ u32 __fastcall iopMemRead32(u32 mem) case 0x3000: return IopMemory::iopHwRead32_Page3(mem); case 0x8000: return IopMemory::iopHwRead32_Page8(mem); - // code for regression testing -- selectively enable these to help narrow out - // which register became buggy with the new Hw handlers. - //case 0x1000: return psxHwRead32(mem); - //case 0x3000: return psxHwRead32(mem); - //case 0x8000: return psxHwRead32(mem); - default: return psxHu32(mem); } @@ -303,25 +285,10 @@ void __fastcall iopMemWrite8(u32 mem, u8 value) { switch( mem & 0xf000 ) { - // Regression testing: selectively pass ranges of registers to new or old - // handlers. Helps narrow out which area of registers is erroring out. - /*case 0x1000: - if( mem >= 0x1f801000 ) - psxHwWrite8( mem, value ); - else - IopMemory::iopHwWrite8_Page1(mem,value); - break;*/ - case 0x1000: IopMemory::iopHwWrite8_Page1(mem,value); break; case 0x3000: IopMemory::iopHwWrite8_Page3(mem,value); break; case 0x8000: IopMemory::iopHwWrite8_Page8(mem,value); break; - // code for regression testing -- selectively enable these to help narrow out - // which register became buggy with the new Hw handlers. - //case 0x1000: psxHwWrite8(mem,value); break; - //case 0x3000: psxHwWrite8(mem,value); break; - //case 0x8000: psxHwWrite8(mem,value); break; - default: psxHu8(mem) = value; break; @@ -365,23 +332,10 @@ void __fastcall iopMemWrite16(u32 mem, u16 value) { switch( mem & 0xf000 ) { - // Regression testing: selectively pass ranges of registers to new or old - // handlers. Helps narrow out which area of registers is erroring out. - /*case 0x1000: - if( mem >= 0x1f801000 ) - psxHwWrite16( mem, value ); - else - IopMemory::iopHwWrite16_Page1(mem,value); - break;*/ - case 0x1000: IopMemory::iopHwWrite16_Page1(mem,value); break; case 0x3000: IopMemory::iopHwWrite16_Page3(mem,value); break; case 0x8000: IopMemory::iopHwWrite16_Page8(mem,value); break; - //case 0x1000: psxHwWrite16(mem,value); break; - //case 0x3000: psxHwWrite16(mem,value); break; - //case 0x8000: psxHwWrite16(mem,value); break; - default: psxHu16(mem) = value; break; @@ -449,22 +403,9 @@ void __fastcall iopMemWrite32(u32 mem, u32 value) { switch( mem & 0xf000 ) { - // Regression testing: selectively pass ranges of registers to new or old - // handlers. Helps narrow out which area of registers is erroring out. - /*case 0x1000: - if( mem >= 0x1f801528 ) - psxHwWrite32( mem, value ); - else - IopMemory::iopHwWrite32_Page1(mem,value); - break;*/ - case 0x1000: IopMemory::iopHwWrite32_Page1(mem,value); break; case 0x3000: IopMemory::iopHwWrite32_Page3(mem,value); break; case 0x8000: IopMemory::iopHwWrite32_Page8(mem,value); break; - - //case 0x1000: psxHwWrite32(mem,value); break; - //case 0x3000: psxHwWrite32(mem,value); break; - //case 0x8000: psxHwWrite32(mem,value); break; default: psxHu32(mem) = value; diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index 7f4912aa27..753c9a83b8 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -1,477 +1,480 @@ - - - - - - + + + + + + diff --git a/pcsx2/Memory.cpp b/pcsx2/Memory.cpp index 5ce0faa083..442d74c166 100644 --- a/pcsx2/Memory.cpp +++ b/pcsx2/Memory.cpp @@ -242,8 +242,6 @@ mem16_t __fastcall _ext_memRead16(u32 mem) { case 1: // hwm return hwRead16(mem); - case 2: // psh - return psxHwRead16(mem); case 4: // b80 MEM_LOG("b800000 Memory read16 address %x", mem); return 0; @@ -343,8 +341,6 @@ void __fastcall _ext_memWrite16(u32 mem, mem16_t value) case 1: // hwm hwWrite16(mem, value); return; - case 2: // psh - psxHwWrite16(mem, value); return; case 5: // ba0 MEM_LOG("ba00000 Memory write16 to address %x with data %x", mem, value); return; diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 7864046690..f5cf589f8f 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -421,7 +421,7 @@ void inifile_command( const wxString& cmd ) void inifile_process(wxTextFile &f1 ) { Console.WriteLn("inifile_process"); - for (int i = 0; i < f1.GetLineCount(); i++) + for (uint i = 0; i < f1.GetLineCount(); i++) { inifile_trim(f1[i]); if (!f1[i].IsEmpty()) inifile_command(f1[i]); diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index 1e7223672d..2292b4f22c 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -34,14 +34,6 @@ using namespace R5900; FILE *emuLog; wxString emuLogName; -#ifdef PCSX2_DEVBUILD -LogSources varLog; - -// these used by the depreciated _old_Log only -u16 logProtocol; -u8 logSource; -#endif - bool enableLogging = TRUE; int connected=0; @@ -53,8 +45,6 @@ void __Log( const char* fmt, ... ) char tmp[2024]; va_list list; - if (!enableLogging) return; - va_start(list, fmt); // concatenate the log message after the prefix: @@ -65,16 +55,10 @@ void __Log( const char* fmt, ... ) // fixme: should throw an exception here once we have proper exception handling implemented. #ifdef PCSX2_DEVBUILD - if (varLog.LogToConsole) // log to console enabled? - { - Console.Write(tmp); - - } - else if( emuLog != NULL ) // manually write to the logfile. + if( emuLog != NULL ) { fputs( tmp, emuLog ); fputs( "\n", emuLog ); - //fputs( "\r\n", emuLog ); fflush( emuLog ); } #endif @@ -101,11 +85,7 @@ static __forceinline void _vSourceLog( u16 protocol, u8 source, u32 cpuPc, u32 c }*/ #endif - if (varLog.LogToConsole) // log to console enabled? - { - Console.WriteLn(tmp); - - } else if( emuLog != NULL ) // manually write to the logfile. + if( emuLog != NULL ) { fputs( tmp, emuLog ); fputs( "\n", emuLog ); @@ -119,9 +99,6 @@ static __forceinline void _vSourceLog( u16 protocol, u8 source, u32 cpuPc, u32 c void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...) { va_list list; - - if (!enableLogging) return; - va_start(list, fmt); _vSourceLog( protocol, source, cpuPc, cpuCycle, fmt, list ); va_end(list); @@ -132,7 +109,6 @@ void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fm bool SrcLog_##unit( const char* fmt, ... ) \ { \ va_list list; \ - if (!enableLogging) return false; \ va_start( list, fmt ); \ _vSourceLog( protocol, source, \ (source == 'E') ? cpuRegs.pc : psxRegs.pc, \ diff --git a/pcsx2/gui/CheckedStaticBox.cpp b/pcsx2/gui/CheckedStaticBox.cpp index 8f07ec0485..0974c9fdfa 100644 --- a/pcsx2/gui/CheckedStaticBox.cpp +++ b/pcsx2/gui/CheckedStaticBox.cpp @@ -30,19 +30,9 @@ CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxS SetSizer( &m_MasterSizer ); - Connect( id, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) ); + Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) ); } -// Adds a checkbox to this group panel's base sizer. -// This is a helper function which saves some typographic red tape over using manual -// checkbox creation and sizer appendage. -wxCheckBox& CheckedStaticBox::AddCheckBox( const wxString& label, const wxString& subtext, const wxString& tooltip ) -{ - return wxPanelWithHelpers::AddCheckBox( ThisSizer, label, subtext, tooltip ); -} - -////////////////////////////////////////////////////////////////////////////////////////// -// void CheckedStaticBox::MainToggle_Click( wxCommandEvent& evt ) { SetValue( evt.IsChecked() ); diff --git a/pcsx2/gui/CheckedStaticBox.h b/pcsx2/gui/CheckedStaticBox.h index 1bae4ca3c9..f20710e285 100644 --- a/pcsx2/gui/CheckedStaticBox.h +++ b/pcsx2/gui/CheckedStaticBox.h @@ -32,9 +32,6 @@ public: void SetValue( bool val ); bool GetValue() const; - using wxPanelWithHelpers::AddCheckBox; // allows access to overloaded parent :) - wxCheckBox& AddCheckBox( const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString ); - public: // Event handler for click events for the main checkbox (default behavior: enables/disables all child controls) // This function can be overridden to implement custom handling of check enable/disable behavior. diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp index e87519a039..9d4035d4e8 100644 --- a/pcsx2/gui/Dialogs/LogOptionsDialog.cpp +++ b/pcsx2/gui/Dialogs/LogOptionsDialog.cpp @@ -14,147 +14,20 @@ */ #include "PrecompiledHeader.h" -#include "DebugTools/Debug.h" #include "LogOptionsDialog.h" +#include "Panels/LogOptionsPanels.h" #include using namespace wxHelpers; -void ConnectChildrenRecurse( wxWindow* parent, int eventType, wxObjectEventFunction handler ) +Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent, int id ) + : wxDialogWithHelpers( parent, id, _("High Volume Logging"), true ) { - wxWindowList& list = parent->GetChildren(); - for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter) - { - wxWindow *current = *iter; - ConnectChildrenRecurse( current, eventType, handler ); - parent->Connect( current->GetId(), eventType, handler ); - } -} - -namespace Dialogs -{ -////////////////////////////////////////////////////////////////////////////////////////// -// -LogOptionsDialog::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) : - CheckedStaticBox( parent, wxHORIZONTAL, L"EE Logs" ) -{ - wxBoxSizer& eeMisc = *new wxBoxSizer( wxVERTICAL ); - - AddCheckBox( eeMisc, L"Memory" ); - AddCheckBox( eeMisc, L"Bios" ); - AddCheckBox( eeMisc, L"Elf" ); - - wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL ); - eeStack.Add( new DisasmPanel( this ), SizerFlags::StdSpace() ); - eeStack.Add( &eeMisc ); - - ThisSizer.Add( new HwPanel( this ), SizerFlags::StdSpace() ); - ThisSizer.Add( &eeStack ); - - SetValue( true ); - Fit(); -} - -LogOptionsDialog::eeLogOptionsPanel::DisasmPanel::DisasmPanel( wxWindow* parent ) : - CheckedStaticBox( parent, wxVERTICAL, L"Disasm" ) -{ - AddCheckBox( L"Core" ); - AddCheckBox( L"Fpu" ); - AddCheckBox( L"VU0" ); - AddCheckBox( L"Cop0" ); - AddCheckBox( L"VU Macro" ); - - SetValue( false ); - Fit(); -} - -LogOptionsDialog::eeLogOptionsPanel::HwPanel::HwPanel( wxWindow* parent ) : - CheckedStaticBox( parent, wxVERTICAL, L"Hardware" ) -{ - AddCheckBox( L"Registers" ); - AddCheckBox( L"Dma" ); - AddCheckBox( L"Vif" ); - AddCheckBox( L"SPR" ); - AddCheckBox( L"GIF" ); - AddCheckBox( L"Sif" ); - AddCheckBox( L"IPU" ); - AddCheckBox( L"RPC" ); - - SetValue( false ); - Fit(); -} - -void LogOptionsDialog::eeLogOptionsPanel::OnLogChecked(wxCommandEvent &event) -{ - //LogChecks checkId = (LogChecks)(int)event.m_callbackUserData; - //ToggleLogOption( checkId ); - event.Skip(); -} - -////////////////////////////////////////////////////////////////////////////////////////// -// -LogOptionsDialog::iopLogOptionsPanel::iopLogOptionsPanel( wxWindow* parent ) : - CheckedStaticBox( parent, wxVERTICAL, L"IOP Logs" ) -{ - AddCheckBox( L"Disasm" ); - AddCheckBox( L"Memory" ); - AddCheckBox( L"Bios" ); - AddCheckBox( L"Registers" ); - AddCheckBox( L"Dma" ); - AddCheckBox( L"Pad" ); - AddCheckBox( L"Cdrom" ); - AddCheckBox( L"GPU (PSX)" ); - - SetValue( true ); - Fit(); -}; - -////////////////////////////////////////////////////////////////////////////////////////// -// -LogOptionsDialog::LogOptionsDialog(wxWindow* parent, int id): - wxDialogWithHelpers( parent, id, _("Logging"), true ) -{ - eeLogOptionsPanel& eeBox = *new eeLogOptionsPanel( this ); - iopLogOptionsPanel& iopSizer = *new iopLogOptionsPanel( this ); - - wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxHORIZONTAL, this, _T("Misc") ); - AddCheckBox( miscSizer, L"Log to STDOUT" ); - AddCheckBox( miscSizer, L"SYMs Log" ); - wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL ); - wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL ); - - // Expand comments below are from an attempt of mine to make the dialog box resizable, but it - // only wanted to work right for the miscSizer and I couldn't figure out why the CheckStaticBox - // panel wouldn't also resize to fit the window.. :( -- air - - topSizer.Add( &eeBox, SizerFlags::StdSpace() ); //.Expand() ); - topSizer.Add( &iopSizer, SizerFlags::StdSpace() ); //.Expand() ); - - mainsizer.Add( &topSizer ); //, wxSizerFlags().Expand() ); // topsizer has it's own padding. - mainsizer.Add( &miscSizer, SizerFlags::StdSpace() ); //.Expand() ); - + + mainsizer.Add( new Panels::LogOptionsPanel( this, 480 ) ); + AddOkCancel( mainsizer ); - SetSizerAndFit( &mainsizer, true ); - - ConnectChildrenRecurse( this, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsDialog::LogChecked) ); } - - -void LogOptionsDialog::LogChecked(wxCommandEvent &evt) -{ - // Anything going here should be a checkbox, unless non-checkbox controls send CheckBox_Clicked commands - // (which would seem bad). - wxCheckBox* checker = wxStaticCast( evt.GetEventObject(), wxCheckBox ); - - /*switch( checker->GetId() ) - { - // [TODO] : Implement me! - }*/ - - evt.Skip(); -} - -} // End Namespace Dialogs diff --git a/pcsx2/gui/Dialogs/LogOptionsDialog.h b/pcsx2/gui/Dialogs/LogOptionsDialog.h index 85df195937..8396703b88 100644 --- a/pcsx2/gui/Dialogs/LogOptionsDialog.h +++ b/pcsx2/gui/Dialogs/LogOptionsDialog.h @@ -20,52 +20,16 @@ #include "wxHelpers.h" #include "CheckedStaticBox.h" +#include "Utilities/HashMap.h" + +using namespace HashTools; + namespace Dialogs { class LogOptionsDialog: public wxDialogWithHelpers { public: LogOptionsDialog( wxWindow* parent=NULL, int id=DialogId_LogOptions ); - -protected: - - // ---------------------------------------------------------------------------- - class iopLogOptionsPanel : public CheckedStaticBox - { - public: - iopLogOptionsPanel( wxWindow* parent ); - void OnLogChecked(wxCommandEvent &event); - - }; - - // ---------------------------------------------------------------------------- - class eeLogOptionsPanel : public CheckedStaticBox - { - public: - eeLogOptionsPanel( wxWindow* parent ); - void OnLogChecked(wxCommandEvent &event); - - protected: - class DisasmPanel : public CheckedStaticBox - { - public: - DisasmPanel( wxWindow* parent ); - void OnLogChecked(wxCommandEvent &event); - }; - - class HwPanel : public CheckedStaticBox - { - public: - HwPanel( wxWindow* parent ); - void OnLogChecked(wxCommandEvent &event); - }; - }; - - -public: - void LogChecked(wxCommandEvent &event); - -protected: }; -}; // end namespace Dialogs \ No newline at end of file +} // end namespace Dialogs \ No newline at end of file diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 3ec802fe0d..d9e74d05a0 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -98,17 +98,15 @@ namespace Implementations void Sys_LoggingToggle() { - #ifdef PCSX2_DEVBUILD // There's likely a better way to implement this, but this seemed useful. // I might add turning EE, VU0, and VU1 recs on and off by hotkey at some point, too. // --arcum42 - enableLogging = !enableLogging; - - if (enableLogging) - GSprintf(10, "Logging Enabled."); - else - GSprintf(10,"Logging Disabled."); - #endif + + // FIXME: Some of the trace logs will require recompiler resets to be activated properly. + // But since those haven't been implemented yet, no point in implementing that here either. + + const_cast(EmuConfig).Trace.Enabled = !EmuConfig.Trace.Enabled; + GSprintf(10, EmuConfig.Trace.Enabled ? "Logging Enabled." : "Logging Disabled."); } void Sys_FreezeGS() diff --git a/pcsx2/gui/Panels/BaseConfigPanel.h b/pcsx2/gui/Panels/BaseConfigPanel.h new file mode 100644 index 0000000000..7f40e86d09 --- /dev/null +++ b/pcsx2/gui/Panels/BaseConfigPanel.h @@ -0,0 +1,165 @@ +/* PCSX2 - PS2 Emulator for PCs + * Copyright (C) 2002-2009 PCSX2 Dev Team + * + * PCSX2 is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCSX2. + * If not, see . + */ + +#pragma once + +#include + +#include "AppConfig.h" +#include "wxHelpers.h" + +#include "Utilities/SafeArray.h" +#include "Utilities/EventSource.h" +#include "Utilities/wxGuiTools.h" + +class wxListBox; +class wxBookCtrlBase; + +// Annoyances of C++ forward declarations. Having to type in this red tape mess +// is keeping me from eating a good sandwich right now... >_< +namespace Panels +{ + class BaseApplicableConfigPanel; +} + +namespace Exception +{ + // -------------------------------------------------------------------------- + // Exception used to perform an abort of Apply/Ok action on settings panels. + // When thrown, the user receives a popup message containing the information + // specified in the exception message, and is returned to the settings dialog + // to correct the invalid input fields. + // + class CannotApplySettings : public BaseException + { + public: + bool IsVerbose; + + protected: + Panels::BaseApplicableConfigPanel* m_Panel; + + public: + DEFINE_EXCEPTION_COPYTORS( CannotApplySettings ) + + explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const char* msg=wxLt("Cannot apply new settings, one of the settings is invalid."), bool isVerbose = true ) + { + BaseException::InitBaseEx( msg ); + m_Panel = thispanel; + IsVerbose = isVerbose; + } + + explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const wxString& msg_eng, const wxString& msg_xlt ) + { + BaseException::InitBaseEx( msg_eng, msg_xlt ); + m_Panel = thispanel; + IsVerbose = true; + } + + Panels::BaseApplicableConfigPanel* GetPanel() + { + return m_Panel; + } + }; +} + +namespace Panels +{ + typedef std::list PanelApplyList_t; + + struct StaticApplyState + { + // Static collection of ApplicableConfigPanels currently available to the user. + PanelApplyList_t PanelList; + + // Current book page being initialized. Any apply objects created will use + // this page as their "go here on error" page. (used to take the user to the + // page with the option that failed apply validation). + int CurOwnerPage; + + // TODO : Rename me to CurOwnerBook, or rename the one above to ParentPage. + wxBookCtrlBase* ParentBook; + + StaticApplyState() + { + CurOwnerPage = wxID_NONE; + ParentBook = NULL; + } + + void SetCurrentPage( int page ) + { + CurOwnerPage = page; + } + + void ClearCurrentPage() + { + CurOwnerPage = wxID_NONE; + } + + void StartBook( wxBookCtrlBase* book ); + void StartWizard(); + bool ApplyAll( bool saveOnSuccess=true ); + bool ApplyPage( int pageid, bool saveOnSuccess=true ); + void DoCleanup() throw(); + }; + + extern StaticApplyState g_ApplyState; + + // -------------------------------------------------------------------------------------- + // BaseApplicableConfigPanel + // -------------------------------------------------------------------------------------- + // Extends the Panel class to add an Apply() method, which is invoked from the parent + // window (usually the ConfigurationDialog) when either Ok or Apply is clicked. + // + // Thread Safety: None. This class is only safe when used from the GUI thread, as it uses + // static vars and assumes that only one ApplicableConfig system is available to the + // user at any time (ie, a singular modal dialog). + // + class BaseApplicableConfigPanel : public wxPanelWithHelpers + { + protected: + int m_OwnerPage; + wxBookCtrlBase* m_OwnerBook; + + public: + virtual ~BaseApplicableConfigPanel() + { + g_ApplyState.PanelList.remove( this ); + } + + BaseApplicableConfigPanel( wxWindow* parent, int idealWidth ) + : wxPanelWithHelpers( parent, idealWidth ) + { + m_OwnerPage = g_ApplyState.CurOwnerPage; + m_OwnerBook = g_ApplyState.ParentBook; + + g_ApplyState.PanelList.push_back( this ); + } + + int GetOwnerPage() const { return m_OwnerPage; } + wxBookCtrlBase* GetOwnerBook() { return m_OwnerBook; } + + void SetFocusToMe(); + + // Returns true if this ConfigPanel belongs to the specified page. Useful for doing + // selective application of options for specific pages. + bool IsOnPage( int pageid ) { return m_OwnerPage == pageid; } + + // This method attempts to assign the settings for the panel into the given + // configuration structure (which is typically a copy of g_Conf). If validation + // of form contents fails, the function should throw Exception::CannotApplySettings. + // If no exceptions are thrown, then the operation is assumed a success. :) + virtual void Apply()=0; + }; +} diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 40291d0f54..befa2e8d89 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -23,157 +23,14 @@ #include #include -#include #include -#include +#include "BaseConfigPanel.h" -#include "AppConfig.h" -#include "wxHelpers.h" -#include "Utilities/SafeArray.h" #include "Utilities/Threading.h" -#include "Utilities/EventSource.h" - -class wxListBox; - -// Annoyances of C++ forward declarations. Having to type in this red tape mess -// is keeping me from eating a good sandwich right now... >_< -namespace Panels -{ - class BaseApplicableConfigPanel; -} - -namespace Exception -{ - // -------------------------------------------------------------------------- - // Exception used to perform an abort of Apply/Ok action on settings panels. - // When thrown, the user receives a popup message containing the information - // specified in the exception message, and is returned to the settings dialog - // to correct the invalid input fields. - // - class CannotApplySettings : public BaseException - { - public: - bool IsVerbose; - - protected: - Panels::BaseApplicableConfigPanel* m_Panel; - - public: - DEFINE_EXCEPTION_COPYTORS( CannotApplySettings ) - - explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const char* msg=wxLt("Cannot apply new settings, one of the settings is invalid."), bool isVerbose = true ) - { - BaseException::InitBaseEx( msg ); - m_Panel = thispanel; - IsVerbose = isVerbose; - } - - explicit CannotApplySettings( Panels::BaseApplicableConfigPanel* thispanel, const wxString& msg_eng, const wxString& msg_xlt ) - { - BaseException::InitBaseEx( msg_eng, msg_xlt ); - m_Panel = thispanel; - IsVerbose = true; - } - - Panels::BaseApplicableConfigPanel* GetPanel() - { - return m_Panel; - } - }; -} namespace Panels { - typedef std::list PanelApplyList_t; - - struct StaticApplyState - { - // Static collection of ApplicableConfigPanels currently available to the user. - PanelApplyList_t PanelList; - - // Current book page being initialized. Any apply objects created will use - // this page as their "go here on error" page. (used to take the user to the - // page with the option that failed apply validation). - int CurOwnerPage; - - // TODO : Rename me to CurOwnerBook, or rename the one above to ParentPage. - wxBookCtrlBase* ParentBook; - - StaticApplyState() : - PanelList() - , CurOwnerPage( wxID_NONE ) - , ParentBook( NULL ) - { - } - - void SetCurrentPage( int page ) - { - CurOwnerPage = page; - } - - void ClearCurrentPage() - { - CurOwnerPage = wxID_NONE; - } - - void StartBook( wxBookCtrlBase* book ); - void StartWizard(); - bool ApplyAll( bool saveOnSuccess=true ); - bool ApplyPage( int pageid, bool saveOnSuccess=true ); - void DoCleanup() throw(); - }; - - extern StaticApplyState g_ApplyState; - - ////////////////////////////////////////////////////////////////////////////////////////// - // Extends the Panel class to add an Apply() method, which is invoked from the parent - // window (usually the ConfigurationDialog) when either Ok or Apply is clicked. - // - // Thread Safety: None. This class is only safe when used from the GUI thread, as it uses - // static vars and assumes that only one ApplicableConfig system is available to the - // user at any time (ie, a singular modal dialog). - // - class BaseApplicableConfigPanel : public wxPanelWithHelpers - { - protected: - int m_OwnerPage; - wxBookCtrlBase* m_OwnerBook; - - public: - virtual ~BaseApplicableConfigPanel() - { - g_ApplyState.PanelList.remove( this ); - } - - BaseApplicableConfigPanel( wxWindow* parent, int idealWidth ) : - wxPanelWithHelpers( parent, idealWidth ) - , m_OwnerPage( g_ApplyState.CurOwnerPage ) - , m_OwnerBook( g_ApplyState.ParentBook ) - { - g_ApplyState.PanelList.push_back( this ); - } - - int GetOwnerPage() const { return m_OwnerPage; } - wxBookCtrlBase* GetOwnerBook() { return m_OwnerBook; } - - void SetFocusToMe() - { - if( (m_OwnerBook == NULL) || (m_OwnerPage == wxID_NONE) ) return; - m_OwnerBook->SetSelection( m_OwnerPage ); - } - - // Returns true if this ConfigPanel belongs to the specified page. Useful for doing - // selective application of options for specific pages. - bool IsOnPage( int pageid ) { return m_OwnerPage == pageid; } - - // This method attempts to assign the settings for the panel into the given - // configuration structure (which is typically a copy of g_Conf). If validation - // of form contents fails, the function should throw Exception::CannotApplySettings. - // If no exceptions are thrown, then the operation is assumed a success. :) - virtual void Apply()=0; - }; - ////////////////////////////////////////////////////////////////////////////////////////// // class UsermodeSelectionPanel : public BaseApplicableConfigPanel @@ -579,3 +436,4 @@ namespace Panels friend class EnumThread; }; } + diff --git a/pcsx2/gui/Panels/LogOptionsPanels.cpp b/pcsx2/gui/Panels/LogOptionsPanels.cpp new file mode 100644 index 0000000000..6345cd7dac --- /dev/null +++ b/pcsx2/gui/Panels/LogOptionsPanels.cpp @@ -0,0 +1,193 @@ +/* PCSX2 - PS2 Emulator for PCs + * Copyright (C) 2002-2009 PCSX2 Dev Team + * + * PCSX2 is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCSX2. + * If not, see . + */ + +#include "PrecompiledHeader.h" +#include "LogOptionsPanels.h" + +#include "DebugTools/Debug.h" + + +using namespace wxHelpers; + +#define newCheckBox( name, label ) \ + (wxCheckBox*) s_##name.Add( new pxCheckBox( name##Panel, wxT(label) ) )->GetWindow() + +Panels::eeLogOptionsPanel::eeLogOptionsPanel( LogOptionsPanel* parent ) + : CheckedStaticBox( parent, wxHORIZONTAL, L"EE Logs" ) +{ + CheckBoxDict& chks( parent->CheckBoxes ); + + wxBoxSizer& s_misc = *new wxBoxSizer( wxVERTICAL ); + wxPanelWithHelpers* miscPanel = this; // helper for our newCheckBox macro. + + chks["EE:Memory"] = newCheckBox( misc, "Memory" ); + chks["EE:Bios"] = newCheckBox( misc, "Bios" ); + chks["EE:MMU"] = newCheckBox( misc, "MMU" ); + + // ---------------------------------------------------------------------------- + CheckedStaticBox* disasmPanel = new CheckedStaticBox( this, wxVERTICAL, L"Disasm" ); + wxSizer& s_disasm( disasmPanel->ThisSizer ); + + chks["EE:R5900"] = newCheckBox( disasm, "R5900" ); + chks["EE:COP0"] = newCheckBox( disasm, "COP0 (MMU/SysCtrl)" ); + chks["EE:COP1"] = newCheckBox( disasm, "COP1 (FPU)" ); + chks["EE:COP2"] = newCheckBox( disasm, "COP2 (VU0 macro)" ); + + chks["EE:VU0micro"] = newCheckBox( disasm, "VU0 micro" ); + chks["EE:VU1micro"] = newCheckBox( disasm, "VU1 micro" ); + + disasmPanel->SetValue( false ); + // ---------------------------------------------------------------------------- + CheckedStaticBox* hwPanel = new CheckedStaticBox( this, wxVERTICAL, L"Hardware" ); + wxSizer& s_hw( hwPanel->ThisSizer ); + + chks["EE:KnownHw"] = newCheckBox( hw, "Registers" ); + chks["EE:UnkownHw"] = newCheckBox( hw, "Unknown Regs" ); + chks["EE:DMA"] = newCheckBox( hw, "DMA" ); + chks["EE:VIF"] = newCheckBox( hw, "VIF" ); + chks["EE:GIF"] = newCheckBox( hw, "GIF" ); + chks["EE:SIF"] = newCheckBox( hw, "SIF" ); + chks["EE:SPR"] = newCheckBox( hw, "SPR" ); + chks["EE:IPU"] = newCheckBox( hw, "IPU" ); + + hwPanel->SetValue( false ); + // ---------------------------------------------------------------------------- + + wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL ); + eeStack.Add( disasmPanel, SizerFlags::StdSpace() ); + eeStack.Add( &s_misc ); + + ThisSizer.Add( hwPanel, SizerFlags::StdSpace() ); + ThisSizer.Add( &eeStack ); + + SetValue( true ); +} + +Panels::iopLogOptionsPanel::iopLogOptionsPanel( LogOptionsPanel* parent ) + : CheckedStaticBox( parent, wxVERTICAL, L"IOP Logs" ) +{ + CheckBoxDict& chks( parent->CheckBoxes ); + + wxBoxSizer& s_misc = *new wxBoxSizer( wxVERTICAL ); + wxPanelWithHelpers* miscPanel = this; // helper for our newCheckBox macro. + + chks["IOP:Memory"] = newCheckBox( misc, "Memory" ); + chks["IOP:Bios"] = newCheckBox( misc, "Bios" ); + + // ---------------------------------------------------------------------------- + CheckedStaticBox* disasmPanel = new CheckedStaticBox( this, wxVERTICAL, L"Disasm" ); + wxSizer& s_disasm( disasmPanel->ThisSizer ); + + chks["IOP:Disasm"] = newCheckBox( disasm, "R3000A" ); + chks["IOP:COP2"] = newCheckBox( disasm, "COP2 (Geometry)" ); + + disasmPanel->SetValue( false ); + + // ---------------------------------------------------------------------------- + CheckedStaticBox* hwPanel = new CheckedStaticBox( this, wxVERTICAL, L"Hardware" ); + wxSizer& s_hw( hwPanel->ThisSizer ); + + chks["IOP:KnownHw"] = newCheckBox( hw, "Registers" ); + chks["IOP:UnknownHw"] = newCheckBox( hw, "UnknownRegs" ); + chks["IOP:DMA"] = newCheckBox( hw, "DMA" ); + chks["IOP:Pad"] = newCheckBox( hw, "Pad" ); + chks["IOP:CDVD"] = newCheckBox( hw, "CDVD" ); + chks["IOP:GPU"] = newCheckBox( hw, "GPU (PS1 only)" ); + + hwPanel->SetValue( false ); + // ---------------------------------------------------------------------------- + + wxBoxSizer& iopStack = *new wxBoxSizer( wxVERTICAL ); + iopStack.Add( disasmPanel, SizerFlags::StdSpace() ); + iopStack.Add( &s_misc ); + + ThisSizer.Add( hwPanel, SizerFlags::StdSpace() ); + ThisSizer.Add( &iopStack ); + + SetValue( true ); +} + +// -------------------------------------------------------------------------------------- +// LogOptionsPanel Implementations +// -------------------------------------------------------------------------------------- +Panels::LogOptionsPanel::LogOptionsPanel(wxWindow* parent, int idealWidth ) + : BaseApplicableConfigPanel( parent, idealWidth ) + , m_eeSection ( *new eeLogOptionsPanel( this ) ) + , m_iopSection ( *new iopLogOptionsPanel( this ) ) +{ + wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL ); + wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer& s_misc = *new wxStaticBoxSizer( wxHORIZONTAL, this, L"Misc" ); + wxPanelWithHelpers* miscPanel = this; // helper for our newCheckBox macro. + + CheckBoxes["STDOUT"] = newCheckBox( misc, "Log to STDOUT" ); + CheckBoxes["SYMs"] = newCheckBox( misc, "SYMs Log" ); + + //miscSizer.Add( ("ELF") ); + + topSizer.Add( &m_eeSection, SizerFlags::StdSpace() ); //.Expand() ); + topSizer.Add( &m_iopSection, SizerFlags::StdSpace() ); //.Expand() ); + + mainsizer.Add( &topSizer ); //, wxSizerFlags().Expand() ); // topsizer has it's own padding. + mainsizer.Add( &s_misc, SizerFlags::StdSpace() ); //.Expand() ); + + SetSizer( &mainsizer ); + Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(LogOptionsPanel::OnCheckBoxClicked) ); +} + + +void Panels::LogOptionsPanel::OnCheckBoxClicked(wxCommandEvent &evt) +{ + m_IsDirty = true; +} + +void Panels::LogOptionsPanel::Apply() +{ + CheckBoxDict& chks( CheckBoxes ); + +#define SetEE( name ) \ + g_Conf->EmuOptions.Trace.EE.m_##name = chks["EE:"#name]->GetValue() + + SetEE(EnableAll); + SetEE(Bios); + SetEE(Memory); + SetEE(SysCtrl); + SetEE(VIFunpack); + SetEE(GIFtag); + + SetEE(EnableDisasm); + SetEE(R5900); + SetEE(COP0); + SetEE(COP1); + SetEE(COP2); + SetEE(VU0micro); + SetEE(VU1micro); + + SetEE(EnableHardware); + SetEE(KnownHw); + SetEE(UnknownHw); + SetEE(DMA); + + SetEE(EnableEvents); + SetEE(Counters); + SetEE(VIF); + SetEE(GIF); + SetEE(SPR); + SetEE(IPU); + + // TODO -- IOP Section! +} + diff --git a/pcsx2/gui/Panels/LogOptionsPanels.h b/pcsx2/gui/Panels/LogOptionsPanels.h new file mode 100644 index 0000000000..16361fad6e --- /dev/null +++ b/pcsx2/gui/Panels/LogOptionsPanels.h @@ -0,0 +1,62 @@ +/* PCSX2 - PS2 Emulator for PCs + * Copyright (C) 2002-2009 PCSX2 Dev Team + * + * PCSX2 is free software: you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCSX2. + * If not, see . + */ + +#pragma once + + +#include "BaseConfigPanel.h" +#include "CheckedStaticBox.h" + +#include "Utilities/HashMap.h" + +namespace Panels +{ + typedef HashTools::Dictionary< wxCheckBox* > CheckBoxDict; + + class LogOptionsPanel; + + class eeLogOptionsPanel : public CheckedStaticBox + { + public: + eeLogOptionsPanel( LogOptionsPanel* parent ); + virtual ~eeLogOptionsPanel() throw() {} + }; + + + class iopLogOptionsPanel : public CheckedStaticBox + { + public: + iopLogOptionsPanel( LogOptionsPanel* parent ); + virtual ~iopLogOptionsPanel() throw() {} + }; + + class LogOptionsPanel : public BaseApplicableConfigPanel + { + public: + CheckBoxDict CheckBoxes; + + protected: + eeLogOptionsPanel& m_eeSection; + iopLogOptionsPanel& m_iopSection; + bool m_IsDirty; // any settings modified since last apply will flag this "true" + + public: + LogOptionsPanel( wxWindow* parent, int idealWidth ); + virtual ~LogOptionsPanel() throw() {} + + void OnCheckBoxClicked(wxCommandEvent &event); + void Apply(); + }; +} diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index 4df00305a8..e6084ae001 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -19,7 +19,9 @@ #include "App.h" #include "ps2/BiosTools.h" + #include +#include using namespace wxHelpers; @@ -124,6 +126,13 @@ bool Panels::StaticApplyState::ApplyAll( bool saveOnSuccess ) return ApplyPage( -1, saveOnSuccess ); } +void Panels::BaseApplicableConfigPanel::SetFocusToMe() +{ + if( (m_OwnerBook == NULL) || (m_OwnerPage == wxID_NONE) ) return; + m_OwnerBook->SetSelection( m_OwnerPage ); +} + + // ----------------------------------------------------------------------- Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int idealWidth, bool isFirstTime ) : BaseApplicableConfigPanel( &parent, idealWidth ) diff --git a/pcsx2/gui/wxHelpers.cpp b/pcsx2/gui/wxHelpers.cpp index a6144344af..2576a0ffe1 100644 --- a/pcsx2/gui/wxHelpers.cpp +++ b/pcsx2/gui/wxHelpers.cpp @@ -80,11 +80,11 @@ wxSizerFlags wxHelpers::SizerFlags::Checkbox() } // This method is used internally to create multi line checkboxes and radio buttons. -static void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen ) +static wxStaticText* _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen ) { static const int Indentation = 23; - if( subtext.IsEmpty() ) return; + if( subtext.IsEmpty() ) return NULL; wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext ); if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation ); @@ -92,6 +92,8 @@ static void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxStri pxSetToolTip( joe, tooltip ); sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) ); sizer.AddSpacer( 9 ); + + return joe; } @@ -113,6 +115,27 @@ wxCheckBox& wxHelpers::AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wx return *retval; } +pxCheckBox::pxCheckBox(wxPanelWithHelpers* parent, const wxString& label, const wxString& subtext) + : wxPanel( parent ) +{ + m_checkbox = new wxCheckBox( this, wxID_ANY, label ); + m_idealWidth = parent->GetIdealWidth() - 24; + + wxBoxSizer& mySizer( *new wxBoxSizer(wxVERTICAL) ); + mySizer.Add( m_checkbox, wxHelpers::SizerFlags::StdExpand() ); + m_subtext = _appendStaticSubtext( this, mySizer, subtext, wxEmptyString, m_idealWidth ); + + SetSizer( &mySizer ); +} + +pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip ) +{ + const wxString wrapped( pxFormatToolTipText(this, tip) ); + pxSetToolTip( m_checkbox, wrapped ); + pxSetToolTip( m_subtext, wrapped ); + return *this; +} + // ------------------------------------------------------------------------ // Creates a new Radio button and adds it to the specified sizer/parent combo, with optional tooltip. // Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied @@ -280,17 +303,17 @@ void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply ) ////////////////////////////////////////////////////////////////////////////////////////// // wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, int idealWidth ) : - wxPanel( parent, wxID_ANY ) -, m_idealWidth( idealWidth ) -, m_StartNewRadioGroup( true ) + wxPanel( parent ) { + m_idealWidth = idealWidth; + m_StartNewRadioGroup = true; } wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size ) : wxPanel( parent, wxID_ANY, pos, size ) -, m_idealWidth( wxDefaultCoord ) -, m_StartNewRadioGroup( true ) { + m_idealWidth = wxDefaultCoord; + m_StartNewRadioGroup = true; } diff --git a/pcsx2/gui/wxHelpers.h b/pcsx2/gui/wxHelpers.h index 663c1e8caa..8cd58faf86 100644 --- a/pcsx2/gui/wxHelpers.h +++ b/pcsx2/gui/wxHelpers.h @@ -33,7 +33,6 @@ namespace wxHelpers extern void Launch( const wxString& path ); extern void Launch( const char *path ); - namespace SizerFlags { extern wxSizerFlags StdSpace(); @@ -65,14 +64,15 @@ public: protected: }; + // -------------------------------------------------------------------------------------- // wxPanelWithHelpers // -------------------------------------------------------------------------------------- class wxPanelWithHelpers : public wxPanel { protected: - const int m_idealWidth; - bool m_StartNewRadioGroup; + int m_idealWidth; + bool m_StartNewRadioGroup; public: wxPanelWithHelpers( wxWindow* parent, int idealWidth=wxDefaultCoord ); @@ -94,6 +94,32 @@ protected: } }; +// -------------------------------------------------------------------------------------- +// pxCheckBox +// -------------------------------------------------------------------------------------- +class pxCheckBox : public wxPanel +{ +protected: + wxCheckBox* m_checkbox; + wxStaticText* m_subtext; + int m_idealWidth; + +public: + pxCheckBox( wxPanelWithHelpers* parent, const wxString& label, const wxString& subtext=wxEmptyString ); + virtual ~pxCheckBox() throw() {} + + bool HasSubText() const { return m_subtext != NULL; } + const wxStaticText* GetSubText() const { return m_subtext; } + + pxCheckBox& SetToolTip( const wxString& tip ); + + operator wxCheckBox*() { return m_checkbox; } + operator const wxCheckBox*() const { return m_checkbox; } + + operator wxCheckBox&() { pxAssert( m_checkbox != NULL ); return *m_checkbox; } + operator const wxCheckBox&() const { pxAssert( m_checkbox != NULL ); return *m_checkbox; } +}; + + extern bool pxDialogExists( wxWindowID id ); -extern void pxSetToolTip( wxWindow* wind, const wxString& src ); -extern void pxSetToolTip( wxWindow& wind, const wxString& src ); + diff --git a/pcsx2/ps2/Iop/IopHwRead.cpp b/pcsx2/ps2/Iop/IopHwRead.cpp index 55cd27b503..203f057da9 100644 --- a/pcsx2/ps2/Iop/IopHwRead.cpp +++ b/pcsx2/ps2/Iop/IopHwRead.cpp @@ -64,12 +64,12 @@ mem8_t __fastcall iopHwRead8_Page1( u32 addr ) else { ret = psxHu8(addr); - PSXHW_LOG( "HwRead8 from Unknown, addr 0x%08x = 0x%02x", addr, ret ); + PSXUnkHW_LOG( "HwRead8 from Unknown, addr 0x%08x = 0x%02x", addr, ret ); } return ret; } - PSXHW_LOG( "HwRead8 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName( addr ), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -86,7 +86,7 @@ mem8_t __fastcall iopHwRead8_Page3( u32 addr ) else ret = psxHu8( addr ); - PSXHW_LOG( "HwRead8 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName( addr ), addr, psxHu8(addr) ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -104,7 +104,7 @@ mem8_t __fastcall iopHwRead8_Page8( u32 addr ) else ret = psxHu8( addr ); - PSXHW_LOG( "HwRead8 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName( addr ), addr, psxHu8(addr) ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -308,10 +308,8 @@ static __forceinline T _HwRead_16or32_Page1( u32 addr ) break; } } - - PSXHW_LOG( "HwRead%s from %s, addr 0x%08x = 0x%04x", - (sizeof(T) == 2) ? "16" : "32", _log_GetIopHwName( addr ), addr, ret - ); + + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -334,7 +332,7 @@ mem16_t __fastcall iopHwRead16_Page3( u32 addr ) jASSUME( (addr >> 12) == 0x1f803 ); mem16_t ret = psxHu16(addr); - PSXHW_LOG( "HwRead16 from %s, addr 0x%08x = 0x%04x", _log_GetIopHwName( addr ), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -346,7 +344,7 @@ mem16_t __fastcall iopHwRead16_Page8( u32 addr ) jASSUME( (addr >> 12) == 0x1f808 ); mem16_t ret = psxHu16(addr); - PSXHW_LOG( "HwRead16 from %s, addr 0x%08x = 0x%04x", _log_GetIopHwName( addr ), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -364,7 +362,7 @@ mem32_t __fastcall iopHwRead32_Page3( u32 addr ) // all addresses are assumed to be prefixed with 0x1f803xxx: jASSUME( (addr >> 12) == 0x1f803 ); const mem32_t ret = psxHu32(addr); - PSXHW_LOG( "HwRead32 from %s, addr 0x%08x = 0x%08x", _log_GetIopHwName( addr ), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -408,7 +406,7 @@ mem32_t __fastcall iopHwRead32_Page8( u32 addr ) // HW_SIO2_FIFO -- A yet unknown: Should this be ignored on 32 bit writes, or handled as a // 4-byte FIFO input? // The old IOP system just ignored it, so that's what we do here. I've included commented code - // for treating it as a 16/32 bit write though [which si what the SIO does, for example). + // for treating it as a 16/32 bit write though [which is what the SIO does, for example). mcase(HW_SIO2_FIFO): //ret = sio2_fifoOut(); //ret |= sio2_fifoOut() << 8; @@ -428,7 +426,7 @@ mem32_t __fastcall iopHwRead32_Page8( u32 addr ) } else ret = psxHu32(addr); - PSXHW_LOG( "HwRead32 from %s, addr 0x%08x = 0x%02x", _log_GetIopHwName( addr ), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp index 6898e44707..56d7883bb9 100644 --- a/pcsx2/ps2/Iop/IopHwWrite.cpp +++ b/pcsx2/ps2/Iop/IopHwWrite.cpp @@ -30,7 +30,7 @@ template< typename T > static __forceinline void _generic_write( u32 addr, T val ) { int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); - PSXHW_LOG( "HwWrite%d to %s, addr 0x%08x = 0x%08x\n", bitsize, _log_GetIopHwName(addr), addr, val ); + IopHwTraceLog( addr, val, "Write" ); psxHu(addr) = val; } @@ -46,7 +46,7 @@ static __forceinline T _generic_read( u32 addr ) int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); T ret = psxHu(addr); - PSXHW_LOG( "HwRead%d from %s, addr 0x%08x = 0x%08x\n", bitsize, _log_GetIopHwName(addr), addr, ret ); + IopHwTraceLog( addr, ret, "Read" ); return ret; } @@ -100,7 +100,7 @@ void __fastcall iopHwWrite8_Page1( u32 addr, mem8_t val ) break; } - PSXHW_LOG( "HwWrite8 to %s, addr 0x%08x = 0x%02x\n", _log_GetIopHwName(addr), addr, val ); + IopHwTraceLog( addr, val, "Write" ); } static char g_pbuf[1024]; @@ -128,8 +128,8 @@ void __fastcall iopHwWrite8_Page3( u32 addr, mem8_t val ) } } - PSXHW_LOG( "HwWrite8 to %s, addr 0x%08x = 0x%02x", _log_GetIopHwName(addr), addr, psxHu8(addr) ); psxHu8( addr ) = val; + IopHwTraceLog( addr, val, "Write" ); } void __fastcall iopHwWrite8_Page8( u32 addr, mem8_t val ) @@ -142,8 +142,7 @@ void __fastcall iopHwWrite8_Page8( u32 addr, mem8_t val ) else psxHu8( addr ) = val; - PSXHW_LOG( "HwWrite8 to %s, addr 0x%08x = 0x%02x", _log_GetIopHwName(addr), addr, psxHu8(addr) ); - + IopHwTraceLog( addr, val, "Write" ); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -450,9 +449,7 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val ) } } - PSXHW_LOG( "HwWrite%s to %s, addr 0x%08x = 0x%04x", - sizeof(T) == 2 ? "16" : "32", _log_GetIopHwName( addr ), addr, val - ); + IopHwTraceLog( addr, val, "Write" ); } @@ -468,7 +465,7 @@ void __fastcall iopHwWrite16_Page3( u32 addr, mem16_t val ) // all addresses are assumed to be prefixed with 0x1f803xxx: pxAssert( (addr >> 12) == 0x1f803 ); psxHu16(addr) = val; - PSXHW_LOG( "HwWrite16 to %s, addr 0x%08x = 0x%04x", _log_GetIopHwName( addr ), addr, val ); + IopHwTraceLog( addr, val, "Write" ); } void __fastcall iopHwWrite16_Page8( u32 addr, mem16_t val ) @@ -476,7 +473,7 @@ void __fastcall iopHwWrite16_Page8( u32 addr, mem16_t val ) // all addresses are assumed to be prefixed with 0x1f808xxx: pxAssert( (addr >> 12) == 0x1f808 ); psxHu16(addr) = val; - PSXHW_LOG( "HwWrite16 to %s, addr 0x%08x = 0x%04x", _log_GetIopHwName( addr ), addr, val ); + IopHwTraceLog( addr, val, "Write" ); } ////////////////////////////////////////////////////////////////////////////////////////// @@ -491,7 +488,7 @@ void __fastcall iopHwWrite32_Page3( u32 addr, mem32_t val ) // all addresses are assumed to be prefixed with 0x1f803xxx: pxAssert( (addr >> 12) == 0x1f803 ); psxHu16(addr) = val; - PSXHW_LOG( "HwWrite32 to %s, addr 0x%08x = 0x%04x", _log_GetIopHwName( addr ), addr, val ); + IopHwTraceLog( addr, val, "Write" ); } void __fastcall iopHwWrite32_Page8( u32 addr, mem32_t val ) @@ -538,7 +535,7 @@ void __fastcall iopHwWrite32_Page8( u32 addr, mem32_t val ) } else psxHu32(addr) = val; - PSXHW_LOG( "HwWrite32 to %s, addr 0x%08x = 0x%02x", _log_GetIopHwName( addr ), addr, val ); + IopHwTraceLog( addr, val, "Write" ); } } diff --git a/pcsx2/ps2/Iop/IopHw_Internal.h b/pcsx2/ps2/Iop/IopHw_Internal.h index 721effa340..278de1d606 100644 --- a/pcsx2/ps2/Iop/IopHw_Internal.h +++ b/pcsx2/ps2/Iop/IopHw_Internal.h @@ -30,14 +30,15 @@ namespace Internal { ////////////////////////////////////////////////////////////////////////////////////////// -// Helper for debug logging of IOP Registers. Takes an input address and retuns a +// Helper for debug logging of IOP Registers. Takes an input address and returns a // register name. // // This list is not yet exhaustive. If you spot something that's missing, feel free to // fill it in any time. :) // + template< typename T> -static __forceinline const char* _log_GetIopHwName( u32 addr ) +static __releaseinline const char* _log_GetIopHwName( u32 addr, T val ) { switch( addr ) { @@ -194,7 +195,25 @@ static __forceinline const char* _log_GetIopHwName( u32 addr ) else if( addr >= 0x1f808200 && addr < 0x1f808240 ) { return "SIO2 param"; } else if( addr >= 0x1f808240 && addr < 0x1f808260 ) { return "SIO2 send"; } - return "Unknown"; + return NULL; //"Unknown"; + } +} + +template< typename T> +static __releaseinline void IopHwTraceLog( u32 addr, T val, const char* modestr ) +{ + if( EmuConfig.Trace.IOP.HwEnabled() ) + { + char temp[] = "Hw%s%d from %s, addr 0x%08x = 0x%0*x"; + + // Replace the * above with the operand size (this ensures nicely formatted + // zero-fill hex values): + temp[(sizeof temp)-3] = '0' + (sizeof(T)*2); + + if( const char* regname = _log_GetIopHwName( addr, val ) ) + PSXHW_LOG( temp, modestr, (sizeof T) * 8, regname, addr, val ); + else + PSXUnkHW_LOG( temp, modestr, (sizeof T) * 8, "Unknown", addr, val ); } } diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index fd172996f5..d07eec9b82 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -2373,6 +2373,10 @@ RelativePath="..\..\gui\Panels\AudioPanel.cpp" > + + @@ -2393,6 +2397,14 @@ RelativePath="..\..\gui\Panels\GameFixesPanel.cpp" > + + + + diff --git a/pcsx2/x86/iCOP0.cpp b/pcsx2/x86/iCOP0.cpp index af2f85a942..be7023d15a 100644 --- a/pcsx2/x86/iCOP0.cpp +++ b/pcsx2/x86/iCOP0.cpp @@ -195,8 +195,8 @@ void recMFC0( void ) return; } - else if( _Rd_ == 24){ - COP0_LOG("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); + else if(_Rd_ == 24){ + SysCtrl_LOG("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); return; } _eeOnWriteReg(_Rt_, 1); @@ -288,7 +288,7 @@ void recMTC0() break; case 24: - COP0_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); + SysCtrl_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); break; default: @@ -337,7 +337,7 @@ void recMTC0() break; case 24: - COP0_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); + SysCtrl_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF); break; default: