From 01c01e9c34e8bac3c478f778de9b9a5eb3f3015b Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Tue, 28 Apr 2009 05:56:22 +0000 Subject: [PATCH] wxGui branch: [linux] Added workspaces and projects for Code::Blocks IDE. Main workspace is currently located in pcsx2/linux/ (will move it to a top level later), and only Pcsx2/zlib projects are tested (and working!). Haven't gotten to any plugins yet. The CodeBlocks project is tested for Debug builds only, and will generate the executable binary to /yoursvnroot/bin/ [same as the MSVC/Win32 build does]. * Note: The 'regular' build script is currently broken and I haven't a darnedest clue how to fix it, since my knowledge of Automake doesn't extend past the end of this sentence. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1079 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/zlib/zlib.cbp | 100 ++++++ pcsx2/Elfheader.cpp | 90 ++--- pcsx2/Exceptions.cpp | 25 +- pcsx2/GS.cpp | 96 +++--- pcsx2/IPU/mpeg2lib/Idct.cpp | 6 +- pcsx2/IPU/mpeg2lib/Mpeg.cpp | 50 +-- pcsx2/IPU/mpeg2lib/Vlc.h | 4 +- pcsx2/Linux/HostGui.cpp | 103 ++++++ pcsx2/Linux/LnxThreads.cpp | 14 +- pcsx2/Linux/pcsx2-codeblocks.workspace | 22 ++ pcsx2/Linux/pcsx2.cbp | 435 ++++++++++++++++++++++++ pcsx2/Memory.cpp | 44 +-- pcsx2/Misc.cpp | 58 ++-- pcsx2/NakedAsm.h | 16 +- pcsx2/NewGUI/Makefile.am | 4 +- pcsx2/PrecompiledHeader.h | 6 +- pcsx2/Saveslots.cpp | 4 +- pcsx2/vssprintf.cpp | 52 +-- pcsx2/vtlb.cpp | 50 +-- pcsx2/x86/iR3000A.cpp | 67 ++-- pcsx2/x86/ix86/implement/xmm/moremovs.h | 28 +- pcsx2/x86/microVU.h | 12 +- pcsx2/xmlpatchloader.cpp | 28 +- 23 files changed, 985 insertions(+), 329 deletions(-) create mode 100644 3rdparty/zlib/zlib.cbp create mode 100644 pcsx2/Linux/HostGui.cpp create mode 100644 pcsx2/Linux/pcsx2-codeblocks.workspace create mode 100644 pcsx2/Linux/pcsx2.cbp diff --git a/3rdparty/zlib/zlib.cbp b/3rdparty/zlib/zlib.cbp new file mode 100644 index 0000000000..0964671767 --- /dev/null +++ b/3rdparty/zlib/zlib.cbp @@ -0,0 +1,100 @@ + + + + + + diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index a423321b64..a6bc488b92 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -39,11 +39,11 @@ struct ELF_HEADER { u32 e_shoff; //Start of section headers (offset from file start) u32 e_flags; //Processor specific flags = 0x20924001 noreorder, mips u16 e_ehsize; //ELF header size (0x34 = 52 bytes) - u16 e_phentsize; //Program headers entry size + u16 e_phentsize; //Program headers entry size u16 e_phnum; //Number of program headers u16 e_shentsize; //Section headers entry size u16 e_shnum; //Number of section headers - u16 e_shstrndx; //Section header stringtable index + u16 e_shstrndx; //Section header stringtable index }; struct ELF_PHR { @@ -94,7 +94,7 @@ Type: 5=HASH hash table 6=DYNAMIC dynamic linking information 7=NOTE -8=NOBITS +8=NOBITS 9=REL relocation entries 10=SHLIB 0x70000000=LOPROC processor specifc @@ -171,25 +171,25 @@ static uint parseCommandLine( const wxString& filename ) p++; else p = filename; - + args_ptr -= strlen( p ) + 1; - + strcpy( (char*)&PS2MEM_BASE[ args_ptr ], p ); //fill param 0; i.e. name of the program for ( i = strlen( p ) + 1 + 256, argc = 0; i > 0; i-- ) { - while (i && ((PS2MEM_BASE[ args_ptr + i ] == 0) || (PS2MEM_BASE[ args_ptr + i ] == 32))) + while (i && ((PS2MEM_BASE[ args_ptr + i ] == 0) || (PS2MEM_BASE[ args_ptr + i ] == 32))) { i--; } - + if ( PS2MEM_BASE[ args_ptr + i + 1 ] == ' ') PS2MEM_BASE[ args_ptr + i + 1 ] = 0; - + while (i && (PS2MEM_BASE[ args_ptr + i ] != 0) && (PS2MEM_BASE[ args_ptr + i] != 32)) { i--; } - + if ((PS2MEM_BASE[ args_ptr + i ] != 0) && (PS2MEM_BASE[ args_ptr + i ] != 32)) { //i==0 argc++; - + if ( args_ptr - 4 - 4 - argc * 4 < 0 ) // fixme - Should this be cast to a signed int? return 0; @@ -241,7 +241,7 @@ struct ElfObject if( header.e_phnum > 0 ) proghead = (ELF_PHR*)&data[header.e_phoff]; - + if( header.e_shnum > 0 ) secthead = (ELF_SHR*)&data[header.e_shoff]; @@ -252,9 +252,9 @@ struct ElfObject Console::Error( "ElfLoader Warning > Size of program headers is not standard" ); ELF_LOG( "type: " ); - switch( header.e_type ) + switch( header.e_type ) { - default: + default: ELF_LOG( "unknown %x", header.e_type ); break; @@ -266,14 +266,14 @@ struct ElfObject ELF_LOG( "relocatable" ); break; - case 0x2: + case 0x2: ELF_LOG( "executable" ); break; - } + } ELF_LOG( "\n" ); ELF_LOG( "machine: " ); - - switch ( header.e_machine ) + + switch ( header.e_machine ) { default: ELF_LOG( "unknown" ); @@ -283,7 +283,7 @@ struct ElfObject ELF_LOG( "mips_rs3000" ); break; } - + ELF_LOG("\n"); ELF_LOG("version: %d",header.e_version); ELF_LOG("entry: %08x",header.e_entry); @@ -296,7 +296,7 @@ struct ElfObject ELF_LOG("sh entsiz: %08x",header.e_shentsize); ELF_LOG("sh num: %08x",header.e_shnum); ELF_LOG("sh strndx: %08x",header.e_shstrndx); - + ELF_LOG("\n"); } @@ -308,9 +308,9 @@ struct ElfObject (strnicmp( work.data(), "cdrom1:", strlen("cdromN:")) == 0)) { int fi = CDVDFS_open(work.data() + strlen("cdromN:"), 1);//RDONLY - + if (fi < 0) throw Exception::FileNotFound( filename ); - + CDVDFS_lseek( fi, 0, SEEK_SET ); rsize = CDVDFS_read( fi, (char*)data.GetPtr(), data.GetSizeInBytes() ); CDVDFS_close( fi ); @@ -321,7 +321,7 @@ struct ElfObject f = fopen( work.data(), "rb" ); if( f == NULL ) Exception::FileNotFound( filename ); - + fseek( f, 0, SEEK_SET ); rsize = fread( data.GetPtr(), 1, data.GetSizeInBytes(), f ); fclose( f ); @@ -349,9 +349,9 @@ struct ElfObject for( int i = 0 ; i < header.e_phnum ; i++ ) { - ELF_LOG( "Elf32 Program Header" ); + ELF_LOG( "Elf32 Program Header" ); ELF_LOG( "type: " ); - + switch ( proghead[ i ].p_type ) { default: ELF_LOG( "unknown %x", (int)proghead[ i ].p_type ); @@ -385,7 +385,7 @@ struct ElfObject } break; } - + ELF_LOG("\n"); ELF_LOG("offset: %08x",(int)proghead[i].p_offset); ELF_LOG("vaddr: %08x",(int)proghead[i].p_vaddr); @@ -398,13 +398,13 @@ struct ElfObject } } - void loadSectionHeaders() + void loadSectionHeaders() { if( secthead == NULL || header.e_shoff > (u32)data.GetLength() ) return; const u8* sections_names = data.GetPtr( secthead[ (header.e_shstrndx == 0xffff ? 0 : header.e_shstrndx) ].sh_offset ); - + int i_st = -1; int i_dt = -1; @@ -415,11 +415,11 @@ struct ElfObject // 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: "); - + switch ( secthead[ i ].sh_type ) { case 0x0: ELF_LOG("null"); break; @@ -431,7 +431,7 @@ struct ElfObject case 0x9: ELF_LOG("rel"); break; default: ELF_LOG("unknown %08x",secthead[i].sh_type); break; } - + ELF_LOG("\n"); ELF_LOG("flags: %08x", secthead[i].sh_flags); ELF_LOG("addr: %08x", secthead[i].sh_addr); @@ -442,11 +442,11 @@ struct ElfObject ELF_LOG("addralign: %08x", secthead[i].sh_addralign); ELF_LOG("entsize: %08x", secthead[i].sh_entsize); // dump symbol table - - if( secthead[ i ].sh_type == 0x02 ) + + if( secthead[ i ].sh_type == 0x02 ) { - i_st = i; - i_dt = secthead[i].sh_link; + i_st = i; + i_dt = secthead[i].sh_link; } #endif } @@ -483,7 +483,7 @@ void ElfApplyPatches() Console::WriteLn( "XML Loader returned an error. Trying to load a pnach..." ); inifile_read( filename.ToAscii().data() ); } - else + else Console::WriteLn( "XML Loading success. Will not load from pnach..." ); applypatch( 0 ); @@ -530,7 +530,7 @@ int loadElfFile(const wxString& filename) if( !filename.StartsWith( L"cdrom0:" ) && !filename.StartsWith( L"cdrom1:" ) ) { // Loading from a file (or non-cd image) - + elfsize = Path::GetFileSize( filename ); } else @@ -551,8 +551,8 @@ int loadElfFile(const wxString& filename) if( elfobj.proghead == NULL ) { throw Exception::CpuStateShutdown( - wxsFormat( wxT("Invalid ELF header encountered in file:\n\t%s"), elfobj.filename ), - wxsFormat(_("Invalid ELF header, file: %s"), elfobj.filename ) + wxsFormat( wxT("Invalid ELF header encountered in file:\n\t%s"), elfobj.filename.c_str() ), + wxsFormat(_("Invalid ELF header, file: %s"), elfobj.filename.c_str() ) ); } @@ -561,10 +561,10 @@ int loadElfFile(const wxString& filename) elfobj.loadProgramHeaders(); elfobj.loadSectionHeaders(); - - cpuRegs.pc = elfobj.header.e_entry; //set pc to proper place + + cpuRegs.pc = elfobj.header.e_entry; //set pc to proper place ELF_LOG( "PC set to: %8.8lx", cpuRegs.pc ); - + cpuRegs.GPR.n.sp.UL[0] = 0x81f00000; cpuRegs.GPR.n.gp.UL[0] = 0x81f80000; // might not be 100% ok //cpuRegs.GPR.n.a0.UL[0] = parseCommandLine( filename ); // see #ifdef'd out parseCommendLine for details. @@ -592,7 +592,7 @@ extern bool path3hack; int g_VUGameFixes = 0; // fixme - this should be moved to patches or eliminated -void LoadGameSpecificSettings() +void LoadGameSpecificSettings() { // default g_VUGameFixes = 0; @@ -604,6 +604,6 @@ void LoadGameSpecificSettings() //case 0xa08c4057: //Sprint Cars (SLUS) //case 0x8b0725d5: //Flinstones Bedrock Racing (SLES) //path3hack = TRUE; // We can move this to patch files right now - //break; + //break; } } diff --git a/pcsx2/Exceptions.cpp b/pcsx2/Exceptions.cpp index faee842f57..b2a65bbae3 100644 --- a/pcsx2/Exceptions.cpp +++ b/pcsx2/Exceptions.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -46,22 +46,23 @@ namespace Exception { // Major hack. After a couple of tries, I'm still not managing to get Linux to catch these exceptions, so that the user actually // gets the messages. Since Console is unavailable at this level, I'm using a simple printf, which of course, means it doesn't get - // logged. But at least the user sees it. - // + // logged. But at least the user sees it. + // // I'll rip this out once I get Linux to actually catch these exceptions. Say, in BeginExecution or StartGui, like I would expect. // -- arcum42 #ifdef __LINUX__ - printf(msg.c_str()); + wxLogError( msg_eng.c_str() ); #endif } - + // given message is assumed to be a translation key, and will be stored in translated // and untranslated forms. - BaseException::BaseException( const char* msg_eng ) : + BaseException::BaseException( const char* msg_eng ) : m_message_eng( GetEnglish( msg_eng ) ), m_message( GetTranslation( msg_eng ) ), m_stacktrace( wxEmptyString ) // unsupported yet { + wxLogError( m_message_eng.c_str() ); } wxString BaseException::LogMessage() const @@ -74,7 +75,7 @@ namespace Exception { return wxsFormat( wxT("Stream exception: %s\n\tObject name: %s"), - m_message_eng, StreamName.c_str() + m_message_eng.c_str(), StreamName.c_str() ) + m_stacktrace; } @@ -94,7 +95,7 @@ namespace Exception wxString PluginFailure::DisplayMessage() const { - return wxsFormat( m_message, plugin_name ); + return wxsFormat( m_message, plugin_name.c_str() ); } // ------------------------------------------------------------------------ @@ -138,7 +139,7 @@ namespace Exception Crc_Savestate, Crc_Cdvd ); } - + wxString StateCrcMismatch::DisplayMessage() const { return wxsFormat( @@ -149,11 +150,11 @@ namespace Exception ) ); } - + // ------------------------------------------------------------------------ wxString IndexBoundsFault::LogMessage() const { - return wxT("Index out of bounds on SafeArray: ") + ArrayName + + return wxT("Index out of bounds on SafeArray: ") + ArrayName + wxsFormat( wxT("(index=%d, size=%d)"), BadIndex, ArrayLength ); } diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index 4ff204c57d..029898a299 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -52,61 +52,61 @@ int g_SaveGSStream = 0; // save GS stream; 1 - prepare, 2 - save int g_nLeftGSFrames = 0; // when saving, number of frames left gzSavingState* g_fGSSave; -void GSGIFTRANSFER1(u32 *pMem, u32 addr) { - if( g_SaveGSStream == 2) { - u32 type = GSRUN_TRANS1; +void GSGIFTRANSFER1(u32 *pMem, u32 addr) { + if( g_SaveGSStream == 2) { + u32 type = GSRUN_TRANS1; u32 size = (0x4000-(addr))/16; g_fGSSave->Freeze( type ); g_fGSSave->Freeze( size ); g_fGSSave->FreezeMem( ((u8*)pMem)+(addr), size*16 ); - } - GSgifTransfer1(pMem, addr); + } + GSgifTransfer1(pMem, addr); } -void GSGIFTRANSFER2(u32 *pMem, u32 size) { - if( g_SaveGSStream == 2) { - u32 type = GSRUN_TRANS2; - u32 _size = size; +void GSGIFTRANSFER2(u32 *pMem, u32 size) { + if( g_SaveGSStream == 2) { + u32 type = GSRUN_TRANS2; + u32 _size = size; g_fGSSave->Freeze( type ); g_fGSSave->Freeze( size ); g_fGSSave->FreezeMem( pMem, _size*16 ); - } - GSgifTransfer2(pMem, size); + } + GSgifTransfer2(pMem, size); } -void GSGIFTRANSFER3(u32 *pMem, u32 size) { - if( g_SaveGSStream == 2 ) { - u32 type = GSRUN_TRANS3; - u32 _size = size; +void GSGIFTRANSFER3(u32 *pMem, u32 size) { + if( g_SaveGSStream == 2 ) { + u32 type = GSRUN_TRANS3; + u32 _size = size; g_fGSSave->Freeze( type ); g_fGSSave->Freeze( size ); g_fGSSave->FreezeMem( pMem, _size*16 ); - } - GSgifTransfer3(pMem, size); + } + GSgifTransfer3(pMem, size); } -__forceinline void GSVSYNC(void) { - if( g_SaveGSStream == 2 ) { - u32 type = GSRUN_VSYNC; - g_fGSSave->Freeze( type ); - } +__forceinline void GSVSYNC(void) { + if( g_SaveGSStream == 2 ) { + u32 type = GSRUN_VSYNC; + g_fGSSave->Freeze( type ); + } } #else -__forceinline void GSGIFTRANSFER1(u32 *pMem, u32 addr) { - GSgifTransfer1(pMem, addr); +__forceinline void GSGIFTRANSFER1(u32 *pMem, u32 addr) { + GSgifTransfer1(pMem, addr); } -__forceinline void GSGIFTRANSFER2(u32 *pMem, u32 size) { - GSgifTransfer2(pMem, size); +__forceinline void GSGIFTRANSFER2(u32 *pMem, u32 size) { + GSgifTransfer2(pMem, size); } -__forceinline void GSGIFTRANSFER3(u32 *pMem, u32 size) { - GSgifTransfer3(pMem, size); +__forceinline void GSGIFTRANSFER3(u32 *pMem, u32 size) { + GSgifTransfer3(pMem, size); } -__forceinline void GSVSYNC(void) { -} +__forceinline void GSVSYNC(void) { +} #endif void _gs_ChangeTimings( u32 framerate, u32 iTicks ) @@ -196,7 +196,7 @@ s32 gsOpen() GSsetBaseMem( PS2MEM_GS ); GSirqCallback( gsIrq ); - m_gsOpened = !GSopen((void *)&pDsp, "PCSX2", 0); + m_gsOpened = !GSopen( &pDsp, "PCSX2", 0 ); } /*if( m_gsOpened ) @@ -244,7 +244,7 @@ void gsReset() gsOnModeChanged( (Config.PsxType & 1) ? FRAMERATE_PAL : FRAMERATE_NTSC, - UpdateVSyncRate() + UpdateVSyncRate() ); memzero_obj(g_RealGSMem); @@ -391,7 +391,7 @@ __forceinline void gsWrite16(u32 mem, u16 value) case GS_CSR+2: gsCSRwrite( (CSRw&0xffff) | ((u32)value<<16)); return; // do not write to MTGS memory - + case GS_IMR: IMRwrite(value); return; // do not write to MTGS memory @@ -451,7 +451,7 @@ void __fastcall gsWrite64_page_01( u32 mem, const mem64_t* value ) IMRwrite((u32)value[0]); return; } - + gsWrite64_generic( mem, value ); } @@ -487,7 +487,7 @@ void __fastcall gsWrite128_page_01( u32 mem, const mem128_t* value ) IMRwrite((u32)value[0]); return; } - + gsWrite128_generic( mem, value ); } @@ -556,7 +556,7 @@ __forceinline u16 gsRead16(u32 mem) return *(u16*)PS2GS_BASE(mem); } -__forceinline u32 gsRead32(u32 mem) +__forceinline u32 gsRead32(u32 mem) { GIF_LOG("GS read 32 from %8.8lx value: %8.8lx", mem, *(u32*)PS2GS_BASE(mem)); return *(u32*)PS2GS_BASE(mem); @@ -604,7 +604,7 @@ void gsSyncLimiterLostTime( s32 deltaTime ) // This function does not regulate frame limiting, meaning it does no stalling. // Stalling functions are performed by the EE: If the MTGS were throtted and not -// the EE, the EE would fill the ringbuffer while the MTGS regulated frames -- +// the EE, the EE would fill the ringbuffer while the MTGS regulated frames -- // fine for most situations but could result in literally dozens of frames queued // up in the ringbuffer durimg some game menu screens; which in turn would result // in a half-second lag of keystroke actions becoming visible to the user (bad!). @@ -619,7 +619,7 @@ __forceinline void gsFrameSkip( bool forceskip ) static u8 FramesToRender = 0; static u8 FramesToSkip = 0; - if( CHECK_FRAMELIMIT != PCSX2_FRAMELIMIT_SKIP && + if( CHECK_FRAMELIMIT != PCSX2_FRAMELIMIT_SKIP && CHECK_FRAMELIMIT != PCSX2_FRAMELIMIT_VUSKIP ) return; // FrameSkip and VU-Skip Magic! @@ -627,7 +627,7 @@ __forceinline void gsFrameSkip( bool forceskip ) // This is the least number of consecutive frames we will render w/o skipping const int noSkipFrames = ((Config.CustomConsecutiveFrames>0) ? Config.CustomConsecutiveFrames : 1); - // This is the number of consecutive frames we will skip + // This is the number of consecutive frames we will skip const int yesSkipFrames = ((Config.CustomConsecutiveSkip>0) ? Config.CustomConsecutiveSkip : 1); const u64 iEnd = GetCPUTicks(); @@ -651,7 +651,7 @@ __forceinline void gsFrameSkip( bool forceskip ) } return; } - + // if we've already given the EE a skipcount assignment then don't do anything more. // Otherwise we could start compounding the issue and skips would be too long. if( g_vu1SkipCount > 0 ) @@ -665,23 +665,23 @@ __forceinline void gsFrameSkip( bool forceskip ) // -- Standard operation section -- // Means neither skipping frames nor force-rendering consecutive frames. - if( sSlowDeltaTime > 0 ) + if( sSlowDeltaTime > 0 ) { // The game is running below the minimum framerate. // But don't start skipping yet! That would be too sensitive. // So the skipping code is only engaged if the SlowDeltaTime falls behind by // a full frame, or if we're already skipping (in which case we don't care // to avoid errant skips). - + // Note: The MTGS can go out of phase from the EE, which means that the // variance for a "nominal" framerate can range from 0 to m_iSlowTicks. // We also check for that here. - if( (m_justSkipped && (sSlowDeltaTime > m_iSlowTicks)) || + if( (m_justSkipped && (sSlowDeltaTime > m_iSlowTicks)) || (sSlowDeltaTime > m_iSlowTicks*2) ) { //Console::Status( "Frameskip Initiated! Lateness: %d", params (int)( (sSlowDeltaTime*100) / m_iSlowTicks ) ); - + if( CHECK_FRAMELIMIT == PCSX2_FRAMELIMIT_VUSKIP ) { // For best results we have to wait for the EE to @@ -755,7 +755,7 @@ void gsPostVsyncEnd( bool updategs ) { *(u32*)(PS2MEM_GS+0x1000) ^= 0x2000; // swap the vsync field - if( mtgsThread != NULL ) + if( mtgsThread != NULL ) mtgsThread->PostVsyncEnd( updategs ); else { @@ -789,7 +789,7 @@ void gsDynamicSkipEnable() if( !m_StrictSkipping ) return; mtgsWaitGS(); - m_iSlowStart = GetCPUTicks(); + m_iSlowStart = GetCPUTicks(); frameLimitReset(); } diff --git a/pcsx2/IPU/mpeg2lib/Idct.cpp b/pcsx2/IPU/mpeg2lib/Idct.cpp index e37294fa34..52a00c9128 100644 --- a/pcsx2/IPU/mpeg2lib/Idct.cpp +++ b/pcsx2/IPU/mpeg2lib/Idct.cpp @@ -25,12 +25,12 @@ #include "PrecompiledHeader.h" #include "Common.h" -#include "IPU.h" +#include "IPU/IPU.h" #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ #define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */ -#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ +#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */ #define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */ #define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */ #define clp(val,res) res = (val < 0) ? 0 : ((val > 255) ? 255 : val); @@ -265,7 +265,7 @@ void mpeg2_idct_mmx_init (void); void mpeg2_idct_init() { int i, j; - + mpeg2_idct_copy = mpeg2_idct_copy_c; mpeg2_idct_add = mpeg2_idct_add_c; for (i = -384; i < 640; i++) diff --git a/pcsx2/IPU/mpeg2lib/Mpeg.cpp b/pcsx2/IPU/mpeg2lib/Mpeg.cpp index 85fb80e084..68a8c9e666 100644 --- a/pcsx2/IPU/mpeg2lib/Mpeg.cpp +++ b/pcsx2/IPU/mpeg2lib/Mpeg.cpp @@ -29,10 +29,10 @@ #include "PrecompiledHeader.h" #include "Common.h" -#include "IPU.h" +#include "IPU/IPU.h" +#include "IPU/coroutine.h" #include "Mpeg.h" #include "Vlc.h" -#include "coroutine.h" int non_linear_quantizer_scale [] = { 0, 1, 2, 3, 4, 5, 6, 7, @@ -211,8 +211,8 @@ static __forceinline int get_luma_dc_dct_diff (decoder_t * const decoder) DUMPBITS (bit_buf, bits, 3); return 0; } - } - + } + tab = DC_long + (UBITS (bit_buf, 9) - 0x1e0);//0x1e0); size = tab->size; DUMPBITS (bit_buf, bits, tab->len); @@ -250,7 +250,7 @@ static __forceinline int get_chroma_dc_dct_diff (decoder_t * const decoder) return 0; } } - + tab = DC_long + (UBITS (bit_buf, 10) - 0x3e0); size = tab->size; DUMPBITS (bit_buf, bits, tab->len + 1); @@ -631,7 +631,7 @@ static __forceinline void get_mpeg1_intra_block (decoder_t * const decoder) bit_buf = decoder->bitstream_buf; bits = decoder->bitstream_bits; bit_ptr = decoder->bitstream_ptr; - + NEEDBITS (bit_buf, bits, bit_ptr); while (1) { @@ -918,7 +918,7 @@ struct TGA_HEADER s16 height; // image height in pixels u8 bits; // image bits per pixel 8,16,24,32 u8 descriptor; // image descriptor bits (vh flip bits) - + // pixel data follows header #if defined(_MSC_VER) }; @@ -935,7 +935,7 @@ void SaveTGA(const char* filename, int width, int height, void* pdata) return; assert( sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18 ); - + memzero_obj(hdr); hdr.imagetype = 2; hdr.bits = 32; @@ -963,7 +963,7 @@ void waitForSCD() while(!getBits8((u8*)&bit8, 0)) so_resume(); - if (bit8==0) + if (bit8==0) { if (g_BP.BP & 7) g_BP.BP += 8 - (g_BP.BP&7); @@ -1018,8 +1018,8 @@ void mpeg2sliceIDEC(void* pdone) *(int*)pdone = 0; bitstream_init(decoder); - decoder->dc_dct_pred[0] = - decoder->dc_dct_pred[1] = + decoder->dc_dct_pred[0] = + decoder->dc_dct_pred[1] = decoder->dc_dct_pred[2] = 128 << decoder->intra_dc_precision; decoder->mbc=0; @@ -1033,11 +1033,11 @@ void mpeg2sliceIDEC(void* pdone) int DCT_offset, DCT_stride; int mba_inc; const MBAtab * mba; - + NEEDBITS (decoder->bitstream_buf, decoder->bitstream_bits, decoder->bitstream_ptr); - + decoder->macroblock_modes = get_macroblock_modes (decoder); - + /* maybe integrate MACROBLOCK_QUANT test into get_macroblock_modes ? */ if (decoder->macroblock_modes & MACROBLOCK_QUANT)//only IDEC decoder->quantizer_scale = get_quantizer_scale (decoder); @@ -1063,7 +1063,7 @@ void mpeg2sliceIDEC(void* pdone) slice_intra_DCT (decoder, 0, (u8*)decoder->mb8->Y + DCT_offset + 8, DCT_stride); slice_intra_DCT (decoder, 1, (u8*)decoder->mb8->Cb, decoder->stride>>1); slice_intra_DCT (decoder, 2, (u8*)decoder->mb8->Cr, decoder->stride>>1); - + // Send The MacroBlock via DmaIpuFrom if (decoder->ofm==0){ ipu_csc(decoder->mb8, decoder->rgb32, decoder->sgn); @@ -1127,9 +1127,9 @@ void mpeg2sliceIDEC(void* pdone) { ipuRegs->ctrl.SCD = 0; coded_block_pattern=decoder->coded_block_pattern; - + g_BP.BP+=decoder->bitstream_bits-16; - + if((int)g_BP.BP < 0) { g_BP.BP = 128 + (int)g_BP.BP; @@ -1137,11 +1137,11 @@ void mpeg2sliceIDEC(void* pdone) // so that reading may continue properly ReorderBitstream(); } - + FillInternalBuffer(&g_BP.BP,1,0); - + waitForSCD(); - + *(int*)pdone = 1; so_exit(); } @@ -1149,7 +1149,7 @@ void mpeg2sliceIDEC(void* pdone) } DUMPBITS (decoder->bitstream_buf, decoder->bitstream_bits, mba->len); mba_inc += mba->mba; - + if (mba_inc) { decoder->dc_dct_pred[0] = decoder->dc_dct_pred[1] = decoder->dc_dct_pred[2] = 128 << decoder->intra_dc_precision; @@ -1173,9 +1173,9 @@ void mpeg2sliceIDEC(void* pdone) // so that reading may continue properly ReorderBitstream(); } - + FillInternalBuffer(&g_BP.BP,1,0); - + waitForSCD(); *(int*)pdone = 1; @@ -1198,7 +1198,7 @@ void mpeg2_slice(void* pdone) memzero_obj(*decoder->mb16); bitstream_init (decoder); - + if (decoder->dcr) decoder->dc_dct_pred[0] = decoder->dc_dct_pred[1] = decoder->dc_dct_pred[2] = 128 << decoder->intra_dc_precision; @@ -1229,7 +1229,7 @@ void mpeg2_slice(void* pdone) if (decoder->coded_block_pattern & 0x04) slice_non_intra_DCT (decoder, (s16*)decoder->mb16->Y + DCT_offset + 8, DCT_stride); if (decoder->coded_block_pattern & 0x2) slice_non_intra_DCT (decoder, (s16*)decoder->mb16->Cb, decoder->stride>>1); if (decoder->coded_block_pattern & 0x1) slice_non_intra_DCT (decoder, (s16*)decoder->mb16->Cr, decoder->stride>>1); - + } } diff --git a/pcsx2/IPU/mpeg2lib/Vlc.h b/pcsx2/IPU/mpeg2lib/Vlc.h index 10d3353949..4867b2175c 100644 --- a/pcsx2/IPU/mpeg2lib/Vlc.h +++ b/pcsx2/IPU/mpeg2lib/Vlc.h @@ -25,7 +25,7 @@ #ifndef __VLC_H__ #define __VLC_H__ -#include "coroutine.h" +#include "IPU/coroutine.h" static u8 data[2]; static u8 dword[4]; @@ -48,7 +48,7 @@ static __forceinline void bitstream_init (decoder_t * decoder){ while( !getBits32(dword, 1) ) so_resume(); - decoder->bitstream_buf = (dword[0] << 24) | (dword[1] << 16) | + decoder->bitstream_buf = (dword[0] << 24) | (dword[1] << 16) | (dword[2] << 8) |dword[3]; } diff --git a/pcsx2/Linux/HostGui.cpp b/pcsx2/Linux/HostGui.cpp new file mode 100644 index 0000000000..609fc67e3e --- /dev/null +++ b/pcsx2/Linux/HostGui.cpp @@ -0,0 +1,103 @@ +/* Pcsx2 - Pc Ps2 Emulator + * Copyright (C) 2002-2009 Pcsx2 Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "PrecompiledHeader.h" + +#include +#include +#include "Common.h" +//#include "x86/iR5900.h" + +extern void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ); +extern void __fastcall InstallLinuxExceptionHandler(); +extern void __fastcall ReleaseLinuxExceptionHandler(); + +#define PCSX2_MEM_PROTECT_BEGIN() InstallLinuxExceptionHandler() +#define PCSX2_MEM_PROTECT_END() ReleaseLinuxExceptionHandler() + +extern void SignalExit(int sig); + +static const uptr m_pagemask = getpagesize()-1; + +void InstallLinuxExceptionHandler() +{ + struct sigaction sa; + + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + sa.sa_sigaction = &SysPageFaultExceptionFilter; + sigaction(SIGSEGV, &sa, NULL); +} + +void ReleaseLinuxExceptionHandler() +{ + // Code this later. +} + +// Linux implementation of SIGSEGV handler. Bind it using sigaction(). +void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ) +{ + // get bad virtual address + uptr offset = (u8*)info->si_addr - psM; + + DevCon::Status( "Protected memory cleanup. Offset 0x%x", params offset ); + + if (offset>=Ps2MemSize::Base) + { + // Bad mojo! Completely invalid address. + // Instigate a crash or abort emulation or something. + assert( false ); + } + + mmap_ClearCpuBlock( offset & ~m_pagemask ); +} + +namespace HostSys +{ + void *Mmap(uptr base, u32 size) + { + u8 *Mem; + Mem = (u8*)mmap((uptr*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + if (Mem == MAP_FAILED) Console::Notice("Mmap Failed!"); + + return Mem; + } + + void Munmap(uptr base, u32 size) + { + munmap((uptr*)base, size); + } + + void MemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution ) + { + int lnxmode = 0; + + // make sure size is aligned to the system page size: + size = (size + m_pagemask) & ~m_pagemask; + + switch( mode ) + { + case Protect_NoAccess: break; + case Protect_ReadOnly: lnxmode = PROT_READ; break; + case Protect_ReadWrite: lnxmode = PROT_READ | PROT_WRITE; break; + } + + if( allowExecution ) lnxmode |= PROT_EXEC; + mprotect( baseaddr, size, lnxmode ); + } +} diff --git a/pcsx2/Linux/LnxThreads.cpp b/pcsx2/Linux/LnxThreads.cpp index 42d27dcc32..02c04ba314 100644 --- a/pcsx2/Linux/LnxThreads.cpp +++ b/pcsx2/Linux/LnxThreads.cpp @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "Linux.h" -#include "../x86/ix86/ix86.h" +#include "PrecompiledHeader.h" +#include "ix86/ix86.h" // Note: assuming multicore is safer because it forces the interlocked routines to use // the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not @@ -64,7 +64,7 @@ namespace Threading // performance hint and isn't required). __asm__ ( "pause" ); } - + void* Thread::_internal_callback( void* itsme ) { jASSUME( itsme != NULL ); @@ -119,7 +119,7 @@ namespace Threading :"=&a" (result) :"m" (*Target), "r" (Value)); } - + return result; } @@ -166,7 +166,7 @@ namespace Threading :"=a" (result) :"m" (*dest), "r" (value), "a" (comp)); } - + return result; } @@ -184,7 +184,7 @@ namespace Threading __forceinline s64 pcsx2_InterlockedCompareExchange64(volatile s64* dest, s64 exch, s64 comp) { s64 old; - __asm__ __volatile__( + __asm__ __volatile__( "lock; cmpxchgq %q2, %q1" : "=a" (old) : "r" (exch), "m" (*dest), "a" (comp) @@ -192,5 +192,5 @@ namespace Threading return old; } #endif - + } diff --git a/pcsx2/Linux/pcsx2-codeblocks.workspace b/pcsx2/Linux/pcsx2-codeblocks.workspace new file mode 100644 index 0000000000..5b2eaeb9bf --- /dev/null +++ b/pcsx2/Linux/pcsx2-codeblocks.workspace @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp new file mode 100644 index 0000000000..dbba8f8d73 --- /dev/null +++ b/pcsx2/Linux/pcsx2.cbp @@ -0,0 +1,435 @@ + + + + + + diff --git a/pcsx2/Memory.cpp b/pcsx2/Memory.cpp index d279b010f5..5794fb00d2 100644 --- a/pcsx2/Memory.cpp +++ b/pcsx2/Memory.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -21,10 +21,10 @@ RAM --- 0x00100000-0x01ffffff this is the physical address for the ram.its cached there -0x20100000-0x21ffffff uncached -0x30100000-0x31ffffff uncached & acceleretade +0x20100000-0x21ffffff uncached +0x30100000-0x31ffffff uncached & acceleretade 0xa0000000-0xa1ffffff MIRROR might...??? -0x80000000-0x81ffffff MIRROR might... ???? +0x80000000-0x81ffffff MIRROR might... ???? scratch pad ---------- @@ -93,8 +93,8 @@ void loadBiosRom( const wxChar *ext, u8 *dest, long maxSize ) // Try first a basic extension concatenation (normally results in something like name.bin.rom1) const wxString Bios( g_Conf.Files.Bios() ); - Bios1.Printf( wxS("%s.%s"), Bios.c_str(), ext); - + Bios1.Printf( wxT("%s.%s"), Bios.c_str(), ext); + if( (filesize=Path::GetFileSize( Bios1 ) ) <= 0 ) { // Try the name properly extensioned next (name.rom1) @@ -136,7 +136,7 @@ void MyMemCheck(u32 mem) } ///////////////////////////// -// REGULAR MEM START +// REGULAR MEM START ///////////////////////////// vtlbHandler tlb_fallback_0; vtlbHandler tlb_fallback_1; @@ -171,7 +171,7 @@ void memMapPhy() { //Main mem vtlb_MapBlock(psM,0x00000000,Ps2MemSize::Base);//mirrored on first 256 mb ? - + //Rom vtlb_MapBlock(psR,0x1fc00000,Ps2MemSize::Rom);//Writable ? //Rom 1 @@ -230,18 +230,18 @@ void memMapKernelMem() } //what do do with these ? -void memMapSupervisorMem() +void memMapSupervisorMem() { } -void memMapUserMem() +void memMapUserMem() { } template -mem8_t __fastcall _ext_memRead8 (u32 mem) +mem8_t __fastcall _ext_memRead8 (u32 mem) { - switch (p) + switch (p) { case 1: // hwm return hwRead8(mem); @@ -297,7 +297,7 @@ mem16_t __fastcall _ext_memRead16(u32 mem) } template -mem32_t __fastcall _ext_memRead32(u32 mem) +mem32_t __fastcall _ext_memRead32(u32 mem) { switch (p) { @@ -586,7 +586,7 @@ void __fastcall vuMicroWrite128(u32 addr,const mem128_t* data) } } -void memSetPageAddr(u32 vaddr, u32 paddr) +void memSetPageAddr(u32 vaddr, u32 paddr) { //Console::WriteLn("memSetPageAddr: %8.8x -> %8.8x", params vaddr, paddr); @@ -594,7 +594,7 @@ void memSetPageAddr(u32 vaddr, u32 paddr) } -void memClearPageAddr(u32 vaddr) +void memClearPageAddr(u32 vaddr) { //Console::WriteLn("memClearPageAddr: %8.8x", params vaddr); @@ -609,13 +609,13 @@ void memClearPageAddr(u32 vaddr) /////////////////////////////////////////////////////////////////////////// // PS2 Memory Init / Reset / Shutdown -static const uint m_allMemSize = +static const uint m_allMemSize = Ps2MemSize::Rom + Ps2MemSize::Rom1 + Ps2MemSize::Rom2 + Ps2MemSize::ERom + Ps2MemSize::Base + Ps2MemSize::Hardware + Ps2MemSize::Scratch; static u8* m_psAllMem = NULL; -void memAlloc() +void memAlloc() { if( m_psAllMem == NULL ) m_psAllMem = vtlb_malloc( m_allMemSize, 4096, 0x2400000 ); @@ -625,7 +625,7 @@ void memAlloc() u8* curpos = m_psAllMem; psM = curpos; curpos += Ps2MemSize::Base; - psR = curpos; curpos += Ps2MemSize::Rom; + psR = curpos; curpos += Ps2MemSize::Rom; psR1 = curpos; curpos += Ps2MemSize::Rom1; psR2 = curpos; curpos += Ps2MemSize::Rom2; psER = curpos; curpos += Ps2MemSize::ERom; @@ -633,7 +633,7 @@ void memAlloc() psS = curpos; //curpos += Ps2MemSize::Scratch; } -void memShutdown() +void memShutdown() { vtlb_free( m_psAllMem, m_allMemSize ); m_psAllMem = NULL; @@ -843,7 +843,7 @@ void mmap_ResetBlockTracking() void mmap_ClearCpuBlock( uint offset ) { HostSys::MemProtect( &psM[offset], 1, Protect_ReadWrite ); - + offset>>=12; psMPWC[(offset/32)]|=(1<<(offset&31)); @@ -852,4 +852,4 @@ void mmap_ClearCpuBlock( uint offset ) Cpu->Clear(psMPWVA[offset][i],0x400); } psMPWVA[offset].clear(); -} \ No newline at end of file +} diff --git a/pcsx2/Misc.cpp b/pcsx2/Misc.cpp index 78dacf8df6..a2db71172b 100644 --- a/pcsx2/Misc.cpp +++ b/pcsx2/Misc.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -70,7 +70,7 @@ struct romdir u16 extInfoSize; u32 fileSize; #if defined(_MSC_VER) -}; +}; #pragma pack() //+22 #else } __attribute__((packed)); @@ -146,12 +146,12 @@ bool IsBIOS(const wxString& filename, wxString& description) if (strcmp(rd.fileName, "ROMVER") == 0) // found romver { char aROMVER[14+1]; // ascii version loaded from disk. - + uint filepos = fp.Tell(); fp.Seek( fileOffset ); if( fp.Read( &aROMVER, 14 ) == 0 ) break; fp.Seek( filepos ); //go back - + const char zonefail[2] = { aROMVER[4], '\0' }; // the default "zone" (unknown code) const char* zone = zonefail; @@ -217,13 +217,13 @@ int GetPS2ElfName( wxString& name ) Console::Error("Boot Error > SYSTEM.CNF not found"); return 0;//could not find; not a PS/PS2 cdvd } - + f=CDVDFS_open("SYSTEM.CNF;1", 1); CDVDFS_read(f, buffer, g_MaxPath); CDVDFS_close(f); - + buffer[tocEntry.fileSize]='\0'; - + pos=strstr(buffer, "BOOT2"); if (pos==NULL){ pos=strstr(buffer, "BOOT"); @@ -234,7 +234,7 @@ int GetPS2ElfName( wxString& name ) return 1; } pos+=strlen("BOOT2"); - while (pos && *pos && pos<&buffer[g_MaxPath] + while (pos && *pos && pos<&buffer[g_MaxPath] && (*pos<'A' || (*pos>'Z' && *pos<'a') || *pos>'z')) pos++; if (!pos || *pos==0) @@ -283,10 +283,10 @@ void SaveGSState(const wxString& file) if( g_SaveGSStream ) return; Console::WriteLn( "Saving GS State..." ); - Console::WriteLn( "\t%s", params file.mb_str() ); + Console::WriteLn( wxsFormat( L"\t%s", file.c_str() ) ); g_fGSSave = new gzSavingState( file ); - + g_SaveGSStream = 1; g_nLeftGSFrames = 2; @@ -419,7 +419,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) { assert(fkey >= 1 && fkey <= 12 ); - switch(fkey) + switch(fkey) { case 1: try @@ -450,7 +450,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) GSchangeSaveState(StatesC, SaveState::GetFilename(StatesC).mb_str()); break; - case 3: + case 3: try { gzLoadingState joe( SaveState::GetFilename( StatesC ) ); // throws exception on version mismatch @@ -477,7 +477,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) throw Exception::CpuStateShutdown( // english log message: wxsFormat( wxT("Error! Could not load from saveslot %d\n"), StatesC ) + ex.LogMessage(), - + // translated message: wxsFormat( _("Error loading saveslot %d. Emulator reset."), StatesC ) ); @@ -492,9 +492,9 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) case 8: GSmakeSnapshot( g_Conf.Folders.Snapshots.ToAscii().data() ); break; - - case 9: //gsdx "on the fly" renderer switching - if (!renderswitch) + + case 9: //gsdx "on the fly" renderer switching + if (!renderswitch) { StateRecovery::MakeGsOnly(); g_EmulationInProgress = false; @@ -503,7 +503,7 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) StateRecovery::Recover(); HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later } - else + else { StateRecovery::MakeGsOnly(); g_EmulationInProgress = false; @@ -519,15 +519,15 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) // 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."); - + break; case 11: - if( mtgsThread != NULL ) + if( mtgsThread != NULL ) { Console::Notice( "Cannot make gsstates in MTGS mode" ); } @@ -554,30 +554,30 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod) { Text = GetGSStateFilename(); } - + SaveGSState(Text); } break; #endif case 12: - if( keymod->shift ) + if( keymod->shift ) { #ifdef PCSX2_DEVBUILD iDumpRegisters(cpuRegs.pc, 0); Console::Notice("hardware registers dumped EE:%x, IOP:%x\n", params cpuRegs.pc, psxRegs.pc); #endif } - else + else { g_Pcsx2Recording ^= 1; - - if( mtgsThread != NULL ) + + if( mtgsThread != NULL ) mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0); - else if( GSsetupRecording != NULL ) + else if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL); - - if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL); + + if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL); } break; } diff --git a/pcsx2/NakedAsm.h b/pcsx2/NakedAsm.h index 589bdc2957..cf9272f74f 100644 --- a/pcsx2/NakedAsm.h +++ b/pcsx2/NakedAsm.h @@ -5,25 +5,25 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - + // Externs for various routines that are defined in assembly files on Linux. #ifndef NAKED_ASM_H #define NAKED_ASM_H -#include "coroutine.h" +#include "IPU/coroutine.h" // Common to Windows and Linux -extern "C" +extern "C" { // acoroutine.S void so_call(coroutine_t coro); @@ -44,18 +44,18 @@ void iopRecRecompile(u32 startpc); PCSX2_ALIGNED16( u8 _xmm_backup[16*2] ); PCSX2_ALIGNED16( u8 _mmx_backup[8*4] ); -extern "C" +extern "C" { // aVUzerorec.S void* SuperVUGetProgram(u32 startpc, int vuindex); void SuperVUCleanupProgram(u32 startpc, int vuindex); void svudispfn(); - + // aR3000A.S void iopJITCompile(); void iopJITCompileInBlock(); void iopDispatcherReg(); - + // aR5900-32.S void JITCompile(); void JITCompileInBlock(); diff --git a/pcsx2/NewGUI/Makefile.am b/pcsx2/NewGUI/Makefile.am index 433b82a00b..3864c17ad5 100644 --- a/pcsx2/NewGUI/Makefile.am +++ b/pcsx2/NewGUI/Makefile.am @@ -7,7 +7,7 @@ bin_PROGRAMS = pcsx2 pcsx2_SOURCES = \ CheckedStaticBox.cpp ConsoleLogger.cpp MainFrame.cpp wxHelpers.cpp AppConfig.cpp main.cpp \ App.h CheckedStaticBox.h MainFrame.h wxHelpers.h \ -AboutBoxDialog.cpp GameFixesDialog.cpp LogOptionsDialog.cpp \ +IniInterface.cpp AboutBoxDialog.cpp GameFixesDialog.cpp LogOptionsDialog.cpp \ AboutBoxDialog.h GameFixesDialog.h LogOptionsDialog.h pcsx2_LDFLAGS = @@ -18,4 +18,4 @@ pcsx2_DEPENDENCIES += ../DebugTools/libDebugTools.a pcsx2_LDADD = ../libpcsx2.a ../IPU/libIPU.a ../IPU/mpeg2lib/libmpeg2IPU.a ../RDebug/libRDebug.a ../tinyxml/libtinyxml.a pcsx2_LDADD += ../x86/libx86recomp.a ../x86/ix86/libix86.a -pcsx2_LDADD += ../DebugTools/libDebugTools.a \ No newline at end of file +pcsx2_LDADD += ../DebugTools/libDebugTools.a diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index e1d98aa940..b8af0b6936 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -1,9 +1,5 @@ #pragma once -#ifndef _PCSX2_PRECOMPILED_HEADER_ -#define _PCSX2_PRECOMPILED_HEADER_ -#endif // pragma once - ////////////////////////////////////////////////////////////////////////////////////////// // Microsoft specific STL extensions for bounds checking and stuff: Enabled in devbuilds, // disabled in release builds. :) @@ -172,7 +168,7 @@ static __forceinline u32 timeGetTime() #else # define DevCon 0&&Console -# define DevMsg +# define DevMsg static const bool IsDevBuild = false; #endif diff --git a/pcsx2/Saveslots.cpp b/pcsx2/Saveslots.cpp index d018489ac7..c459bc90ac 100644 --- a/pcsx2/Saveslots.cpp +++ b/pcsx2/Saveslots.cpp @@ -31,7 +31,7 @@ static int Slots[5] = { -1, -1, -1, -1, -1 }; bool States_isSlotUsed(int num) { - if (ElfCRC == 0) + if (ElfCRC == 0) return false; else return wxFileExists( SaveState::GetFilename( num ) ); @@ -105,7 +105,7 @@ void States_Load(int num) } catch( Exception::StateLoadError_Recoverable& ex) { - Console::Notice( wxsFormat( L"Could not load savestate slot %d.\n\n%s", num, ex.LogMessage() ) ); + Console::Notice( wxsFormat( L"Could not load savestate slot %d.\n\n%s", num, ex.LogMessage().c_str() ) ); // At this point the cpu hasn't been reset, so we can return // control to the user safely... (that's why we use a console notice instead of a popup) diff --git a/pcsx2/vssprintf.cpp b/pcsx2/vssprintf.cpp index 234017f0e1..64a5556389 100644 --- a/pcsx2/vssprintf.cpp +++ b/pcsx2/vssprintf.cpp @@ -8,16 +8,16 @@ // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. +// documentation and/or other materials provided with the distribution. // 3. Neither the name of the project nor the names of its contributors // may be used to endorse or promote products derived from this software -// without specific prior written permission. -// +// without specific prior written permission. +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -27,9 +27,9 @@ // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. -// +// // modified by gigahers and air to write formatted output directly into a std::string container. @@ -84,19 +84,19 @@ static void cvt(char (&buf)[_CVTBUFSIZE], double arg, int preci, int& decpt, int arg = modf(arg, &fi); p1 = &buf[_CVTBUFSIZE]; - if (fi != 0) + if (fi != 0) { - while (fi != 0) + while (fi != 0) { fj = modf(fi / 10, &fi); *--p1 = (int)((fj + .03) * 10) + '0'; r2++; } while (p1 < &buf[_CVTBUFSIZE]) *p++ = *p1++; - } + } else if (arg > 0) { - while ((fj = arg * 10) < 1) + while ((fj = arg * 10) < 1) { arg = fj; r2--; @@ -107,7 +107,7 @@ static void cvt(char (&buf)[_CVTBUFSIZE], double arg, int preci, int& decpt, int if (eflag == 0) p1 += r2; decpt = r2; - if (p1 < &buf[0]) + if (p1 < &buf[0]) { buf[0] = '\0'; return; @@ -118,23 +118,23 @@ static void cvt(char (&buf)[_CVTBUFSIZE], double arg, int preci, int& decpt, int arg = modf(arg, &fj); *p++ = (int) fj + '0'; } - if (p1 >= &buf[_CVTBUFSIZE]) + if (p1 >= &buf[_CVTBUFSIZE]) { buf[_CVTBUFSIZE - 1] = '\0'; return; } p = p1; *p1 += 5; - while (*p1 > '9') + while (*p1 > '9') { *p1 = '0'; if (p1 > buf) ++*--p1; - else + else { *p1 = '1'; decpt++; - if (eflag == 0) + if (eflag == 0) { if (p > buf) *p = '0'; p++; @@ -285,19 +285,19 @@ static void iaddr( std::string& dest, unsigned char *addr, int size, int precisi { if (i != 0) tmp[len++] = '.'; n = addr[i]; - + if (n == 0) tmp[len++] = digits[0]; else { - if (n >= 100) + if (n >= 100) { tmp[len++] = digits[n / 100]; n = n % 100; tmp[len++] = digits[n / 10]; n = n % 10; } - else if (n >= 10) + else if (n >= 10) { tmp[len++] = digits[n / 10]; n = n % 10; @@ -434,7 +434,7 @@ static void forcdecpt(char *buffer) if (*buffer) { int n = strlen(buffer); - while (n > 0) + while (n > 0) { buffer[n + 1] = buffer[n]; n--; @@ -578,7 +578,7 @@ repeat: precision = -1; if (*fmt == '.') { - ++fmt; + ++fmt; if (is_digit(*fmt)) precision = skip_atoi(&fmt); else if (*fmt == '*') @@ -748,9 +748,11 @@ repeat: else { s32 num; - if (qualifier == 'h') - num = va_arg(args, s16); - else // 'l' qualifier or no qualifier means 32 bits on all our std target platforms. + // Modern 32 bit compilers pass parameters into va_arg by 32 bit scale always, + // so no point in using or checking for the 'h' parameter. + /*if (qualifier == 'h') + num = va_arg(args, int); + else*/ // 'l' qualifier or no qualifier means 32 bits on all our std target platforms. num = va_arg(args, s32); number(dest, num, base, field_width, precision, flags); diff --git a/pcsx2/vtlb.cpp b/pcsx2/vtlb.cpp index f34df81bf4..00756f75f1 100644 --- a/pcsx2/vtlb.cpp +++ b/pcsx2/vtlb.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -69,7 +69,7 @@ vtlbHandler UnmappedPhyHandler1; shr ecx,12; mov ecx,[ecx*4+vmap]; //translate add ecx,eax; //transform - + js callfunction; //if <0 its invalid ptr :) mov eax,[ecx]; @@ -131,7 +131,7 @@ __forceinline void __fastcall MemOp_r1(u32 addr, DataType* data) data[1]=*reinterpret_cast(ppf+8); } else - { + { //has to: translate, find function, call function u32 hand=(u8)vmv; u32 paddr=ppf-hand+0x80000000; @@ -158,7 +158,7 @@ __forceinline void __fastcall MemOp_w0(u32 addr, DataType data) *reinterpret_cast(ppf)=data; } else - { + { //has to: translate, find function, call function u32 hand=(u8)vmv; u32 paddr=ppf-hand+0x80000000; @@ -187,7 +187,7 @@ __forceinline void __fastcall MemOp_w1(u32 addr,const DataType* data) *reinterpret_cast(ppf+8)=data[1]; } else - { + { //has to: translate, find function, call function u32 hand=(u8)vmv; u32 paddr=ppf-hand+0x80000000; @@ -246,7 +246,7 @@ void __fastcall vtlb_memWrite128(u32 mem, const mem128_t *value) ///////////////////////////////////////////////////////////////////////// // Error / TLB Miss Handlers -// +// static const char* _getModeStr( u32 mode ) { @@ -330,7 +330,7 @@ void __fastcall vtlbDefaultPhyWrite128(u32 addr,const mem128_t* data) { Console: ///////////////////////////////////////////////////////////////////////// // VTLB Public API -- Init/Term/RegisterHandler stuff -// +// // Registers a handler into the VTLB's internal handler array. The handler defines specific behavior // for how memory pages bound to the handler are read from / written to. If any of the handler pointers @@ -345,18 +345,18 @@ vtlbHandler vtlb_RegisterHandler( vtlbMemR8FP* r8,vtlbMemR16FP* r16,vtlbMemR32FP { //write the code :p vtlbHandler rv=vtlbHandlerCount++; - - vtlbdata.RWFT[0][0][rv] = (r8!=0) ? r8:vtlbDefaultPhyRead8; - vtlbdata.RWFT[1][0][rv] = (r16!=0) ? r16:vtlbDefaultPhyRead16; - vtlbdata.RWFT[2][0][rv] = (r32!=0) ? r32:vtlbDefaultPhyRead32; - vtlbdata.RWFT[3][0][rv] = (r64!=0) ? r64:vtlbDefaultPhyRead64; - vtlbdata.RWFT[4][0][rv] = (r128!=0) ? r128:vtlbDefaultPhyRead128; - vtlbdata.RWFT[0][1][rv] = (w8!=0) ? w8:vtlbDefaultPhyWrite8; - vtlbdata.RWFT[1][1][rv] = (w16!=0) ? w16:vtlbDefaultPhyWrite16; - vtlbdata.RWFT[2][1][rv] = (w32!=0) ? w32:vtlbDefaultPhyWrite32; - vtlbdata.RWFT[3][1][rv] = (w64!=0) ? w64:vtlbDefaultPhyWrite64; - vtlbdata.RWFT[4][1][rv] = (w128!=0) ? w128:vtlbDefaultPhyWrite128; + vtlbdata.RWFT[0][0][rv] = (r8!=0) ? (void*)r8:(void*)vtlbDefaultPhyRead8; + vtlbdata.RWFT[1][0][rv] = (r16!=0) ? (void*)r16:(void*)vtlbDefaultPhyRead16; + vtlbdata.RWFT[2][0][rv] = (r32!=0) ? (void*)r32:(void*)vtlbDefaultPhyRead32; + vtlbdata.RWFT[3][0][rv] = (r64!=0) ? (void*)r64:(void*)vtlbDefaultPhyRead64; + vtlbdata.RWFT[4][0][rv] = (r128!=0) ? (void*)r128:(void*)vtlbDefaultPhyRead128; + + vtlbdata.RWFT[0][1][rv] = (void*)((w8!=0) ? w8:vtlbDefaultPhyWrite8); + vtlbdata.RWFT[1][1][rv] = (void*)((w16!=0) ? w16:vtlbDefaultPhyWrite16); + vtlbdata.RWFT[2][1][rv] = (void*)((w32!=0) ? w32:vtlbDefaultPhyWrite32); + vtlbdata.RWFT[3][1][rv] = (void*)((w64!=0) ? w64:vtlbDefaultPhyWrite64); + vtlbdata.RWFT[4][1][rv] = (void*)((w128!=0) ? w128:vtlbDefaultPhyWrite128); return rv; } @@ -380,7 +380,7 @@ void vtlb_MapHandler(vtlbHandler handler,u32 start,u32 size) start+=VTLB_PAGE_SIZE; size-=VTLB_PAGE_SIZE; - } + } } void vtlb_MapBlock(void* base,u32 start,u32 size,u32 blocksize) @@ -389,7 +389,7 @@ void vtlb_MapBlock(void* base,u32 start,u32 size,u32 blocksize) verify(0==(start&VTLB_PAGE_MASK)); verify(0==(size&VTLB_PAGE_MASK) && size>0); - if (blocksize==0) + if (blocksize==0) blocksize=size; verify(0==(blocksize&VTLB_PAGE_MASK) && blocksize>0); verify(0==(size%blocksize)); @@ -424,7 +424,7 @@ void vtlb_Mirror(u32 new_region,u32 start,u32 size) start+=VTLB_PAGE_SIZE; new_region+=VTLB_PAGE_SIZE; size-=VTLB_PAGE_SIZE; - } + } } __forceinline void* vtlb_GetPhyPtr(u32 paddr) @@ -484,7 +484,7 @@ void vtlb_VMapUnmap(u32 vaddr,u32 sz) { verify(0==(vaddr&VTLB_PAGE_MASK)); verify(0==(sz&VTLB_PAGE_MASK) && sz>0); - + while(sz>0) { u32 handl=UnmappedVirtHandler0; @@ -532,8 +532,8 @@ void vtlb_Init() //done ! //Setup the initial mappings - vtlb_MapHandler(DefaultPhyHandler,0,VTLB_PMAP_SZ); - + vtlb_MapHandler(DefaultPhyHandler,0,VTLB_PMAP_SZ); + //Set the V space as unmapped vtlb_VMapUnmap(0,(VTLB_VMAP_ITEMS-1)*VTLB_PAGE_SIZE); //yeah i know, its stupid .. but this code has to be here for now ;p diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 4ee56ee010..ffb4b7f143 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -119,10 +119,8 @@ static void iIopDumpBlock( int startpc, u8 * ptr ) Console::WriteLn( "dump1 %x:%x, %x", params startpc, psxpc, psxRegs.cycle ); Path::CreateDirectory( L"dumps" ); - AsciiFile f( - Path::Combine( g_Conf.Folders.Dumps, wxsFormat( L"psxdump%.8X.txt", startpc ) ), - wxFile::write - ); + wxString filename( Path::Combine( g_Conf.Folders.Dumps, wxsFormat( L"psxdump%.8X.txt", startpc ) ) ); + AsciiFile f( filename, wxFile::write ); for ( i = startpc; i < s_nEndBlock; i += 4 ) { f.Printf("%s\n", disR3000Fasm( iopMemRead32( i ), i ) ); @@ -155,7 +153,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr ) pcur = s_pInstCache+1; for( i = 0; i < (s_nEndBlock-startpc)/4; ++i, ++pcur) { f.Printf("%2d: %2.2x ", i+1, pcur->info); - + count = 1; for(j = 0; j < ArraySize(s_pInstCache->regs); j++) { if( used[j] ) { @@ -168,15 +166,18 @@ static void iIopDumpBlock( int startpc, u8 * ptr ) #ifdef __LINUX__ char command[256]; - // dump the asm - f = fopen( "mydump1", "wb" ); - fwrite( ptr, 1, (uptr)x86Ptr - (uptr)ptr, f ); - fclose( f ); - sprintf( command, "objdump -D --target=binary --architecture=i386 -M intel mydump1 | cat %s - > tempdump", filename ); + // dump the asm + { + AsciiFile f2( L"mydump1", wxFile::write ); + f2.Write( ptr, (uptr)x86Ptr - (uptr)ptr ); + } + wxCharBuffer buf( filename.ToAscii() ); + const char* filenamea = buf.data(); + sprintf( command, "objdump -D --target=binary --architecture=i386 -M intel mydump1 | cat %s - > tempdump", filenamea ); system( command ); - sprintf(command, "mv tempdump %s", filename); - system(command); - f = fopen( filename.c_str(), "a+" ); + sprintf( command, "mv tempdump %s", filenamea ); + system( command ); + //f = fopen( filename.c_str(), "a+" ); #endif } #endif @@ -213,7 +214,7 @@ void _psxFlushAllUnused() continue; if( i < 32 && PSX_IS_CONST1(i) ) _psxFlushConstReg(i); - else { + else { _deleteX86reg(X86TYPE_PSX, i, 1); } } @@ -258,7 +259,7 @@ void _psxFlushConstRegs() // ignore r0 for(i = 1; i < 32; ++i) { if( g_psxHasConstReg & (1< failed to allocate memory for the recompiler." ); @@ -542,10 +543,10 @@ void recResetIOP() for (int i = 0; i < 0x10000; i++) recLUT_SetPage(psxRecLUT, 0, 0, 0, i, 0); // IOP knows 64k pages, hence for the 0x10000's - + // The bottom 2 bits of PC are always zero, so we <<14 to "compress" // the pc indexer into it's lower common denominator. - + // We're only mapping 20 pages here in 4 places. // 0x80 comes from : (Ps2MemSize::IopRam / 0x10000) * 4 for (int i=0; i<0x80; i++) @@ -680,7 +681,7 @@ static __forceinline s32 recExecuteBlock( s32 eeCycles ) "push ebp\n" "call iopDispatcherReg\n" - + "pop ebp\n" "pop edi\n" "pop esi\n" @@ -717,7 +718,7 @@ static __forceinline u32 psxRecClearMem(u32 pc) lowerextent = min(lowerextent, pexblock->startpc); blockidx--; } - + while (pexblock = recBlocks[blockidx]) { if (pexblock->startpc >= upperextent) break; @@ -756,7 +757,7 @@ void psxSetBranchReg(u32 reg) _psxMoveGPRtoR(ESI, reg); psxRecompileNextInstruction(1); - + if( x86regs[ESI].inuse ) { assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK ); MOV32RtoM((uptr)&psxRegs.pc, ESI); @@ -767,7 +768,7 @@ void psxSetBranchReg(u32 reg) MOV32RtoM((uptr)&psxRegs.pc, EAX); } } - + _psxFlushCall(FLUSH_EVERYTHING); iPsxBranchTest(0xffffffff, 1); @@ -972,13 +973,13 @@ void iopRecRecompile(u32 startpc) // if recPtr reached the mem limit reset whole mem if (((uptr)recPtr - (uptr)recMem) >= (RECMEM_SIZE - 0x10000)) recResetIOP(); - + x86SetPtr( recPtr ); x86Align(16); recPtr = x86Ptr; s_pCurBlock = PSX_GETBLOCK(startpc); - + assert(s_pCurBlock->GetFnptr() == (uptr)iopJITCompile || s_pCurBlock->GetFnptr() == (uptr)iopJITCompileInBlock); @@ -993,7 +994,7 @@ void iopRecRecompile(u32 startpc) s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr); } } - + psxbranch = 0; s_pCurBlock->SetFnptr( (uptr)x86Ptr ); @@ -1014,7 +1015,7 @@ void iopRecRecompile(u32 startpc) // go until the next branch i = startpc; s_nEndBlock = 0xffffffff; - + while(1) { BASEBLOCK* pblock = PSX_GETBLOCK(i); if (i != startpc @@ -1038,9 +1039,9 @@ void iopRecRecompile(u32 startpc) break; case 1: // regimm - + if( _Rt_ == 0 || _Rt_ == 1 || _Rt_ == 16 || _Rt_ == 17 ) { - + branchTo = _Imm_ * 4 + i + 4; if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo; else s_nEndBlock = i+8; @@ -1056,12 +1057,12 @@ void iopRecRecompile(u32 startpc) goto StartRecomp; // branches - case 4: case 5: case 6: case 7: + case 4: case 5: case 6: case 7: branchTo = _Imm_ * 4 + i + 4; if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo; else s_nEndBlock = i+8; - + goto StartRecomp; } @@ -1104,7 +1105,7 @@ StartRecomp: if( (psxdump & 1) ) iIopDumpBlock(startpc, recPtr); #endif - + g_pCurInstInfo = s_pInstCache; while (!psxbranch && psxpc < s_nEndBlock) { psxRecompileNextInstruction(0); @@ -1129,7 +1130,7 @@ StartRecomp: if( psxbranch == 2 ) { _psxFlushCall(FLUSH_EVERYTHING); - iPsxBranchTest(0xffffffff, 1); + iPsxBranchTest(0xffffffff, 1); JMP32((uptr)iopDispatcherReg - ( (uptr)x86Ptr + 5 )); } diff --git a/pcsx2/x86/ix86/implement/xmm/moremovs.h b/pcsx2/x86/ix86/implement/xmm/moremovs.h index 98cfafc230..ce56078494 100644 --- a/pcsx2/x86/ix86/implement/xmm/moremovs.h +++ b/pcsx2/x86/ix86/implement/xmm/moremovs.h @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -63,12 +63,12 @@ public: // All implementations of Unaligned Movs will, when possible, use aligned movs instead. // This happens when using Mem,Reg or Reg,Mem forms where the address is simple displacement // which can be checked for alignment at runtime. -// +// template< u8 Prefix, bool isAligned > class SimdImpl_MoveSSE { - static const u16 OpcodeA = 0x28; // Aligned [aps] form - static const u16 OpcodeU = 0x10; // unaligned [ups] form + static const uint OpcodeA = 0x28; // Aligned [aps] form + static const uint OpcodeU = 0x10; // unaligned [ups] form public: SimdImpl_MoveSSE() {} //GCC. @@ -78,7 +78,7 @@ public: if( to != from ) xOpWrite0F( Prefix, OpcodeA, to, from ); } - __forceinline void operator()( const xRegisterSSE& to, const void* from ) const + __forceinline void operator()( const xRegisterSSE& to, const void* from ) const { xOpWrite0F( Prefix, (isAligned || ((uptr)from & 0x0f) == 0) ? OpcodeA : OpcodeU, to, from ); } @@ -123,7 +123,7 @@ public: if( to != from ) xOpWrite0F( PrefixA, Opcode, to, from ); } - __forceinline void operator()( const xRegisterSSE& to, const void* from ) const + __forceinline void operator()( const xRegisterSSE& to, const void* from ) const { xOpWrite0F( (isAligned || ((uptr)from & 0x0f) == 0) ? PrefixA : PrefixU, Opcode, to, from ); } @@ -168,7 +168,7 @@ class SimdImpl_Blend public: // [SSE-4.1] Conditionally copies dword values from src to dest, depending on the // mask bits in the immediate operand (bits [3:0]). Each mask bit corresponds to a - // dword element in a 128-bit operand. + // dword element in a 128-bit operand. // // If a mask bit is 1, then the corresponding dword in the source operand is copied // to dest, else the dword element in dest is left unchanged. @@ -177,25 +177,25 @@ public: // [SSE-4.1] Conditionally copies quadword values from src to dest, depending on the // mask bits in the immediate operand (bits [1:0]). Each mask bit corresponds to a - // quadword element in a 128-bit operand. + // quadword element in a 128-bit operand. // // If a mask bit is 1, then the corresponding dword in the source operand is copied // to dest, else the dword element in dest is left unchanged. // SimdImpl_DestRegImmSSE<0x66,0x0d3a> PD; - + // [SSE-4.1] Conditionally copies dword values from src to dest, depending on the // mask (bits [3:0]) in XMM0 (yes, the fixed register). Each mask bit corresponds - // to a dword element in the 128-bit operand. + // to a dword element in the 128-bit operand. // // If a mask bit is 1, then the corresponding dword in the source operand is copied // to dest, else the dword element in dest is left unchanged. // SimdImpl_DestRegSSE<0x66,0x1438> VPS; - + // [SSE-4.1] Conditionally copies quadword values from src to dest, depending on the // mask (bits [1:0]) in XMM0 (yes, the fixed register). Each mask bit corresponds - // to a quadword element in the 128-bit operand. + // to a quadword element in the 128-bit operand. // // If a mask bit is 1, then the corresponding dword in the source operand is copied // to dest, else the dword element in dest is left unchanged. @@ -223,7 +223,7 @@ public: // [SSE-4.1] Zero/Sign-extend the low byte values in src into qword integers // and store them in dest. SimdImpl_DestRegStrict<0x66,OpcodeBase+0x200,xRegisterSSE,xRegisterSSE,u16> BQ; - + // [SSE-4.1] Zero/Sign-extend the low word values in src into dword integers // and store them in dest. SimdImpl_DestRegStrict<0x66,OpcodeBase+0x300,xRegisterSSE,xRegisterSSE,u64> WD; diff --git a/pcsx2/x86/microVU.h b/pcsx2/x86/microVU.h index 78cd364220..74809d0780 100644 --- a/pcsx2/x86/microVU.h +++ b/pcsx2/x86/microVU.h @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -78,7 +78,7 @@ struct microProgram { template struct microProgManager { microProgram prog[mMaxProg]; // Store MicroPrograms in memory - static const int max = mMaxProg - 1; + static const int max = mMaxProg - 1; int cur; // Index to Current MicroProgram thats running (-1 = uncached) int total; // Total Number of valid MicroPrograms minus 1 int cleared; // Micro Program is Indeterminate so must be searched for (and if no matches are found then recompile a new one) @@ -93,7 +93,7 @@ struct microVU { static const u32 cacheSize = 0x800000; // VU Cache Size microProgManager<0x4000> prog; // Micro Program Data - + VURegs* regs; // VU Regs Struct u8* cache; // Dynarec Cache Start (where we will start writing the recompiled code to) u8* startFunct; // Ptr Function to the Start code for recompiled programs @@ -136,11 +136,7 @@ microVUt(void) mVUcacheProg(microVU* mVU, int progIndex); void* __fastcall mVUexecuteVU0(u32 startPC, u32 cycles); void* __fastcall mVUexecuteVU1(u32 startPC, u32 cycles); -#ifndef __LINUX__ typedef void (__fastcall *mVUrecCall)(u32, u32); -#else -typedef void (*mVUrecCall)(u32, u32) __attribute__((__fastcall)); // Not sure if this is correct syntax (should be close xD) -#endif // Include all the *.inl files (Needed because C++ sucks with templates and *.cpp files) #include "microVU_Misc.inl" diff --git a/pcsx2/xmlpatchloader.cpp b/pcsx2/xmlpatchloader.cpp index afc737fa19..917d43cb73 100644 --- a/pcsx2/xmlpatchloader.cpp +++ b/pcsx2/xmlpatchloader.cpp @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -82,12 +82,12 @@ int LoadPatch( const wxString& crc ) { //Console::Error("XML Patch Loader: Could not load file '%s'. Error='%s'.", pfile, doc.ErrorDesc() ); return -1; - } - else - { - Console::WriteLn("XML Patch Loader: '%s' Found", params pfile); } - + else + { + Console::WriteLn("XML Patch Loader: '%s' Found", params pfile.c_str() ); + } + TiXmlNode *root = doc.FirstChild("GAME"); if(!root) { @@ -144,12 +144,12 @@ int LoadGroup(TiXmlNode *group,int gParent) } string t; - + if(gtitle) t.assign(gtitle); else t.clear(); - + Group gp=Group(gParent,gEnabled,t); groups.push_back(gp); @@ -165,10 +165,10 @@ int LoadGroup(TiXmlNode *group,int gParent) { TiXmlElement *rm=zerogs->ToElement(); const char* pid = rm->FirstAttribute()->Value(); - - if( pid != NULL ) + + if( pid != NULL ) sscanf(pid, "%x", &g_ZeroGSOptions); - else + else Console::WriteLn("zerogs attribute wrong"); } @@ -307,7 +307,7 @@ int LoadGroup(TiXmlNode *group,int gParent) patchnumber=0; return -1; } - + if(strcmp(place,"EE")==0) { patch[patchnumber].cpu= CPU_EE; @@ -355,7 +355,7 @@ int LoadGroup(TiXmlNode *group,int gParent) pt.assign(ptitle); else pt.clear(); - + Patch p=Patch(patchnumber,gIndex,penabled,pt); patches.push_back(p);