From e0347fd2851429dab35d1f6ec494590c25167965 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 13 Mar 2009 04:49:23 +0000 Subject: [PATCH] Some header work, get rid of some dead code, and rename PsxCommon.h. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@762 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD.cpp | 4 +- pcsx2/CDVD.h | 2 +- pcsx2/CdRom.cpp | 4 +- pcsx2/CdRom.h | 2 +- pcsx2/Common.h | 12 +- pcsx2/DebugTools/Debug.h | 2 +- pcsx2/Elfheader.cpp | 125 +++------ pcsx2/IopBios.cpp | 2 +- pcsx2/{PsxCommon.h => IopCommon.h} | 34 +-- pcsx2/IopCounters.cpp | 2 +- pcsx2/IopDma.cpp | 2 +- pcsx2/IopHw.cpp | 3 +- pcsx2/IopMem.cpp | 2 +- pcsx2/IopSio2.cpp | 2 +- pcsx2/Makefile.am | 2 +- pcsx2/Mdec.cpp | 3 +- pcsx2/MemcpyFast.h | 1 + pcsx2/Memory.cpp | 3 +- pcsx2/MemoryCard.cpp | 2 +- pcsx2/Misc.cpp | 302 +++++---------------- pcsx2/Misc.h | 56 ---- pcsx2/Patch.cpp | 2 +- pcsx2/Plugins.cpp | 3 +- pcsx2/PrecompiledHeader.h | 27 ++ pcsx2/R3000A.cpp | 4 +- pcsx2/R3000AInterpreter.cpp | 3 +- pcsx2/R3000AOpcodeTables.cpp | 3 +- pcsx2/RDebug/deci2_dbgp.cpp | 3 +- pcsx2/RDebug/deci2_iloadp.cpp | 3 +- pcsx2/SaveState.cpp | 3 +- pcsx2/SaveState.h | 2 +- pcsx2/Sif.cpp | 3 +- pcsx2/Sio.cpp | 2 +- pcsx2/Stats.cpp | 3 +- pcsx2/System.h | 2 + pcsx2/configure.ac | 7 +- pcsx2/windows/VCprojects/pcsx2_2008.vcproj | 4 + pcsx2/windows/Win32.h | 2 +- pcsx2/x86/iCore.h | 1 + pcsx2/x86/iPsxMem.cpp | 2 +- pcsx2/x86/iR3000A.cpp | 2 +- pcsx2/x86/iR3000Atables.cpp | 2 +- pcsx2/x86/ix86-32/iCore-32.cpp | 2 +- 43 files changed, 199 insertions(+), 453 deletions(-) rename pcsx2/{PsxCommon.h => IopCommon.h} (77%) diff --git a/pcsx2/CDVD.cpp b/pcsx2/CDVD.cpp index 35c76b4387..9bcee55a05 100644 --- a/pcsx2/CDVD.cpp +++ b/pcsx2/CDVD.cpp @@ -20,7 +20,7 @@ #include -#include "PsxCommon.h" +#include "IopCommon.h" #include "CDVDiso.h" static cdvdStruct cdvd; @@ -462,7 +462,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) { // get main elf name GetPS2ElfName(str); - 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]); + 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 diff --git a/pcsx2/CDVD.h b/pcsx2/CDVD.h index f793e737e1..9eec464375 100644 --- a/pcsx2/CDVD.h +++ b/pcsx2/CDVD.h @@ -19,7 +19,7 @@ #ifndef __CDVD_H__ #define __CDVD_H__ -#include "PsxCommon.h" +#include "IopCommon.h" struct cdvdRTC { u8 status; diff --git a/pcsx2/CdRom.cpp b/pcsx2/CdRom.cpp index d0a3ff09f6..6947ae044a 100644 --- a/pcsx2/CdRom.cpp +++ b/pcsx2/CdRom.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" -#include "Common.h" +#include "IopCommon.h" //THIS ALL IS FOR THE CDROM REGISTERS HANDLING @@ -73,7 +72,6 @@ const char *CmdName[0x100]= { cdrStruct cdr; long LoadCdBios; -int cdOpenCase; u8 Test04[] = { 0 }; u8 Test05[] = { 0 }; diff --git a/pcsx2/CdRom.h b/pcsx2/CdRom.h index be33f9390c..10757dff7e 100644 --- a/pcsx2/CdRom.h +++ b/pcsx2/CdRom.h @@ -19,7 +19,7 @@ #ifndef __CDROM_H__ #define __CDROM_H__ -#include "PsxCommon.h" +#include "IopCommon.h" #include "Decode_XA.h" #include "PS2Edefs.h" diff --git a/pcsx2/Common.h b/pcsx2/Common.h index 7737c6c612..1461bb83bd 100644 --- a/pcsx2/Common.h +++ b/pcsx2/Common.h @@ -27,20 +27,20 @@ //#define PSXCLK 186864000 /* 36.864 Mhz */ #define PS2CLK 294912000 //hz /* 294.912 mhz */ +#define PCSX2_VERSION "(beta)" #include "Plugins.h" -#include "Misc.h" #include "SaveState.h" #include "DebugTools/Debug.h" -#include "R5900.h" #include "Memory.h" -#include "Elfheader.h" #include "Hw.h" -// Moving this before one of the other includes causes compilation issues. -//#include "Misc.h" + +#include "R5900.h" +#include "Elfheader.h" #include "Patch.h" -#define PCSX2_VERSION "(beta)" +#include "System.h" +#include "Pcsx2Config.h" #endif /* __COMMON_H__ */ diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index cc7dac97e9..77152441df 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -20,7 +20,7 @@ #ifndef __DEBUG_H__ #define __DEBUG_H__ -#include "Misc.h" +#include "Pcsx2Config.h" extern FILE *emuLog; diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 020412431b..358a1cc672 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -148,7 +148,7 @@ static uint parseCommandLine( const char *filename ) { // 4 + 4 + 256 const char * p; int argc; - int i; + int i; args_ptr -= 256; @@ -159,59 +159,47 @@ static uint parseCommandLine( const char *filename ) p = strrchr( filename, '\\' ); #else //linux p = strrchr( filename, '/' ); - if( p == NULL ) - p = strchr(filename, '\\'); + if( p == NULL ) p = strchr(filename, '\\'); #endif - if ( p ) - { - p++; - } + if (p) + p++; else - { - p = filename; - } + p = filename; + args_ptr -= strlen( p ) + 1; - /* if ( args_ptr < 0 ) // fixme- This is still impossible. - { - return 0; - }*/ + 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 ) ) ) - { - 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 ) ) + { + 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; - } + return 0; + ((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i; } - else - { + else + { if ( ( PS2MEM_BASE[ args_ptr + i + 1 ] != 0 ) && ( PS2MEM_BASE[ args_ptr + i + 1 ] != 32 ) ) { argc++; if ( args_ptr - 4 - 4 - argc * 4 < 0 ) // fixme - Should this be cast to a signed int? - { return 0; - } + ((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i + 1; } - } + } } ((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 1 ] = argc; //how many args ((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 2 ] = ( argc > 0); //have args? //not used, cannot be filled at all @@ -311,10 +299,10 @@ struct ElfObject if ((strnicmp( filename.c_str(), "cdrom0:", strlen("cdromN:")) == 0) || (strnicmp( filename.c_str(), "cdrom1:", strlen("cdromN:")) == 0)) { - int fi; - fi = CDVDFS_open(filename.c_str() + strlen("cdromN:"), 1);//RDONLY - if (fi < 0) - throw Exception::FileNotFound( filename ); + int fi = CDVDFS_open(filename.c_str() + 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 ); @@ -324,15 +312,14 @@ struct ElfObject FILE *f; f = fopen( filename.c_str(), "rb" ); - if( f == NULL ) - Exception::FileNotFound( filename ); + if( f == NULL ) Exception::FileNotFound( filename ); + fseek( f, 0, SEEK_SET ); rsize = fread( data.GetPtr(), 1, data.GetSizeInBytes(), f ); fclose( f ); } - if( rsize < data.GetSizeInBytes() ) - throw Exception::EndOfStream( filename ); + if( rsize < data.GetSizeInBytes() ) throw Exception::EndOfStream( filename ); } u32 GetCRC() const @@ -426,37 +413,14 @@ struct ElfObject switch ( secthead[ i ].sh_type ) { - default: - ELF_LOG("unknown %08x",secthead[i].sh_type); - break; - - case 0x0: - ELF_LOG("null"); - break; - - case 0x1: - ELF_LOG("progbits"); - break; - - case 0x2: - ELF_LOG("symtab"); - break; - - case 0x3: - ELF_LOG("strtab"); - break; - - case 0x4: - ELF_LOG("rela"); - break; - - case 0x8: - ELF_LOG("no bits"); - break; - - case 0x9: - ELF_LOG("rel"); - break; + case 0x0: ELF_LOG("null"); break; + case 0x1: ELF_LOG("progbits"); break; + case 0x2: ELF_LOG("symtab"); break; + case 0x3: ELF_LOG("strtab"); break; + case 0x4: ELF_LOG("rela"); break; + case 0x8: ELF_LOG("no bits"); break; + case 0x9: ELF_LOG("rel"); break; + default: ELF_LOG("unknown %08x",secthead[i].sh_type); break; } ELF_LOG("\n"); @@ -619,17 +583,6 @@ void LoadGameSpecificSettings() g_FFXHack = 0; switch(ElfCRC) { - // The code involving VUFIX_SIGNEDZERO & VUFIX_EXTRAFLAGS - // is no longer in pcsx2. - - //case 0x0c414549: // spacefisherman, missing gfx - // g_VUGameFixes |= VUFIX_SIGNEDZERO; - // break; - //case 0x4C9EE7DF: // crazy taxi (u) - //case 0xC9C145BF: // crazy taxi, missing gfx - // g_VUGameFixes |= VUFIX_EXTRAFLAGS; - // break; - case 0xb99379b7: // erementar gerad (discolored chars) g_VUGameFixes |= VUFIX_XGKICKDELAY2; // Tested - still needed - arcum42 break; diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp index bb84b6dc85..029b888cc7 100644 --- a/pcsx2/IopBios.cpp +++ b/pcsx2/IopBios.cpp @@ -19,7 +19,7 @@ #include "PrecompiledHeader.h" #include -#include "PsxCommon.h" +#include "IopCommon.h" namespace R3000A { diff --git a/pcsx2/PsxCommon.h b/pcsx2/IopCommon.h similarity index 77% rename from pcsx2/PsxCommon.h rename to pcsx2/IopCommon.h index 1e7683cdf8..27b8341f4d 100644 --- a/pcsx2/PsxCommon.h +++ b/pcsx2/IopCommon.h @@ -15,37 +15,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __PSXCOMMON_H__ -#define __PSXCOMMON_H__ - -#include "PS2Etypes.h" - -#include - -#include "System.h" - -extern long LoadCdBios; -extern int cdOpenCase; +#ifndef __IOPCOMMON_H__ +#define __IOPCOMMON_H__ #define PSXCLK (36864000ULL) /* 36.864 Mhz */ -#include "Plugins.h" -#include "Misc.h" -#include "SaveState.h" - #include "R3000A.h" +#include "Common.h" + +#include "CdRom.h" +#include "CDVD.h" + +#include "Sio.h" +#include "Sif.h" + #include "IopMem.h" #include "IopHw.h" #include "IopBios.h" #include "IopDma.h" #include "IopCounters.h" -#include "CdRom.h" -#include "Sio.h" -#include "DebugTools/Debug.h" #include "IopSio2.h" -#include "CDVD.h" -#include "Memory.h" -#include "Hw.h" -#include "Sif.h" -#endif /* __PSXCOMMON_H__ */ +#endif /* __IOPCOMMON_H__ */ diff --git a/pcsx2/IopCounters.cpp b/pcsx2/IopCounters.cpp index 798af8d94f..10027f1ed5 100644 --- a/pcsx2/IopCounters.cpp +++ b/pcsx2/IopCounters.cpp @@ -23,7 +23,7 @@ #include "PrecompiledHeader.h" #include -#include "PsxCommon.h" +#include "IopCommon.h" /* Config.PsxType == 1: PAL: VBlank interlaced 50.00 Hz diff --git a/pcsx2/IopDma.cpp b/pcsx2/IopDma.cpp index 53995dfb1d..d90b247aaa 100644 --- a/pcsx2/IopDma.cpp +++ b/pcsx2/IopDma.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" +#include "IopCommon.h" using namespace R3000A; diff --git a/pcsx2/IopHw.cpp b/pcsx2/IopHw.cpp index 80ea92c464..073102ef86 100644 --- a/pcsx2/IopHw.cpp +++ b/pcsx2/IopHw.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" -#include "Misc.h" +#include "IopCommon.h" #include "iR5900.h" // NOTE: Any modifications to read/write fns should also go into their const counterparts diff --git a/pcsx2/IopMem.cpp b/pcsx2/IopMem.cpp index 18d45cf737..0a4d04e582 100644 --- a/pcsx2/IopMem.cpp +++ b/pcsx2/IopMem.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "VU.h" #include "iCore.h" #include "Hw.h" diff --git a/pcsx2/IopSio2.cpp b/pcsx2/IopSio2.cpp index ebece56760..04e704e47a 100644 --- a/pcsx2/IopSio2.cpp +++ b/pcsx2/IopSio2.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" +#include "IopCommon.h" sio2Struct sio2; diff --git a/pcsx2/Makefile.am b/pcsx2/Makefile.am index 3dcb5723ec..4f6b70356e 100644 --- a/pcsx2/Makefile.am +++ b/pcsx2/Makefile.am @@ -18,7 +18,7 @@ RecoverySystem.cpp Saveslots.cpp libpcsx2_a_SOURCES += \ CDVD.h CDVDiso.h CDVDisodrv.h CDVDlib.h COP0.h Cache.h CdRom.h Common.h Counters.h Decode_XA.h EEregs.h \ Elfheader.h Exceptions.h GS.h Hw.h IopBios.h IopBios2.h IopCounters.h IopDma.h IopHw.h IopMem.h IopSio2.h Memcpyfast.h \ -Memory.h MemoryCard.h Misc.h Patch.h Paths.h Plugins.h PrecompiledHeader.h PsxCommon.h R3000A.h R5900.h R5900OpcodeTables.h \ +Memory.h MemoryCard.h Misc.h Patch.h Paths.h Plugins.h PrecompiledHeader.h IopCommon.h R3000A.h R5900.h R5900OpcodeTables.h \ SPR.h SamplProf.h SaveState.h Sif.h Sifcmd.h Sio.h SafeArray.h Stats.h StringUtils.h System.h Threading.h \ VU.h VUflags.h VUmicro.h VUops.h Vif.h VifDma.h cheatscpp.h vtlb.h NakedAsm.h R5900Exceptions.h HostGui.h Pcsx2Config.h diff --git a/pcsx2/Mdec.cpp b/pcsx2/Mdec.cpp index 3b16800591..839c84669b 100644 --- a/pcsx2/Mdec.cpp +++ b/pcsx2/Mdec.cpp @@ -21,8 +21,7 @@ #include #include -#include "Misc.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "Mdec.h" int iq_y[DCTSIZE2],iq_uv[DCTSIZE2]; diff --git a/pcsx2/MemcpyFast.h b/pcsx2/MemcpyFast.h index c4ceeffa11..652170be88 100644 --- a/pcsx2/MemcpyFast.h +++ b/pcsx2/MemcpyFast.h @@ -25,6 +25,7 @@ #include "Linux/memzero.h" #endif // WIN32 + // Only used in the Windows version of memzero.h. But it's in Misc.cpp for some reason. void _memset16_unaligned( void* dest, u16 data, size_t size ); // The new simplified memcpy_amd_ is now faster than memcpy_raz_. diff --git a/pcsx2/Memory.cpp b/pcsx2/Memory.cpp index 21098ad649..31c604598f 100644 --- a/pcsx2/Memory.cpp +++ b/pcsx2/Memory.cpp @@ -43,10 +43,9 @@ BIOS #include -#include "Common.h" +#include "IopCommon.h" #include "iR5900.h" -#include "PsxCommon.h" #include "VUmicro.h" #include "GS.h" #include "IPU/IPU.h" diff --git a/pcsx2/MemoryCard.cpp b/pcsx2/MemoryCard.cpp index 079309c0ec..b6805cdf3f 100644 --- a/pcsx2/MemoryCard.cpp +++ b/pcsx2/MemoryCard.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "Misc.h" +#include "System.h" #include "MemoryCard.h" #include "Paths.h" diff --git a/pcsx2/Misc.cpp b/pcsx2/Misc.cpp index 801b015fae..676ace76b2 100644 --- a/pcsx2/Misc.cpp +++ b/pcsx2/Misc.cpp @@ -26,8 +26,7 @@ #include -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "HostGui.h" #include "CDVDisodrv.h" @@ -52,6 +51,61 @@ char CdromId[12]; static int g_Pcsx2Recording = 0; // true 1 if recording video and sound bool renderswitch = 0; +#define NUM_STATES 10 +int StatesC = 0; + +extern char strgametitle[256]; + +struct LangDef { + char id[8]; + char name[64]; +}; + +LangDef sLangs[] = { + { "ar_AR", N_("Arabic") }, + { "bg_BG", N_("Bulgarian") }, + { "ca_CA", N_("Catalan") }, + { "cz_CZ", N_("Czech") }, + { "du_DU", N_("Dutch") }, + { "de_DE", N_("German") }, + { "el_EL", N_("Greek") }, + { "en_US", N_("English") }, + { "fr_FR", N_("French") }, + { "hb_HB" , N_("Hebrew") }, + { "hu_HU", N_("Hungarian") }, + { "it_IT", N_("Italian") }, + { "ja_JA", N_("Japanese") }, + { "pe_PE", N_("Persian") }, + { "po_PO", N_("Portuguese") }, + { "po_BR", N_("Portuguese BR") }, + { "pl_PL" , N_("Polish") }, + { "ro_RO", N_("Romanian") }, + { "ru_RU", N_("Russian") }, + { "es_ES", N_("Spanish") }, + { "sh_SH" , N_("S-Chinese") }, + { "sw_SW", N_("Swedish") }, + { "tc_TC", N_("T-Chinese") }, + { "tr_TR", N_("Turkish") }, + { "", "" }, +}; + +#define DIRENTRY_SIZE 16 + +#if defined(_MSC_VER) +#pragma pack(1) +#endif + +struct romdir{ + char fileName[10]; + u16 extInfoSize; + u32 fileSize; +#if defined(_MSC_VER) +}; +#pragma pack() //+22 +#else +} __attribute__((packed)); +#endif + const char *LabelAuthors = { N_( "PCSX2, a PS2 emulator\n\n" "Active Devs: Arcum42, Refraction,\n" @@ -82,74 +136,6 @@ const char *LabelGreets = { N_( ) }; -static struct { - const char *name; - u32 size; -} ioprps[]={ - {"IOPRP14", 43845}, - {"IOPRP142", 48109}, - {"IOPRP143", 58317}, - {"IOPRP144", 58525}, - {"IOPRP15", 82741}, - {"IOPRP151", 82917}, - {"IOPRP153", 82949}, - {"IOPRP16", 91909}, - {"IOPRP165", 98901}, - {"IOPRP20", 109809}, - {"IOPRP202", 110993}, - {"IOPRP205", 119797}, - {"IOPRP21", 126857}, - {"IOPRP211", 129577}, - {"IOPRP213", 129577}, - {"IOPRP214", 140945}, - {"IOPRP22", 199257}, - {"IOPRP221", 196937}, - {"IOPRP222", 198233}, - {"IOPRP224", 201065}, - {"IOPRP23", 230329}, - {"IOPRP234", 247641}, - {"IOPRP24", 251065}, - {"IOPRP241", 251049}, - {"IOPRP242", 252409}, - {"IOPRP243", 253201}, - {"IOPRP250", 264897}, - {"IOPRP252", 265233}, - {"IOPRP253", 267217}, - {"IOPRP254", 264449}, - {"IOPRP255", 264449}, - {"IOPRP260", 248945}, - {"IOPRP270", 249121}, - {"IOPRP271", 266817}, - {"IOPRP280", 269889}, - {"IOPRP300", 275345}, - {"DNAS280", 272753}, - {"DNAS270", 251729}, - {"DNAS271", 268977}, - {"DNAS300", 278641}, - {"DNAS280", 272705}, - {"DNAS255", 264945}, - {NULL, 0} -}; - -void GetRPCVersion(char *ioprp, char *rpcver){ - char *p=ioprp; - int i; - struct TocEntry te; - - if (p && (CDVD_findfile(p+strlen("cdromN:"), &te) != -1)){ - for (i=0; ioprps[i].size>0; i++) - if (te.fileSize==ioprps[i].size) - break; - if (ioprps[i].size>0) - p=(char *)ioprps[i].name; - } - // fixme - Is p really supposed to be set in the middle of an if statement? - if (p && (p=strstr(p, "IOPRP")+strlen("IOPRP"))){ - for (i=0;(i<4) && p && (*p>='0') && (*p<='9');i++, p++) rpcver[i]=*p; - for ( ; i<4 ;i++ ) rpcver[i]='0'; - } -} - u32 GetBiosVersion() { unsigned int fileOffset=0; s8 *ROMVER; @@ -269,44 +255,6 @@ int IsBIOS(char *filename, char *description) return FALSE; //fail quietly } -// LOAD STUFF - -// fixme - Is there any reason why we shouldn't delete this define, and replace the array lengths -// with the actual numbers? -#define ISODCL(from, to) (to - from + 1) - -struct iso_directory_record { - char length [ISODCL (1, 1)]; /* length[1]; 711 */ - char ext_attr_length [ISODCL (2, 2)]; /* ext_attr_length[1]; 711 */ - char extent [ISODCL (3, 10)]; /* extent[8]; 733 */ - char size [ISODCL (11, 18)]; /* size[8]; 733 */ - char date [ISODCL (19, 25)]; /* date[7]; 7 by 711 */ - char flags [ISODCL (26, 26)]; /* flags[1]; */ - char file_unit_size [ISODCL (27, 27)]; /* file_unit_size[1]; 711 */ - char interleave [ISODCL (28, 28)]; /* interleave[1]; 711 */ - char volume_sequence_number [ISODCL (29, 32)]; /* volume_sequence_number[3]; 723 */ - unsigned char name_len [ISODCL (33, 33)]; /* name_len[1]; 711 */ - char name [1]; -}; - -int LoadCdrom() { - return 0; -} - -int CheckCdrom() { - u8 *buf; - - if (CDVDreadTrack(16, CDVD_MODE_2352) == -1) - return -1; - buf = CDVDgetBuffer(); - if (buf == NULL) - return -1; - - strncpy(CdromId, (char*)buf+52, 10); - - return 0; -} - int GetPS2ElfName(char *name){ int f; char buffer[g_MaxPath];//if a file is longer...it should be shorter :D @@ -353,7 +301,6 @@ int GetPS2ElfName(char *name){ FILE *fp; int i; - // inifile_read(CdromId); fp = fopen("System.map", "r"); if( fp == NULL ) return 2; @@ -398,7 +345,6 @@ void SaveGSState(const string& file) g_fGSSave->Freeze( g_nLeftGSFrames ); } -extern uptr pDsp; void LoadGSState(const string& file) { int ret; @@ -450,40 +396,6 @@ void LoadGSState(const string& file) #endif -struct LangDef { - char id[8]; - char name[64]; -}; - -LangDef sLangs[] = { - { "ar_AR", N_("Arabic") }, - { "bg_BG", N_("Bulgarian") }, - { "ca_CA", N_("Catalan") }, - { "cz_CZ", N_("Czech") }, - { "du_DU", N_("Dutch") }, - { "de_DE", N_("German") }, - { "el_EL", N_("Greek") }, - { "en_US", N_("English") }, - { "fr_FR", N_("French") }, - { "hb_HB" , N_("Hebrew") }, - { "hu_HU", N_("Hungarian") }, - { "it_IT", N_("Italian") }, - { "ja_JA", N_("Japanese") }, - { "pe_PE", N_("Persian") }, - { "po_PO", N_("Portuguese") }, - { "po_BR", N_("Portuguese BR") }, - { "pl_PL" , N_("Polish") }, - { "ro_RO", N_("Romanian") }, - { "ru_RU", N_("Russian") }, - { "es_ES", N_("Spanish") }, - { "sh_SH" , N_("S-Chinese") }, - { "sw_SW", N_("Swedish") }, - { "tc_TC", N_("T-Chinese") }, - { "tr_TR", N_("Turkish") }, - { "", "" }, -}; - - char *ParseLang(char *id) { int i=0; @@ -496,11 +408,6 @@ char *ParseLang(char *id) { return id; } -#define NUM_STATES 10 -int StatesC = 0; - -extern char strgametitle[256]; - char* mystrlwr( char* string ) { assert( string != NULL ); @@ -577,10 +484,10 @@ void CycleFrameLimit(int dir) void ProcessFKeys(int fkey, int shift) { - assert(fkey >= 1 && fkey <= 12 ); + assert(fkey >= 1 && fkey <= 12 ); - switch(fkey) { - case 1: + switch(fkey) { + case 1: try { gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll(); @@ -701,92 +608,25 @@ void ProcessFKeys(int fkey, int shift) #endif case 12: - if( shift ) { + if( shift ) { #ifdef PCSX2_DEVBUILD - iDumpRegisters(cpuRegs.pc, 0); + iDumpRegisters(cpuRegs.pc, 0); Console::Notice("hardware registers dumped EE:%x, IOP:%x\n", params cpuRegs.pc, psxRegs.pc); #endif - } - else { - g_Pcsx2Recording ^= 1; - if( mtgsThread != NULL ) { + } + else { + g_Pcsx2Recording ^= 1; + if( mtgsThread != NULL ) { mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0); - } - else { - if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL); - } + } + else { + if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL); + } if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL); - } + } break; - } -} - -/*void injectIRX(const char *filename) -{ - char name[260], *p, *q; - struct romdir *rd; - int iROMDIR=-1, iIOPBTCONF=-1, iBLANK=-1, i, filesize; - FILE *fp; - - strcpy(name, filename); - for (i=0; name[i] && name[i]!='.' && i<10; i++) name[i]=toupper(name[i]);name[i]=0; - - //phase 1: find ROMDIR in bios - for (p=(char*)PS2MEM_ROM; p<(char*)PS2MEM_ROM+0x80000; p++) - if (strncmp(p, "RESET", 5)==0) - break; - rd=(struct romdir*)p; - - for (i=0; rd[i].fileName[0]; i++)if (strncmp(rd[i].fileName, name, strlen(name))==0)break; - if (rd[i].fileName[0])return;//already in;) - - //phase 2: make room in IOPBTCONF & ROMDIR - for (i=0; rd[i].fileName[0]; i++)if (strncmp(rd[i].fileName, "ROMDIR", 6)==0)iROMDIR=i; - for (i=0; rd[i].fileName[0]; i++)if (strncmp(rd[i].fileName, "IOPBTCONF", 9)==0)iIOPBTCONF=i; - - for (i=0; rd[i].fileName[0]; i++)if (rd[i].fileName[0]=='-')break; iBLANK=i; - rd[iBLANK].fileSize-=DIRENTRY_SIZE+DIRENTRY_SIZE; - p=(char*)PS2MEM_ROM;for (i=0; iq){*((u64*)p)=*((u64*)p-4);*((u64*)p+1)=*((u64*)p-3);p-=DIRENTRY_SIZE;} - *((u64*)p)=*((u64*)p+1)=0;p-=DIRENTRY_SIZE;rd[iIOPBTCONF].fileSize+=DIRENTRY_SIZE; - - q=(char*)PS2MEM_ROM;for (i=0; i<=iROMDIR; i++) q+=(rd[i].fileSize+0xF)&(~0xF); - while (p >q){*((u64*)p)=*((u64*)p-2);*((u64*)p+1)=*((u64*)p-1);p-=DIRENTRY_SIZE;} - *((u64*)p)=*((u64*)p+1)=0;p-=DIRENTRY_SIZE;rd[iROMDIR].fileSize+=DIRENTRY_SIZE; - - //phase 3: add the name to the end of IOPBTCONF - p=(char*)PS2MEM_ROM;for (i=0; i -#include -#endif - -#undef _ -#define _(String) dgettext (PACKAGE, String) -#ifdef gettext_noop -# define N_(String) gettext_noop (String) -#else -# define N_(String) (String) -#endif - -#else - -#define _(msgid) msgid -#define N_(msgid) msgid - -#endif // ENABLE_NLS - // what the hell is this unused piece of crap passed to every plugin for? (air) // Agreed. It ought to get removed in the next version of the plugin api. (arcum42) extern uptr pDsp; //Used in GS, MTGS, Plugins, Misc @@ -80,9 +49,6 @@ extern void FreezeRegs(int save); #define FreezeXMMRegs(save) if( g_EEFreezeRegs ) { FreezeXMMRegs_(save); } #define FreezeMMXRegs(save) if( g_EEFreezeRegs ) { FreezeMMXRegs_(save); } -// Not used. -//void injectIRX(const char *filename); - // If we move the rest of this stuff, we can probably move these, too. extern void InitCPUTicks(); extern u64 GetCPUTicks(); @@ -96,30 +62,8 @@ extern const char *LabelAuthors; extern const char *LabelGreets; void CycleFrameLimit(int dir); -// Only used in Misc.cpp void SaveGSState(const string& file); void LoadGSState(const string& file); -extern char CdromId[12]; -int LoadCdrom(); -int CheckCdrom(); - -#define DIRENTRY_SIZE 16 - -#if defined(_MSC_VER) -#pragma pack(1) -#endif - -struct romdir{ - char fileName[10]; - u16 extInfoSize; - u32 fileSize; -#if defined(_MSC_VER) -}; -#pragma pack() //+22 -#else -} __attribute__((packed)); -#endif - #endif /* __MISC_H__ */ diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 429a10b887..30414ac479 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -23,7 +23,7 @@ #define _PC_ // disables MIPS opcode macros. -#include "PsxCommon.h" +#include "IopCommon.h" #include "Paths.h" #include "Patch.h" #include "VU.h" diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 3216955736..1238eed877 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -19,8 +19,7 @@ #include "PrecompiledHeader.h" #include "RedtapeWindows.h" -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "GS.h" _GSinit GSinit; diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index 8bf5cdb6bd..84c3e977d2 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -115,6 +115,33 @@ static __forceinline u32 timeGetTime() # define __unused #endif +///////////////////////////////////////////////////////////////////////// +// GNU GetText / NLS + +#ifdef ENABLE_NLS + +#ifdef _WIN32 +#include "libintlmsc.h" +#else +#include +#include +#endif + +#undef _ +#define _(String) dgettext (PACKAGE, String) +#ifdef gettext_noop +# define N_(String) gettext_noop (String) +#else +# define N_(String) (String) +#endif + +#else + +#define _(msgid) msgid +#define N_(msgid) msgid + +#endif // ENABLE_NLS + ////////////////////////////////////////////////////////////////////////////////////////// // Forceinline macro that is enabled for RELEASE/PUBLIC builds ONLY. (non-inline in devel) // This is useful because forceinline can make certain types of debugging problematic since diff --git a/pcsx2/R3000A.cpp b/pcsx2/R3000A.cpp index 8d28d86a4a..fca5f4de97 100644 --- a/pcsx2/R3000A.cpp +++ b/pcsx2/R3000A.cpp @@ -18,9 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" -#include "Misc.h" - +#include "IopCommon.h" #include "R5900.h" using namespace R3000A; diff --git a/pcsx2/R3000AInterpreter.cpp b/pcsx2/R3000AInterpreter.cpp index 094eb29b72..10f0c7aaee 100644 --- a/pcsx2/R3000AInterpreter.cpp +++ b/pcsx2/R3000AInterpreter.cpp @@ -19,8 +19,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" -#include "Common.h" +#include "IopCommon.h" using namespace R3000A; diff --git a/pcsx2/R3000AOpcodeTables.cpp b/pcsx2/R3000AOpcodeTables.cpp index 7433bda285..98ba9a92de 100644 --- a/pcsx2/R3000AOpcodeTables.cpp +++ b/pcsx2/R3000AOpcodeTables.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" -#include "Common.h" +#include "IopCommon.h" extern void zeroEx(); diff --git a/pcsx2/RDebug/deci2_dbgp.cpp b/pcsx2/RDebug/deci2_dbgp.cpp index 7a38786ee4..09ec2f44df 100644 --- a/pcsx2/RDebug/deci2_dbgp.cpp +++ b/pcsx2/RDebug/deci2_dbgp.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "VUmicro.h" #include "deci2.h" diff --git a/pcsx2/RDebug/deci2_iloadp.cpp b/pcsx2/RDebug/deci2_iloadp.cpp index dcf733dc2a..86660bf28f 100644 --- a/pcsx2/RDebug/deci2_iloadp.cpp +++ b/pcsx2/RDebug/deci2_iloadp.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "IopBios2.h" #include "deci2.h" diff --git a/pcsx2/SaveState.cpp b/pcsx2/SaveState.cpp index 46c853a89a..318eb53b4a 100644 --- a/pcsx2/SaveState.cpp +++ b/pcsx2/SaveState.cpp @@ -18,8 +18,7 @@ #include "PrecompiledHeader.h" -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "SaveState.h" #include "CDVDisodrv.h" diff --git a/pcsx2/SaveState.h b/pcsx2/SaveState.h index 0a4bc57927..d7fe5fb242 100644 --- a/pcsx2/SaveState.h +++ b/pcsx2/SaveState.h @@ -23,7 +23,7 @@ #ifdef __LINUX__ #include "PS2Edefs.h" #endif - +#include "System.h" // Savestate Versioning! // If you make changes to the savestate version, please increment the value below. diff --git a/pcsx2/Sif.cpp b/pcsx2/Sif.cpp index 5996e030a9..06b11b45b3 100644 --- a/pcsx2/Sif.cpp +++ b/pcsx2/Sif.cpp @@ -20,8 +20,7 @@ #define _PC_ // disables MIPS opcode macros. -#include "PsxCommon.h" -#include "Common.h" +#include "IopCommon.h" #include "Sifcmd.h" using namespace std; diff --git a/pcsx2/Sio.cpp b/pcsx2/Sio.cpp index ed50adf161..894ad7e180 100644 --- a/pcsx2/Sio.cpp +++ b/pcsx2/Sio.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "MemoryCard.h" _sio sio; diff --git a/pcsx2/Stats.cpp b/pcsx2/Stats.cpp index 94f7c9d07c..b515c2f7fb 100644 --- a/pcsx2/Stats.cpp +++ b/pcsx2/Stats.cpp @@ -20,8 +20,7 @@ #include -#include "Common.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "Stats.h" #include "Paths.h" diff --git a/pcsx2/System.h b/pcsx2/System.h index 59e4690c8e..5d64ad0040 100644 --- a/pcsx2/System.h +++ b/pcsx2/System.h @@ -20,10 +20,12 @@ #define __SYSTEM_H__ #include "PS2Etypes.h" +#include "Pcsx2Config.h" #include "Exceptions.h" #include "Paths.h" #include "MemcpyFast.h" #include "SafeArray.h" +#include "Misc.h" enum PageProtectionMode diff --git a/pcsx2/configure.ac b/pcsx2/configure.ac index c59dbb1510..4f3d12e5e1 100644 --- a/pcsx2/configure.ac +++ b/pcsx2/configure.ac @@ -35,12 +35,13 @@ else DEBUG_FLAGS=" -O0 -g " fi -WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value" -NORMAL_FLAGS=" -pipe -msse -msse2 -O2 " +WARNING_FLAGS="-Wno-format -Wno-unused-value" +EXTRA_WARNING_FLAGS="-Wall -Wextra" +NORMAL_FLAGS=" -pipe -msse -msse2 -O2 ${WARNING_FLAGS}" # These optimizations seem to cause issues with GCC 4.3.3, so we'll turn them off. NORMAL_FLAGS+=" -fno-guess-branch-probability -fno-dse -fno-tree-dse " -DEBUG_FLAGS+=" -g -msse -msse2 ${WARNING_FLAGS} " +DEBUG_FLAGS+=" -g -msse -msse2 ${EXTRA_WARNING_FLAGS} ${WARNING_FLAGS} " dnl Check for debug build AC_MSG_CHECKING(debug build) diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index c28f50407d..f8e1617bd5 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -3070,6 +3070,10 @@ RelativePath="..\..\Common.h" > + + diff --git a/pcsx2/windows/Win32.h b/pcsx2/windows/Win32.h index 1ad9e1ca58..252475101e 100644 --- a/pcsx2/windows/Win32.h +++ b/pcsx2/windows/Win32.h @@ -27,7 +27,7 @@ #include #include -#include "Misc.h" +#include "System.h" #include "HostGui.h" #include "resource.h" #include "WinDebugResource.h" diff --git a/pcsx2/x86/iCore.h b/pcsx2/x86/iCore.h index 002a2bc7e8..8191ddcfc2 100644 --- a/pcsx2/x86/iCore.h +++ b/pcsx2/x86/iCore.h @@ -324,6 +324,7 @@ void SetFPUstate(); #define MMX_TEMP 0x7f #define MMX_IS32BITS(x) (((x)>=MMX_FPU&&(x)= MMX_GPR && (x) < MMX_GPR+34) struct _mmxregs { diff --git a/pcsx2/x86/iPsxMem.cpp b/pcsx2/x86/iPsxMem.cpp index 4fa4003107..55b6384a0f 100644 --- a/pcsx2/x86/iPsxMem.cpp +++ b/pcsx2/x86/iPsxMem.cpp @@ -18,7 +18,7 @@ #include "PrecompiledHeader.h" -#include "PsxCommon.h" +#include "IopCommon.h" #include "iR3000A.h" #include "VU.h" diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 6a0c6af8dd..4fa5df94cd 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -30,7 +30,7 @@ #include #endif -#include "PsxCommon.h" +#include "IopCommon.h" #include "VU.h" #include "iCore.h" diff --git a/pcsx2/x86/iR3000Atables.cpp b/pcsx2/x86/iR3000Atables.cpp index 2ace926c44..ef66b115dc 100644 --- a/pcsx2/x86/iR3000Atables.cpp +++ b/pcsx2/x86/iR3000Atables.cpp @@ -19,7 +19,7 @@ #include "PrecompiledHeader.h" #include -#include "PsxCommon.h" +#include "IopCommon.h" #include "iR3000A.h" #include "IopMem.h" #include "IopDma.h" diff --git a/pcsx2/x86/ix86-32/iCore-32.cpp b/pcsx2/x86/ix86-32/iCore-32.cpp index d5c054c039..2a8411d4cf 100644 --- a/pcsx2/x86/ix86-32/iCore-32.cpp +++ b/pcsx2/x86/ix86-32/iCore-32.cpp @@ -444,7 +444,7 @@ int _getFreeMMXreg() // check for dead regs for (i=0; i= MMX_GPR && mmxregs[i].reg < MMX_GPR+34 ) { + if (mmxregs[i].reg >= MMX_GPR && mmxregs[i].reg < MMX_GPR+34 ) { // mmxregs[i] is unsigned, and MMX_GPR == 0, so the first part is always true. if( !(g_pCurInstInfo->regs[mmxregs[i].reg-MMX_GPR] & (EEINST_LIVE0|EEINST_LIVE1)) ) { _freeMMXreg(i); return i;