General cleanup. Get rid of some compiler warnings, change or correct a few messages, and remove a few unused variables.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@454 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
arcum42 2008-12-19 07:40:56 +00:00 committed by Gregory Hainaut
parent 5d14c71dfb
commit 13fa966fa5
24 changed files with 79 additions and 81 deletions

View File

@ -273,7 +273,7 @@ int CDVD_GetVolumeDescriptor(void){
return TRUE;
}
int CDVD_findfile(char* fname, struct TocEntry* tocEntry){
int CDVD_findfile(const char* fname, struct TocEntry* tocEntry){
static char filename[128+1];
static char pathname[1024+1];
static char toc[2048];

View File

@ -25,7 +25,7 @@
#include "CDVDlib.h"
int CDVD_findfile(char* fname, struct TocEntry* tocEntry);
int CDVD_findfile(const char* fname, struct TocEntry* tocEntry);
int CDVD_GetDir_RPC_request(char* pathname, char* extensions, unsigned int inc_dirs);
int CDVD_GetDir_RPC_get_entries(struct TocEntry tocEntry[], int req_entries);

View File

@ -175,7 +175,7 @@ struct TocEntry
#pragma pack()
#endif
int CDVD_findfile(char* fname, struct TocEntry* tocEntry);
int CDVD_findfile(const char* fname, struct TocEntry* tocEntry);
/*
int CdBreak(void);
int CdCallback( void (*func)() );

View File

@ -1412,10 +1412,12 @@ void GIFdma()
}
}
}
// When MTGS is enabled, Gifchain calls WRITERING_DMA, which calls GSRINGBUF_DONECOPY, which freezes
// the registers inside of the FreezeXMMRegs calls here and in the other two below..
// I'm not really sure that is intentional. --arcum42
FreezeXMMRegs(1);
FreezeMMXRegs(1);
GIFchain();
GIFchain();
FreezeXMMRegs(0); // Theres a comment below that says not to unfreeze the xmm regs, so not sure about this.
FreezeMMXRegs(0);

View File

@ -53,7 +53,7 @@ coroutine* g_pCurrentRoutine;
coroutine_t so_create(void (*func)(void *), void *data, void *stack, int size)
{
void* endstack;
int alloc = 0, r = CO_STK_COROSIZE;
int alloc = 0; // r = CO_STK_COROSIZE;
coroutine *co;
if ((size &= ~(sizeof(long) - 1)) < CO_MIN_SIZE)

View File

@ -231,7 +231,9 @@ static void mpeg2_idct_add_c (const int last, s16 * block,
}
}
extern "C" u8 mpeg2_scan_norm[64] = {
extern "C"
{
u8 mpeg2_scan_norm[64] = {
/* Zig-Zag scan pattern */
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
@ -239,13 +241,14 @@ extern "C" u8 mpeg2_scan_norm[64] = {
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
};
extern "C" u8 mpeg2_scan_alt[64] = {
u8 mpeg2_scan_alt[64] = {
/* Alternate scan pattern */
0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
};
};
/* idct_mmx.c */
void mpeg2_idct_copy_mmxext (s16 * block, u8 * dest, int stride);

View File

@ -913,8 +913,6 @@ extern u8* g_pIPU0Pointer;
#if defined(_MSC_VER)
#pragma pack(push, 1)
#else
__attribute__((packed))
#endif
struct TGA_HEADER
{
@ -961,7 +959,7 @@ void SaveTGA(const char* filename, int width, int height, void* pdata)
fwrite(pdata, width*height*4, 1, f);
fclose(f);
}
static int s_index = 0, s_frame = 0;
static int s_index = 0; //, s_frame = 0;
void SaveRGB32(u8* ptr)
{

View File

@ -2937,7 +2937,7 @@ void memWrite128(u32 mem, u64 *value) {
#endif // PCSX2_VIRTUAL_MEM
void loadBiosRom(char *ext, u8 *dest) {
void loadBiosRom(const char *ext, u8 *dest) {
struct stat buf;
char Bios1[g_MaxPath];
char Bios[g_MaxPath];

View File

@ -42,6 +42,10 @@
#define X86_32CODE(x) x
#endif
#ifndef __LINUX__
#define __unused
#endif
// --->> Path Utilities [PathUtil.c]
#define g_MaxPath 255 // 255 is safer with antiquitated Win32 ASCII APIs.
@ -396,32 +400,35 @@ static __forceinline long InterlockedCompareExchangePointer(PVOID volatile *dest
#endif
// define some overloads for InterlockedExchanges, for commonly used types.
static void AtomicExchange( u32& Target, u32 value )
// Note: _unused is there simply to get rid of a few Linux compiler warnings while
// debugging, as any compiler warnings in Misc.h get repeated x100 or so.
__unused static void AtomicExchange( u32& Target, u32 value )
{
InterlockedExchange( (volatile LONG*)&Target, value );
}
static void AtomicIncrement( u32& Target )
__unused static void AtomicIncrement( u32& Target )
{
InterlockedIncrement( (volatile LONG*)&Target );
}
static void AtomicDecrement( u32& Target )
__unused static void AtomicDecrement( u32& Target )
{
InterlockedDecrement( (volatile LONG*)&Target );
}
static void AtomicExchange( s32& Target, s32 value )
__unused static void AtomicExchange( s32& Target, s32 value )
{
InterlockedExchange( (volatile LONG*)&Target, value );
}
static void AtomicIncrement( s32& Target )
__unused static void AtomicIncrement( s32& Target )
{
InterlockedIncrement( (volatile LONG*)&Target );
}
static void AtomicDecrement( s32& Target )
__unused static void AtomicDecrement( s32& Target )
{
InterlockedDecrement( (volatile LONG*)&Target );
}

View File

@ -50,6 +50,7 @@ typedef unsigned __int64 u64;
#else
#ifdef __LINUX__
#ifdef HAVE_STDINT_H
#include "stdint.h"
@ -79,14 +80,16 @@ typedef unsigned int u32;
typedef unsigned long long u64;
#endif
#define LONG long
typedef union _LARGE_INTEGER
{
long long QuadPart;
} LARGE_INTEGER;
#define _inline __inline__ __attribute__((unused))
#define __fastcall __attribute__((fastcall))
#define LONG long
#define __unused __attribute__((unused))
#define _inline __inline__ __attribute__((unused))
#define __forceinline __attribute__((always_inline,unused))
#endif
#if defined(__MINGW32__)
@ -97,9 +100,6 @@ typedef union _LARGE_INTEGER
#define PCSX2_ALIGNED16_DECL(x) x
#ifndef __forceinline
#define __forceinline __attribute__((always_inline,unused))
#endif
#endif // _MSC_VER

View File

@ -98,7 +98,7 @@ u8 psxHwRead8(u32 add) {
default:
hard = psxHu8(add);
PSXHW_LOG("*Unkwnown 8bit read at address %lx\n", add);
PSXHW_LOG("*Unknown 8bit read at address %lx\n", add);
return hard;
}
@ -253,7 +253,7 @@ u16 psxHwRead16(u32 add) {
hard = SPU2read(add);
} else {
hard = psxHu16(add);
PSXHW_LOG("*Unkwnown 16bit read at address %lx\n", add);
PSXHW_LOG("*Unknown 16bit read at address %lx\n", add);
}
return hard;
}
@ -1330,8 +1330,8 @@ u8 psxHw4Read8(u32 add) {
default:
// note: use SysPrintF to notify console since this is a potentially serious
// emulation problem:
//PSXHW_LOG("*Unkwnown 8bit read at address %lx\n", add);
SysPrintf("*Unkwnown 8bit read at address %lx\n", add);
//PSXHW_LOG("*Unknown 8bit read at address %lx\n", add);
SysPrintf("*Unknown 8bit read at address %lx\n", add);
return 0;
}
@ -1341,6 +1341,7 @@ u8 psxHw4Read8(u32 add) {
}
void psxHw4Write8(u32 add, u8 value) {
switch (add) {
case 0x1f402004: cdvdWrite04(value); return;
case 0x1f402005: cdvdWrite05(value); return;
@ -1352,6 +1353,7 @@ void psxHw4Write8(u32 add, u8 value) {
case 0x1f402014: cdvdWrite14(value); return;
case 0x1f402016:
cdvdWrite16(value);
//fixme - are these supposed to be here?
FreezeMMXRegs(0);
FreezeXMMRegs(0);
return;

View File

@ -44,8 +44,8 @@ void D2_DCMP(const u8 *inbuffer, u8 *outbuffer, char *message){
*out=(DECI2_DCMP_HEADER*)outbuffer;
u8 *data=(u8*)in+sizeof(DECI2_DCMP_HEADER);
DECI2_DCMP_CONNECT *connect=(DECI2_DCMP_CONNECT*)data;
DECI2_DCMP_ECHO *echo =(DECI2_DCMP_ECHO*)data;
//DECI2_DCMP_CONNECT *connect=(DECI2_DCMP_CONNECT*)data;
//DECI2_DCMP_ECHO *echo =(DECI2_DCMP_ECHO*)data;
memcpy(outbuffer, inbuffer, 128*1024);//BUFFERSIZE
out->h.length=sizeof(DECI2_DCMP_HEADER);

View File

@ -102,7 +102,7 @@ void _vu0WaitMicro() {
Cpu->ExecuteVU0Block();
// knockout kings 2002 loops here
if( VU0.cycle-startcycle > 0x1000 ) {
SysPrintf("VU0 wait stall (email zero if gfx are bad)\n");
SysPrintf("VU0 wait stall.\n"); // (email zero if gfx are bad)
break;
}
} while ((VU0.VI[REG_VPU_STAT].UL & 0x1) && (VU0.flags & VUFLAG_MFLAGSET) == 0);

View File

@ -489,17 +489,6 @@ void mfifoVIF1transfer(int qwc) {
}
if(vif1ch->qwc == 0){
/*if(vif1ch->tadr == spr0->madr) {
#ifdef PCSX2_DEVBUILD
SysPrintf("vif mfifo tadr==madr but qwc = %d\n", vifqwc);
#endif
FreezeMMXRegs(0);
FreezeXMMRegs(0);
//hwDmacIrq(14);
return;
}*/
ptag = (u32*)dmaGetAddr(vif1ch->tadr);
if (vif1ch->chcr & 0x40) {

View File

@ -343,31 +343,28 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
u8 *cdata = (u8*)data;
//u64 basetick = GetCPUTick();
#ifdef _DEBUG
u32 memsize;
u32 memsize = VIFdmanum ? 0x4000 : 0x1000;
#endif
#ifdef _MSC_VER
_mm_prefetch((char*)data, _MM_HINT_NTA);
#endif
if (VIFdmanum == 0) {
if (VIFdmanum == 0)
{
VU = &VU0;
vif = &vif0;
vifRegs = vif0Regs;
#ifdef _DEBUG
memsize = 0x1000;
#endif
assert( v->addr < 0x1000 );
assert( v->addr < memsize );
//v->addr &= 0xfff;
} else {
}
else
{
VU = &VU1;
vif = &vif1;
vifRegs = vif1Regs;
#ifdef _DEBUG
memsize = 0x4000;
#endif
assert( v->addr < 0x4000 );
assert( v->addr < memsize );
//v->addr &= 0x3fff;
if( Cpu->ExecuteVU1Block == DummyExecuteVU1Block ) {
@ -412,7 +409,7 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
#endif
_vifRegs = (VIFregisters*)vifRegs;
_vifMaskRegs = VIFdmanum ? g_vif1Masks : g_vif0Masks;
_vif = vif;
_vif = vif;
_vifRow = VIFdmanum ? g_vifRow1 : g_vifRow0;
ft = &VIFfuncTable[ unpackType ];
func = _vif->usn ? ft->funcU : ft->funcS;
@ -1697,7 +1694,6 @@ static int Vif1TransDirectHL(u32 *data){
static int Vif1TransUnpack(u32 *data){
FreezeXMMRegs(1);
if (vif1.vifpacketsize < vif1.tag.size) {

View File

@ -368,8 +368,8 @@ static void recCTC2()
// then they modify the register and expect vu0 to stop spinning within 10 cycles (donald duck)
iFlushCall(FLUSH_FREE_VU0|FLUSH_FREE_TEMPX86);
_callFunctionArg1((uptr)FreezeXMMRegs_, MEM_CONSTTAG, 1); // fixme - are these two calls neccessary?
_callFunctionArg1((uptr)FreezeXMMRegs_, MEM_CONSTTAG, 0);
//_callFunctionArg1((uptr)FreezeXMMRegs_, MEM_CONSTTAG, 1); // fixme - are these two calls neccessary?
//_callFunctionArg1((uptr)FreezeXMMRegs_, MEM_CONSTTAG, 0);
#else
_eeMoveGPRtoM((uptr)&VU0.VI[_Fs_].UL,_Rt_);

View File

@ -152,13 +152,13 @@ void recMFC0( void )
else EEINST_RESETHASLIVE1(_Rt_);
#ifdef PCSX2_DEVBUILD
SysPrintf("MFC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
COP0_LOG("MFC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);
#endif
return;
}
else if( _Rd_ == 24){
SysPrintf("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
COP0_LOG("MFC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
return;
}
_eeOnWriteReg(_Rt_, 1);
@ -249,7 +249,7 @@ void recMTC0()
MOV32ItoM((uptr)&cpuRegs.CP0.r[9], g_cpuConstRegs[_Rt_].UL[0]);
break;
case 25:
SysPrintf("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
COP0_LOG("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);
switch(_Imm_ & 0x3F){
case 0:
@ -274,7 +274,7 @@ void recMTC0()
}
break;
case 24:
SysPrintf("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
COP0_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
break;
default:
MOV32ItoM((uptr)&cpuRegs.CP0.r[_Rd_], g_cpuConstRegs[_Rt_].UL[0]);
@ -294,7 +294,7 @@ void recMTC0()
MOV32RtoM((uptr)&s_iLastCOP0Cycle, ECX);
break;
case 25:
SysPrintf("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
COP0_LOG("MTC0 PCCR = %x PCR0 = %x PCR1 = %x IMM= %x\n",
cpuRegs.PERF.n.pccr, cpuRegs.PERF.n.pcr0, cpuRegs.PERF.n.pcr1, _Imm_ & 0x3F);
switch(_Imm_ & 0x3F){
case 0:
@ -318,7 +318,7 @@ void recMTC0()
}
break;
case 24:
SysPrintf("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
COP0_LOG("MTC0 Breakpoint debug Registers code = %x\n", cpuRegs.code & 0x3FF);
break;
default:
_eeMoveGPRtoM((uptr)&cpuRegs.CP0.r[_Rd_], _Rt_);

View File

@ -1042,6 +1042,7 @@ void _freeXMMregs()
__forceinline void FreezeXMMRegs_(int save)
{
//SysPrintf("FreezeXMMRegs_(%d); [%d]\n", save, g_globalXMMSaved);
assert( g_EEFreezeRegs );
if( save ) {

View File

@ -23,9 +23,9 @@
// stop compiling if NORECBUILD build (only for Visual Studio)
#if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
#include "ix86/ix86.h"
#include "Common.h"
#include "InterTables.h"
#include "ix86/ix86.h"
#include "iR5900.h"
#include "iMMI.h"

View File

@ -1129,7 +1129,7 @@ int psxHw4ConstRead8(u32 x86reg, u32 add, u32 sign) {
case 0x1f402039: CONSTREAD8_CALL((uptr)cdvdRead39); return 1;
case 0x1f40203A: CONSTREAD8_CALL((uptr)cdvdRead3A); return 1;
default:
SysPrintf("*Unkwnown 8bit read at address %lx\n", add);
SysPrintf("*Unknown 8bit read at address %lx\n", add);
XOR32RtoR(x86reg, x86reg);
return 0;
}

View File

@ -3200,7 +3200,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
s_ClipRead = (uptr)&VU->VI[REG_CLIP_FLAG];
else {
s_ClipRead = s_pCurBlock->GetInstIterAtPc(nParentPc)->pClipWrite;
if (s_ClipRead == NULL) SysPrintf("super ClipRead allocation error! \n");
if (s_ClipRead == 0) SysPrintf("super ClipRead allocation error! \n");
}
}
@ -3216,7 +3216,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
if( pparentinst != NULL ) { //&& pparentinst->pStatusWrite != NULL ) {
// might not have processed it yet, so reserve a mem loc
if( pparentinst->pStatusWrite == NULL ) {
if( pparentinst->pStatusWrite == 0 ) {
pparentinst->pStatusWrite = (uptr)SuperVUStaticAlloc(4);
//MOV32ItoM(pparentinst->pStatusWrite, 0);
}
@ -3237,7 +3237,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
// else
// MOV32MtoR(EAX, (uptr)&VU->VI[REG_STATUS_FLAG]);
// s_StatusRead = tempstatus;
if( s_StatusRead == NULL )
if( s_StatusRead == 0 )
s_StatusRead = (uptr)&VU->VI[REG_STATUS_FLAG];
CMP32ItoM((uptr)&g_nLastBlockExecuted, nParentCheckForExecution);
@ -3262,7 +3262,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
}
else {
s_StatusRead = s_pCurBlock->GetInstIterAtPc(nParentPc)->pStatusWrite;
if (s_StatusRead == NULL) SysPrintf("super StatusRead allocation error! \n");
if (s_StatusRead == 0) SysPrintf("super StatusRead allocation error! \n");
// if( pc >= (u32)s_pCurBlock->endpc-8 ) {
// // towards the end, so variable might be leaded to another block (silent hill 4)
// uptr tempstatus = (uptr)SuperVUStaticAlloc(4);
@ -3283,7 +3283,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
// towards the end, so variable might be leaked to another block (silent hill 4)
// might not have processed it yet, so reserve a mem loc
if( pparentinst->pMACWrite == NULL ) {
if( pparentinst->pMACWrite == 0 ) {
pparentinst->pMACWrite = (uptr)SuperVUStaticAlloc(4);
//MOV32ItoM(pparentinst->pMACWrite, 0);
}
@ -3304,7 +3304,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
// MOV32MtoR(EAX, (uptr)&VU->VI[REG_MAC_FLAG]);
// s_MACRead = tempmac;
if( s_MACRead == NULL )
if( s_MACRead == 0 )
s_MACRead = (uptr)&VU->VI[REG_MAC_FLAG];
CMP32ItoM((uptr)&g_nLastBlockExecuted, nParentCheckForExecution);
@ -3345,9 +3345,9 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
}
else if( pparentinst != NULL) {
// make sure to reset the mac and status flags! (katamari)
if( pparentinst->pStatusWrite != NULL )
if( pparentinst->pStatusWrite)
MOV32ItoM(pparentinst->pStatusWrite, 0);
if( pparentinst->pMACWrite != NULL )
if( pparentinst->pMACWrite)
MOV32ItoM(pparentinst->pMACWrite, 0);
}
@ -3398,7 +3398,7 @@ void VuInstruction::Recompile(list<VuInstruction>::iterator& itinst, u32 vuxyz)
}
}
if( pClipWrite == NULL && ((regs[0].VIwrite|regs[1].VIwrite) & (1<<REG_CLIP_FLAG)) ) {
if( (pClipWrite == 0) && ((regs[0].VIwrite|regs[1].VIwrite) & (1<<REG_CLIP_FLAG)) ) {
pClipWrite = (uptr)SuperVUStaticAlloc(4);
//MOV32ItoM(pClipWrite, 0);
}

View File

@ -62,7 +62,7 @@ extern u8 s_maskwrite[256];
extern "C" PCSX2_ALIGNED16(u32 s_TempDecompress[4]) = {0};
#if defined(_MSC_VER) // gcc functions can be found in iVif.S
#if defined(_MSC_VER)
#include <xmmintrin.h>
#include <emmintrin.h>

View File

@ -117,10 +117,10 @@ LARGE_INTEGER lbase = {0}, lfinal = {0};
//static u32 s_startcount = 0;
//#endif
char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n";
char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n";
char *txt1 = "REG[%d] = %x_%x\n";
char *txt2 = "M32 = %x\n";
const char *txt0 = "EAX = %x : ECX = %x : EDX = %x\n";
const char *txt0RC = "EAX = %x : EBX = %x : ECX = %x : EDX = %x : ESI = %x : EDI = %x\n";
const char *txt1 = "REG[%d] = %x_%x\n";
const char *txt2 = "M32 = %x\n";
void _cop2AnalyzeOp(EEINST* pinst, int dostalls); // reccop2.c
static void iBranchTest(u32 newpc, u32 cpuBranch);

View File

@ -824,7 +824,7 @@ void recMADDU()
void recMADD1()
{
SysPrintf("MADD1 email zero if abnormal behavior\n");
//SysPrintf("MADD1 email zero if abnormal behavior\n");
EEINST_SETSIGNEXT(_Rs_);
EEINST_SETSIGNEXT(_Rt_);
if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_);
@ -835,7 +835,7 @@ void recMADD1()
void recMADDU1()
{
SysPrintf("MADDU1 email zero if abnormal behavior\n");
//SysPrintf("MADDU1 email zero if abnormal behavior\n");
EEINST_SETSIGNEXT(_Rs_);
EEINST_SETSIGNEXT(_Rt_);
if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_);