From db3e81504e17666caaad6f6a00a3a83031667b98 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 20 Aug 2009 23:05:26 +0000 Subject: [PATCH] wxgui: The Linux side compiles and runs again. Note: Removed "Open in Explorer" buttons for folders since there seems no reliable way to do that in Linux. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1661 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/build/Utilities/Utilities.cbp | 4 +- common/include/Utilities/Threading.h | 27 +- common/src/Utilities/ThreadTools.cpp | 22 +- common/src/Utilities/x86/MemcpyFast.cpp | 24 +- pcsx2/CDVD/CDVD.cpp | 336 +++++++++++------------ pcsx2/CDVD/IsoFileTools.cpp | 39 +-- pcsx2/CDVD/IsoFileTools.h | 27 +- pcsx2/Linux/pcsx2.cbp | 31 ++- pcsx2/Plugins.cpp | 157 ++++++----- pcsx2/Plugins.h | 10 +- pcsx2/System.h | 2 + pcsx2/Tags.h | 92 +++---- pcsx2/gui/AppConfig.cpp | 40 +-- pcsx2/gui/Dialogs/FirstTimeWizard.cpp | 23 +- pcsx2/gui/HostGui.cpp | 10 +- pcsx2/gui/MainFrame.cpp | 4 +- pcsx2/gui/Panels/BiosSelectorPanel.cpp | 21 +- pcsx2/gui/Panels/DirPickerPanel.cpp | 23 +- pcsx2/gui/Panels/GameFixesPanel.cpp | 4 +- pcsx2/gui/Panels/MiscPanelStuff.cpp | 24 +- pcsx2/gui/Panels/PathsPanel.cpp | 4 +- pcsx2/gui/Panels/PluginSelectorPanel.cpp | 28 +- pcsx2/gui/Panels/SpeedhacksPanel.cpp | 20 +- pcsx2/gui/main.cpp | 3 +- pcsx2/gui/wxHelpers.cpp | 21 +- pcsx2/ps2/CoreEmuThread.cpp | 16 +- pcsx2/x86/microVU_Upper.inl | 67 ++--- 27 files changed, 560 insertions(+), 519 deletions(-) diff --git a/common/build/Utilities/Utilities.cbp b/common/build/Utilities/Utilities.cbp index 95b38e1c61..04004a42fb 100644 --- a/common/build/Utilities/Utilities.cbp +++ b/common/build/Utilities/Utilities.cbp @@ -67,10 +67,12 @@ + - + + diff --git a/common/include/Utilities/Threading.h b/common/include/Utilities/Threading.h index 214a7889f2..1c5d1afa3a 100644 --- a/common/include/Utilities/Threading.h +++ b/common/include/Utilities/Threading.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - + #pragma once #include // EBUSY @@ -99,7 +99,7 @@ namespace Threading // For use in spin/wait loops. extern void SpinWait(); - + // sleeps the current thread for the given number of milliseconds. extern void Sleep( int ms ); @@ -139,9 +139,9 @@ namespace Threading // Gets the return code of the thread. // Throws std::logic_error if the thread has not terminated. virtual int GetReturnCode() const; - + virtual bool IsRunning() const; - virtual sptr Block(); + virtual sptr Block(); protected: // Used to dispatch the thread callback function. @@ -158,12 +158,7 @@ namespace Threading public: // performs a test on the given thread handle, returning true if the thread exists // or false if the thread is dead/done/never existed. - static bool Exists( pthread_t pid ) - { - // passing 0 to pthread_kill is a NOP, and returns the status of the thread only. - return ( ESRCH != pthread_kill( pid, 0 ) ); - } - + static bool Exists( pthread_t pid ); }; ////////////////////////////////////////////////////////////////////////////////////////// @@ -174,7 +169,7 @@ namespace Threading class ScopedLock { DeclareNoncopyableObject(ScopedLock) - + protected: MutexLock& m_lock; bool m_IsLocked; @@ -192,7 +187,7 @@ namespace Threading { m_lock.Lock(); } - + // Provides manual unlocking of a scoped lock prior to object destruction. void Unlock() { @@ -200,7 +195,7 @@ namespace Threading m_IsLocked = false; m_lock.Unlock(); } - + // provides manual locking of a scoped lock, to re-lock after a manual unlocking. void Lock() { @@ -242,7 +237,7 @@ namespace Threading // * The best application of tasking threads is to divide a large loop over a linear array // into smaller sections. For example, if you have 20,000 items to process, the task // can be divided into two threads of 10,000 items each. - // + // class BaseTaskThread : public PersistentThread { protected: @@ -267,7 +262,7 @@ namespace Threading m_post_event.Post(); return PersistentThread::Block(); } - + // Initiates the new task. This should be called after your own StartTask has // initialized internal variables / preparations for task execution. void PostTask() @@ -287,7 +282,7 @@ namespace Threading else m_post_TaskComplete.Reset(); } - + protected: // Abstract method run when a task has been posted. Implementing classes should do // all your necessary processing work here. diff --git a/common/src/Utilities/ThreadTools.cpp b/common/src/Utilities/ThreadTools.cpp index 3813e12616..d84c8cadc8 100644 --- a/common/src/Utilities/ThreadTools.cpp +++ b/common/src/Utilities/ThreadTools.cpp @@ -19,6 +19,10 @@ #include "PrecompiledHeader.h" #include "Threading.h" +#ifdef __LINUX__ +# include // for pthread_kill, which is in pthread.h on w32-pthreads +#endif + using namespace Threading; namespace Threading @@ -83,7 +87,13 @@ namespace Threading pthread_join( m_thread, (void**)&m_returncode ); return m_returncode; } - + + bool Exists( pthread_t pid ) + { + // passing 0 to pthread_kill is a NOP, and returns the status of the thread only. + return ( ESRCH != pthread_kill( pid, 0 ) ); + } + bool PersistentThread::IsRunning() const { return ( m_running && (ESRCH != pthread_kill( m_thread, 0 )) ); @@ -102,7 +112,7 @@ namespace Threading return m_returncode; } - + void* PersistentThread::_internal_callback( void* itsme ) { jASSUME( itsme != NULL ); @@ -210,11 +220,11 @@ namespace Threading { if( isRecursive ) { - pthread_mutexattr_t mutexAttribute; + pthread_mutexattr_t mutexAttribute; int status = pthread_mutexattr_init( &mutexAttribute ); - if (status != 0) { /* ... */ } - status = pthread_mutexattr_settype( &mutexAttribute, PTHREAD_MUTEX_RECURSIVE); - if (status != 0) { /* ... */} + if (status != 0) { /* ... */ } + status = pthread_mutexattr_settype( &mutexAttribute, PTHREAD_MUTEX_RECURSIVE); + if (status != 0) { /* ... */} int err = 0; err = pthread_mutex_init( &mutex, &mutexAttribute ); diff --git a/common/src/Utilities/x86/MemcpyFast.cpp b/common/src/Utilities/x86/MemcpyFast.cpp index cd1c77d12f..d66a26a3d5 100644 --- a/common/src/Utilities/x86/MemcpyFast.cpp +++ b/common/src/Utilities/x86/MemcpyFast.cpp @@ -31,7 +31,7 @@ 3dsdk.support@amd.com ******************************************************************************/ -#include "..\PrecompiledHeader.h" +#include "../PrecompiledHeader.h" #ifdef _MSC_VER #pragma warning(disable:4414) @@ -64,7 +64,7 @@ MEMCPY_AMD.CPP // uses the software prefetch instruction to pre-read the data. // USE 64 * 1024 FOR THIS VALUE IF YOU'RE ALWAYS FILLING A "CLEAN CACHE" -#define BLOCK_PREFETCH_COPY infinity // no limit for movq/movntq w/block prefetch +#define BLOCK_PREFETCH_COPY infinity // no limit for movq/movntq w/block prefetch #define CACHEBLOCK 80h // number of 64-byte blocks (cache lines) for block prefetch // For the largest size blocks, a special technique called Block Prefetch // can be used to accelerate the read operations. Block Prefetch reads @@ -135,7 +135,7 @@ _loop_8: //127~ja, 127 is encodable as simm8 :) cmp eax,127; ja _loop_8; - + //direct copy for 0~7 qwords //in order to avoid the inc/dec of all 3 registers //i use negative relative addressing from the top of the buffers @@ -151,7 +151,7 @@ _loop_1: _loop_1_inner: MOVSRC xmm0,[edx+eax]; MOVDST [ecx+eax],xmm0; - + add eax,16; //while the offset is still negative we have data to copy js _loop_1_inner; @@ -301,7 +301,7 @@ _loop_8: //127~ja, 127 is encodable as simm8 :) cmp eax,127; ja _loop_8; - + //direct copy for 0~7 qwords //in order to avoid the inc/dec of all 3 registers //i use negative relative addressing from the top of the buffers @@ -317,7 +317,7 @@ _loop_1: _loop_1_inner: MOVSRC xmm0,[edx+eax]; MOVDST [ecx+eax],xmm0; - + add eax,16; //while the offset is still negative we have data to copy js _loop_1_inner; @@ -358,8 +358,8 @@ __declspec(naked) void __fastcall memcpy_amd_(void *dest, const void *src, size_ { __asm { - push edi - push esi + push edi + push esi mov edi, ecx ; destination mov esi, edx ; source @@ -534,7 +534,7 @@ $memcpy_bp_3: add esi, 64 ; update source pointer movntq [edi ], mm0 ; write 64 bits, bypassing cache movntq [edi+ 8], mm1 ; note: movntq also prevents the CPU - movntq [edi+16], mm2 ; from READING the destination address + movntq [edi+16], mm2 ; from READING the destination address movntq [edi+24], mm3 ; into the cache, only to be over-written, movntq [edi+32], mm4 ; so that also helps performance movntq [edi+40], mm5 @@ -574,12 +574,12 @@ $memcpy_last_few: ; dword aligned from before movsd's jz $memcpy_final ; no more, let's leave rep movsb ; the last 1, 2, or 3 bytes -$memcpy_final: +$memcpy_final: emms ; clean up the MMX state sfence ; flush the write buffer //mov eax, [dest] ; ret value = destination pointer - pop esi + pop esi pop edi ret 4 @@ -663,7 +663,7 @@ Cmp8: pand mm0, mm6 pand mm0, mm7 pmovmskb eax, mm0 - + // check if eq cmp eax, 0xff je Continue diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 0e1c3be80f..f2dc092c2e 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.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 @@ -25,7 +25,7 @@ #include "IsoFStools.h" #include "CDVD_internal.h" #include "CDVDisoReader.h" -#include "gs.h" // for gsRegionMode +#include "GS.h" // for gsRegionMode #include "ps2/BiosTools.h" #include "AppConfig.h" @@ -34,11 +34,11 @@ static cdvdStruct cdvd; static __forceinline void SetResultSize(u8 size) { cdvd.ResultC = size; - cdvd.ResultP = 0; + cdvd.ResultP = 0; cdvd.sDataIn&=~0x40; } -static void CDVDREAD_INT(int eCycle) +static void CDVDREAD_INT(int eCycle) { PSX_INT(IopEvt_CdvdRead, eCycle); } @@ -63,13 +63,13 @@ static void cdvdSetIrq( uint id = (1<FullpathToBios().ToAscii().data() ); - + ptr = file; i = (int)strlen(file); - + while (i > 0) { if (ptr[i] == '.') break; i--; } ptr[i+1] = '\0'; strcat(file, "MEC"); - + // if file doesnt exist, create empty one fd = fopen(file, "r+b"); if (fd == NULL) { @@ -105,7 +105,7 @@ FILE *_cdvdOpenMechaVer() { //Msgbox::Alert( "_cdvdOpenMechaVer: Error creating %s", params file); //exit(1); } - + fputc(0x03, fd); fputc(0x06, fd); fputc(0x02, fd); @@ -131,19 +131,19 @@ FILE *_cdvdOpenNVM() { FILE* fd; // get the name of the bios file - + // use the bios filename to get the name of the nvm file // [TODO] : Upgrade this to use std::string! strcpy( file, g_Conf->FullpathToBios().ToAscii().data() ); ptr = file; i = (int)strlen(file); - + while (i > 0) { if (ptr[i] == '.') break; i--; } ptr[i+1] = '\0'; - + strcat(file, "NVM"); - + // if file doesnt exist, create empty one fd = fopen(file, "r+b"); if (fd == NULL) { @@ -160,28 +160,28 @@ FILE *_cdvdOpenNVM() { return fd; } -// +// // the following 'cdvd' functions all return 0 if successful -// +// s32 cdvdReadNVM(u8 *dst, int offset, int bytes) { FILE* fd = _cdvdOpenNVM(); if (fd == NULL) return 1; - + fseek(fd, offset, SEEK_SET); fread(dst, 1, bytes, fd); fclose(fd); - + return 0; } s32 cdvdWriteNVM(const u8 *src, int offset, int bytes) { FILE* fd = _cdvdOpenNVM(); if (fd == NULL) return 1; - + fseek(fd, offset, SEEK_SET); fwrite(src, 1, bytes, fd); fclose(fd); - + return 0; } @@ -189,7 +189,7 @@ NVMLayout* getNvmLayout(void) { NVMLayout* nvmLayout = NULL; s32 nvmIdx; - + for(nvmIdx=0; nvmIdx(config); return 0; } - + // get config data switch (cdvd.COffset) { @@ -310,7 +310,7 @@ s32 cdvdWriteConfig(const u8* config) ((cdvd.COffset == 2) && (cdvd.CBlockIndex >= 7)) ) return 0; - + // get config data switch (cdvd.COffset) { @@ -332,43 +332,43 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) { s32 numbers, letters; u32 key_0_3; u8 key_4, key_14; - + // get main elf name GetPS2ElfName(fname); const wxCharBuffer crap( fname.ToAscii() ); const char* str = crap.data(); sprintf(exeName, "%c%c%c%c%c%c%c%c%c%c%c",str[8],str[9],str[10],str[11],str[12],str[13],str[14],str[15],str[16],str[17],str[18]); DevCon::Notice("exeName = %s", params &str[8]); - + // convert the number characters to a real 32bit number numbers = ((((exeName[5] - '0'))*10000) + (((exeName[ 6] - '0'))*1000) + (((exeName[ 7] - '0'))*100) + (((exeName[ 9] - '0'))*10) + (((exeName[10] - '0'))*1) ); - + // combine the lower 7 bits of each char // to make the 4 letters fit into a single u32 letters = (s32)((exeName[3]&0x7F)<< 0) | (s32)((exeName[2]&0x7F)<< 7) | (s32)((exeName[1]&0x7F)<<14) | (s32)((exeName[0]&0x7F)<<21); - + // calculate magic numbers key_0_3 = ((numbers & 0x1FC00) >> 10) | ((0x01FFFFFF & letters) << 7); // numbers = 7F letters = FFFFFF80 key_4 = ((numbers & 0x0001F) << 3) | ((0x0E000000 & letters) >> 25); // numbers = F8 letters = 07 key_14 = ((numbers & 0x003E0) >> 2) | 0x04; // numbers = F8 extra = 04 unused = 03 - + // clear key values memzero_ptr<16>(key); - + // store key values key[ 0] = (key_0_3&0x000000FF)>> 0; key[ 1] = (key_0_3&0x0000FF00)>> 8; key[ 2] = (key_0_3&0x00FF0000)>>16; key[ 3] = (key_0_3&0xFF000000)>>24; key[ 4] = key_4; - + if(arg2 == 75) { key[14] = key_14; @@ -392,7 +392,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) { { key[15] = 0x01; } - + Console::WriteLn( "CDVD->KEY = %02X,%02X,%02X,%02X,%02X,%02X,%02X", params cdvd.Key[0],cdvd.Key[1],cdvd.Key[2],cdvd.Key[3],cdvd.Key[4],cdvd.Key[14],cdvd.Key[15] ); @@ -408,7 +408,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) { s32 cdvdGetToc(void* toc) { s32 ret = CDVD->getTOC(toc); - if (ret == -1) ret = 0x80; + if (ret == -1) ret = 0x80; return ret; } @@ -438,8 +438,8 @@ s32 cdvdCtrlTrayClose() s32 cdvdGetTrayStatus() { s32 ret = CDVD->getTrayStatus(); - - if (ret == -1) + + if (ret == -1) return(CDVD_TRAY_CLOSE); else return(ret); @@ -457,7 +457,7 @@ static __forceinline void cdvdGetDiskType() // check whether disc is single or dual layer // if its dual layer, check what the disctype is and what sector number // layer1 starts at -// +// // args: gets value for dvd type (0=single layer, 1=ptp, 2=otp) // gets value for start lsn of layer1 // returns: 1 if on dual layer disc @@ -551,7 +551,7 @@ void mechaDecryptBytes( u32 madr, int size ) int shiftAmount = (cdvd.decSet>>4) & 7; int doXor = (cdvd.decSet) & 1; int doShift = (cdvd.decSet) & 2; - + u8* curval = iopPhysMem( madr ); for( int i=0; i= layer1Start)) { // dual layer ptp disc @@ -602,13 +602,13 @@ int cdvdReadSector() { lsn = ~(layer1Start+0x30000 - 1); } else - { + { // Assuming the other dualType is 0, // single layer disc, or on first layer of dual layer disc. layerNum = 0; lsn += 0x30000; } - + mdest[0] = 0x20 | layerNum; mdest[1] = (u8)(lsn >> 16); mdest[2] = (u8)(lsn >> 8); @@ -632,9 +632,9 @@ int cdvdReadSector() { // Unlike CDVDiso, the internal IsoReadTrack function will pass an error if lsn is more // then the number of blocks in the iso. If this happens, cdr.pTransfer will be NULL. // - // Passing null to memcpy is a bad thing, and will result in, for example, the start of - // Final Fantasy X-2 crashing. So we won't. - + // Passing null to memcpy is a bad thing, and will result in, for example, the start of + // Final Fantasy X-2 crashing. So we won't. + DevCon::WriteLn("Bad Transfer!"); for (int i = 12; i <= 2060; i++) { @@ -645,18 +645,18 @@ int cdvdReadSector() { { memcpy_fast( &mdest[12], cdr.pTransfer, 2048); } - + // 4 bytes of edc (not calculated at present) mdest[2060] = 0; mdest[2061] = 0; mdest[2062] = 0; - mdest[2063] = 0; + mdest[2063] = 0; } else { memcpy_fast( mdest, cdr.pTransfer, cdvd.BlockSize); } - + // decrypt sector's bytes if( cdvd.decSet ) mechaDecryptBytes( HW_DMA3_MADR, cdvd.BlockSize ); @@ -738,23 +738,23 @@ __forceinline void cdvdReadInterrupt() } else { - if (cdvd.RErr == 0) + if (cdvd.RErr == 0) { cdr.RErr = DoCDVDgetBuffer(cdr.Transfer); cdr.pTransfer = cdr.Transfer; } - else + else { DevCon::WriteLn("Error reading track."); cdr.pTransfer = NULL; } - + if (cdr.RErr == -1) { cdvd.RetryCntP++; Console::Error("CDVD READ ERROR, sector=%d", params cdvd.Sector); - - if (cdvd.RetryCntP <= cdvd.RetryCnt) + + if (cdvd.RetryCntP <= cdvd.RetryCnt) { cdvd.RErr = DoCDVDreadTrack(cdvd.Sector, cdvd.ReadMode); CDVDREAD_INT(cdvd.ReadTime); @@ -823,7 +823,7 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode ) else if( (tbl_ContigiousSeekDelta[mode] == 0) || (delta >= tbl_ContigiousSeekDelta[mode]) ) { // Select either Full or Fast seek depending on delta: - + if( delta >= tbl_FastSeekDelta[mode] ) { // Full Seek @@ -839,7 +839,7 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode ) else { CDR_LOG( "CdSeek Begin > Contiguous block without seek - delta=%d sectors", delta ); - + // seektime is the time it takes to read to the destination block: seektime = delta * cdvd.ReadTime; @@ -852,7 +852,7 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode ) // setting Readed to 0 skips the seek logic, which means the next call to // cdvdReadInterrupt will load a block. So make sure it's properly scheduled // based on sector read speeds: - + seektime = cdvd.ReadTime; } } @@ -903,7 +903,7 @@ static __forceinline u8 cdvdRead18(void) // SDATAOUT ret = cdvd.Result[cdvd.ResultP-1]; } CDR_LOG("cdvdRead18(SDataOut) %x (ResultC=%d, ResultP=%d)", ret, cdvd.ResultC, cdvd.ResultP); - + return ret; } @@ -915,32 +915,32 @@ u8 cdvdRead(u8 key) CDR_LOG("cdvdRead04(NCMD) %x", cdvd.nCommand); return cdvd.nCommand; break; - + case 0x05: // N-READY CDR_LOG("cdvdRead05(NReady) %x", cdvd.Ready); return cdvd.Ready; break; - + case 0x06: // ERROR CDR_LOG("cdvdRead06(Error) %x", cdvd.Error); return cdvd.Error; break; - + case 0x07: // BREAK CDR_LOG("cdvdRead07(Break) %x", 0); return 0; break; - + case 0x08: // STATUS CDR_LOG("cdvdRead08(Status) %x", cdvd.Status); return cdvd.Status; break; - + case 0x0A: // STATUS CDR_LOG("cdvdRead0A(Status) %x", cdvd.Status); return cdvd.Status; break; - + case 0x0B: // TRAY-STATE (if tray has been opened) { u8 tray = cdvdGetTrayStatus(); @@ -952,104 +952,104 @@ u8 cdvdRead(u8 key) CDR_LOG("cdvdRead0C(Min) %x", itob((u8)(cdvd.Sector/(60*75)))); return itob((u8)(cdvd.Sector/(60*75))); break; - + case 0x0D: // CRT SECOND CDR_LOG("cdvdRead0D(Sec) %x", itob((u8)((cdvd.Sector/75)%60)+2)); return itob((u8)((cdvd.Sector/75)%60)+2); break; - + case 0x0E: // CRT FRAME CDR_LOG("cdvdRead0E(Frame) %x", itob((u8)(cdvd.Sector%75))); return itob((u8)(cdvd.Sector%75)); break; - + case 0x0F: // TYPE CDR_LOG("cdvdRead0F(Disc Type) %x", cdvd.Type); cdvdGetDiskType(); return cdvd.Type; break; - + case 0x13: // UNKNOWN CDR_LOG("cdvdRead13(Unknown) %x", 4); return 4; break; - + case 0x15: // RSV CDR_LOG("cdvdRead15(RSV)"); return 0x01; // | 0x80 for ATAPI mode break; - + case 0x16: // SCOMMAND CDR_LOG("cdvdRead16(SCMD) %x", cdvd.sCommand); return cdvd.sCommand; break; - + case 0x17: // SREADY CDR_LOG("cdvdRead17(SReady) %x", cdvd.sDataIn); return cdvd.sDataIn; break; - - case 0x18: + + case 0x18: return cdvdRead18(); break; - - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - { + + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + { int temp = key - 0x20; - + CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } - case 0x28: - case 0x29: - case 0x2A: - case 0x2B: - case 0x2C: - { + case 0x28: + case 0x29: + case 0x2A: + case 0x2B: + case 0x2C: + { int temp = key - 0x23; - + CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } - - case 0x30: - case 0x31: - case 0x32: - case 0x33: - case 0x34: - { + + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + { int temp = key - 0x26; - + CDR_LOG("cdvdRead%d(Key%d) %x", key, temp, cdvd.Key[temp]); return cdvd.Key[temp]; break; } - + case 0x38: // valid parts of key data (first and last are valid) CDR_LOG("cdvdRead38(KeysValid) %x", cdvd.Key[15]); - + return cdvd.Key[15]; break; - + case 0x39: // KEY-XOR CDR_LOG("cdvdRead39(KeyXor) %x", cdvd.KeyXor); - + return cdvd.KeyXor; break; - + case 0x3A: // DEC_SET CDR_LOG("cdvdRead3A(DecSet) %x", cdvd.decSet); - + Console::WriteLn("DecSet Read: %02X", params cdvd.decSet); return cdvd.decSet; break; - + default: // note: notify the console since this is a potentially serious emulation problem: PSXHW_LOG("*Unknown 8bit read at address 0x1f4020%x", key); @@ -1071,7 +1071,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND case N_CD_NOP: // CdNop_ cdvdSetIrq(); break; - + case N_CD_STANDBY: // CdStandby // Seek to sector zero. The cdvdStartSeek function will simulate @@ -1099,10 +1099,10 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM ); CDVD_INT( cdvdStartSeek( *(uint*)(cdvd.Param+0), MODE_DVDROM ) ); break; - + case N_CD_READ: // CdRead // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7]. - cdvd.SeekToSector = *(u32*) (cdvd.Param+0); + cdvd.SeekToSector = *(u32*) (cdvd.Param+0); cdvd.nSectors = *(u32*)(cdvd.Param+4); cdvd.RetryCnt = (cdvd.Param[8] == 0) ? 0x100 : cdvd.Param[8]; cdvd.SpindlCtrl = cdvd.Param[9]; @@ -1110,7 +1110,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND switch (cdvd.Param[10]) { case 2: cdvd.ReadMode = CDVD_MODE_2340; cdvd.BlockSize = 2340; break; case 1: cdvd.ReadMode = CDVD_MODE_2328; cdvd.BlockSize = 2328; break; - case 0: + case 0: default: cdvd.ReadMode = CDVD_MODE_2048; cdvd.BlockSize = 2048; break; } @@ -1138,16 +1138,16 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND case N_CD_READ_CDDA: // CdReadCDDA case N_CD_READ_XCDDA: // CdReadXCDDA // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7]. - cdvd.SeekToSector = *(u32*) (cdvd.Param+0); + cdvd.SeekToSector = *(u32*) (cdvd.Param+0); cdvd.nSectors = *(u32*)(cdvd.Param+4); - - if (cdvd.Param[8] == 0) + + if (cdvd.Param[8] == 0) cdvd.RetryCnt = 0x100; - else + else cdvd.RetryCnt = cdvd.Param[8]; - + cdvd.SpindlCtrl = cdvd.Param[9]; - + switch (cdvd.Param[9]) { case 0x01: cdvd.Speed = 1; break; case 0x02: cdvd.Speed = 2; break; @@ -1155,7 +1155,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND case 0x04: cdvd.Speed = 12; break; default: cdvd.Speed = 24; break; } - + switch (cdvd.Param[10]) { case 1: cdvd.ReadMode = CDVD_MODE_2368; cdvd.BlockSize = 2368; break; case 2: @@ -1168,7 +1168,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND if( EmuConfig.CdvdVerboseReads ) Console::WriteLn("CdAudioRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx", params cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed); - + cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM ); CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_CDROM ) ); @@ -1185,29 +1185,29 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND case N_DVD_READ: // DvdRead // Assign the seek to sector based on cdvd.Param[0]-[3], and the number of sectors based on cdvd.Param[4]-[7]. - cdvd.SeekToSector = *(u32*) (cdvd.Param+0); + cdvd.SeekToSector = *(u32*) (cdvd.Param+0); cdvd.nSectors = *(u32*)(cdvd.Param+4); - - if (cdvd.Param[8] == 0) + + if (cdvd.Param[8] == 0) cdvd.RetryCnt = 0x100; - else + else cdvd.RetryCnt = cdvd.Param[8]; - + cdvd.SpindlCtrl = cdvd.Param[9]; cdvd.Speed = 4; cdvd.ReadMode = CDVD_MODE_2048; cdvd.BlockSize = 2064; // Why oh why was it 2064 - + CDR_LOG( "DvdRead > startSector=%d, nSectors=%d, RetryCnt=%x, Speed=%x(%x), ReadMode=%x(%x) (1074=%x)", cdvd.Sector, cdvd.nSectors, cdvd.RetryCnt, cdvd.Speed, cdvd.Param[9], cdvd.ReadMode, cdvd.Param[10], psxHu32(0x1074)); - + if( EmuConfig.CdvdVerboseReads ) Console::WriteLn("DvdRead: Reading Sector %d(%d Blocks of Size %d) at Speed=%dx", params cdvd.Sector, cdvd.nSectors,cdvd.BlockSize,cdvd.Speed); - + cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM ); CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_DVDROM ) ); - + // Read-ahead by telling the plugin about the track now. // This helps improve performance on actual from-cd emulation // (ie, not using the hard drive) @@ -1231,7 +1231,7 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND HW_DMA3_CHCR &= ~0x01000000; psxDmaInterrupt(3); break; - + case N_CD_READ_KEY: // CdReadKey { u8 arg0 = cdvd.Param[0]; @@ -1313,9 +1313,9 @@ static __forceinline void cdvdWrite0F(u8 rt) { // TYPE static __forceinline void cdvdWrite14(u8 rt) { // PS1 MODE?? u32 cycle = psxRegs.cycle; - if (rt == 0xFE) + if (rt == 0xFE) Console::Notice("*PCSX2*: go PS1 mode DISC SPEED = FAST"); - else + else Console::Notice("*PCSX2*: go PS1 mode DISC SPEED = %dX", params rt); psxReset(); @@ -1337,7 +1337,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND // int i, lbn, type, min, sec, frm, address; int address; u8 tmp; - + CDR_LOG("cdvdWrite16: SCMD %s (%x) (ParamP = %x)", sCmdName[rt], rt, cdvd.ParamP); cdvd.sCommand = rt; @@ -1359,17 +1359,17 @@ static void cdvdWrite16(u8 rt) // SCOMMAND SetResultSize(4); cdvdGetMechaVer(&cdvd.Result[0]); break; - + case 0x44: // write console ID (9:1) SetResultSize(1); cdvd.Result[0] = cdvdWriteConsoleID(&cdvd.Param[1]); break; - + case 0x45: // read console ID (1:9) SetResultSize(9); cdvd.Result[0] = cdvdReadConsoleID(&cdvd.Result[1]); break; - + case 0xFD: // _sceCdReadRenewalDate (1:6) BCD SetResultSize(6); cdvd.Result[0] = 0; @@ -1387,7 +1387,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND break; } break; - + case 0x05: // CdTrayReqState (0:1) - resets the tray open detection SetResultSize(1); cdvd.Result[0] = 0; @@ -1408,7 +1408,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND cdvd.Result[2] = itob(cdvd.RTC.minute); //Minutes cdvd.Result[3] = itob((cdvd.RTC.hour+8) %24); //Hours cdvd.Result[4] = 0; //Nothing - cdvd.Result[5] = itob(cdvd.RTC.day); //Day + cdvd.Result[5] = itob(cdvd.RTC.day); //Day if(cdvd.Result[3] <= 7) cdvd.Result[5] += 1; cdvd.Result[6] = itob(cdvd.RTC.month)+0x80; //Month cdvd.Result[7] = itob(cdvd.RTC.year); //Year @@ -1439,8 +1439,8 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x0A: // sceCdReadNVM (2:3) address = (cdvd.Param[0]<<8) | cdvd.Param[1]; - - if (address < 512) + + if (address < 512) { SetResultSize(3); cdvd.Result[0] = cdvdReadNVM(&cdvd.Result[1], address*2, 2); @@ -1448,8 +1448,8 @@ static void cdvdWrite16(u8 rt) // SCOMMAND tmp = cdvd.Result[1]; cdvd.Result[1] = cdvd.Result[2]; cdvd.Result[2] = tmp; - } - else + } + else { SetResultSize(1); cdvd.Result[0] = 0xff; @@ -1459,26 +1459,26 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x0B: // sceCdWriteNVM (4:1) SetResultSize(1); address = (cdvd.Param[0]<<8) | cdvd.Param[1]; - - if (address < 512) + + if (address < 512) { // swap bytes around tmp = cdvd.Param[2]; cdvd.Param[2] = cdvd.Param[3]; cdvd.Param[3] = tmp; cdvd.Result[0] = cdvdWriteNVM(&cdvd.Param[2], address*2, 2); - } - else + } + else { cdvd.Result[0] = 0xff; } break; -// case 0x0C: // sceCdSetHDMode (1:1) +// case 0x0C: // sceCdSetHDMode (1:1) // break; - case 0x0F: // sceCdPowerOff (0:1)- Call74 from Xcdvdman + case 0x0F: // sceCdPowerOff (0:1)- Call74 from Xcdvdman SetResultSize(1); cdvd.Result[0] = 0; break; @@ -1499,7 +1499,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND cdvd.Result[0] = 0; //8 is a flag; not used break; - case 0x15: // sceCdForbidDVDP (0:1) + case 0x15: // sceCdForbidDVDP (0:1) //Console::WriteLn("sceCdForbidDVDP"); SetResultSize(1); cdvd.Result[0] = 5; @@ -1538,7 +1538,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND cdvd.Result[0] = 0; break; -// case 0x1D: // cdvdman_call116 (0:5) - In V10 Bios +// case 0x1D: // cdvdman_call116 (0:5) - In V10 Bios // break; case 0x1E: // sceRemote2Read (0:5) - // 00 14 AA BB CC -> remote key code @@ -1560,10 +1560,10 @@ static void cdvdWrite16(u8 rt) // SCOMMAND cdvd.Result[2] = 0x00; break; -// case 0x21: // sceCdWriteWakeUpTime (8:1) +// case 0x21: // sceCdWriteWakeUpTime (8:1) // break; - case 0x22: // sceCdReadWakeUpTime (0:10) + case 0x22: // sceCdReadWakeUpTime (0:10) SetResultSize(10); cdvd.Result[0] = 0; cdvd.Result[1] = 0; @@ -1577,22 +1577,22 @@ static void cdvdWrite16(u8 rt) // SCOMMAND cdvd.Result[9] = 0; break; - case 0x24: // sceCdRCBypassCtrl (1:1) - In V10 Bios + case 0x24: // sceCdRCBypassCtrl (1:1) - In V10 Bios // FIXME: because PRId<0x23, the bit 0 of sio2 don't get updated 0xBF808284 SetResultSize(1); cdvd.Result[0] = 0; break; -// case 0x25: // cdvdman_call120 (1:1) - In V10 Bios +// case 0x25: // cdvdman_call120 (1:1) - In V10 Bios // break; -// case 0x26: // cdvdman_call128 (0,3) - In V10 Bios +// case 0x26: // cdvdman_call128 (0,3) - In V10 Bios // break; -// case 0x27: // cdvdman_call148 (0:13) - In V10 Bios +// case 0x27: // cdvdman_call148 (0:13) - In V10 Bios // break; -// case 0x28: // cdvdman_call150 (1:1) - In V10 Bios +// case 0x28: // cdvdman_call150 (1:1) - In V10 Bios // break; case 0x29: //sceCdNoticeGameStart (1:1) @@ -1631,7 +1631,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x36: //cdvdman_call189 [__sceCdReadRegionParams - made up name] (0:15) i think it is 16, not 15 SetResultSize(15); - + cdvdGetMechaVer(&cdvd.Result[1]); cdvd.Result[0] = cdvdReadRegionParams(&cdvd.Result[3]);//size==8 Console::WriteLn("REGION PARAMS = %s %s", params mg_zones[cdvd.Result[1]], &cdvd.Result[3]); @@ -1721,7 +1721,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x84: // secrman: __mechacon_auth_0x84 SetResultSize(1+8+4);//in:0 cdvd.Result[0] = 0; - + cdvd.Result[1] = 0x21; cdvd.Result[2] = 0xdc; cdvd.Result[3] = 0x31; @@ -1740,7 +1740,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x85: // secrman: __mechacon_auth_0x85 SetResultSize(1+4+8);//in:0 cdvd.Result[0] = 0; - + cdvd.Result[1] = 0xeb; cdvd.Result[2] = 0x01; cdvd.Result[3] = 0xc7; @@ -1800,7 +1800,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND fail_pol_cal(); break; } - + Console::Write("[MG] ELF_size=0x%X Hdr_size=0x%X unk=0x%X flags=0x%X count=%d zones=", params *(u32*)&cdvd.mg_buffer[0x10], *(u16*)&cdvd.mg_buffer[0x14], *(u16*)&cdvd.mg_buffer[0x16], *(u16*)&cdvd.mg_buffer[0x18], *(u16*)&cdvd.mg_buffer[0x1A]); @@ -1809,18 +1809,18 @@ static void cdvdWrite16(u8 rt) // SCOMMAND if (cdvd.mg_buffer[0x1C] & (1< void *_openfile(const char *filename, int flags) @@ -54,11 +54,11 @@ int _seekfile(void *handle, u64 offset, int whence) { u64 ofs = (u64)offset; PLONG _ofs = (LONG*) & ofs; - + // Console::WriteLn("_seekfile %p, %d_%d", params handle, _ofs[1], _ofs[0]); - + SetFilePointer(handle, _ofs[0], &_ofs[1], (whence == SEEK_SET) ? FILE_BEGIN : FILE_END); - + return 0; } @@ -71,7 +71,7 @@ int _readfile(void *handle, void *dst, int size) return ret; } -int _writefile(void *handle, void *src, int size) +int _writefile(void *handle, const void *src, int size) { DWORD ret; @@ -94,18 +94,19 @@ void *_openfile(const char *filename, int flags) if (flags & O_WRONLY) return fopen64(filename, "wb"); - else + else return fopen64(filename, "rb"); } u64 _tellfile(void *handle) { - s64 cursize = ftell(handle); - + FILE* fp = (FILE*)handle; + s64 cursize = ftell(fp); + if (cursize == -1) { // try 64bit - cursize = ftello64(handle); + cursize = ftello64(fp); if (cursize < -1) { // zero top 32 bits @@ -117,26 +118,26 @@ u64 _tellfile(void *handle) int _seekfile(void *handle, u64 offset, int whence) { - int seekerr = fseeko64(handle, offset, whence); - + int seekerr = fseeko64((FILE*)handle, offset, whence); + if (seekerr == -1) Console::Error("Failed to seek."); - + return seekerr; } int _readfile(void *handle, void *dst, int size) { - return fread(dst, 1, size, handle); + return fread(dst, 1, size, (FILE*)handle); } -int _writefile(void *handle, void *src, int size) +int _writefile(void *handle, const void *src, int size) { - return fwrite(src, 1, size, handle); + return fwrite(src, 1, size, (FILE*)handle); } void _closefile(void *handle) { - fclose(handle); + fclose((FILE*)handle); } #endif diff --git a/pcsx2/CDVD/IsoFileTools.h b/pcsx2/CDVD/IsoFileTools.h index 0692c4ccaa..304cd9ab96 100644 --- a/pcsx2/CDVD/IsoFileTools.h +++ b/pcsx2/CDVD/IsoFileTools.h @@ -5,33 +5,35 @@ * 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 */ - #ifndef __ISO_FILE_TOOLS_H__ -#define __ISO_FILE_TOOLS_H__ +#pragma once #ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE +#define _LARGEFILE_SOURCE #endif #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif +#ifndef __USE_FILE_OFFSET64 #define __USE_FILE_OFFSET64 +#endif + #define _FILE_OFFSET_BITS 64 #ifdef _MSC_VER -#pragma warning(disable:4018) +# pragma warning(disable:4018) // disable signed/unsigned mismatch error #endif #include "IopCommon.h" @@ -40,11 +42,10 @@ #include #include -void *_openfile(const char *filename, int flags); -u64 _tellfile(void *handle); -int _seekfile(void *handle, u64 offset, int whence); -int _readfile(void *handle, void *dst, int size); -int _writefile(void *handle, void *src, int size); -void _closefile(void *handle); +extern void *_openfile(const char *filename, int flags); +extern u64 _tellfile(void *handle); +extern int _seekfile(void *handle, u64 offset, int whence); +extern int _readfile(void *handle, void *dst, int size); +extern int _writefile(void *handle, const void *src, int size); +extern void _closefile(void *handle); -#endif \ No newline at end of file diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index c2e987a620..26c654c845 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -109,16 +109,31 @@ + + + - + + - + + + + + + + + + + + + @@ -199,6 +214,7 @@ + @@ -253,12 +269,15 @@ + + + @@ -268,10 +287,14 @@ + + + + @@ -292,6 +315,10 @@ + + + + diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 1430a1b1fe..6032786ee0 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -47,7 +47,7 @@ const PluginInfo tbl_PluginInfo[] = }; -int EnumeratePluginsInFolder( wxDirName& searchpath, wxArrayString* dest ) +int EnumeratePluginsInFolder( const wxDirName& searchpath, wxArrayString* dest ) { wxScopedPtr placebo; wxArrayString* realdest = dest; @@ -87,7 +87,7 @@ struct LegacyApi_ReqMethod // fallback is used if the method is null. If the method is null and fallback is null // also, the plugin is considered incomplete or invalid, and an error is generated. VoidMethod* Fallback; - + // returns the method name as a wxString, converted from UTF8. wxString GetMethodName( ) const { @@ -100,7 +100,7 @@ struct LegacyApi_OptMethod { const char* MethodName; VoidMethod** Dest; // Target function where the binding is saved. - + // returns the method name as a wxString, converted from UTF8. wxString GetMethodName() const { return wxString::FromUTF8( MethodName ); } }; @@ -335,7 +335,7 @@ s32 CALLBACK CDVD_readSector(u8* buffer, u32 lsn, int mode) { if(CDVD->readTrack(lsn,mode) < 0) return -1; - + // TEMP: until all the plugins use the new CDVDgetBuffer style switch (mode) { @@ -397,7 +397,7 @@ CDVD_API CDVDapi_Plugin = { CDVDplugin_Close, - // The rest are filled in by the plugin manager + // The rest are filled in by the plugin manager NULL }; CDVD_API* CDVD = NULL; @@ -420,7 +420,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_CDVD[] = { "CDVDreadSector", (vMeth**)&CDVDapi_Plugin.readSector, (vMeth*)CDVD_readSector }, { "CDVDgetBuffer2", (vMeth**)&CDVDapi_Plugin.getBuffer2, (vMeth*)CDVD_getBuffer2 }, { "CDVDgetDualInfo", (vMeth**)&CDVDapi_Plugin.getDualInfo, (vMeth*)CDVD_getDualInfo }, - + { NULL } }; @@ -476,7 +476,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_DEV9[] = { "DEV9writeDMA8Mem", (vMeth**)&DEV9writeDMA8Mem, NULL }, { "DEV9irqCallback", (vMeth**)&DEV9irqCallback, NULL }, { "DEV9irqHandler", (vMeth**)&DEV9irqHandler, NULL }, - + { NULL } }; @@ -523,7 +523,7 @@ static const LegacyApi_OptMethod s_MethMessOpt_FW[] = { NULL } }; -static const LegacyApi_ReqMethod* const s_MethMessReq[] = +static const LegacyApi_ReqMethod* const s_MethMessReq[] = { s_MethMessReq_CDVD, s_MethMessReq_GS, @@ -557,7 +557,6 @@ Exception::NotPcsxPlugin::NotPcsxPlugin( const PluginsEnum_t& pid ) : void PluginManager::BindCommon( PluginsEnum_t pid ) { const LegacyApi_CommonMethod* current = s_MethMessCommon; - int fid = 0; // function id VoidMethod** target = (VoidMethod**)&m_CommonBindings[pid]; while( current->MethodName != NULL ) @@ -576,10 +575,10 @@ void PluginManager::BindRequired( PluginsEnum_t pid ) while( current->MethodName != NULL ) { *(current->Dest) = (VoidMethod*)lib.GetSymbol( current->GetMethodName() ); - + if( *(current->Dest) == NULL ) *(current->Dest) = current->Fallback; - + if( *(current->Dest) == NULL ) { throw Exception::NotPcsxPlugin( pid ); @@ -618,22 +617,22 @@ void PluginManager::LoadPlugins() if( !m_libs[i].Load( plugpath ) ) throw Exception::NotPcsxPlugin( plugpath ); - + // Try to enumerate the new v2.0 plugin interface first. // If that fails, fall back on the old style interface. //m_libs[i].GetSymbol( L"PS2E_InitAPI" ); - + // Bind Required Functions // (generate critical error if binding fails) - + BindCommon( pid ); BindRequired( pid ); BindOptional( pid ); - + // Bind Optional Functions // (leave pointer null and do not generate error) - + } } @@ -780,20 +779,20 @@ namespace PluginTypes }; } -int PS2E_LT[9] = { -PS2E_LT_GS, -PS2E_LT_PAD,PS2E_LT_PAD, PS2E_LT_PAD, -PS2E_LT_SPU2, -PS2E_LT_CDVD, +int PS2E_LT[9] = { +PS2E_LT_GS, +PS2E_LT_PAD,PS2E_LT_PAD, PS2E_LT_PAD, +PS2E_LT_SPU2, +PS2E_LT_CDVD, PS2E_LT_DEV9, PS2E_LT_USB, PS2E_LT_FW}; int PS2E_VERSION[9] = { -PS2E_GS_VERSION, -PS2E_PAD_VERSION,PS2E_PAD_VERSION, PS2E_PAD_VERSION, -PS2E_SPU2_VERSION, -PS2E_CDVD_VERSION, +PS2E_GS_VERSION, +PS2E_PAD_VERSION,PS2E_PAD_VERSION, PS2E_PAD_VERSION, +PS2E_SPU2_VERSION, +PS2E_CDVD_VERSION, PS2E_DEV9_VERSION, PS2E_USB_VERSION, PS2E_FW_VERSION}; @@ -845,7 +844,7 @@ static int _TestPS2Esyms(void* drv, int type, int expected_version, const wxStri return 0; } -static __forceinline bool TestPS2Esyms(void* &drv, PluginTypes::PluginTypes type, const string& filename) +static __forceinline bool TestPS2Esyms(void* &drv, PluginTypes::PluginTypes type, const string& filename) { if (_TestPS2Esyms(drv, PS2E_LT[type],PS2E_VERSION[type],filename) < 0) return false; return true; @@ -1210,7 +1209,7 @@ bool ReportError(int err, const char *str) { if (err != 0) { - Msgbox::Alert("%s error: %d", params str, err); + Msgbox::Alert("%s error: %d", params str, err); return true; } return false; @@ -1220,7 +1219,7 @@ bool ReportError2(int err, const char *str) { if (err != 0) { - Msgbox::Alert("Error Opening %s Plugin", params str, err); + Msgbox::Alert("Error Opening %s Plugin", params str, err); return true; } return false; @@ -1239,9 +1238,9 @@ int InitPlugins() if (ReportError(PAD1init(1), "PAD1init")) return -1; if (ReportError(PAD2init(2), "PAD2init")) return -1; if (ReportError(SPU2init(), "SPU2init")) return -1; - + if (ReportError(DoCDVDinit(), "CDVDinit")) return -1; - + if (ReportError(DEV9init(), "DEV9init")) return -1; if (ReportError(USBinit(), "USBinit")) return -1; if (ReportError(FWinit(), "FWinit")) return -1; @@ -1264,14 +1263,14 @@ void ShutdownPlugins() if (PAD2shutdown != NULL) PAD2shutdown(); if (SPU2shutdown != NULL) SPU2shutdown(); - + //if (CDVDshutdown != NULL) CDVDshutdown(); DoCDVDshutdown(); // safety measures, in case ISO is currently loaded. if(cdvdInitCount>0) CDVD_plugin.shutdown(); - + if (DEV9shutdown != NULL) DEV9shutdown(); if (USBshutdown != NULL) USBshutdown(); if (FWshutdown != NULL) FWshutdown(); @@ -1286,13 +1285,13 @@ extern void spu2Irq(); bool OpenGS() { GSdriverInfo info; - - if (!OpenStatus.GS) + + if (!OpenStatus.GS) { - if (ReportError2(gsOpen(), "GS")) - { + if (ReportError2(gsOpen(), "GS")) + { ClosePlugins(true); - return false; + return false; } //Get the user input. @@ -1315,18 +1314,18 @@ bool OpenCDVD(const char* pTitleFilename) //First, we need the data. CDVD->newDiskCB(cdvdNewDiskCB); - if (DoCDVDopen(pTitleFilename) != 0) - { - if (g_Startup.BootMode != BootMode_Elf) - { - Msgbox::Alert("Error Opening CDVD Plugin"); - ClosePlugins(true); + if (DoCDVDopen(pTitleFilename) != 0) + { + if (g_Startup.BootMode != BootMode_Elf) + { + Msgbox::Alert("Error Opening CDVD Plugin"); + ClosePlugins(true); return false; } - else - { - Console::Notice("Running ELF File Without CDVD Plugin Support!"); - only_loading_elf = true; + else + { + Console::Notice("Running ELF File Without CDVD Plugin Support!"); + only_loading_elf = true; } } OpenStatus.CDVD = true; @@ -1338,10 +1337,10 @@ bool OpenPAD1() { if (!OpenStatus.PAD1) { - if (ReportError2(PAD1open((void *)&pDsp), "PAD1")) - { - ClosePlugins(true); - return false; + if (ReportError2(PAD1open((void *)&pDsp), "PAD1")) + { + ClosePlugins(true); + return false; } OpenStatus.PAD1 = true; } @@ -1349,13 +1348,13 @@ bool OpenPAD1() } bool OpenPAD2() -{ +{ if (!OpenStatus.PAD2) { - if (ReportError2(PAD2open((void *)&pDsp), "PAD2")) - { - ClosePlugins(true); - return false; + if (ReportError2(PAD2open((void *)&pDsp), "PAD2")) + { + ClosePlugins(true); + return false; } OpenStatus.PAD2 = true; } @@ -1367,14 +1366,14 @@ bool OpenSPU2() if (!OpenStatus.SPU2) { SPU2irqCallback(spu2Irq,spu2DMA4Irq,spu2DMA7Irq); - + if (SPU2setDMABaseAddr != NULL) SPU2setDMABaseAddr((uptr)psxM); if (SPU2setClockPtr != NULL) SPU2setClockPtr(&psxRegs.cycle); - if (ReportError2(SPU2open((void*)&pDsp), "SPU2")) - { - ClosePlugins(true); - return false; + if (ReportError2(SPU2open((void*)&pDsp), "SPU2")) + { + ClosePlugins(true); + return false; } OpenStatus.SPU2 = true; } @@ -1387,11 +1386,11 @@ bool OpenDEV9() { DEV9irqCallback(dev9Irq); dev9Handler = DEV9irqHandler(); - - if (ReportError2(DEV9open(&psxRegs.pc)/*((void *)&pDsp)*/, "DEV9")) - { - ClosePlugins(true); - return false; + + if (ReportError2(DEV9open(&psxRegs.pc)/*((void *)&pDsp)*/, "DEV9")) + { + ClosePlugins(true); + return false; } OpenStatus.DEV9 = true; } @@ -1404,11 +1403,11 @@ bool OpenUSB() USBirqCallback(usbIrq); usbHandler = USBirqHandler(); USBsetRAM(psxM); - - if (ReportError2(USBopen((void *)&pDsp), "USB")) - { - ClosePlugins(true); - return false; + + if (ReportError2(USBopen((void *)&pDsp), "USB")) + { + ClosePlugins(true); + return false; } OpenStatus.USB = true; } @@ -1420,11 +1419,11 @@ bool OpenFW() if (!OpenStatus.FW) { FWirqCallback(fwIrq); - - if (ReportError2(FWopen((void *)&pDsp), "FW")) - { - ClosePlugins(true); - return false; + + if (ReportError2(FWopen((void *)&pDsp), "FW")) + { + ClosePlugins(true); + return false; } OpenStatus.FW = true; } @@ -1445,7 +1444,7 @@ int OpenPlugins(const char* pTitleFilename) if ((!OpenCDVD(pTitleFilename)) || (!OpenGS()) || (!OpenPAD1()) || (!OpenPAD2()) || (!OpenSPU2()) || (!OpenDEV9()) || (!OpenUSB()) || (!OpenFW())) return -1; - + if (!only_loading_elf) cdvdDetectDisk(); return 0; } @@ -1533,7 +1532,7 @@ void ReleasePlugins() SysCloseLibrary(DEV9plugin); DEV9plugin = NULL; SysCloseLibrary(USBplugin); USBplugin = NULL; SysCloseLibrary(FWplugin); FWplugin = NULL; - + plugins_loaded = false; } @@ -1558,4 +1557,4 @@ void PluginsResetGS() #else -#endif \ No newline at end of file +#endif diff --git a/pcsx2/Plugins.h b/pcsx2/Plugins.h index 8ab0bba287..9738d7870f 100644 --- a/pcsx2/Plugins.h +++ b/pcsx2/Plugins.h @@ -71,7 +71,7 @@ class PluginManager protected: bool m_initialized; bool m_loaded; - + bool m_IsInitialized[PluginId_Count]; bool m_IsOpened[PluginId_Count]; @@ -90,16 +90,16 @@ public: void LoadPlugins(); void UnloadPlugins(); - + void Init( PluginsEnum_t pid ); void Shutdown( PluginsEnum_t pid ); void Open( PluginsEnum_t pid ); void Close( PluginsEnum_t pid ); - + void Freeze( PluginsEnum_t pid, int mode, freezeData* data ); void Freeze( PluginsEnum_t pid, SaveState& state ); void Freeze( SaveState& state ); - + protected: void BindCommon( PluginsEnum_t pid ); void BindRequired( PluginsEnum_t pid ); @@ -109,7 +109,7 @@ protected: extern const PluginInfo tbl_PluginInfo[]; extern PluginManager* g_plugins; -extern int EnumeratePluginsInFolder( wxDirName& searchPath, wxArrayString* dest ); +extern int EnumeratePluginsInFolder( const wxDirName& searchPath, wxArrayString* dest ); void LoadPlugins(); diff --git a/pcsx2/System.h b/pcsx2/System.h index ebfb8def1a..f116cd872b 100644 --- a/pcsx2/System.h +++ b/pcsx2/System.h @@ -53,6 +53,8 @@ extern void vSyncDebugStuff( uint frame ); #ifdef __LINUX__ +# include + extern void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ); extern void __fastcall InstallLinuxExceptionHandler(); extern void __fastcall ReleaseLinuxExceptionHandler(); diff --git a/pcsx2/Tags.h b/pcsx2/Tags.h index 12f8614aaf..1f6e46c7db 100644 --- a/pcsx2/Tags.h +++ b/pcsx2/Tags.h @@ -22,7 +22,7 @@ // Actually, looks like I didn't need templates after all... :) -enum mfd_type +enum mfd_type { NO_MFD, MFD_RESERVED, @@ -30,7 +30,7 @@ enum mfd_type MFD_GIF }; -enum sts_type +enum sts_type { NO_STS, STS_SIF0, @@ -38,7 +38,7 @@ enum sts_type STS_fromIPU }; -enum std_type +enum std_type { NO_STD, STD_VIF1, @@ -60,7 +60,7 @@ enum d_ctrl_flags enum pce_values { - PCE_NOTHING = 0, + PCE_NOTHING = 0, PCE_RESERVED, PCE_DISABLED, PCE_ENABLED @@ -68,7 +68,7 @@ enum pce_values enum tag_id { - TAG_CNTS = 0, + TAG_CNTS = 0, TAG_REFE = 0, // Transfer Packet According to ADDR field, clear STR, and end TAG_CNT, // Transfer QWC following the tag. TAG_NEXT, // Transfer QWC following tag. TADR = ADDR @@ -82,7 +82,7 @@ enum tag_id enum chcr_flags { CHCR_DIR = 0x1, // Direction: 0 - to memory, 1 - from memory. VIF1 & SIF2 only. - CHCR_MOD1 = 0x4, + CHCR_MOD1 = 0x4, CHCR_MOD2 = 0x8, CHCR_MOD = 0xC, // MOD1 & MOD2; Holds which of the Transfer modes above is used. CHCR_ASP1 = 0x10, @@ -122,9 +122,9 @@ namespace Tag { Console::Error("%s BUSERR", params s); UpperTransfer(tag, ptag); - + // Set BEIS (BUSERR) in DMAC_STAT register - psHu32(DMAC_STAT) |= DMAC_STAT_BEIS; + psHu32(DMAC_STAT) |= DMAC_STAT_BEIS; return false; } else @@ -134,16 +134,16 @@ namespace Tag return true; } } - + /*// Not sure if I'll need this one. static __forceinline bool SafeTransfer(const char *s, DMACh *tag, u32* ptag) { if (ptag == NULL) // Is ptag empty? { Console::Error("%s BUSERR", params s); - + // Set BEIS (BUSERR) in DMAC_STAT register - psHu32(DMAC_STAT) |= DMAC_STAT_BEIS; + psHu32(DMAC_STAT) |= DMAC_STAT_BEIS; return false; } else @@ -153,40 +153,40 @@ namespace Tag return true; } }*/ - + static __forceinline void UnsafeTransfer(DMACh *tag, u32* ptag) { UpperTransfer(tag, ptag); LowerTransfer(tag, ptag); } - + // Untested static __forceinline u16 QWC(u32 *tag) { return (tag[0] & 0xffff); } - + // Untested static __forceinline pce_values PCE(u32 *tag) { return (pce_values)((tag[0] >> 22) & 0x3); } - + static __forceinline tag_id Id(u32* tag) { return (tag_id)((tag[0] >> 28) & 0x7); } - + static __forceinline tag_id Id(u32 tag) { return (tag_id)((tag >> 28) & 0x7); } - + static __forceinline bool IRQ(u32 *tag) { return !!(tag[0] >> 31); } - + static __forceinline bool IRQ(u32 tag) { return !!(tag >> 31); @@ -205,10 +205,10 @@ namespace CHCR { return (TransferMode)((tag->chcr & CHCR_MOD) >> 2); } - + static __forceinline u8 ASP(DMACh *tag) { - + return (TransferMode)((tag->chcr & CHCR_ASP) >> 4); } @@ -217,47 +217,47 @@ namespace CHCR static __forceinline void clearTIE(DMACh *tag) { tag->chcr &= ~CHCR_TIE; } static __forceinline void clearTTE(DMACh *tag) { tag->chcr &= ~CHCR_TTE; } static __forceinline void clearDIR(DMACh *tag) { tag->chcr &= ~CHCR_DIR; } - + // Set them. static __forceinline void setSTR(DMACh *tag) { tag->chcr |= CHCR_STR; } static __forceinline void setTIE(DMACh *tag) { tag->chcr |= CHCR_TIE; } static __forceinline void setTTE(DMACh *tag) { tag->chcr |= CHCR_TTE; } static __forceinline void setDIR(DMACh *tag) { tag->chcr |= CHCR_DIR; } - + static __forceinline void setMOD(DMACh *tag, TransferMode mode) { if (mode & (1 << 0)) - tag->chcr |= CHCR_MOD1; + tag->chcr |= CHCR_MOD1; else - tag->chcr &= CHCR_MOD1; - - if (mode & (1 << 1)) + tag->chcr &= CHCR_MOD1; + + if (mode & (1 << 1)) tag->chcr |= CHCR_MOD2; else tag->chcr &= CHCR_MOD2; } - + static __forceinline void setASP(DMACh *tag, u8 num) { if (num & (1 << 0)) - tag->chcr |= CHCR_ASP1; + tag->chcr |= CHCR_ASP1; else - tag->chcr &= CHCR_ASP2; - - if (num & (1 << 1)) + tag->chcr &= CHCR_ASP2; + + if (num & (1 << 1)) tag->chcr |= CHCR_ASP1; else tag->chcr &= CHCR_ASP2; } - + // Print information about a chcr tag. static __forceinline void Print(const char* s, DMACh *tag) { u8 num_addr = ASP(tag); TransferMode mode = MOD(tag); - - Console::Write("%s chcr %s mem: ", params s, (DIR(tag)) ? "from" : "to"); - + + Console::Write("%s chcr %s mem: ", params s, CHCR::DIR(tag) ? "from" : "to"); + if (mode == NORMAL_MODE) Console::Write(" normal mode; "); else if (mode == CHAIN_MODE) @@ -266,7 +266,7 @@ namespace CHCR Console::Write(" interleave mode; "); else Console::Write(" ?? mode; "); - + if (num_addr != 0) Console::Write("ASP = %d;", params num_addr); if (TTE(tag)) Console::Write("TTE;"); if (TIE(tag)) Console::Write("TIE;"); @@ -281,8 +281,8 @@ namespace QWC { return (tag->qwc == 0); } - - + + static __forceinline void Clear(DMACh *tag) { tag->qwc = 0; @@ -293,20 +293,20 @@ namespace D_CTRL { static __forceinline bool DMAE() { return !!(psHu32(DMAC_CTRL) & CTRL_DMAE); } static __forceinline bool RELE() { return !!(psHu32(DMAC_CTRL) & CTRL_RELE); } - static __forceinline mfd_type MFD() - { + static __forceinline mfd_type MFD() + { return (mfd_type)((psHu32(DMAC_CTRL) & CTRL_MFD) >> 2); } - static __forceinline sts_type STS() - { + static __forceinline sts_type STS() + { return (sts_type)((psHu32(DMAC_CTRL) & CTRL_STS) >> 4); } - static __forceinline std_type STD() - { + static __forceinline std_type STD() + { return (std_type)((psHu32(DMAC_CTRL) & CTRL_STD) >> 6); } - static __forceinline int RCLC() - { + static __forceinline int RCLC() + { return ((((psHu32(DMAC_CTRL) & CTRL_RCYC) >> 3) + 1) * 8); } } diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 9a1ba29d03..c4efc339cd 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -38,7 +38,7 @@ namespace PathDefs static const wxDirName retval( L"snaps" ); return retval; } - + const wxDirName& Savestates() { static const wxDirName retval( L"sstates" ); @@ -50,19 +50,19 @@ namespace PathDefs static const wxDirName retval( L"memcards" ); return retval; } - + const wxDirName& Settings() { static const wxDirName retval( L"inis" ); return retval; } - + const wxDirName& Plugins() { static const wxDirName retval( L"plugins" ); return retval; } - + const wxDirName& Logs() { static const wxDirName retval( L"logs" ); @@ -74,7 +74,7 @@ namespace PathDefs static const wxDirName retval( L"dumps" ); return retval; } - + const wxDirName& Themes() { static const wxDirName retval( L"themes" ); @@ -175,7 +175,7 @@ const wxDirName& AppConfig::FolderOptions::operator[]( FoldersEnum_t folderidx ) case FolderId_Savestates: return Savestates; case FolderId_MemoryCards: return MemoryCards; case FolderId_Logs: return Logs; - + jNO_DEFAULT } return Plugins; // unreachable, but suppresses warnings. @@ -192,7 +192,7 @@ const bool AppConfig::FolderOptions::IsDefault( FoldersEnum_t folderidx ) const case FolderId_Savestates: return UseDefaultSavestates; case FolderId_MemoryCards: return UseDefaultMemoryCards; case FolderId_Logs: return UseDefaultLogs; - + jNO_DEFAULT } return false; @@ -211,27 +211,27 @@ void AppConfig::FolderOptions::Set( FoldersEnum_t folderidx, const wxString& src Settings = src; UseDefaultSettings = useDefault; break; - + case FolderId_Bios: Bios = src; UseDefaultBios = useDefault; break; - + case FolderId_Snapshots: Snapshots = src; UseDefaultSnapshots = useDefault; break; - + case FolderId_Savestates: Savestates = src; UseDefaultSavestates = useDefault; break; - + case FolderId_MemoryCards: MemoryCards = src; UseDefaultMemoryCards = useDefault; break; - + case FolderId_Logs: Logs = src; UseDefaultLogs = useDefault; @@ -252,10 +252,10 @@ namespace FilenameDefs return wxGetApp().GetAppName() + L".ini"; } - + wxFileName GetUsermodeConfig() { - return L"usermode.ini"; + return wxFileName( L"usermode.ini" ); } const wxFileName& Memcard( int slot ) @@ -265,10 +265,10 @@ namespace FilenameDefs wxFileName( L"Mcd001.ps2" ), wxFileName( L"Mcd002.ps2" ) }; - + if( IsDevBuild && ((uint)slot) < 2 ) throw Exception::IndexBoundsFault( L"FilenameDefs::Memcard", slot, 2 ); - + return retval[slot]; } }; @@ -433,7 +433,7 @@ void AppConfig::Apply() // Update the compression attribute on the Memcards folder. // Memcards generally compress very well via NTFS compression. - + NTFS_CompressFile( Folders.MemoryCards.ToString(), McdEnableNTFS ); { @@ -446,7 +446,7 @@ void AppConfig::Apply() } } } - + // Always perform delete and reload of the Recent Iso List. This handles cases where // the recent file count has been changed, and it's a helluva lot easier than trying // to make a clone copy of this complex object. ;) @@ -492,7 +492,7 @@ AppConfig::ConsoleLogOptions::ConsoleLogOptions() : , FontSize( 8 ) { } - + void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini, const wxChar* logger ) { ConsoleLogOptions defaults; @@ -503,7 +503,7 @@ void AppConfig::ConsoleLogOptions::LoadSave( IniInterface& ini, const wxChar* lo IniEntry( DisplayPosition ); IniEntry( DisplaySize ); IniEntry( FontSize ); - + ini.SetPath( L".." ); } diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index b929e4fe1d..9ff5bcfce6 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -36,13 +36,13 @@ static T& MakeWizWidget( int pageid, wxWizardPage& src ) // ---------------------------------------------------------------------------- Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) : - DirPickerPanel( parent, FolderId_Settings, _("Settings"), _("Select a folder for PCSX2 settings") ) + DirPickerPanel( parent, FolderId_Settings, _("Settings"), _("Select a folder for PCSX2 settings") ) { SetToolTip( pxE( ".Tooltips:Folders:Settings", L"This is the folder where PCSX2 saves your settings, including settings generated " L"by most plugins (some older plugins may not respect this value)." ) ); - + // Insert this into the top of the staticboxsizer created by the constructor. GetSizer()->Insert( 0, new wxStaticText( this, wxID_ANY, @@ -52,10 +52,9 @@ Panels::SettingsDirPickerPanel::SettingsDirPickerPanel( wxWindow* parent ) : ), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ), wxSizerFlags().Expand().Border( wxBOTTOM, 6 ) ); - - SetSizerAndFit( GetSizer(), false ); -} + //SetSizerAndFit( GetSizer(), false ); +} // ---------------------------------------------------------------------------- FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) : @@ -64,7 +63,6 @@ FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) : , m_dirpick_settings( *new SettingsDirPickerPanel( this ) ) , m_panel_LangSel( *new LanguageSelectionPanel( *this, 608 ) ) , m_panel_UserSel( *new UsermodeSelectionPanel( *this, 608 ) ) - { wxBoxSizer& usermodeSizer( *new wxBoxSizer( wxVERTICAL ) ); AddStaticTextTo( this, usermodeSizer, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") ); @@ -74,7 +72,7 @@ FirstTimeWizard::UsermodePage::UsermodePage( wxWizard* parent ) : usermodeSizer.AddSpacer( 6 ); usermodeSizer.Add( &m_dirpick_settings, SizerFlags::SubGroup() ); - SetSizerAndFit( &usermodeSizer ); + SetSizer( &usermodeSizer ); Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(FirstTimeWizard::UsermodePage::OnUsermodeChanged) ); } @@ -102,7 +100,12 @@ FirstTimeWizard::FirstTimeWizard( wxWindow* parent ) : // Page 2 - Plugins Panel wxBoxSizer& pluginSizer( *new wxBoxSizer( wxVERTICAL ) ); pluginSizer.Add( &m_panel_PluginSel, SizerFlags::StdExpand() ); - m_page_plugins.SetSizerAndFit( &pluginSizer ); + m_page_plugins.SetSizer( &pluginSizer ); + + // Page 3 - Bios Panel + wxBoxSizer& biosSizer( *new wxBoxSizer( wxVERTICAL ) ); + biosSizer.Add( &m_panel_BiosSel, SizerFlags::StdExpand() ); + m_page_bios.SetSizer( &biosSizer ); // Assign page indexes as client data m_page_usermode.SetClientData ( (void*)0 ); @@ -152,7 +155,7 @@ void FirstTimeWizard::OnPageChanging( wxWizardEvent& evt ) if( wxFile::Exists( g_Conf->FullPathToConfig() ) ) { // Asks the user if they want to import or overwrite the existing settings. - + Dialogs::ImportSettingsDialog modal( this ); if( modal.ShowModal() != wxID_OK ) { @@ -194,4 +197,4 @@ if( !wxDir::Exists( biosfolder ) ) { Msgbox::Alert( ("First Time Installation:\n\n") + BIOS_GetMsg_Required() ); } -*/ \ No newline at end of file +*/ diff --git a/pcsx2/gui/HostGui.cpp b/pcsx2/gui/HostGui.cpp index 5aeb98a5af..2e9a6c12c6 100644 --- a/pcsx2/gui/HostGui.cpp +++ b/pcsx2/gui/HostGui.cpp @@ -15,9 +15,9 @@ * 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 "Mainframe.h" +#include "MainFrame.h" // This API is likely obsolete for the most part, so I've just included a few dummies // to keep things compiling until I can get to the point of tying up loose ends. @@ -41,14 +41,14 @@ namespace HostGui { // Probably obsolete if we do a savestate dialog. } - + void BeginExecution() { wxASSERT( g_EmuThread != NULL ); g_EmuThread->Resume(); } - + void __fastcall KeyEvent( keyEvent* ev ) { } -} \ No newline at end of file +} diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 3db2853a32..21e09d7004 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -225,7 +225,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_SaveStatesSubmenu( *MakeStatesSubMenu( Menu_State_Save01 ) ), m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, Menu_Console, L"Show Console", wxEmptyString, wxITEM_CHECK ) ), - + m_IsPaused( false ) { // ------------------------------------------------------------------------ @@ -293,7 +293,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // ------------------------------------------------------------------------ - m_menuConfig.Append(Menu_Config_Settings, _("Settings") ); + m_menuConfig.Append(Menu_Config_Settings, _("General Settings") ); m_menuConfig.AppendSeparator(); // Query installed "tertiary" plugins for name and menu options. diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index a1e7aa9fc0..0f9888eaea 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -47,7 +47,7 @@ bool Panels::BaseSelectorPanel::Show( bool visible ) { if( visible ) OnShown(); - + return BaseApplicableConfigPanel::Show( visible ); } @@ -66,7 +66,7 @@ void Panels::BaseSelectorPanel::OnFolderChanged( wxFileDirPickerEvent& evt ) // ---------------------------------------------------------------------------- Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow& parent, int idealWidth ) : - BaseSelectorPanel( parent, idealWidth-9 ) + BaseSelectorPanel( parent, idealWidth-12 ) , m_ComboBox( *new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT | wxLB_NEEDED_SB ) ) , m_FolderPicker( *new DirPickerPanel( this, FolderId_Bios, _("BIOS Search Path:"), // static box label @@ -77,16 +77,15 @@ Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow& parent, int idealWidth ) m_ComboBox.SetFont( wxFont( m_ComboBox.GetFont().GetPointSize()+1, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL, false, L"Lucida Console" ) ); m_ComboBox.SetMinSize( wxSize( wxDefaultCoord, std::max( m_ComboBox.GetMinSize().GetHeight(), 96 ) ) ); + m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") ); + wxBoxSizer& sizer( *new wxBoxSizer( wxVERTICAL ) ); AddStaticText( sizer, _("Select a BIOS rom:"), wxALIGN_LEFT ); sizer.Add( &m_ComboBox, SizerFlags::StdExpand() ); - sizer.AddSpacer( 6 ); - - m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder where PCSX2 will look for PS2 BIOS roms.") ); sizer.Add( &m_FolderPicker, SizerFlags::StdExpand() ); - SetSizerAndFit( &sizer ); + SetSizer( &sizer ); } Panels::BiosSelectorPanel::~BiosSelectorPanel() @@ -110,7 +109,7 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus() delete m_BiosList; m_BiosList = bioslist.release(); - + return validated; } @@ -124,9 +123,9 @@ void Panels::BiosSelectorPanel::Apply( AppConfig& conf ) L"User did not specify a valid BIOS selection.", // Translated - pxE( ".Popup Error:Invalid BIOS Selection", - L"Please select a valid BIOS before applying new settings. If you are unable to make\n" - L"a valid selection then press cancel to close the Configuration panel." + pxE( ".Popup Error:Invalid BIOS Selection", + L"Please select a valid BIOS. If you are unable to make a valid selection " + L"then press cancel to close the Configuration panel." ) ); } @@ -145,7 +144,7 @@ void Panels::BiosSelectorPanel::DoRefresh() wxString description; if( !IsBIOS((*m_BiosList)[i], description) ) continue; int sel = m_ComboBox.Append( description, (void*)i ); - + wxFileName left( (*m_BiosList)[i] ); left.MakeRelativeTo( g_Conf->Folders.Plugins.ToString() ); diff --git a/pcsx2/gui/Panels/DirPickerPanel.cpp b/pcsx2/gui/Panels/DirPickerPanel.cpp index 96986dcbcc..03c42b8fc3 100644 --- a/pcsx2/gui/Panels/DirPickerPanel.cpp +++ b/pcsx2/gui/Panels/DirPickerPanel.cpp @@ -31,7 +31,7 @@ static wxString GetNormalizedConfigFolder( FoldersEnum_t folderId ) wxDirName normalized( isDefault ? PathDefs::Get(folderId) : g_Conf->Folders[folderId] ); normalized.Normalize( wxPATH_NORM_ALL ); return normalized.ToString(); -} +} // Pass me TRUE if the default path is to be used, and the DirPcikerCtrl disabled from use. void Panels::DirPickerPanel::UpdateCheckStatus( bool someNoteworthyBoolean ) @@ -71,7 +71,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid { wxStaticBoxSizer& s_box( *new wxStaticBoxSizer( wxVERTICAL, this, label ) ); wxFlexGridSizer& s_lower( *new wxFlexGridSizer( 2, 0, 4 ) ); - + s_lower.AddGrowableCol( 1 ); // Force the Dir Picker to use a text control. This isn't standard on Linux/GTK but it's much @@ -87,7 +87,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid if( !wxDir::Exists( normalized ) ) wxMkdir( normalized ); - m_pickerCtrl = new wxDirPickerCtrl( this, wxID_ANY, normalized, dialogLabel, + m_pickerCtrl = new wxDirPickerCtrl( this, wxID_ANY, wxEmptyString, dialogLabel, wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST ); @@ -99,12 +99,19 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid L"" ) ); +#ifndef __WXGTK__ + // GTK+ : The wx implementation of Explore isn't reliable, so let's not even put the + // button on the dialogs for now. + wxButton* b_explore( new wxButton( this, wxID_ANY, _("Open in Explorer") ) ); b_explore->SetToolTip( _("Open an explorer window to this folder.") ); s_lower.Add( b_explore, SizerFlags::StdButton().Align( wxALIGN_RIGHT ) ); + Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) ); +#endif + s_box.Add( &s_lower, wxSizerFlags().Expand() ); - SetSizerAndFit( &s_box ); + SetSizer( &s_box ); // Apply default values const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId ); @@ -112,13 +119,17 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid m_pickerCtrl->Enable( !isDefault ); Connect( m_checkCtrl->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DirPickerPanel::UseDefaultPath_Click ) ); - Connect( b_explore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DirPickerPanel::Explore_Click ) ); + + // Finally, assign the real value from the config. + // (done here because wxGTK fails to init the control when provisioning the initial path + // via the contructor) + m_pickerCtrl->SetPath( GetNormalizedConfigFolder( m_FolderId ) ); } Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& msg ) { InsertStaticTextAt( this, *GetSizer(), 0, msg ); - SetSizerAndFit( GetSizer(), false ); + //SetSizer( GetSizer(), false ); return *this; } diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index eadb843ab2..3e0a5f3c3d 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -41,11 +41,11 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : L"will need to turn off fixes manually when changing games." )); - SetSizerAndFit( &mainSizer ); + SetSizer( &mainSizer ); } void Panels::GameFixesPanel::Apply( AppConfig& conf ) { - + } diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index a4034c9c3f..6e88892d04 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -27,7 +27,7 @@ using namespace wxHelpers; Panels::StaticApplyState Panels::g_ApplyState; // ----------------------------------------------------------------------- -// This method should be called by the parent dalog box of a configuration +// This method should be called by the parent dalog box of a configuration // on dialog destruction. It asserts if the ApplyList hasn't been cleaned up // and then cleans it up forcefully. // @@ -88,14 +88,14 @@ bool Panels::StaticApplyState::ApplyPage( int pageid, bool saveOnSuccess ) catch( Exception::CannotApplySettings& ex ) { wxMessageBox( ex.DisplayMessage(), _("Cannot apply settings...") ); - + if( ex.GetPanel() != NULL ) ex.GetPanel()->SetFocusToMe(); retval = false; } - - return retval; + + return retval; } // Returns false if one of the panels fails input validation (in which case dialogs @@ -106,18 +106,18 @@ bool Panels::StaticApplyState::ApplyAll() } // ----------------------------------------------------------------------- -Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int idealWidth, bool isFirstTime ) : +Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int idealWidth, bool isFirstTime ) : BaseApplicableConfigPanel( &parent, idealWidth ) , m_radio_user( NULL ) , m_radio_cwd( NULL ) { - const wxString usermodeExplained( pxE( ".Panels:Usermode:Explained", + const wxString usermodeExplained( pxE( ".Panels:Usermode:Explained", L"Please select your preferred default location for PCSX2 user-level documents below " L"(includes memory cards, screenshots, settings, and savestates). " L"These folder locations can be overridden at any time using the Core Settings panel." ) ); - - const wxString usermodeWarning( pxE( ".Panels:Usermode:Warning", + + const wxString usermodeWarning( pxE( ".Panels:Usermode:Warning", L"You can change the preferred default location for PCSX2 user-level documents here " L"(includes memory cards, screenshots, settings, and savestates). " L"This option only affects Standard Paths which are set to use the installation default value." @@ -132,7 +132,7 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int id _("This setting requires administration privlidges from your operating system.") ); s_boxer.AddSpacer( 4 ); - SetSizerAndFit( &s_boxer ); + SetSizer( &s_boxer ); } void Panels::UsermodeSelectionPanel::Apply( AppConfig& conf ) @@ -144,7 +144,7 @@ void Panels::UsermodeSelectionPanel::Apply( AppConfig& conf ) } // ----------------------------------------------------------------------- -Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow& parent, int idealWidth ) : +Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow& parent, int idealWidth ) : BaseApplicableConfigPanel( &parent, idealWidth ) , m_langs() , m_picker( NULL ) @@ -171,8 +171,8 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow& parent, int id AddStaticText( s_lang, _("Select a language: "), wxALIGN_CENTRE_VERTICAL ); s_lang.AddSpacer( 5 ); s_lang.Add( m_picker, SizerFlags::StdSpace() ); - - SetSizerAndFit( &s_lang ); + + SetSizer( &s_lang ); } void Panels::LanguageSelectionPanel::Apply( AppConfig& conf ) diff --git a/pcsx2/gui/Panels/PathsPanel.cpp b/pcsx2/gui/Panels/PathsPanel.cpp index e20d0e40b0..ce85e4c1fa 100644 --- a/pcsx2/gui/Panels/PathsPanel.cpp +++ b/pcsx2/gui/Panels/PathsPanel.cpp @@ -58,7 +58,7 @@ Panels::StandardPathsPanel::StandardPathsPanel( wxWindow& parent ) : _("Select a folder for Snapshots") ). SetToolTip( pxE( ".Tooltips:Folders:Snapshots", L"This folder is where PCSX2 saves screenshots. Actual screenshot image format and style " - L"may vary depending on the GS plugin being used." + L"may vary depending on the GS plugin being used." ) ); s_main.AddSpacer( BetweenFolderSpace ); @@ -80,6 +80,6 @@ Panels::StandardPathsPanel::StandardPathsPanel( wxWindow& parent ) : ) ); s_main.AddSpacer( 5 ); - SetSizerAndFit( &s_main ); + SetSizer( &s_main ); } diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 5641418178..dfb89cf974 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -133,7 +133,7 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent ) : s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) ); s_main.Add( &m_label, SizerFlags::StdExpand() ); - SetSizerAndFit( &s_main ); + SetSizer( &s_main ); } void Panels::PluginSelectorPanel::StatusPanel::SetGaugeLength( int len ) @@ -185,13 +185,17 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel* s_main.AddSpacer( 6 ); s_main.Add( &m_FolderPicker, SizerFlags::StdExpand() ); - SetSizerAndFit( &s_main ); + SetSizer( &s_main ); } void Panels::PluginSelectorPanel::ComboBoxPanel::Reset() { for( int i=0; iClear(); + m_combobox[i]->SetSelection( wxNOT_FOUND ); + m_combobox[i]->SetValue( wxEmptyString ); + } } // ------------------------------------------------------------------------ @@ -204,7 +208,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWid { // note: the status panel is a floating window, so that it can be positioned in the // center of the dialog after it's been fitted to the contents. - + wxBoxSizer& s_main( *new wxBoxSizer( wxVERTICAL ) ); s_main.Add( &m_ComponentBoxes, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() ); @@ -216,7 +220,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWid //s_main.Add( refresh ); //Connect( refresh->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnRefresh ) ); - SetSizerAndFit( &s_main ); + SetSizer( &s_main ); Connect( wxEVT_EnumeratedNext, wxCommandEventHandler( PluginSelectorPanel::OnProgress ) ); Connect( wxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) ); @@ -235,14 +239,14 @@ void Panels::PluginSelectorPanel::Apply( AppConfig& conf ) if( sel == wxNOT_FOUND ) { wxString plugname( wxString::FromAscii( tbl_PluginInfo[i].shortname ) ); - + throw Exception::CannotApplySettings( this, // English Log wxsFormat( L"User did not specify a valid selection for the %s plugin.", plugname.c_str() ), // Translated wxsFormat( L"Please select a valid plugin for the %s.", plugname.c_str() ) + L"\n\n" + - pxE( ".Popup Error:Invalid Plugin Selection", + pxE( ".Popup Error:Invalid Plugin Selection", L"All plugins must have valid selections for PCSX2 to run. If you are unable to make\n" L"a valid selection due to missing plugins or an incomplete install of PCSX2, then\n" L"press cancel to close the Configuration panel." @@ -283,7 +287,7 @@ void Panels::PluginSelectorPanel::DoRefresh() bool Panels::PluginSelectorPanel::ValidateEnumerationStatus() { bool validated = true; - + // re-enumerate plugins, and if anything changed then we need to wipe // the contents of the combo boxes and re-enumerate everything. @@ -322,14 +326,6 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) m_ComponentBoxes.Get(i).SetSelection( 0 ); } - /*if( emptyBoxes > 0 ) - { - Msgbox::Alert( pxE( ".Popup Error:Missing Plugins", - L"Critical Error: A valid plugin for one or more components of PCSX2 could not be found.\n" - L"If this is a fresh install of PCSX2 then your installation may be corrupted or incomplete.\n") - ); - }*/ - m_ComponentBoxes.Show(); m_StatusPanel.Hide(); m_StatusPanel.Reset(); @@ -438,7 +434,7 @@ sptr Panels::PluginSelectorPanel::EnumThread::ExecuteTask() yay.SetExtraLong( curidx ); m_master.GetEventHandler()->AddPendingEvent( yay ); } - + wxCommandEvent done( wxEVT_EnumerationFinished ); m_master.GetEventHandler()->AddPendingEvent( done ); diff --git a/pcsx2/gui/Panels/SpeedhacksPanel.cpp b/pcsx2/gui/Panels/SpeedhacksPanel.cpp index 42172c26a9..1197642984 100644 --- a/pcsx2/gui/Panels/SpeedhacksPanel.cpp +++ b/pcsx2/gui/Panels/SpeedhacksPanel.cpp @@ -50,10 +50,10 @@ const wxChar* Panels::SpeedHacksPanel::GetEEcycleSliderMsg( int val ) L"3 - Reduces the EE's cyclerate by about 50%. Moderate speedup, but *will* cause studdering " L"audio on many FMVs." ); - + jNO_DEFAULT } - + return L"Unreachable Warning Suppressor!!"; } @@ -82,10 +82,10 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val ) L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering " L"visuals or slowdown in most games." ); - + jNO_DEFAULT } - + return L"Unreachable Warning Suppressor!!"; } @@ -96,7 +96,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) : wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer& cycleHacksSizer = *new wxFlexGridSizer( 2 ); - + cycleHacksSizer.AddGrowableCol( 0, 1 ); cycleHacksSizer.AddGrowableCol( 1, 1 ); @@ -114,16 +114,16 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) : // ------------------------------------------------------------------------ // EE Cyclerate Hack Section: - + m_slider_eecycle = new wxSlider( this, wxID_ANY, opts.EECycleRate+1, 1, 3, wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS ); - + tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider", L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's " L"R5900 core cpu, and typically brings big speedups to games that fail to utilize " L"the full potential of the real PS2 hardware." ); - + cyclerateSizer.Add( m_slider_eecycle, sliderFlags ); m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( opts.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 ); m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) ); @@ -145,7 +145,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) : // Misc help text that I might find a home for later: // Cycle stealing works by 'fast-forwarding' the EE by an arbitrary number of cycles whenever VU1 micro-programs // are run, which works as a rough-guess skipping of what would normally be idle time spent running on the EE. - + stealerSizer.Add( m_slider_vustealer, wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() ); m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( opts.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 ); m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) ); @@ -184,7 +184,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) : mainSizer.Add( &cycleHacksSizer, wxSizerFlags().Expand() ); mainSizer.Add( &miscSizer, SizerFlags::TopLevelBox() ); - SetSizerAndFit( &mainSizer ); + SetSizer( &mainSizer ); Connect( m_slider_eecycle->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::EECycleRate_Scroll ) ); Connect( m_slider_vustealer->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::VUCycleRate_Scroll ) ); diff --git a/pcsx2/gui/main.cpp b/pcsx2/gui/main.cpp index 192c2274c0..cd6ac2776b 100644 --- a/pcsx2/gui/main.cpp +++ b/pcsx2/gui/main.cpp @@ -166,7 +166,6 @@ bool Pcsx2App::OnInit() m_Ps2ConLogBox = m_ProgramLogBox; // just use a single logger for now. //m_Ps2ConLogBox = new ConsoleLogFrame( NULL, L"PS2 Console Log" ); - SetTopWindow( m_MainFrame ); // not really needed... SetExitOnFrameDelete( true ); // but being explicit doesn't hurt... m_MainFrame->Show(); @@ -176,7 +175,7 @@ bool Pcsx2App::OnInit() catch( Exception::StartupAborted& ) { return false; - } + } Connect( pxEVT_MSGBOX, wxCommandEventHandler( Pcsx2App::OnMessageBox ) ); diff --git a/pcsx2/gui/wxHelpers.cpp b/pcsx2/gui/wxHelpers.cpp index 5a9aadd1df..d40ff7a794 100644 --- a/pcsx2/gui/wxHelpers.cpp +++ b/pcsx2/gui/wxHelpers.cpp @@ -106,7 +106,7 @@ namespace wxHelpers return StdExpand(); } }; - + // This method is used internally to create multi line checkboxes and radio buttons. void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen ) { @@ -134,7 +134,7 @@ namespace wxHelpers sizer.Add( retval, SizerFlags::Checkbox() ); if( !tooltip.IsEmpty() ) - retval->SetToolTip( tooltip ); + retval->SetToolTip( tooltip ); _appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen ); @@ -154,7 +154,7 @@ namespace wxHelpers sizer.Add( retval, SizerFlags::Checkbox() ); if( !tooltip.IsEmpty() ) - retval->SetToolTip( tooltip ); + retval->SetToolTip( tooltip ); _appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen ); @@ -200,9 +200,7 @@ namespace wxHelpers // void Launch( const wxString& filename ) { - if( !wxLaunchDefaultBrowser( filename ) ) - { - } + wxLaunchDefaultBrowser( filename ); } void Launch(const char *filename) @@ -212,16 +210,13 @@ namespace wxHelpers // ------------------------------------------------------------------------ // Launches a file explorer window on the specified path. If the given path is not - // a qualified URI (with a prefix:// ), file:// is automatically prepended. + // a qualified URI (with a prefix:// ), file:// is automatically prepended. This + // bypasses wxWidgets internal filename checking, which can end up launching things + // through browser more often than desired. // void Explore( const wxString& path ) { - if( wxLaunchDefaultBrowser( - !path.Contains( L"://") ? L"file://" + path : path ) - ) - { - // WARN_LOG - } + wxLaunchDefaultBrowser( !path.Contains( L"://") ? L"file://" + path : path ); } void Explore(const char *path) diff --git a/pcsx2/ps2/CoreEmuThread.cpp b/pcsx2/ps2/CoreEmuThread.cpp index 487783a2b0..8d4c316112 100644 --- a/pcsx2/ps2/CoreEmuThread.cpp +++ b/pcsx2/ps2/CoreEmuThread.cpp @@ -19,7 +19,7 @@ #include "PrecompiledHeader.h" #include "System.h" #include "SaveState.h" -#include "ElfHeader.h" +#include "Elfheader.h" #include "Plugins.h" #include "CoreEmuThread.h" @@ -79,7 +79,7 @@ void CoreEmuThread::StateCheck() { { ScopedLock locker( m_lock_ExecMode ); - + switch( m_ExecMode ) { case ExecMode_Idle: @@ -91,14 +91,14 @@ void CoreEmuThread::StateCheck() // These are not the case statements you're looking for. Move along. case ExecMode_Running: break; case ExecMode_Suspended: break; - + case ExecMode_Suspending: m_ExecMode = ExecMode_Suspended; m_SuspendEvent.Post(); break; } } - + while( (m_ExecMode == ExecMode_Suspended) && !m_Done ) { m_ResumeEvent.Wait(); @@ -108,7 +108,7 @@ void CoreEmuThread::StateCheck() void CoreEmuThread::Start() { if( IsRunning() ) return; - + m_running = false; m_ExecMode = ExecMode_Idle; m_Done = false; @@ -169,7 +169,7 @@ void CoreEmuThread::Resume() m_resetRecompilers = false; m_resetProfilers = false; } - + m_ExecMode = ExecMode_Running; m_ResumeEvent.Post(); } @@ -191,10 +191,10 @@ void CoreEmuThread::Suspend( bool isBlocking ) if( (m_ExecMode == ExecMode_Suspended) || (m_ExecMode == ExecMode_Idle) ) return; - + if( m_ExecMode == ExecMode_Running ) m_ExecMode = ExecMode_Suspending; - + DevAssert( m_ExecMode == ExecMode_Suspending, "ExecMode should be nothing other than Suspended..." ); } diff --git a/pcsx2/x86/microVU_Upper.inl b/pcsx2/x86/microVU_Upper.inl index 2b152f5493..4029675009 100644 --- a/pcsx2/x86/microVU_Upper.inl +++ b/pcsx2/x86/microVU_Upper.inl @@ -1,20 +1,20 @@ /* Pcsx2 - Pc Ps2 Emulator -* Copyright (C) 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 -*/ + * Copyright (C) 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 + */ #pragma once @@ -28,13 +28,14 @@ // Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations microVUt(void) mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool modXYZW = 1) { - int sReg, mReg = gprT1, xyzw = _X_Y_Z_W, regT1b = 0, regT2b = 0; + int sReg, mReg = gprT1, regT1b = 0, regT2b = 0; + //int xyzw = _X_Y_Z_W; // unused local, still needed? -- air static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; //SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag); if (mVUsFlagHack) { sFLAG.doFlag = 0; } if (!sFLAG.doFlag && !mFLAG.doFlag) { return; } - if ((mFLAG.doFlag && !(_XYZW_SS && modXYZW))) { + if ((mFLAG.doFlag && !(_XYZW_SS && modXYZW))) { if (regT2 < 0) { regT2 = mVU->regAlloc->allocReg(); regT2b = 1; } SSE2_PSHUFD_XMM_to_XMM(regT2, reg, 0x1B); // Flip wzyx to xyzw } @@ -82,7 +83,7 @@ microVUt(void) mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool // Helper Macros and Functions //------------------------------------------------------------------ -static void (*SSE_PS[]) (microVU*, int, int, int, int) = { +static void (*SSE_PS[]) (microVU*, int, int, int, int) = { SSE_ADDPS, // 0 SSE_SUBPS, // 1 SSE_MULPS, // 2 @@ -91,8 +92,8 @@ static void (*SSE_PS[]) (microVU*, int, int, int, int) = { SSE_ADD2PS // 5 }; -static void (*SSE_SS[]) (microVU*, int, int, int, int) = { - SSE_ADDSS, // 0 +static void (*SSE_SS[]) (microVU*, int, int, int, int) = { + SSE_ADDSS, // 0 SSE_SUBSS, // 1 SSE_MULSS, // 2 SSE_MAXSS, // 3 @@ -155,7 +156,7 @@ void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, co opCase1 { if((opType == 2) && _XYZW_PS) { mVUclamp2(mVU, Ft, -1, _X_Y_Z_W); } } // Clamp Needed for Ice Age 3 (VU0) opCase1 { if((opType == 2) && _XYZW_PS) { mVUclamp2(mVU, Fs, -1, _X_Y_Z_W); } } // Clamp Needed for Ice Age 3 (VU0) opCase2 { if (opType == 2) { mVUclamp2(mVU, Fs, -1, _X_Y_Z_W); } } // Clamp Needed for alot of games (TOTA, DoM, etc...) - + if (_XYZW_SS) SSE_SS[opType](mVU, Fs, Ft, -1, -1); else SSE_PS[opType](mVU, Fs, Ft, -1, -1); @@ -167,7 +168,7 @@ void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, co mVU->regAlloc->clearNeeded(ACC); } else mVUupdateFlags(mVU, Fs, tempFt); - + mVU->regAlloc->clearNeeded(Fs); // Always Clear Written Reg First mVU->regAlloc->clearNeeded(Ft); } @@ -192,7 +193,7 @@ void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, const char* op if (_XYZW_SS || _X_Y_Z_W == 0xf) { if (_XYZW_SS) SSE_SS[opType](mVU, ACC, Fs, tempFt, -1); - else SSE_PS[opType](mVU, ACC, Fs, tempFt, -1); + else SSE_PS[opType](mVU, ACC, Fs, tempFt, -1); mVUupdateFlags(mVU, ACC, Fs, tempFt); if (_XYZW_SS && _X_Y_Z_W != 8) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } @@ -248,10 +249,10 @@ void mVU_FMACd(microVU* mVU, int recPass, int opCase, const char* opName) { Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W); Fd = mVU->regAlloc->allocReg(32, _Fd_, _X_Y_Z_W); - + if (_XYZW_SS) { SSE_SS[2](mVU, Fs, Ft, -1, -1); SSE_SS[1](mVU, Fd, Fs, tempFt, -1); } else { SSE_PS[2](mVU, Fs, Ft, -1, -1); SSE_PS[1](mVU, Fd, Fs, tempFt, -1); } - + mVUupdateFlags(mVU, Fd, Fs, tempFt); mVU->regAlloc->clearNeeded(Fd); // Always Clear Written Reg First @@ -264,7 +265,7 @@ void mVU_FMACd(microVU* mVU, int recPass, int opCase, const char* opName) { // ABS Opcode mVUop(mVU_ABS) { pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } - pass2 { + pass2 { if (!_Ft_) return; int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf))); SSE_ANDPS_M128_to_XMM(Fs, (uptr)mVU_absclip); @@ -274,7 +275,7 @@ mVUop(mVU_ABS) { } // OPMULA Opcode -mVUop(mVU_OPMULA) { +mVUop(mVU_OPMULA) { pass1 { mVUanalyzeFMAC1(mVU, 0, _Fs_, _Ft_); } pass2 { int Ft = mVU->regAlloc->allocReg(_Ft_, 0, _X_Y_Z_W); @@ -291,7 +292,7 @@ mVUop(mVU_OPMULA) { } // OPMSUB Opcode -mVUop(mVU_OPMSUB) { +mVUop(mVU_OPMSUB) { pass1 { mVUanalyzeFMAC1(mVU, _Fd_, _Fs_, _Ft_); } pass2 { int Ft = mVU->regAlloc->allocReg(_Ft_, 0, 0xf); @@ -314,7 +315,7 @@ mVUop(mVU_OPMSUB) { // FTOI0/FTIO4/FTIO12/FTIO15 Opcodes void mVU_FTOIx(mP, uptr addr, const char* opName) { pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } - pass2 { + pass2 { if (!_Ft_) return; int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf))); int t1 = mVU->regAlloc->allocReg(); @@ -341,14 +342,14 @@ void mVU_FTOIx(mP, uptr addr, const char* opName) { // ITOF0/ITOF4/ITOF12/ITOF15 Opcodes void mVU_ITOFx(mP, uptr addr, const char* opName) { pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } - pass2 { + pass2 { if (!_Ft_) return; int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf))); - + SSE2_CVTDQ2PS_XMM_to_XMM(Fs, Fs); if (addr) { SSE_MULPS_M128_to_XMM(Fs, addr); } //mVUclamp2(Fs, xmmT1, 15); // Clamp (not sure if this is needed) - + mVU->regAlloc->clearNeeded(Fs); } pass3 { mVUlog(opName); mVUlogFtFs(); }