From 137f0da055ac1c11a7485cca9e1ce3abc0b1c00c Mon Sep 17 00:00:00 2001 From: arcum42 Date: Thu, 12 Nov 2009 12:51:00 +0000 Subject: [PATCH] Add 'Print CDVD Info' back in. In Linux, make writing to stdio optional. Make a few log messages grey. A few misc things. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2191 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVDaccess.cpp | 28 +++++------ pcsx2/Config.h | 20 ++++---- pcsx2/Dump.cpp | 69 ++++++++++++---------------- pcsx2/Elfheader.cpp | 3 +- pcsx2/Pcsx2Config.cpp | 7 +-- pcsx2/SaveState.cpp | 23 +++++----- pcsx2/gui/App.h | 14 +++--- pcsx2/gui/ConsoleLogger.cpp | 24 +++++----- pcsx2/gui/Dialogs/AboutBoxDialog.cpp | 20 ++++---- pcsx2/gui/IsoDropTarget.cpp | 9 ++-- pcsx2/gui/MainFrame.cpp | 18 ++++++-- pcsx2/gui/MainFrame.h | 5 ++ pcsx2/gui/MainMenuClicks.cpp | 39 ++++++++++------ pcsx2/ps2/Iop/IopHwWrite.cpp | 6 +-- pcsx2/x86/ix86-32/iR5900-32.cpp | 15 +++--- 15 files changed, 157 insertions(+), 143 deletions(-) diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index ba70cdb732..591a17f0ba 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -1,6 +1,6 @@ /* 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. @@ -56,7 +56,7 @@ int lastReadSize; int lastLSN; // needed for block dumping // Records last read block length for block dumping -static int plsn = 0; +//static int plsn = 0; static isoFile *blockDumpFile = NULL; // Assertion check for CDVD != NULL (in devel and debug builds), because its handier than @@ -133,7 +133,7 @@ static int FindDiskType(int mType) if (DoCDVDreadSector(bleh, 16, CDVD_MODE_2048) == 0) { //const cdVolDesc& volDesc = (cdVolDesc&)bleh; - //if(volDesc.rootToc.tocSize == 2048) + //if(volDesc.rootToc.tocSize == 2048) if(*(u16*)(bleh+166) == 2048) iCDType = CDVD_TYPE_DETCTCD; else @@ -158,11 +158,11 @@ static int FindDiskType(int mType) case CDVD_TYPE_DETCTCD: Console.WriteLn(" * CDVD Disk Open: CD, %d tracks (%d to %d):", tn.etrack-tn.strack+1,tn.strack,tn.etrack); break; - + case CDVD_TYPE_DETCTDVDS: Console.WriteLn(" * CDVD Disk Open: DVD, Single layer or unknown:"); break; - + case CDVD_TYPE_DETCTDVDD: Console.WriteLn(" * CDVD Disk Open: DVD, Double layer:"); break; @@ -172,7 +172,7 @@ static int FindDiskType(int mType) for(int i = tn.strack; i <= tn.etrack; i++) { cdvdTD td,td2; - + CDVD->getTD(i,&td); if (tn.etrack > i) @@ -182,12 +182,12 @@ static int FindDiskType(int mType) int tlength = td2.lsn - td.lsn; - if (td.type == CDVD_AUDIO_TRACK) + if (td.type == CDVD_AUDIO_TRACK) { audioTracks++; Console.WriteLn(" * * Track %d: Audio (%d sectors)", i,tlength); } - else + else { dataTracks++; Console.WriteLn(" * * Track %d: Data (Mode %d) (%d sectors)", i,((td.type==CDVD_MODE1_TRACK)?1:2),tlength); @@ -241,18 +241,18 @@ static void DetectDiskType() case CDVD_TYPE_PS2CDDA: mType = CDVD_TYPE_DETCTCD; break; - + case CDVD_TYPE_DVDV: case CDVD_TYPE_PS2DVD: mType = CDVD_TYPE_DETCTDVDS; break; - + case CDVD_TYPE_DETCTDVDS: case CDVD_TYPE_DETCTDVDD: case CDVD_TYPE_DETCTCD: mType = baseMediaType; break; - + case CDVD_TYPE_NODISC: diskTypeCached = CDVD_TYPE_NODISC; return; @@ -278,7 +278,7 @@ void CDVDsys_ChangeSource( CDVD_SourceType type ) case CDVDsrc_Iso: CDVD = &CDVDapi_Iso; break; - + case CDVDsrc_NoDisc: CDVD = &CDVDapi_NoDisc; break; @@ -298,10 +298,10 @@ bool DoCDVDopen() // the new disk callback is set on Init also, but just in case the plugin clears it for // some reason on close, we re-send here: CDVD->newDiskCB( cdvdNewDiskCB ); - + // Win32 Fail: the old CDVD api expects MBCS on Win32 platforms, but generating a MBCS // from unicode is problematic since we need to know the codepage of the text being - // converted (which isn't really practical knowledge). A 'best guess' would be the + // converted (which isn't really practical knowledge). A 'best guess' would be the // default codepage of the user's Windows install, but even that will fail and return // question marks if the filename is another language. // Likely Fix: Force new versions of CDVD plugins to expect UTF8 instead. diff --git a/pcsx2/Config.h b/pcsx2/Config.h index d568b3da96..f26947ac1f 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -1,6 +1,6 @@ /* 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. @@ -29,7 +29,7 @@ enum PluginsEnum_t PluginId_FW, PluginId_DEV9, PluginId_Count, - + // Memorycard plugin support is preliminary, and is only hacked/hardcoded in at this // time. So it's placed afer PluginId_Count so that it doesn't show up in the conf // screens or other plugin tables. @@ -83,7 +83,7 @@ struct TraceFiltersEE 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, @@ -91,7 +91,7 @@ struct TraceFiltersEE 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; } @@ -234,7 +234,7 @@ struct TraceLogFilters } void LoadSave( IniInterface& ini ); - + bool operator ==( const TraceLogFilters& right ) const { return OpEqu( Enabled ) && OpEqu( SIF ) && OpEqu( EE ) && OpEqu( IOP ); @@ -346,7 +346,7 @@ struct Pcsx2Config CpuOptions(); void LoadSave( IniInterface& conf ); void ApplySanityCheck(); - + bool operator ==( const CpuOptions& right ) const { return OpEqu( sseMXCSR ) && OpEqu( sseVUMXCSR ) && OpEqu( Recompiler ); @@ -377,7 +377,7 @@ struct Pcsx2Config VideoOptions(); void LoadSave( IniInterface& conf ); - + bool operator ==( const VideoOptions& right ) const { return @@ -457,7 +457,7 @@ struct Pcsx2Config return !this->operator ==( right ); } }; - + BITFIELD32() bool CdvdVerboseReads:1, // enables cdvd read activity verbosely dumped to the console @@ -471,7 +471,9 @@ struct Pcsx2Config McdEnableEjection:1, MultitapPort0_Enabled:1, - MultitapPort1_Enabled:1; + MultitapPort1_Enabled:1, + + ConsoleToStdio:1; BITFIELD_END CpuOptions Cpu; diff --git a/pcsx2/Dump.cpp b/pcsx2/Dump.cpp index 193274aa80..00fd8935e0 100644 --- a/pcsx2/Dump.cpp +++ b/pcsx2/Dump.cpp @@ -1,6 +1,6 @@ /* 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. @@ -12,7 +12,7 @@ * You should have received a copy of the GNU General Public License along with PCSX2. * If not, see . */ - + #include "PrecompiledHeader.h" #include "IopCommon.h" #include "Counters.h" @@ -21,6 +21,7 @@ #include "IPU/IPU.h" #include "AppConfig.h" +#include "Utilities/AsciiFile.h" using namespace R5900; // fixme: currently should not be uncommented. @@ -38,7 +39,7 @@ extern tIPU_BP g_BP; // iR5900-32.cpp extern EEINST* s_pInstCache; -extern u32 s_nEndBlock; // what pc the current block ends +extern u32 s_nEndBlock; // what pc the current block ends void iDumpPsxRegisters(u32 startpc, u32 temp) @@ -51,10 +52,10 @@ void iDumpPsxRegisters(u32 startpc, u32 temp) // fixme: PSXM doesn't exist any more. //__Log("%spsxreg: %x %x ra:%x k0: %x %x", pstr, startpc, psxRegs.cycle, psxRegs.GPR.n.ra, psxRegs.GPR.n.k0, *(int*)PSXM(0x13c128)); - + for(i = 0; i < 34; i+=2) __Log("%spsx%s: %x %x", pstr, disRNameGPR[i], psxRegs.GPR.r[i], psxRegs.GPR.r[i+1]); - - __Log("%scycle: %x %x %x; counters %x %x", pstr, psxRegs.cycle, g_psxNextBranchCycle, EEsCycle, + + __Log("%scycle: %x %x %x; counters %x %x", pstr, psxRegs.cycle, g_psxNextBranchCycle, EEsCycle, psxNextsCounter, psxNextCounter); __Log("psxdma%d c%x b%x m%x t%x", 2, HW_DMA2_CHCR, HW_DMA2_BCR, HW_DMA2_MADR, HW_DMA2_TADR); @@ -67,7 +68,7 @@ void iDumpPsxRegisters(u32 startpc, u32 temp) __Log("psxdma%d c%x b%x m%x", 10, HW_DMA10_CHCR, HW_DMA10_BCR, HW_DMA10_MADR); __Log("psxdma%d c%x b%x m%x", 11, HW_DMA11_CHCR, HW_DMA11_BCR, HW_DMA11_MADR); __Log("psxdma%d c%x b%x m%x", 12, HW_DMA12_CHCR, HW_DMA12_BCR, HW_DMA12_MADR); - + for(i = 0; i < 7; ++i) __Log("%scounter%d: mode %x count %I64x rate %x scycle %x target %I64x", pstr, i, psxCounters[i].mode, psxCounters[i].count, psxCounters[i].rate, psxCounters[i].sCycleT, psxCounters[i].target); #endif @@ -83,40 +84,40 @@ void iDumpRegisters(u32 startpc, u32 temp) const char* pstr;// = temp ? "t" : ""; const u32 dmacs[] = {0x8000, 0x9000, 0xa000, 0xb000, 0xb400, 0xc000, 0xc400, 0xc800, 0xd000, 0xd400 }; const char* psymb; - + if (temp) pstr = "t"; else pstr = ""; - + psymb = disR5900GetSym(startpc); if( psymb != NULL ) __Log("%sreg(%s): %x %x c:%x", pstr, psymb, startpc, cpuRegs.interrupt, cpuRegs.cycle); else __Log("%sreg: %x %x c:%x", pstr, startpc, cpuRegs.interrupt, cpuRegs.cycle); - + for(i = 1; i < 32; ++i) __Log("%s: %x_%x_%x_%x", disRNameGPR[i], cpuRegs.GPR.r[i].UL[3], cpuRegs.GPR.r[i].UL[2], cpuRegs.GPR.r[i].UL[1], cpuRegs.GPR.r[i].UL[0]); - + //for(i = 0; i < 32; i+=4) __Log("cp%d: %x_%x_%x_%x", i, cpuRegs.CP0.r[i], cpuRegs.CP0.r[i+1], cpuRegs.CP0.r[i+2], cpuRegs.CP0.r[i+3]); //for(i = 0; i < 32; ++i) __Log("%sf%d: %f %x", pstr, i, fpuRegs.fpr[i].f, fpuRegs.fprc[i]); //for(i = 1; i < 32; ++i) __Log("%svf%d: %f %f %f %f, vi: %x", pstr, i, VU0.VF[i].F[3], VU0.VF[i].F[2], VU0.VF[i].F[1], VU0.VF[i].F[0], VU0.VI[i].UL); - + for(i = 0; i < 32; ++i) __Log("%sf%d: %x %x", pstr, i, fpuRegs.fpr[i].UL, fpuRegs.fprc[i]); for(i = 1; i < 32; ++i) __Log("%svf%d: %x %x %x %x, vi: %x", pstr, i, VU0.VF[i].UL[3], VU0.VF[i].UL[2], VU0.VF[i].UL[1], VU0.VF[i].UL[0], VU0.VI[i].UL); - + __Log("%svfACC: %x %x %x %x", pstr, VU0.ACC.UL[3], VU0.ACC.UL[2], VU0.ACC.UL[1], VU0.ACC.UL[0]); __Log("%sLO: %x_%x_%x_%x, HI: %x_%x_%x_%x", pstr, cpuRegs.LO.UL[3], cpuRegs.LO.UL[2], cpuRegs.LO.UL[1], cpuRegs.LO.UL[0], cpuRegs.HI.UL[3], cpuRegs.HI.UL[2], cpuRegs.HI.UL[1], cpuRegs.HI.UL[0]); __Log("%sCycle: %x %x, Count: %x", pstr, cpuRegs.cycle, g_nextBranchCycle, cpuRegs.CP0.n.Count); - + iDumpPsxRegisters(psxRegs.pc, temp); __Log("f410,30,40: %x %x %x, %d %d", psHu32(0xf410), psHu32(0xf430), psHu32(0xf440), rdram_sdevid, rdram_devices); __Log("cyc11: %x %x; vu0: %x, vu1: %x", cpuRegs.sCycle[1], cpuRegs.eCycle[1], VU0.cycle, VU1.cycle); __Log("%scounters: %x %x; psx: %x %x", pstr, nextsCounter, nextCounter, psxNextsCounter, psxNextCounter); - + // fixme: The members of the counters[i] struct are wrong here. /*for(i = 0; i < 4; ++i) { __Log("eetimer%d: count: %x mode: %x target: %x %x; %x %x; %x %x %x %x", i, @@ -126,7 +127,7 @@ void iDumpRegisters(u32 startpc, u32 temp) __Log("VIF0_STAT = %x, VIF1_STAT = %x", psHu32(0x3800), psHu32(0x3C00)); __Log("ipu %x %x %x %x; bp: %x %x %x %x", psHu32(0x2000), psHu32(0x2010), psHu32(0x2020), psHu32(0x2030), g_BP.BP, g_BP.bufferhasnew, g_BP.FP, g_BP.IFC); __Log("gif: %x %x %x", psHu32(0x3000), psHu32(0x3010), psHu32(0x3020)); - + for(i = 0; i < ArraySize(dmacs); ++i) { DMACh* p = (DMACh*)(PS2MEM_HW+dmacs[i]); __Log("dma%d c%x m%x q%x t%x s%x", i, p->chcr._u32, p->madr, p->qwc, p->tadr, p->sadr); @@ -143,17 +144,17 @@ void iDumpVU0Registers() // Needs heavy mods to be useful. #ifdef TEST_BROKEN_DUMP_ROUTINES int i; - + for(i = 1; i < 32; ++i) { __Log("v%d: %x %x %x %x, vi: ", i, VF_VAL(VU0.VF[i].UL[3]), VF_VAL(VU0.VF[i].UL[2]), VF_VAL(VU0.VF[i].UL[1]), VF_VAL(VU0.VF[i].UL[0])); - if( i == REG_Q || i == REG_P ) + if( i == REG_Q || i == REG_P ) __Log("%f\n", VU0.VI[i].F); - else if( i == REG_MAC_FLAG ) + else if( i == REG_MAC_FLAG ) __Log("%x\n", 0);//VU0.VI[i].UL&0xff); else if( i == REG_STATUS_FLAG ) __Log("%x\n", 0);//VU0.VI[i].UL&0x03); - else if( i == REG_CLIP_FLAG ) + else if( i == REG_CLIP_FLAG ) __Log("0\n"); else __Log("%x\n", VU0.VI[i].UL); @@ -168,18 +169,18 @@ void iDumpVU1Registers() // Needs heavy mods to be useful. #ifdef TEST_BROKEN_DUMP_ROUTINES int i; - + // static int icount = 0; // __Log("%x\n", icount); - + for(i = 1; i < 32; ++i) { - + // __Log("v%d: w%f(%x) z%f(%x) y%f(%x) x%f(%x), vi: ", i, VU1.VF[i].F[3], VU1.VF[i].UL[3], VU1.VF[i].F[2], VU1.VF[i].UL[2], // VU1.VF[i].F[1], VU1.VF[i].UL[1], VU1.VF[i].F[0], VU1.VF[i].UL[0]); //__Log("v%d: %f %f %f %f, vi: ", i, VU1.VF[i].F[3], VU1.VF[i].F[2], VU1.VF[i].F[1], VU1.VF[i].F[0]); - + __Log("v%d: %x %x %x %x, vi: ", i, VF_VAL(VU1.VF[i].UL[3]), VF_VAL(VU1.VF[i].UL[2]), VF_VAL(VU1.VF[i].UL[1]), VF_VAL(VU1.VF[i].UL[0])); - + if( i == REG_Q || i == REG_P ) __Log("%f\n", VU1.VI[i].F); //else __Log("%x\n", VU1.VI[i].UL); else __Log("%x\n", (i==REG_STATUS_FLAG||i==REG_MAC_FLAG||i==REG_CLIP_FLAG)?0:VU1.VI[i].UL); @@ -188,18 +189,6 @@ void iDumpVU1Registers() #endif } - -#ifdef PCSX2_DEVBUILD -// and not sure what these might have once been used for... (air) -//static const char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n"; -//static const char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n"; -//static const char *txt1 = "REG[%d] = %x_%x\n"; -//static const char *txt2 = "M32 = %x\n"; -#endif -//////////////////////////////////////////////////// - -#include "Utilities/AsciiFile.h" - // Originally from iR5900-32.cpp void iDumpBlock( int startpc, u8 * ptr ) { @@ -207,7 +196,7 @@ void iDumpBlock( int startpc, u8 * ptr ) u8 fpuused[33]; int numused, fpunumused; - Console.WriteLn( "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle ); + DbgCon.WriteLn( Color_Gray, "dump1 %x:%x, %x", startpc, pc, cpuRegs.cycle ); g_Conf->Folders.Logs.Mkdir(); AsciiFile eff( @@ -219,7 +208,7 @@ void iDumpBlock( int startpc, u8 * ptr ) eff.Printf( disR5900GetSym( startpc ) ); eff.Printf( "\n" ); } - + for ( uint i = startpc; i < s_nEndBlock; i += 4 ) { string output; @@ -279,7 +268,7 @@ void iDumpBlock( int startpc, u8 * ptr ) pcur = s_pInstCache+1; for( uint i = 0; i < (s_nEndBlock-startpc)/4; ++i, ++pcur) { fprintf(f, "%2d: %2.2x ", i+1, pcur->info); - + count = 1; for(uint j = 0; j < ArraySize(s_pInstCache->regs); j++) { if( used[j] ) { diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 1b27136390..b0b274e5a4 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -296,7 +296,7 @@ struct ElfObject case 5: machine = "Motorola 88000"; break; case 7: machine = "Intel 80860"; break; case 8: machine = "mips_rs3000"; break; - + default: ELF_LOG( "machine: unknown = %x", header.e_machine ); break; @@ -505,7 +505,6 @@ u32 loadElfCRC( const char* filename ) { u32 crcval = 0; Console.WriteLn("loadElfCRC: %s", filename); - int mylen = strlen( "cdromN:" ); IsoFSCDVD isofs; const int filesize = IsoDirectory(isofs).GetFileSize( fromUTF8(filename) ); diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index f22f8ce583..b85fcb30c0 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -1,6 +1,6 @@ /* 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. @@ -27,7 +27,7 @@ void TraceLogFilters::LoadSave( IniInterface& ini ) IniEntry( Enabled ); IniEntry( SIF ); - + // Retaining backwards compat of the trace log enablers isn't really important, and // doing each one by hand would be murder. So let's cheat and just save it as an int: @@ -236,7 +236,8 @@ void Pcsx2Config::LoadSave( IniInterface& ini ) IniBitBool( CdvdVerboseReads ); IniBitBool( CdvdDumpBlocks ); IniBitBool( EnablePatches ); - + IniBitBool( ConsoleToStdio ); + IniBitBool( SkipBiosSplash ); IniBitBool( McdEnableEjection ); diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index 8c9862b43e..ed181034bd 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -1,6 +1,6 @@ /* 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. @@ -53,7 +53,7 @@ wxString SaveStateBase::GetFilename( int slot ) } SaveStateBase::SaveStateBase( SafeArray& memblock ) : - m_memory( memblock ) + m_memory( memblock ) , m_version( g_SaveVersion ) , m_idx( 0 ) , m_sectid( FreezeId_Unknown ) @@ -98,7 +98,7 @@ void SaveStateBase::FreezeBios() // Check the BIOS, and issue a warning if the bios for this state // doesn't match the bios currently being used (chances are it'll still // work fine, but some games are very picky). - + char descin[128], desccmp[128]; wxString descout; IsBIOS( g_Conf->FullpathToBios(), descout ); @@ -130,7 +130,7 @@ void SaveStateBase::FreezeBios() m_DidBios = true; } -static const int MainMemorySizeInBytes = +static const int MainMemorySizeInBytes = Ps2MemSize::Base + Ps2MemSize::Scratch + Ps2MemSize::Hardware + Ps2MemSize::IopRam + Ps2MemSize::IopHardware + 0x0100; @@ -141,13 +141,13 @@ void SaveStateBase::FreezeMainMemory() // First Block - Memory Dumps // --------------------------- - FreezeMem(PS2MEM_BASE, Ps2MemSize::Base); // 32 MB main memory - FreezeMem(PS2MEM_SCRATCH, Ps2MemSize::Scratch); // scratch pad + FreezeMem(PS2MEM_BASE, Ps2MemSize::Base); // 32 MB main memory + FreezeMem(PS2MEM_SCRATCH, Ps2MemSize::Scratch); // scratch pad FreezeMem(PS2MEM_HW, Ps2MemSize::Hardware); // hardware memory FreezeMem(psxM, Ps2MemSize::IopRam); // 2 MB main memory FreezeMem(psxH, Ps2MemSize::IopHardware); // hardware memory - FreezeMem(psxS, 0x000100); // iop's sif memory + FreezeMem(psxS, 0x000100); // iop's sif memory } void SaveStateBase::FreezeRegisters() @@ -279,7 +279,7 @@ bool SaveStateBase::FreezeSection( int seek_section ) m_sectid++; } break; - + case FreezeId_Registers: { FreezeTag( "HardwareRegisters" ); @@ -293,7 +293,7 @@ bool SaveStateBase::FreezeSection( int seek_section ) m_sectid++; } break; - + case FreezeId_Plugin: { FreezeTag( "Plugin" ); @@ -382,14 +382,14 @@ void memSavingState::FreezeAll() _parent::FreezeAll(); } -memLoadingState::memLoadingState( const SafeArray& load_from ) : +memLoadingState::memLoadingState( const SafeArray& load_from ) : SaveStateBase( const_cast&>(load_from) ) { } memLoadingState::~memLoadingState() { } -// Loading of state data +// Loading of state data void memLoadingState::FreezeMem( void* data, int size ) { const u8* const src = m_memory.GetPtr(m_idx); @@ -407,7 +407,6 @@ bool memLoadingState::SeekToSection( PluginsEnum_t pid ) if( m_sectid == FreezeId_End ) return false; FreezeTag( "Plugin" ); - int seekpos = m_idx + 4; int sectlen = 0xdead; Freeze( sectlen ); diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 564f40b80f..955d47ed04 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -142,6 +142,8 @@ enum MenuIdentifiers MenuId_Website, // Visit our awesome website! MenuId_Profiler, // Enable profiler MenuId_Console, // Enable console + MenuId_Console_Stdio, // Enable Stdio + MenuId_CDVD_Info, // Debug Subsection MenuId_Debug_Open, // opens the debugger window / starts a debug session @@ -415,7 +417,7 @@ public: void OpenGsFrame(); void OnGsFrameClosed(); void OnMainFrameClosed(); - + // -------------------------------------------------------------------------- // Overrides of wxApp virtuals: // -------------------------------------------------------------------------- @@ -525,14 +527,14 @@ DECLARE_APP(Pcsx2App) // -------------------------------------------------------------------------------------- // Use these for "silent fail" invocation of PCSX2 Application-related constructs. If the // construct (albeit wxApp, MainFrame, CoreThread, etc) is null, the requested method will -// not be invoked, and an optional "else" clause cn be affixed for handling the end case. +// not be invoked, and an optional "else" clause can be affixed for handling the end case. // // Usage Examples: // sMainFrame.ApplySettings(); // sMainFrame.ApplySettings(); else Console.WriteLn( "Judge Wapner" ); // 'else' clause for handling NULL scenarios. // -// Note! These macros are not "syntax complete", which means they could generat unexpected -// syntax errors in some situatins, and more importantly they cannot be used for invoking +// Note! These macros are not "syntax complete", which means they could generate unexpected +// syntax errors in some situations, and more importantly, they cannot be used for invoking // functions with return values. // // Rationale: There are a lot of situations where we want to invoke a void-style method on @@ -540,7 +542,7 @@ DECLARE_APP(Pcsx2App) // objects are NULL the most intuitive response is to simply ignore the call request and // continue running silently. These macros make that possible without any extra boilerplate // conditionals or temp variable defines in the code. -// +// #define sApp \ if( Pcsx2App* __app_ = (Pcsx2App*)wxApp::GetInstance() ) (*__app_) @@ -558,7 +560,7 @@ DECLARE_APP(Pcsx2App) // A scoped convenience class for closing a single plugin and saving its state to memory. // Emulation is suspended as needed, and is restored when the object leaves scope. Within // the scope of the object, code is free to call plugin re-configurations or even unload -// a plugin entirely and re-load a different DLL in its place. +// a plugin entirely and re-load a different plugin in its place. // class SaveSinglePluginHelper { diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index feafc4cba6..b0705abd3a 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -639,18 +639,13 @@ void Pcsx2App::ProgramLog_PostEvent( wxEvent& evt ) // ConsoleImpl_ToFile // -------------------------------------------------------------------------------------- -static void __concall _immediate_logger( const wxString& src ) -{ -#ifdef __LINUX__ - ConsoleWriter_Stdio.DoWrite(src); -#endif - px_fputs( emuLog, src.ToUTF8() ); -} - static void __concall ConsoleToFile_Newline() { #ifdef __LINUX__ - ConsoleWriter_Stdio.Newline(); + if (g_Conf->EmuOptions.ConsoleToStdio) ConsoleWriter_Stdio.Newline(); +#endif + +#ifdef __LINUX__ fputc( '\n', emuLog ); #else fputs( "\r\n", emuLog ); @@ -659,16 +654,19 @@ static void __concall ConsoleToFile_Newline() static void __concall ConsoleToFile_DoWrite( const wxString& fmt ) { - _immediate_logger( fmt ); +#ifdef __LINUX__ + if (g_Conf->EmuOptions.ConsoleToStdio) ConsoleWriter_Stdio.DoWrite(fmt); +#endif + + px_fputs( emuLog, fmt.ToUTF8() ); } static void __concall ConsoleToFile_DoWriteLn( const wxString& fmt ) { - _immediate_logger( fmt ); + ConsoleToFile_DoWrite( fmt ); ConsoleToFile_Newline(); - if( emuLog != NULL ) - fflush( emuLog ); + if (emuLog != NULL) fflush( emuLog ); } static void __concall ConsoleToFile_SetTitle( const wxString& title ) diff --git a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp index 99f98fde86..39963c442d 100644 --- a/pcsx2/gui/Dialogs/AboutBoxDialog.cpp +++ b/pcsx2/gui/Dialogs/AboutBoxDialog.cpp @@ -1,6 +1,6 @@ /* 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. @@ -54,16 +54,16 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ): static const wxString LabelAuthors = fromUTF8( "Developers" "\n\n" - "v0.9.6+: Arcum42, Refraction," - "drk||raziel, cottonvibes, gigaherz," + "v0.9.6+: Arcum42, Refraction, " + "drk||raziel, cottonvibes, gigaherz, " "rama, Jake.Stine, saqib, Tmkk, pseudonym" "\n\n" - "Previous versions: Alexey silinov, Aumatt," - "Florin, goldfinger, Linuzappz, loser," + "Previous versions: Alexey silinov, Aumatt, " + "Florin, goldfinger, Linuzappz, loser, " "Nachbrenner, shadow, Zerofrog" "\n\n" - "Betatesting: Bositman, ChaosCode," - "CKemu, crushtest, GeneralPlot," + "Betatesting: Bositman, ChaosCode, " + "CKemu, crushtest, GeneralPlot, " "Krakatos, Parotaku, Rudy_X" "\n\n" "Webmasters: CKemu, Falcon4ever" @@ -74,10 +74,10 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ): "\n\n" "Hiryu and Sjeep (libcdvd / iso filesystem), nneeve (fpu and vu)" "\n\n" - "Plugin Specialists: ChickenLiver (Lilypad), Efp (efp)," + "Plugin Specialists: ChickenLiver (Lilypad), Efp (efp), " "Gabest (Gsdx, Cdvdolio, Xpad), Zeydlitz (ZZogl)" "\n\n" - "Special thanks to: black_wd, Belmont, BGome, _Demo_, Dreamtime," + "Special thanks to: black_wd, Belmont, BGome, _Demo_, Dreamtime, " "F|RES, MrBrown, razorblade, Seta-san, Skarmeth, feal87" ); @@ -124,6 +124,6 @@ Dialogs::AboutBoxDialog::AboutBoxDialog( wxWindow* parent, int id ): mainSizer.Add( new wxButton( this, wxID_OK, L"I've seen enough"), SizerFlags::StdCenter() ); SetSizerAndFit( &mainSizer ); - + CenterOnScreen(); } diff --git a/pcsx2/gui/IsoDropTarget.cpp b/pcsx2/gui/IsoDropTarget.cpp index 9c0a0399b2..6a555a5db9 100644 --- a/pcsx2/gui/IsoDropTarget.cpp +++ b/pcsx2/gui/IsoDropTarget.cpp @@ -71,7 +71,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen { confirmed = Dialogs::IssueConfirmation( m_WindowBound, L"DragDrop:BootELF", ConfButtons().Reset().Cancel(), _("Confirm PS2 Reset"), - _("You have dropped the following ELF binary into PCSX2:\n\n") + + _("You have dropped the following ELF binary into PCSX2:\n\n") + filenames[0] + L"\n\n" + GetMsg_ConfirmSysReset() ) != wxID_CANCEL; } @@ -89,7 +89,7 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen // --------------- // ISO CHECK // --------------- - + // FIXME : The whole IsoFileFormats api (meaning isoOpen / isoDetect / etc) needs to be // converted to C++ and wxInputStream . Until then this is a nasty little exception unsafe // hack ;) @@ -105,19 +105,18 @@ bool IsoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen { Console.WriteLn( L"(Drag&Drop) Found valid ISO file type!" ); - bool confirmed = true; wxWindowID result = wxID_RESET; if( SysHasValidState() ) { result = Dialogs::IssueConfirmation( m_WindowBound, L"DragDrop:BootIso", ConfButtons().Reset().Cancel().Custom(_("Swap Disc")), _("Confirm PS2 Reset"), - _("You have dropped the following ISO image into PCSX2:\n\n") + + _("You have dropped the following ISO image into PCSX2:\n\n") + filenames[0] + L"\n\n" + _("Do you want to swap discs or boot the new image (via system reset)?") ); } - + if( result != wxID_CANCEL ) { SysUpdateIsoSrcFile( filenames[0] ); diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 3ef91e9715..4ce395e09b 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -171,6 +171,8 @@ void MainEmuFrame::ConnectMenus() ConnectMenu( MenuId_Debug_Logging, Menu_Debug_Logging_Click ); ConnectMenu( MenuId_Console, Menu_ShowConsole ); + ConnectMenu( MenuId_Console_Stdio, Menu_ShowConsole_Stdio ); + ConnectMenu( MenuId_CDVD_Info, Menu_PrintCDVD_Info ); ConnectMenu( MenuId_About, Menu_ShowAboutBox ); } @@ -263,6 +265,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ), m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ), + m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, L"Console to Stdio", wxEmptyString, wxITEM_CHECK ) ), m_Listener_CoreThreadStatus( wxGetApp().Source_CoreThreadStatus(), CmdEvt_Listener( this, OnCoreThreadStatusChanged ) ), m_Listener_CorePluginStatus( wxGetApp().Source_CorePluginStatus(), EventListener( this, OnCorePluginStatusChanged ) ), @@ -379,7 +382,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_menuSys.Append(MenuId_Sys_SaveStates, _("Save state"), &m_SaveStatesSubmenu); m_menuSys.AppendSeparator(); - + m_menuSys.Append(MenuId_EnablePatches, _("Enable Patches"), wxEmptyString, wxITEM_CHECK); @@ -415,16 +418,19 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // ------------------------------------------------------------------------ m_menuMisc.Append( &m_MenuItem_Console ); +#ifdef __LINUX__ + m_menuMisc.Append( &m_MenuItem_Console_Stdio ); +#endif //Todo: Though not many people need this one :p //m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); - m_menuMisc.AppendSeparator(); + //m_menuMisc.AppendSeparator(); // No dialogs implemented for these yet... //m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL); - // Ref will want this re-added eventually. - //m_menuMisc.Append(47, _T("Print CDVD Info..."), wxEmptyString, wxITEM_CHECK); + m_menuMisc.Append(MenuId_CDVD_Info, _T("Print CDVD Info"), wxEmptyString, wxITEM_CHECK); + m_menuMisc.AppendSeparator(); //Todo: //There's a great working "open website" in the about panel. Less clutter by just using that. @@ -510,6 +516,10 @@ void MainEmuFrame::ApplySettings() menubar.Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash ); menubar.Check( MenuId_EnablePatches, g_Conf->EmuOptions.EnablePatches ); + menubar.Check( MenuId_CDVD_Info, g_Conf->EmuOptions.CdvdVerboseReads ); +#ifdef __LINUX__ + menubar.Check( MenuId_Console_Stdio, g_Conf->EmuOptions.ConsoleToStdio ); +#endif menubar.Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled ); menubar.Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled ); diff --git a/pcsx2/gui/MainFrame.h b/pcsx2/gui/MainFrame.h index a1d83d297a..e46f4cf9a3 100644 --- a/pcsx2/gui/MainFrame.h +++ b/pcsx2/gui/MainFrame.h @@ -115,6 +115,7 @@ protected: wxMenu& m_SaveStatesSubmenu; wxMenuItem& m_MenuItem_Console; + wxMenuItem& m_MenuItem_Console_Stdio; PerPluginMenuInfo m_PluginMenuPacks[PluginId_Count]; @@ -147,6 +148,8 @@ protected: void ApplyCoreStatus(); void ApplyPluginStatus(); + void SaveEmuOptions(); + void InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf ); void OnCloseWindow(wxCloseEvent& evt); @@ -180,6 +183,8 @@ protected: void Menu_Debug_Logging_Click(wxCommandEvent &event); void Menu_ShowConsole(wxCommandEvent &event); + void Menu_ShowConsole_Stdio(wxCommandEvent &event); + void Menu_PrintCDVD_Info(wxCommandEvent &event); void Menu_ShowAboutBox(wxCommandEvent &event); bool _DoSelectIsoBrowser( wxString& dest ); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 0553e56e4b..4efa648253 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -23,10 +23,21 @@ #include "Dialogs/ConfigurationDialog.h" #include "Dialogs/LogOptionsDialog.h" +#include "IniInterface.h" + using namespace Dialogs; extern wxString GetMsg_ConfirmSysReset(); +void MainEmuFrame::SaveEmuOptions() +{ + if (wxConfigBase* conf = GetAppConfig()) + { + IniSaver saver(*conf); + g_Conf->EmuOptions.LoadSave(saver); + } +} + void MainEmuFrame::Menu_ConfigSettings_Click(wxCommandEvent &event) { Dialogs::ConfigurationDialog( this ).ShowModal(); @@ -146,8 +157,6 @@ void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event ) if( resume ) CoreThread.Resume(); } -#include "IniInterface.h" - void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event ) { g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle ); @@ -158,23 +167,13 @@ void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event ) { g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle ); - - if( wxConfigBase* conf = GetAppConfig() ) - { - IniSaver saver( *conf ); - g_Conf->EmuOptions.LoadSave( saver ); - } + SaveEmuOptions(); } void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent &event ) { g_Conf->EmuOptions.EnablePatches = GetMenuBar()->IsChecked( MenuId_EnablePatches ); - - if( wxConfigBase* conf = GetAppConfig() ) - { - IniSaver saver( *conf ); - g_Conf->EmuOptions.LoadSave( saver ); - } + SaveEmuOptions(); } void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event) @@ -283,6 +282,18 @@ void MainEmuFrame::Menu_ShowConsole(wxCommandEvent &event) wxGetApp().ProgramLog_PostEvent( evt ); } +void MainEmuFrame::Menu_ShowConsole_Stdio(wxCommandEvent &event) +{ + g_Conf->EmuOptions.ConsoleToStdio = GetMenuBar()->IsChecked( MenuId_Console_Stdio ); + SaveEmuOptions(); +} + +void MainEmuFrame::Menu_PrintCDVD_Info(wxCommandEvent &event) +{ + g_Conf->EmuOptions.CdvdVerboseReads = GetMenuBar()->IsChecked( MenuId_CDVD_Info ); + SaveEmuOptions(); +} + void MainEmuFrame::Menu_ShowAboutBox(wxCommandEvent &event) { AboutBoxDialog( this, wxID_ANY ).ShowModal(); diff --git a/pcsx2/ps2/Iop/IopHwWrite.cpp b/pcsx2/ps2/Iop/IopHwWrite.cpp index 56d7883bb9..aaa7065327 100644 --- a/pcsx2/ps2/Iop/IopHwWrite.cpp +++ b/pcsx2/ps2/Iop/IopHwWrite.cpp @@ -1,6 +1,6 @@ /* 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. @@ -29,7 +29,7 @@ using namespace Internal; template< typename T > static __forceinline void _generic_write( u32 addr, T val ) { - int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); + //int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); IopHwTraceLog( addr, val, "Write" ); psxHu(addr) = val; } @@ -43,7 +43,7 @@ void __fastcall iopHwWrite32_generic( u32 addr, mem32_t val ) { _generic_write static __forceinline T _generic_read( u32 addr ) { - int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); + //int bitsize = (sizeof(T) == 1) ? 8 : ( (sizeof(T) == 2) ? 16 : 32 ); T ret = psxHu(addr); IopHwTraceLog( addr, ret, "Read" ); diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index b2b805a3b1..96ab577b00 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -1315,9 +1315,7 @@ static void __fastcall recRecompile( const u32 startpc ) u32 usecop2; #ifdef PCSX2_DEBUG - //dumplog |= 4; - if( dumplog & 4 ) - iDumpRegisters(startpc, 0); + if (dumplog & 4) iDumpRegisters(startpc, 0); #endif pxAssert( startpc ); @@ -1540,14 +1538,15 @@ StartRecomp: #ifdef PCSX2_DEBUG // dump code - for(i = 0; i < ArraySize(s_recblocks); ++i) { - if( startpc == s_recblocks[i] ) { + for(i = 0; i < ArraySize(s_recblocks); ++i) + { + if (startpc == s_recblocks[i]) + { iDumpBlock(startpc, recPtr); } } - if( (dumplog & 1) ) //|| usecop2 ) - iDumpBlock(startpc, recPtr); + if (dumplog & 1) iDumpBlock(startpc, recPtr); #endif u32 sz = (s_nEndBlock-startpc) >> 2; @@ -1618,7 +1617,7 @@ StartRecomp: } else { - DbgCon.WriteLn( "Uncounted Manual block @ 0x%08X : size=%3d page/offs=%05X/%03X inpgsz=%d", + DbgCon.WriteLn( Color_Gray, "Uncounted Manual block @ 0x%08X : size=%3d page/offs=%05X/%03X inpgsz=%d", startpc, sz, inpage_ptr>>12, inpage_ptr&0xfff, pgsz, inpage_sz ); }