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
This commit is contained in:
arcum42 2009-03-13 04:49:23 +00:00
parent 3821425442
commit e0347fd285
43 changed files with 199 additions and 453 deletions

View File

@ -20,7 +20,7 @@
#include <ctype.h> #include <ctype.h>
#include "PsxCommon.h" #include "IopCommon.h"
#include "CDVDiso.h" #include "CDVDiso.h"
static cdvdStruct cdvd; static cdvdStruct cdvd;
@ -462,7 +462,7 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
// get main elf name // get main elf name
GetPS2ElfName(str); 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]); DevCon::Notice("exeName = %s", params &str[8]);
// convert the number characters to a real 32bit number // convert the number characters to a real 32bit number

View File

@ -19,7 +19,7 @@
#ifndef __CDVD_H__ #ifndef __CDVD_H__
#define __CDVD_H__ #define __CDVD_H__
#include "PsxCommon.h" #include "IopCommon.h"
struct cdvdRTC { struct cdvdRTC {
u8 status; u8 status;

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "Common.h"
//THIS ALL IS FOR THE CDROM REGISTERS HANDLING //THIS ALL IS FOR THE CDROM REGISTERS HANDLING
@ -73,7 +72,6 @@ const char *CmdName[0x100]= {
cdrStruct cdr; cdrStruct cdr;
long LoadCdBios; long LoadCdBios;
int cdOpenCase;
u8 Test04[] = { 0 }; u8 Test04[] = { 0 };
u8 Test05[] = { 0 }; u8 Test05[] = { 0 };

View File

@ -19,7 +19,7 @@
#ifndef __CDROM_H__ #ifndef __CDROM_H__
#define __CDROM_H__ #define __CDROM_H__
#include "PsxCommon.h" #include "IopCommon.h"
#include "Decode_XA.h" #include "Decode_XA.h"
#include "PS2Edefs.h" #include "PS2Edefs.h"

View File

@ -27,20 +27,20 @@
//#define PSXCLK 186864000 /* 36.864 Mhz */ //#define PSXCLK 186864000 /* 36.864 Mhz */
#define PS2CLK 294912000 //hz /* 294.912 mhz */ #define PS2CLK 294912000 //hz /* 294.912 mhz */
#define PCSX2_VERSION "(beta)"
#include "Plugins.h" #include "Plugins.h"
#include "Misc.h"
#include "SaveState.h" #include "SaveState.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include "R5900.h"
#include "Memory.h" #include "Memory.h"
#include "Elfheader.h"
#include "Hw.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" #include "Patch.h"
#define PCSX2_VERSION "(beta)" #include "System.h"
#include "Pcsx2Config.h"
#endif /* __COMMON_H__ */ #endif /* __COMMON_H__ */

View File

@ -20,7 +20,7 @@
#ifndef __DEBUG_H__ #ifndef __DEBUG_H__
#define __DEBUG_H__ #define __DEBUG_H__
#include "Misc.h" #include "Pcsx2Config.h"
extern FILE *emuLog; extern FILE *emuLog;

View File

@ -148,7 +148,7 @@ static uint parseCommandLine( const char *filename )
{ // 4 + 4 + 256 { // 4 + 4 + 256
const char * p; const char * p;
int argc; int argc;
int i; int i;
args_ptr -= 256; args_ptr -= 256;
@ -159,59 +159,47 @@ static uint parseCommandLine( const char *filename )
p = strrchr( filename, '\\' ); p = strrchr( filename, '\\' );
#else //linux #else //linux
p = strrchr( filename, '/' ); p = strrchr( filename, '/' );
if( p == NULL ) if( p == NULL ) p = strchr(filename, '\\');
p = strchr(filename, '\\');
#endif #endif
if ( p ) if (p)
{ p++;
p++;
}
else else
{ p = filename;
p = filename;
}
args_ptr -= strlen( p ) + 1; 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 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-- ) for ( i = strlen( p ) + 1 + 256, argc = 0; i > 0; i-- )
{ {
while ( i && ( ( PS2MEM_BASE[ args_ptr + i ] == 0 ) || ( PS2MEM_BASE[ args_ptr + i ] == 32 ) ) ) while (i && ((PS2MEM_BASE[ args_ptr + i ] == 0) || (PS2MEM_BASE[ args_ptr + i ] == 32)))
{ { i--; }
i--;
} if ( PS2MEM_BASE[ args_ptr + i + 1 ] == ' ') PS2MEM_BASE[ args_ptr + i + 1 ] = 0;
if ( PS2MEM_BASE[ args_ptr + i + 1 ] == ' ' )
{ while (i && (PS2MEM_BASE[ args_ptr + i ] != 0) && (PS2MEM_BASE[ args_ptr + i] != 32))
PS2MEM_BASE[ args_ptr + i + 1 ] = 0; { i--; }
}
while ( i && ( PS2MEM_BASE[ args_ptr + i ] != 0 ) && ( PS2MEM_BASE[ args_ptr + i] != 32 ) ) if ((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 { //i==0
argc++; argc++;
if ( args_ptr - 4 - 4 - argc * 4 < 0 ) // fixme - Should this be cast to a signed int? 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; ((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 ) ) if ( ( PS2MEM_BASE[ args_ptr + i + 1 ] != 0 ) && ( PS2MEM_BASE[ args_ptr + i + 1 ] != 32 ) )
{ {
argc++; argc++;
if ( args_ptr - 4 - 4 - argc * 4 < 0 ) // fixme - Should this be cast to a signed int? 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 + 1; ((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 - 1 ] = argc; //how many args
((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 2 ] = ( argc > 0); //have args? //not used, cannot be filled at all ((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) || if ((strnicmp( filename.c_str(), "cdrom0:", strlen("cdromN:")) == 0) ||
(strnicmp( filename.c_str(), "cdrom1:", strlen("cdromN:")) == 0)) (strnicmp( filename.c_str(), "cdrom1:", strlen("cdromN:")) == 0))
{ {
int fi; int fi = CDVDFS_open(filename.c_str() + strlen("cdromN:"), 1);//RDONLY
fi = CDVDFS_open(filename.c_str() + strlen("cdromN:"), 1);//RDONLY
if (fi < 0) if (fi < 0) throw Exception::FileNotFound( filename );
throw Exception::FileNotFound( filename );
CDVDFS_lseek( fi, 0, SEEK_SET ); CDVDFS_lseek( fi, 0, SEEK_SET );
rsize = CDVDFS_read( fi, (char*)data.GetPtr(), data.GetSizeInBytes() ); rsize = CDVDFS_read( fi, (char*)data.GetPtr(), data.GetSizeInBytes() );
CDVDFS_close( fi ); CDVDFS_close( fi );
@ -324,15 +312,14 @@ struct ElfObject
FILE *f; FILE *f;
f = fopen( filename.c_str(), "rb" ); f = fopen( filename.c_str(), "rb" );
if( f == NULL ) if( f == NULL ) Exception::FileNotFound( filename );
Exception::FileNotFound( filename );
fseek( f, 0, SEEK_SET ); fseek( f, 0, SEEK_SET );
rsize = fread( data.GetPtr(), 1, data.GetSizeInBytes(), f ); rsize = fread( data.GetPtr(), 1, data.GetSizeInBytes(), f );
fclose( f ); fclose( f );
} }
if( rsize < data.GetSizeInBytes() ) if( rsize < data.GetSizeInBytes() ) throw Exception::EndOfStream( filename );
throw Exception::EndOfStream( filename );
} }
u32 GetCRC() const u32 GetCRC() const
@ -426,37 +413,14 @@ struct ElfObject
switch ( secthead[ i ].sh_type ) switch ( secthead[ i ].sh_type )
{ {
default: case 0x0: ELF_LOG("null"); break;
ELF_LOG("unknown %08x",secthead[i].sh_type); case 0x1: ELF_LOG("progbits"); break;
break; case 0x2: ELF_LOG("symtab"); break;
case 0x3: ELF_LOG("strtab"); break;
case 0x0: case 0x4: ELF_LOG("rela"); break;
ELF_LOG("null"); case 0x8: ELF_LOG("no bits"); break;
break; case 0x9: ELF_LOG("rel"); break;
default: ELF_LOG("unknown %08x",secthead[i].sh_type); 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;
} }
ELF_LOG("\n"); ELF_LOG("\n");
@ -619,17 +583,6 @@ void LoadGameSpecificSettings()
g_FFXHack = 0; g_FFXHack = 0;
switch(ElfCRC) { 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) case 0xb99379b7: // erementar gerad (discolored chars)
g_VUGameFixes |= VUFIX_XGKICKDELAY2; // Tested - still needed - arcum42 g_VUGameFixes |= VUFIX_XGKICKDELAY2; // Tested - still needed - arcum42
break; break;

View File

@ -19,7 +19,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include <ctype.h> #include <ctype.h>
#include "PsxCommon.h" #include "IopCommon.h"
namespace R3000A { namespace R3000A {

View File

@ -15,37 +15,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef __PSXCOMMON_H__ #ifndef __IOPCOMMON_H__
#define __PSXCOMMON_H__ #define __IOPCOMMON_H__
#include "PS2Etypes.h"
#include <assert.h>
#include "System.h"
extern long LoadCdBios;
extern int cdOpenCase;
#define PSXCLK (36864000ULL) /* 36.864 Mhz */ #define PSXCLK (36864000ULL) /* 36.864 Mhz */
#include "Plugins.h"
#include "Misc.h"
#include "SaveState.h"
#include "R3000A.h" #include "R3000A.h"
#include "Common.h"
#include "CdRom.h"
#include "CDVD.h"
#include "Sio.h"
#include "Sif.h"
#include "IopMem.h" #include "IopMem.h"
#include "IopHw.h" #include "IopHw.h"
#include "IopBios.h" #include "IopBios.h"
#include "IopDma.h" #include "IopDma.h"
#include "IopCounters.h" #include "IopCounters.h"
#include "CdRom.h"
#include "Sio.h"
#include "DebugTools/Debug.h"
#include "IopSio2.h" #include "IopSio2.h"
#include "CDVD.h"
#include "Memory.h"
#include "Hw.h"
#include "Sif.h"
#endif /* __PSXCOMMON_H__ */ #endif /* __IOPCOMMON_H__ */

View File

@ -23,7 +23,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include <math.h> #include <math.h>
#include "PsxCommon.h" #include "IopCommon.h"
/* Config.PsxType == 1: PAL: /* Config.PsxType == 1: PAL:
VBlank interlaced 50.00 Hz VBlank interlaced 50.00 Hz

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
using namespace R3000A; using namespace R3000A;

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "Misc.h"
#include "iR5900.h" #include "iR5900.h"
// NOTE: Any modifications to read/write fns should also go into their const counterparts // NOTE: Any modifications to read/write fns should also go into their const counterparts

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "VU.h" #include "VU.h"
#include "iCore.h" #include "iCore.h"
#include "Hw.h" #include "Hw.h"

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
sio2Struct sio2; sio2Struct sio2;

View File

@ -18,7 +18,7 @@ RecoverySystem.cpp Saveslots.cpp
libpcsx2_a_SOURCES += \ 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 \ 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 \ 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 \ 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 VU.h VUflags.h VUmicro.h VUops.h Vif.h VifDma.h cheatscpp.h vtlb.h NakedAsm.h R5900Exceptions.h HostGui.h Pcsx2Config.h

View File

@ -21,8 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "Misc.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "Mdec.h" #include "Mdec.h"
int iq_y[DCTSIZE2],iq_uv[DCTSIZE2]; int iq_y[DCTSIZE2],iq_uv[DCTSIZE2];

View File

@ -25,6 +25,7 @@
#include "Linux/memzero.h" #include "Linux/memzero.h"
#endif // WIN32 #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 ); void _memset16_unaligned( void* dest, u16 data, size_t size );
// The new simplified memcpy_amd_ is now faster than memcpy_raz_. // The new simplified memcpy_amd_ is now faster than memcpy_raz_.

View File

@ -43,10 +43,9 @@ BIOS
#include <vector> #include <vector>
#include "Common.h" #include "IopCommon.h"
#include "iR5900.h" #include "iR5900.h"
#include "PsxCommon.h"
#include "VUmicro.h" #include "VUmicro.h"
#include "GS.h" #include "GS.h"
#include "IPU/IPU.h" #include "IPU/IPU.h"

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Misc.h" #include "System.h"
#include "MemoryCard.h" #include "MemoryCard.h"
#include "Paths.h" #include "Paths.h"

View File

@ -26,8 +26,7 @@
#include <ctype.h> #include <ctype.h>
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "HostGui.h" #include "HostGui.h"
#include "CDVDisodrv.h" #include "CDVDisodrv.h"
@ -52,6 +51,61 @@ char CdromId[12];
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
bool renderswitch = 0; 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_( const char *LabelAuthors = { N_(
"PCSX2, a PS2 emulator\n\n" "PCSX2, a PS2 emulator\n\n"
"Active Devs: Arcum42, Refraction,\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() { u32 GetBiosVersion() {
unsigned int fileOffset=0; unsigned int fileOffset=0;
s8 *ROMVER; s8 *ROMVER;
@ -269,44 +255,6 @@ int IsBIOS(char *filename, char *description)
return FALSE; //fail quietly 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 GetPS2ElfName(char *name){
int f; int f;
char buffer[g_MaxPath];//if a file is longer...it should be shorter :D char buffer[g_MaxPath];//if a file is longer...it should be shorter :D
@ -353,7 +301,6 @@ int GetPS2ElfName(char *name){
FILE *fp; FILE *fp;
int i; int i;
// inifile_read(CdromId);
fp = fopen("System.map", "r"); fp = fopen("System.map", "r");
if( fp == NULL ) return 2; if( fp == NULL ) return 2;
@ -398,7 +345,6 @@ void SaveGSState(const string& file)
g_fGSSave->Freeze( g_nLeftGSFrames ); g_fGSSave->Freeze( g_nLeftGSFrames );
} }
extern uptr pDsp;
void LoadGSState(const string& file) void LoadGSState(const string& file)
{ {
int ret; int ret;
@ -450,40 +396,6 @@ void LoadGSState(const string& file)
#endif #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) { char *ParseLang(char *id) {
int i=0; int i=0;
@ -496,11 +408,6 @@ char *ParseLang(char *id) {
return id; return id;
} }
#define NUM_STATES 10
int StatesC = 0;
extern char strgametitle[256];
char* mystrlwr( char* string ) char* mystrlwr( char* string )
{ {
assert( string != NULL ); assert( string != NULL );
@ -577,10 +484,10 @@ void CycleFrameLimit(int dir)
void ProcessFKeys(int fkey, int shift) void ProcessFKeys(int fkey, int shift)
{ {
assert(fkey >= 1 && fkey <= 12 ); assert(fkey >= 1 && fkey <= 12 );
switch(fkey) { switch(fkey) {
case 1: case 1:
try try
{ {
gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll(); gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll();
@ -701,92 +608,25 @@ void ProcessFKeys(int fkey, int shift)
#endif #endif
case 12: case 12:
if( shift ) { if( shift ) {
#ifdef PCSX2_DEVBUILD #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); Console::Notice("hardware registers dumped EE:%x, IOP:%x\n", params cpuRegs.pc, psxRegs.pc);
#endif #endif
} }
else { else {
g_Pcsx2Recording ^= 1; g_Pcsx2Recording ^= 1;
if( mtgsThread != NULL ) { if( mtgsThread != NULL ) {
mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0); mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
} }
else { else {
if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL); if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL);
} }
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL); if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
} }
break; 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; i<iBLANK; i++)p+=(rd[i].fileSize+0xF)&(~0xF);p+=DIRENTRY_SIZE;
// fixme - brevity, yes, but at the expense of readability?
q=(char*)PS2MEM_ROM;for (i=0; i<=iIOPBTCONF; i++) q+=(rd[i].fileSize+0xF)&(~0xF);
while (p-16>q){*((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<iIOPBTCONF; i++) p+=(rd[i].fileSize+0xF)&(~0xF);while(*p) p++;//go to end of file
strcpy(p, name);p[strlen(name)]=0xA;
//phase 4: find file
string path( Path::Combine( Config.BiosDir, filename ) );
if( !Path::isFile( path ) )
{
Msgbox::Alert("Unable to hack in %s%s\n", params Config.BiosDir, filename);
return;
} }
}
//phase 5: add the file to the end of the bios
p=(char*)PS2MEM_ROM;for (i=0; rd[i].fileName[0]; i++)p+=(rd[i].fileSize+0xF)&(~0xF);
fp=fopen(path.c_str(), "rb");
fseek(fp, 0, SEEK_END);
filesize=ftell(fp);
fseek(fp, 0, SEEK_SET);
fread(p, 1, filesize, fp);
fclose(fp);
//phase 6: register it in ROMDIR
memset(rd[i].fileName, 0, 10);
memcpy(rd[i].fileName, name, strlen(name));
rd[i].fileSize=filesize;
rd[i].extInfoSize=0;
}*/
void _memset16_unaligned( void* dest, u16 data, size_t size ) void _memset16_unaligned( void* dest, u16 data, size_t size )
{ {

View File

@ -19,37 +19,6 @@
#ifndef __MISC_H__ #ifndef __MISC_H__
#define __MISC_H__ #define __MISC_H__
#include "System.h"
#include "Pcsx2Config.h"
/////////////////////////////////////////////////////////////////////////
// GNU GetText / NLS
// Move to System.h, perhaps?
#ifdef ENABLE_NLS
#ifdef _WIN32
#include "libintlmsc.h"
#else
#include <locale.h>
#include <libintl.h>
#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) // 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) // Agreed. It ought to get removed in the next version of the plugin api. (arcum42)
extern uptr pDsp; //Used in GS, MTGS, Plugins, Misc 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 FreezeXMMRegs(save) if( g_EEFreezeRegs ) { FreezeXMMRegs_(save); }
#define FreezeMMXRegs(save) if( g_EEFreezeRegs ) { FreezeMMXRegs_(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. // If we move the rest of this stuff, we can probably move these, too.
extern void InitCPUTicks(); extern void InitCPUTicks();
extern u64 GetCPUTicks(); extern u64 GetCPUTicks();
@ -96,30 +62,8 @@ extern const char *LabelAuthors;
extern const char *LabelGreets; extern const char *LabelGreets;
void CycleFrameLimit(int dir); void CycleFrameLimit(int dir);
// Only used in Misc.cpp
void SaveGSState(const string& file); void SaveGSState(const string& file);
void LoadGSState(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__ */ #endif /* __MISC_H__ */

View File

@ -23,7 +23,7 @@
#define _PC_ // disables MIPS opcode macros. #define _PC_ // disables MIPS opcode macros.
#include "PsxCommon.h" #include "IopCommon.h"
#include "Paths.h" #include "Paths.h"
#include "Patch.h" #include "Patch.h"
#include "VU.h" #include "VU.h"

View File

@ -19,8 +19,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "RedtapeWindows.h" #include "RedtapeWindows.h"
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "GS.h" #include "GS.h"
_GSinit GSinit; _GSinit GSinit;

View File

@ -115,6 +115,33 @@ static __forceinline u32 timeGetTime()
# define __unused # define __unused
#endif #endif
/////////////////////////////////////////////////////////////////////////
// GNU GetText / NLS
#ifdef ENABLE_NLS
#ifdef _WIN32
#include "libintlmsc.h"
#else
#include <locale.h>
#include <libintl.h>
#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) // 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 // This is useful because forceinline can make certain types of debugging problematic since

View File

@ -18,9 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "Misc.h"
#include "R5900.h" #include "R5900.h"
using namespace R3000A; using namespace R3000A;

View File

@ -19,8 +19,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "Common.h"
using namespace R3000A; using namespace R3000A;

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "Common.h"
extern void zeroEx(); extern void zeroEx();

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "VUmicro.h" #include "VUmicro.h"
#include "deci2.h" #include "deci2.h"

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "IopBios2.h" #include "IopBios2.h"
#include "deci2.h" #include "deci2.h"

View File

@ -18,8 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "SaveState.h" #include "SaveState.h"
#include "CDVDisodrv.h" #include "CDVDisodrv.h"

View File

@ -23,7 +23,7 @@
#ifdef __LINUX__ #ifdef __LINUX__
#include "PS2Edefs.h" #include "PS2Edefs.h"
#endif #endif
#include "System.h"
// Savestate Versioning! // Savestate Versioning!
// If you make changes to the savestate version, please increment the value below. // If you make changes to the savestate version, please increment the value below.

View File

@ -20,8 +20,7 @@
#define _PC_ // disables MIPS opcode macros. #define _PC_ // disables MIPS opcode macros.
#include "PsxCommon.h" #include "IopCommon.h"
#include "Common.h"
#include "Sifcmd.h" #include "Sifcmd.h"
using namespace std; using namespace std;

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "MemoryCard.h" #include "MemoryCard.h"
_sio sio; _sio sio;

View File

@ -20,8 +20,7 @@
#include <time.h> #include <time.h>
#include "Common.h" #include "IopCommon.h"
#include "PsxCommon.h"
#include "Stats.h" #include "Stats.h"
#include "Paths.h" #include "Paths.h"

View File

@ -20,10 +20,12 @@
#define __SYSTEM_H__ #define __SYSTEM_H__
#include "PS2Etypes.h" #include "PS2Etypes.h"
#include "Pcsx2Config.h"
#include "Exceptions.h" #include "Exceptions.h"
#include "Paths.h" #include "Paths.h"
#include "MemcpyFast.h" #include "MemcpyFast.h"
#include "SafeArray.h" #include "SafeArray.h"
#include "Misc.h"
enum PageProtectionMode enum PageProtectionMode

View File

@ -35,12 +35,13 @@ else
DEBUG_FLAGS=" -O0 -g " DEBUG_FLAGS=" -O0 -g "
fi fi
WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value" WARNING_FLAGS="-Wno-format -Wno-unused-value"
NORMAL_FLAGS=" -pipe -msse -msse2 -O2 " 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. # 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 " 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 dnl Check for debug build
AC_MSG_CHECKING(debug build) AC_MSG_CHECKING(debug build)

View File

@ -3070,6 +3070,10 @@
RelativePath="..\..\Common.h" RelativePath="..\..\Common.h"
> >
</File> </File>
<File
RelativePath="..\..\IopCommon.h"
>
</File>
<File <File
RelativePath="..\..\Stats.cpp" RelativePath="..\..\Stats.cpp"
> >

View File

@ -27,7 +27,7 @@
#include <windowsx.h> #include <windowsx.h>
#include <tchar.h> #include <tchar.h>
#include "Misc.h" #include "System.h"
#include "HostGui.h" #include "HostGui.h"
#include "resource.h" #include "resource.h"
#include "WinDebugResource.h" #include "WinDebugResource.h"

View File

@ -324,6 +324,7 @@ void SetFPUstate();
#define MMX_TEMP 0x7f #define MMX_TEMP 0x7f
#define MMX_IS32BITS(x) (((x)>=MMX_FPU&&(x)<MMX_COP0+32)||(x)==MMX_FPUACC) #define MMX_IS32BITS(x) (((x)>=MMX_FPU&&(x)<MMX_COP0+32)||(x)==MMX_FPUACC)
// If x is unsigned, the first part of this is always true, and it usually is.
#define MMX_ISGPR(x) ((x) >= MMX_GPR && (x) < MMX_GPR+34) #define MMX_ISGPR(x) ((x) >= MMX_GPR && (x) < MMX_GPR+34)
struct _mmxregs { struct _mmxregs {

View File

@ -18,7 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "PsxCommon.h" #include "IopCommon.h"
#include "iR3000A.h" #include "iR3000A.h"
#include "VU.h" #include "VU.h"

View File

@ -30,7 +30,7 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include "PsxCommon.h" #include "IopCommon.h"
#include "VU.h" #include "VU.h"
#include "iCore.h" #include "iCore.h"

View File

@ -19,7 +19,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include <time.h> #include <time.h>
#include "PsxCommon.h" #include "IopCommon.h"
#include "iR3000A.h" #include "iR3000A.h"
#include "IopMem.h" #include "IopMem.h"
#include "IopDma.h" #include "IopDma.h"

View File

@ -444,7 +444,7 @@ int _getFreeMMXreg()
// check for dead regs // check for dead regs
for (i=0; i<MMXREGS; i++) { for (i=0; i<MMXREGS; i++) {
if (mmxregs[i].needed) continue; if (mmxregs[i].needed) continue;
if (mmxregs[i].reg >= 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)) ) { if( !(g_pCurInstInfo->regs[mmxregs[i].reg-MMX_GPR] & (EEINST_LIVE0|EEINST_LIVE1)) ) {
_freeMMXreg(i); _freeMMXreg(i);
return i; return i;