Renamed memzero_obj to memzero. Been meaning to do that for a while. Also, Savestates *almost* work, but it's just not going to happen. See everyone in 5 days or so. -_-

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1913 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-23 12:53:32 +00:00
parent 32550ef6a0
commit 6b9ffd8132
33 changed files with 123 additions and 120 deletions

View File

@ -16,11 +16,11 @@
#ifndef _LNX_MEMZERO_H_ #ifndef _LNX_MEMZERO_H_
#define _LNX_MEMZERO_H_ #define _LNX_MEMZERO_H_
// This header contains non-optimized implementation of memzero_ptr and memset8_obj, // This header contains non-optimized implementation of memzero_ptr and memset8,
// memset16_obj, etc. // memset16, etc.
template< u32 data, typename T > template< u32 data, typename T >
static __forceinline void memset32_obj( T& obj ) static __forceinline void memset32( T& obj )
{ {
// this function works on 32-bit aligned lengths of data only. // this function works on 32-bit aligned lengths of data only.
// If the data length is not a factor of 32 bits, the C++ optimizing compiler will // If the data length is not a factor of 32 bits, the C++ optimizing compiler will
@ -40,28 +40,28 @@ static __forceinline void memzero_ptr( void* dest )
} }
template< typename T > template< typename T >
static __forceinline void memzero_obj( T& obj ) static __forceinline void memzero( T& obj )
{ {
memset( &obj, 0, sizeof( T ) ); memset( &obj, 0, sizeof( T ) );
} }
template< u8 data, typename T > template< u8 data, typename T >
static __forceinline void memset8_obj( T& obj ) static __forceinline void memset8( T& obj )
{ {
// Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset. // Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset.
if( (sizeof(T) & 0x3) != 0 ) if( (sizeof(T) & 0x3) != 0 )
memset( &obj, data, sizeof( T ) ); memset( &obj, data, sizeof( T ) );
else else
memset32_obj<data + (data<<8) + (data<<16) + (data<<24)>( obj ); memset32<data + (data<<8) + (data<<16) + (data<<24)>( obj );
} }
template< u16 data, typename T > template< u16 data, typename T >
static __forceinline void memset16_obj( T& obj ) static __forceinline void memset16( T& obj )
{ {
if( (sizeof(T) & 0x3) != 0 ) if( (sizeof(T) & 0x3) != 0 )
_memset16_unaligned( &obj, data, sizeof( T ) ); _memset16_unaligned( &obj, data, sizeof( T ) );
else else
memset32_obj<data + (data<<16)>( obj ); memset32<data + (data<<16)>( obj );
} }

View File

@ -562,28 +562,28 @@ static __forceinline void memset_32( void *dest )
// Structures, static arrays, etc. No need to include sizeof() crap, this does it automatically // Structures, static arrays, etc. No need to include sizeof() crap, this does it automatically
// for you! // for you!
template< typename T > template< typename T >
static __forceinline void memzero_obj( T& object ) static __forceinline void memzero( T& object )
{ {
memzero_ptr<sizeof(T)>( &object ); memzero_ptr<sizeof(T)>( &object );
} }
// This method clears an object with the given 8 bit value. // This method clears an object with the given 8 bit value.
template< u8 data, typename T > template< u8 data, typename T >
static __forceinline void memset8_obj( T& object ) static __forceinline void memset8( T& object )
{ {
memset_8<data, sizeof(T)>( &object ); memset_8<data, sizeof(T)>( &object );
} }
// This method clears an object with the given 16 bit value. // This method clears an object with the given 16 bit value.
template< u16 data, typename T > template< u16 data, typename T >
static __forceinline void memset16_obj( T& object ) static __forceinline void memset16( T& object )
{ {
memset_16<data, sizeof(T)>( &object ); memset_16<data, sizeof(T)>( &object );
} }
// This method clears an object with the given 32 bit value. // This method clears an object with the given 32 bit value.
template< u32 data, typename T > template< u32 data, typename T >
static __forceinline void memset32_obj( T& object ) static __forceinline void memset32( T& object )
{ {
memset_32<data, sizeof(T)>( &object ); memset_32<data, sizeof(T)>( &object );
} }

View File

@ -166,7 +166,7 @@ void cpudetectInit()
int num; int num;
char str[50]; char str[50];
memzero_obj( x86caps.VendorName ); memzero( x86caps.VendorName );
x86caps.FamilyID = 0; x86caps.FamilyID = 0;
x86caps.Model = 0; x86caps.Model = 0;
x86caps.TypeID = 0; x86caps.TypeID = 0;
@ -254,7 +254,7 @@ void cpudetectInit()
if ( x86caps.VendorName[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p if ( x86caps.VendorName[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p
if ( x86caps.VendorName[ 0 ] == 'A' ){ cputype=1;} if ( x86caps.VendorName[ 0 ] == 'A' ){ cputype=1;}
memzero_obj( x86caps.FamilyName ); memzero( x86caps.FamilyName );
iCpuId( 0x80000002, (u32*)x86caps.FamilyName); iCpuId( 0x80000002, (u32*)x86caps.FamilyName);
iCpuId( 0x80000003, (u32*)(x86caps.FamilyName+16)); iCpuId( 0x80000003, (u32*)(x86caps.FamilyName+16));
iCpuId( 0x80000004, (u32*)(x86caps.FamilyName+32)); iCpuId( 0x80000004, (u32*)(x86caps.FamilyName+32));

View File

@ -453,7 +453,7 @@ static uint cdvdBlockReadTime( CDVD_MODE_TYPE mode )
void cdvdReset() void cdvdReset()
{ {
memzero_obj(cdvd); memzero(cdvd);
cdvd.Type = CDVD_TYPE_NODISC; cdvd.Type = CDVD_TYPE_NODISC;
cdvd.Spinning = false; cdvd.Spinning = false;

View File

@ -508,7 +508,7 @@ void cdrReadInterrupt() {
if (cdr.RErr == -1) if (cdr.RErr == -1)
{ {
CDR_LOG(" err\n"); CDR_LOG(" err\n");
memzero_obj(cdr.Transfer); memzero(cdr.Transfer);
cdr.Stat = DiskError; cdr.Stat = DiskError;
cdr.Result[0] |= 0x01; cdr.Result[0] |= 0x01;
ReadTrack(); ReadTrack();
@ -955,7 +955,7 @@ void cdvdDmaInterrupt(s32 channel)
#endif #endif
void cdrReset() { void cdrReset() {
memzero_obj(cdr); memzero(cdr);
cdr.CurTrack=1; cdr.CurTrack=1;
cdr.File=1; cdr.Channel=1; cdr.File=1; cdr.Channel=1;
cdReadTime = (PSXCLK / 1757) * BIAS; cdReadTime = (PSXCLK / 1757) * BIAS;

View File

@ -50,8 +50,8 @@ void IsoFS_init()
ISOFS_LOG("[IsoFSdrv:init] Initializing '%s' file driver.", "IsoFS"); ISOFS_LOG("[IsoFSdrv:init] Initializing '%s' file driver.", "IsoFS");
memzero_obj( fd_table ); memzero( fd_table );
memzero_obj( fd_used ); memzero( fd_used );
inited = TRUE; inited = TRUE;

View File

@ -124,7 +124,7 @@ static __forceinline void cpuRcntSet()
void rcntInit() { void rcntInit() {
int i; int i;
memzero_obj(counters); memzero(counters);
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
counters[i].rate = 2; counters[i].rate = 2;

View File

@ -234,7 +234,7 @@ void iDumpBlock( int startpc, u8 * ptr )
EEINST_LIVE0, EEINST_LIVE1, EEINST_LIVE2, EEINST_LASTUSE, EEINST_MMX, EEINST_XMM, EEINST_USED EEINST_LIVE0, EEINST_LIVE1, EEINST_LIVE2, EEINST_LASTUSE, EEINST_MMX, EEINST_XMM, EEINST_USED
); );
memzero_obj(used); memzero(used);
numused = 0; numused = 0;
for(uint i = 0; i < ArraySize(s_pInstCache->regs); ++i) { for(uint i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( s_pInstCache->regs[i] & EEINST_USED ) { if( s_pInstCache->regs[i] & EEINST_USED ) {
@ -243,7 +243,7 @@ void iDumpBlock( int startpc, u8 * ptr )
} }
} }
memzero_obj(fpuused); memzero(fpuused);
fpunumused = 0; fpunumused = 0;
for(uint i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) { for(uint i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
if( s_pInstCache->fpuregs[i] & EEINST_USED ) { if( s_pInstCache->fpuregs[i] & EEINST_USED ) {

View File

@ -87,7 +87,7 @@ void gsSetRegionMode( GS_RegionMode region )
// Make sure framelimiter options are in sync with the plugin's capabilities. // Make sure framelimiter options are in sync with the plugin's capabilities.
void gsInit() void gsInit()
{ {
memzero_obj(g_RealGSMem); memzero(g_RealGSMem);
} }
void gsReset() void gsReset()
@ -99,7 +99,7 @@ void gsReset()
UpdateVSyncRate() UpdateVSyncRate()
); );
memzero_obj(g_RealGSMem); memzero(g_RealGSMem);
GSCSRr = 0x551B4000; // Set the FINISH bit to 1 for now GSCSRr = 0x551B4000; // Set the FINISH bit to 1 for now
GSIMR = 0x7f00; GSIMR = 0x7f00;

View File

@ -49,7 +49,7 @@ public:
const char* gsdll, *cdvddll, *spudll; const char* gsdll, *cdvddll, *spudll;
const char* pad1dll, *pad2dll, *dev9dll; const char* pad1dll, *pad2dll, *dev9dll;
StartupParams() { memzero_obj(*this); } StartupParams() { memzero(*this); }
}; };
extern StartupParams g_Startup; extern StartupParams g_Startup;

View File

@ -132,12 +132,12 @@ __forceinline void mpeg2_init()
{ {
mpeg2_idct_init(); mpeg2_idct_init();
yuv2rgb_init(); yuv2rgb_init();
memzero_obj(mb8.Y); memzero(mb8.Y);
memzero_obj(mb8.Cb); memzero(mb8.Cb);
memzero_obj(mb8.Cr); memzero(mb8.Cr);
memzero_obj(mb16.Y); memzero(mb16.Y);
memzero_obj(mb16.Cb); memzero(mb16.Cb);
memzero_obj(mb16.Cr); memzero(mb16.Cr);
mpeg2_inited = TRUE; mpeg2_inited = TRUE;
} }
} }
@ -146,8 +146,8 @@ __forceinline void mpeg2_init()
// Register accesses (run on EE thread) // Register accesses (run on EE thread)
int ipuInit() int ipuInit()
{ {
memzero_obj(*ipuRegs); memzero(*ipuRegs);
memzero_obj(g_BP); memzero(g_BP);
init_g_decoder(); init_g_decoder();
g_nDMATransfer._u32 = 0; g_nDMATransfer._u32 = 0;
@ -156,7 +156,7 @@ int ipuInit()
void ipuReset() void ipuReset()
{ {
memzero_obj(*ipuRegs); memzero(*ipuRegs);
g_nDMATransfer._u32 = 0; g_nDMATransfer._u32 = 0;
} }
@ -499,8 +499,8 @@ static __forceinline BOOL ipuBDEC(u32 val)
g_decoder.dcr = bdec.DCR; g_decoder.dcr = bdec.DCR;
g_decoder.macroblock_modes |= bdec.MBI ? MACROBLOCK_INTRA : MACROBLOCK_PATTERN; g_decoder.macroblock_modes |= bdec.MBI ? MACROBLOCK_INTRA : MACROBLOCK_PATTERN;
memzero_obj(mb8); memzero(mb8);
memzero_obj(mb16); memzero(mb16);
s_routine = so_create(mpeg2_slice, &s_RoutineDone, s_tempstack, sizeof(s_tempstack)); s_routine = so_create(mpeg2_slice, &s_RoutineDone, s_tempstack, sizeof(s_tempstack));
assert(s_routine != NULL); assert(s_routine != NULL);
@ -1300,7 +1300,7 @@ void __fastcall ipu_copy(const macroblock_8 *mb8, macroblock_16 *mb16)
///////////////////// IPU DMA //////////////////////// ///////////////////// IPU DMA ////////////////////////
void FIFOto_clear() void FIFOto_clear()
{ {
memzero_obj(fifo_input); memzero(fifo_input);
g_BP.IFC = 0; g_BP.IFC = 0;
ipuRegs->ctrl.IFC = 0; ipuRegs->ctrl.IFC = 0;
FIreadpos = 0; FIreadpos = 0;
@ -1592,7 +1592,7 @@ int IPU1dma()
void FIFOfrom_clear() void FIFOfrom_clear()
{ {
memzero_obj(fifo_output); memzero(fifo_output);
ipuRegs->ctrl.OFC = 0; ipuRegs->ctrl.OFC = 0;
FOreadpos = 0; FOreadpos = 0;
FOwritepos = 0; FOwritepos = 0;

View File

@ -985,7 +985,7 @@ static void __fastcall slice_non_intra_DCT(decoder_t * const decoder,
/*u8*/s16 * const dest, const int stride) /*u8*/s16 * const dest, const int stride)
{ {
int last; int last;
memzero_obj(decoder->DCTblock); memzero(decoder->DCTblock);
if (decoder->mpeg1) if (decoder->mpeg1)
last = get_mpeg1_non_intra_block(decoder); last = get_mpeg1_non_intra_block(decoder);
@ -1035,7 +1035,7 @@ void SaveTGA(const char* filename, int width, int height, void* pdata)
assert(sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18); assert(sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18);
memzero_obj(hdr); memzero(hdr);
hdr.imagetype = 2; hdr.imagetype = 2;
hdr.bits = 32; hdr.bits = 32;
hdr.width = width; hdr.width = width;
@ -1185,8 +1185,8 @@ void mpeg2sliceIDEC(void* pdone)
decoder->coded_block_pattern = 0x3F;//all 6 blocks decoder->coded_block_pattern = 0x3F;//all 6 blocks
//ipuRegs->ctrl.CBP = 0x3f; //ipuRegs->ctrl.CBP = 0x3f;
memzero_obj(*decoder->mb8); memzero(*decoder->mb8);
memzero_obj(*decoder->rgb32); memzero(*decoder->rgb32);
slice_intra_DCT(decoder, 0, (u8*)decoder->mb8->Y, DCT_stride); slice_intra_DCT(decoder, 0, (u8*)decoder->mb8->Y, DCT_stride);
slice_intra_DCT(decoder, 0, (u8*)decoder->mb8->Y + 8, DCT_stride); slice_intra_DCT(decoder, 0, (u8*)decoder->mb8->Y + 8, DCT_stride);
@ -1312,8 +1312,8 @@ void mpeg2_slice(void* pdone)
*(int*)pdone = 0; *(int*)pdone = 0;
ipuRegs->ctrl.ECD = 0; ipuRegs->ctrl.ECD = 0;
memzero_obj(*decoder->mb8); memzero(*decoder->mb8);
memzero_obj(*decoder->mb16); memzero(*decoder->mb16);
bitstream_init(decoder); bitstream_init(decoder);

View File

@ -113,7 +113,7 @@ static void _rcntSet( int cntidx )
void psxRcntInit() { void psxRcntInit() {
int i; int i;
memzero_obj( psxCounters ); memzero( psxCounters );
for (i=0; i<3; i++) { for (i=0; i<3; i++) {
psxCounters[i].rate = 1; psxCounters[i].rate = 1;

View File

@ -53,7 +53,7 @@ only recv2 & dataout influences padman
void sio2Reset() { void sio2Reset() {
DevCon::Status( "Sio2 Reset" ); DevCon::Status( "Sio2 Reset" );
memzero_obj(sio2); memzero(sio2);
sio2.packet.recvVal1 = 0x1D100; // Nothing is connected at start sio2.packet.recvVal1 = 0x1D100; // Nothing is connected at start
} }

View File

@ -885,6 +885,6 @@ void mmap_ClearCpuBlock( uint offset )
void mmap_ResetBlockTracking() void mmap_ResetBlockTracking()
{ {
DevCon::WriteLn( "vtlb/mmap: Block Tracking reset..." ); DevCon::WriteLn( "vtlb/mmap: Block Tracking reset..." );
memzero_obj( m_PageProtectInfo ); memzero( m_PageProtectInfo );
HostSys::MemProtect( psM, Ps2MemSize::Base, Protect_ReadWrite ); HostSys::MemProtect( psM, Ps2MemSize::Base, Protect_ReadWrite );
} }

View File

@ -521,8 +521,8 @@ void inifile_command( char * cmd )
if ( ! pEqual ) pEqual = cmd+strlen(cmd); // fastmemory doesn't have = if ( ! pEqual ) pEqual = cmd+strlen(cmd); // fastmemory doesn't have =
memzero_obj( command ); memzero( command );
memzero_obj( parameter ); memzero( parameter );
strncpy( command, cmd, pEqual - cmd ); strncpy( command, cmd, pEqual - cmd );
strncpy( parameter, pEqual + 1, sizeof( parameter ) ); strncpy( parameter, pEqual + 1, sizeof( parameter ) );

View File

@ -51,7 +51,7 @@ PCSX2_ALIGNED16(psxRegisters psxRegs);
void psxReset() void psxReset()
{ {
memzero_obj(psxRegs); memzero(psxRegs);
psxRegs.pc = 0xbfc00000; // Start in bootstrap psxRegs.pc = 0xbfc00000; // Start in bootstrap
psxRegs.CP0.n.Status = 0x10900000; // COP0 enabled | BEV = 1 | TS = 1 psxRegs.CP0.n.Status = 0x10900000; // COP0 enabled | BEV = 1 | TS = 1

View File

@ -65,9 +65,9 @@ void cpuReset()
psxMemReset(); psxMemReset();
vuMicroMemReset(); vuMicroMemReset();
memzero_obj(cpuRegs); memzero(cpuRegs);
memzero_obj(fpuRegs); memzero(fpuRegs);
memzero_obj(tlb); memzero(tlb);
cpuRegs.pc = 0xbfc00000; ///set pc reg to stack cpuRegs.pc = 0xbfc00000; ///set pc reg to stack
cpuRegs.CP0.n.Config = 0x440; cpuRegs.CP0.n.Config = 0x440;

View File

@ -41,7 +41,7 @@ static void PreLoadPrep()
static void PostLoadPrep() static void PostLoadPrep()
{ {
memzero_obj(pCache); memzero(pCache);
// WriteCP0Status(cpuRegs.CP0.n.Status.val); // WriteCP0Status(cpuRegs.CP0.n.Status.val);
for(int i=0; i<48; i++) MapTLB(i); for(int i=0; i<48; i++) MapTLB(i);
} }
@ -78,7 +78,7 @@ void SaveStateBase::FreezeTag( const char* src )
{ {
wxASSERT( strlen(src) < (sizeof( m_tagspace )-1) ); wxASSERT( strlen(src) < (sizeof( m_tagspace )-1) );
memzero_obj( m_tagspace ); memzero( m_tagspace );
strcpy( m_tagspace, src ); strcpy( m_tagspace, src );
Freeze( m_tagspace ); Freeze( m_tagspace );
@ -98,10 +98,14 @@ void SaveStateBase::FreezeBios()
// doesn't match the bios currently being used (chances are it'll still // doesn't match the bios currently being used (chances are it'll still
// work fine, but some games are very picky). // work fine, but some games are very picky).
char descin[128]; char descin[128], desccmp[128];
wxString descout; wxString descout;
IsBIOS( g_Conf->FullpathToBios(), descout ); IsBIOS( g_Conf->FullpathToBios(), descout );
memcpy_fast( descin, descout.ToAscii().data(), 128 ); memzero( descin );
memzero( desccmp );
memcpy_fast( descin, descout.ToAscii().data(), descout.Length() );
memcpy_fast( desccmp, descout.ToAscii().data(), descout.Length() );
// ... and only freeze bios info once per state, since the user msg could // ... and only freeze bios info once per state, since the user msg could
// become really annoying on a corrupted state or something. (have to always // become really annoying on a corrupted state or something. (have to always
@ -112,7 +116,7 @@ void SaveStateBase::FreezeBios()
if( !m_DidBios ) if( !m_DidBios )
{ {
if( memcmp( descin, descout.ToAscii().data(), 128 ) != 0 ) if( memcmp( descin, desccmp, 128 ) != 0 )
{ {
Console::Error( Console::Error(
"\n\tWarning: BIOS Version Mismatch, savestate may be unstable!\n" "\n\tWarning: BIOS Version Mismatch, savestate may be unstable!\n"
@ -246,15 +250,15 @@ bool SaveStateBase::FreezeSection()
FreezeTag( "HardwareRegisters" ); FreezeTag( "HardwareRegisters" );
int seekpos = m_idx+4; int seekpos = m_idx+4;
int sectsize; int sectsize;
Freeze( sectsize );
Freeze( sectsize );
FreezeRegisters(); FreezeRegisters();
int realsectsize = m_idx - seekpos; int realsectsize = m_idx - seekpos;
if( IsSaving() ) if( IsSaving() )
{ {
// write back the section length... // write back the section length...
*((u32*)m_memory.GetPtr(seekpos)) = realsectsize - 4; *((u32*)m_memory.GetPtr(seekpos-4)) = realsectsize;
} }
else // IsLoading!! else // IsLoading!!
{ {
@ -275,8 +279,8 @@ bool SaveStateBase::FreezeSection()
FreezeTag( "Plugin" ); FreezeTag( "Plugin" );
int seekpos = m_idx+4; int seekpos = m_idx+4;
int sectsize; int sectsize;
Freeze( sectsize ); Freeze( sectsize );
Freeze( m_pid ); Freeze( m_pid );
g_plugins->Freeze( (PluginsEnum_t)m_pid, *this ); g_plugins->Freeze( (PluginsEnum_t)m_pid, *this );
@ -284,7 +288,7 @@ bool SaveStateBase::FreezeSection()
if( IsSaving() ) if( IsSaving() )
{ {
// write back the section length... // write back the section length...
*((u32*)m_memory.GetPtr(seekpos)) = realsectsize - 4; *((u32*)m_memory.GetPtr(seekpos-4)) = realsectsize;
} }
else else
{ {

View File

@ -64,10 +64,10 @@ extern bool iopsifbusy[2];
void sifInit() void sifInit()
{ {
memzero_obj(sif0); memzero(sif0);
memzero_obj(sif1); memzero(sif1);
memzero_obj(eesifbusy); memzero(eesifbusy);
memzero_obj(iopsifbusy); memzero(iopsifbusy);
} }
static __forceinline void SIF0write(u32 *from, int words) static __forceinline void SIF0write(u32 *from, int words)

View File

@ -86,8 +86,8 @@ static u8 sio_xor( const u8 *buf, uint length )
void sioInit() void sioInit()
{ {
memzero_obj(sio); memzero(sio);
memzero_obj(m_PostSavestateCards); memzero(m_PostSavestateCards);
// Transfer(?) Ready and the Buffer is Empty // Transfer(?) Ready and the Buffer is Empty
sio.StatReg = TX_RDY | TX_EMPTY; sio.StatReg = TX_RDY | TX_EMPTY;
@ -171,7 +171,7 @@ void SIO_CommandWrite(u8 value,int way) {
PAD_LOG("RESET MEMORY CARD"); PAD_LOG("RESET MEMORY CARD");
sio.bufcount = 8; sio.bufcount = 8;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[3] = sio.terminator; sio.buf[3] = sio.terminator;
sio.buf[2] = '+'; sio.buf[2] = '+';
sio.mcdst = 99; sio.mcdst = 99;
@ -179,7 +179,7 @@ void SIO_CommandWrite(u8 value,int way) {
break; break;
case 0x12: // RESET case 0x12: // RESET
sio.bufcount = 8; sio.bufcount = 8;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[3] = sio.terminator; sio.buf[3] = sio.terminator;
sio.buf[2] = '+'; sio.buf[2] = '+';
sio.mcdst = 99; sio.mcdst = 99;
@ -189,7 +189,7 @@ void SIO_CommandWrite(u8 value,int way) {
break; break;
case 0x81: // COMMIT case 0x81: // COMMIT
sio.bufcount = 8; sio.bufcount = 8;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.mcdst = 99; sio.mcdst = 99;
sio.buf[3] = sio.terminator; sio.buf[3] = sio.terminator;
sio.buf[2] = '+'; sio.buf[2] = '+';
@ -205,7 +205,7 @@ void SIO_CommandWrite(u8 value,int way) {
case 0x22: case 0x22:
case 0x23: // SECTOR SET case 0x23: // SECTOR SET
sio.bufcount = 8; sio.mcdst = 99; sio.sector=0; sio.k=0; sio.bufcount = 8; sio.mcdst = 99; sio.sector=0; sio.k=0;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio2.packet.recvVal3 = 0x8c; sio2.packet.recvVal3 = 0x8c;
sio.buf[8]=sio.terminator; sio.buf[8]=sio.terminator;
sio.buf[7]='+'; sio.buf[7]='+';
@ -219,7 +219,7 @@ void SIO_CommandWrite(u8 value,int way) {
break; break;
case 0x26: case 0x26:
sio.bufcount = 12; sio.mcdst = 99; sio2.packet.recvVal3 = 0x83; sio.bufcount = 12; sio.mcdst = 99; sio2.packet.recvVal3 = 0x83;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
memcpy(&sio.buf[2], &mc_command_0x26, sizeof(mc_command_0x26)); memcpy(&sio.buf[2], &mc_command_0x26, sizeof(mc_command_0x26));
sio.buf[12]=sio.terminator; sio.buf[12]=sio.terminator;
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
@ -228,7 +228,7 @@ void SIO_CommandWrite(u8 value,int way) {
case 0x28: case 0x28:
case 0xBF: case 0xBF:
sio.bufcount = 4; sio.mcdst = 99; sio2.packet.recvVal3 = 0x8b; sio.bufcount = 4; sio.mcdst = 99; sio2.packet.recvVal3 = 0x8b;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[4]=sio.terminator; sio.buf[4]=sio.terminator;
sio.buf[3]='+'; sio.buf[3]='+';
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
@ -243,7 +243,7 @@ void SIO_CommandWrite(u8 value,int way) {
if(value==0x43) sio.lastsector = sio.sector; // Reading if(value==0x43) sio.lastsector = sio.sector; // Reading
sio.bufcount =133; sio.mcdst = 99; sio.bufcount =133; sio.mcdst = 99;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[133]=sio.terminator; sio.buf[133]=sio.terminator;
sio.buf[132]='+'; sio.buf[132]='+';
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
@ -257,24 +257,24 @@ void SIO_CommandWrite(u8 value,int way) {
case 0xf3: case 0xf3:
case 0xf7: case 0xf7:
sio.bufcount = 4; sio.mcdst = 99; sio.bufcount = 4; sio.mcdst = 99;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[4]=sio.terminator; sio.buf[4]=sio.terminator;
sio.buf[3]='+'; sio.buf[3]='+';
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
break; break;
case 0x52: case 0x52:
sio.rdwr = 1; memset8_obj<0xff>(sio.buf); sio.rdwr = 1; memset8<0xff>(sio.buf);
sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+'; sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+';
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
break; break;
case 0x57: case 0x57:
sio.rdwr = 2; memset8_obj<0xff>(sio.buf); sio.rdwr = 2; memset8<0xff>(sio.buf);
sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+'; sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+';
MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
break; break;
default: default:
sio.mcdst = 0; sio.mcdst = 0;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+'; sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount-1]='+';
MEMCARDS_LOG("Unknown MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("Unknown MC(%d) command 0x%02X", sio.GetMemcardIndex()+1, value);
} }
@ -332,7 +332,7 @@ void SIO_CommandWrite(u8 value,int way) {
case 0x42: case 0x42:
if (sio.parp==2) { if (sio.parp==2) {
sio.bufcount=5+value; sio.bufcount=5+value;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[sio.bufcount-1]='+'; sio.buf[sio.bufcount-1]='+';
sio.buf[sio.bufcount]=sio.terminator; sio.buf[sio.bufcount]=sio.terminator;
MEMCARDS_LOG("MC(%d) WRITE command, size=0x%02X", sio.GetMemcardIndex()+1, value); MEMCARDS_LOG("MC(%d) WRITE command, size=0x%02X", sio.GetMemcardIndex()+1, value);
@ -409,7 +409,7 @@ void SIO_CommandWrite(u8 value,int way) {
case 17: case 17:
case 19: case 19:
sio.bufcount=13; sio.bufcount=13;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[12] = 0; // Xor value of data from index 4 to 11 sio.buf[12] = 0; // Xor value of data from index 4 to 11
sio.buf[3]='+'; sio.buf[3]='+';
sio.buf[13] = sio.terminator; sio.buf[13] = sio.terminator;
@ -418,13 +418,13 @@ void SIO_CommandWrite(u8 value,int way) {
case 7: case 7:
case 11: case 11:
sio.bufcount=13; sio.bufcount=13;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[12]='+'; sio.buf[12]='+';
sio.buf[13] = sio.terminator; sio.buf[13] = sio.terminator;
break; break;
default: default:
sio.bufcount=4; sio.bufcount=4;
memset8_obj<0xff>(sio.buf); memset8<0xff>(sio.buf);
sio.buf[3]='+'; sio.buf[3]='+';
sio.buf[4] = sio.terminator; sio.buf[4] = sio.terminator;
} }

View File

@ -285,8 +285,7 @@ void SysLoadState( const wxString& srcfile )
SysClearExecutionCache(); SysClearExecutionCache();
cpuReset(); cpuReset();
//joe.FreezeAll(); joe.FreezeAll();
StateRecovery::Recover();
} }
// Maps a block of memory for use as a recompiled code buffer, and ensures that the // Maps a block of memory for use as a recompiled code buffer, and ensures that the

View File

@ -96,9 +96,9 @@ void vuMicroMemReset()
memMapVUmicro(); memMapVUmicro();
// === VU0 Initialization === // === VU0 Initialization ===
memzero_obj(VU0.ACC); memzero(VU0.ACC);
memzero_obj(VU0.VF); memzero(VU0.VF);
memzero_obj(VU0.VI); memzero(VU0.VI);
VU0.VF[0].f.x = 0.0f; VU0.VF[0].f.x = 0.0f;
VU0.VF[0].f.y = 0.0f; VU0.VF[0].f.y = 0.0f;
VU0.VF[0].f.z = 0.0f; VU0.VF[0].f.z = 0.0f;
@ -119,9 +119,9 @@ void vuMicroMemReset()
VU0.vifRegs = vif0Regs; VU0.vifRegs = vif0Regs;
// === VU1 Initialization === // === VU1 Initialization ===
memzero_obj(VU1.ACC); memzero(VU1.ACC);
memzero_obj(VU1.VF); memzero(VU1.VF);
memzero_obj(VU1.VI); memzero(VU1.VI);
VU1.VF[0].f.x = 0.0f; VU1.VF[0].f.x = 0.0f;
VU1.VF[0].f.y = 0.0f; VU1.VF[0].f.y = 0.0f;
VU1.VF[0].f.z = 0.0f; VU1.VF[0].f.z = 0.0f;

View File

@ -1553,7 +1553,7 @@ void vif0Write32(u32 mem, u32 value)
{ {
/* Reset VIF */ /* Reset VIF */
//Console::WriteLn("Vif0 Reset %x", vif0Regs->stat); //Console::WriteLn("Vif0 Reset %x", vif0Regs->stat);
memzero_obj(vif0); memzero(vif0);
vif0ch->qwc = 0; //? vif0ch->qwc = 0; //?
cpuRegs.interrupt &= ~1; //Stop all vif0 DMA's cpuRegs.interrupt &= ~1; //Stop all vif0 DMA's
psHu64(VIF0_FIFO) = 0; psHu64(VIF0_FIFO) = 0;
@ -1648,8 +1648,8 @@ void vif0Write32(u32 mem, u32 value)
void vif0Reset() void vif0Reset()
{ {
/* Reset the whole VIF, meaning the internal pcsx2 vars and all the registers */ /* Reset the whole VIF, meaning the internal pcsx2 vars and all the registers */
memzero_obj(vif0); memzero(vif0);
memzero_obj(*vif0Regs); memzero(*vif0Regs);
SetNewMask(g_vif0Masks, g_vif0HasMask3, 0, 0xffffffff); SetNewMask(g_vif0Masks, g_vif0HasMask3, 0, 0xffffffff);
psHu64(VIF0_FIFO) = 0; psHu64(VIF0_FIFO) = 0;
psHu64(VIF0_FIFO + 8) = 0; psHu64(VIF0_FIFO + 8) = 0;
@ -2648,7 +2648,7 @@ void vif1Write32(u32 mem, u32 value)
if (value & 0x1) if (value & 0x1)
{ {
/* Reset VIF */ /* Reset VIF */
memzero_obj(vif1); memzero(vif1);
cpuRegs.interrupt &= ~((1 << 1) | (1 << 10)); //Stop all vif1 DMA's cpuRegs.interrupt &= ~((1 << 1) | (1 << 10)); //Stop all vif1 DMA's
vif1ch->qwc = 0; //? vif1ch->qwc = 0; //?
psHu64(VIF1_FIFO) = 0; psHu64(VIF1_FIFO) = 0;
@ -2792,8 +2792,8 @@ void vif1Write32(u32 mem, u32 value)
void vif1Reset() void vif1Reset()
{ {
/* Reset the whole VIF, meaning the internal pcsx2 vars, and all the registers */ /* Reset the whole VIF, meaning the internal pcsx2 vars, and all the registers */
memzero_obj(vif1); memzero(vif1);
memzero_obj(*vif1Regs); memzero(*vif1Regs);
SetNewMask(g_vif1Masks, g_vif1HasMask3, 0, 0xffffffff); SetNewMask(g_vif1Masks, g_vif1HasMask3, 0, 0xffffffff);
psHu64(VIF1_FIFO) = 0; psHu64(VIF1_FIFO) = 0;
psHu64(VIF1_FIFO + 8) = 0; psHu64(VIF1_FIFO + 8) = 0;

View File

@ -76,7 +76,7 @@ protected:
FileMemoryCard::FileMemoryCard() FileMemoryCard::FileMemoryCard()
{ {
memset8_obj<0xff>( m_effeffs ); memset8<0xff>( m_effeffs );
for( int port=0; port<2; ++port ) for( int port=0; port<2; ++port )
{ {

View File

@ -199,7 +199,7 @@ PCSX2_ALIGNED16( static GifPathStruct s_gifPath ) =
GIFPath::GIFPath() : tag() GIFPath::GIFPath() : tag()
{ {
memzero_obj( *this ); memzero( *this );
} }
__forceinline bool GIFPath::StepReg() __forceinline bool GIFPath::StepReg()
@ -379,14 +379,14 @@ __forceinline int GIFPath_ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size)
// Clears all GIFpath data to zero. // Clears all GIFpath data to zero.
void GIFPath_Reset() void GIFPath_Reset()
{ {
memzero_obj( s_gifPath.path ); memzero( s_gifPath.path );
} }
// This is a hackfix tool provided for "canceling" the contents of the GIFpath when // This is a hackfix tool provided for "canceling" the contents of the GIFpath when
// invalid GIFdma states are encountered (tpyically needed for PATH3 only). // invalid GIFdma states are encountered (tpyically needed for PATH3 only).
__forceinline void GIFPath_Clear( GIF_PATH pathidx ) __forceinline void GIFPath_Clear( GIF_PATH pathidx )
{ {
memzero_obj(s_gifPath.path[pathidx]); memzero(s_gifPath.path[pathidx]);
if( GSgifSoftReset == NULL ) return; if( GSgifSoftReset == NULL ) return;
mtgsThread.SendSimplePacket( GS_RINGTYPE_SOFTRESET, (1<<pathidx), 0, 0 ); mtgsThread.SendSimplePacket( GS_RINGTYPE_SOFTRESET, (1<<pathidx), 0, 0 );
} }

View File

@ -489,7 +489,7 @@ void vtlb_VMapUnmap(u32 vaddr,u32 sz)
void vtlb_Init() void vtlb_Init()
{ {
vtlbHandlerCount=0; vtlbHandlerCount=0;
memzero_obj(vtlbdata.RWFT); memzero(vtlbdata.RWFT);
//Register default handlers //Register default handlers
//Unmapped Virt handlers _MUST_ be registered first. //Unmapped Virt handlers _MUST_ be registered first.

View File

@ -49,7 +49,7 @@ using namespace std;
static int s_xmmchecknext = 0; static int s_xmmchecknext = 0;
void _initXMMregs() { void _initXMMregs() {
memzero_obj( xmmregs ); memzero( xmmregs );
g_xmmAllocCounter = 0; g_xmmAllocCounter = 0;
s_xmmchecknext = 0; s_xmmchecknext = 0;
} }
@ -1028,9 +1028,9 @@ int _allocCheckGPRtoX86(EEINST* pinst, int gprreg, int mode)
void _recClearInst(EEINST* pinst) void _recClearInst(EEINST* pinst)
{ {
memzero_obj( *pinst ); memzero( *pinst );
memset8_obj<EEINST_LIVE0|EEINST_LIVE1|EEINST_LIVE2>( pinst->regs ); memset8<EEINST_LIVE0|EEINST_LIVE1|EEINST_LIVE2>( pinst->regs );
memset8_obj<EEINST_LIVE0>( pinst->fpuregs ); memset8<EEINST_LIVE0>( pinst->fpuregs );
} }
// returns nonzero value if reg has been written between [startpc, endpc-4] // returns nonzero value if reg has been written between [startpc, endpc-4]

View File

@ -164,7 +164,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
// write the instruction info // write the instruction info
f.Printf("\n\nlive0 - %x, lastuse - %x used - %x\n", EEINST_LIVE0, EEINST_LASTUSE, EEINST_USED); f.Printf("\n\nlive0 - %x, lastuse - %x used - %x\n", EEINST_LIVE0, EEINST_LASTUSE, EEINST_USED);
memzero_obj(used); memzero(used);
numused = 0; numused = 0;
for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( s_pInstCache->regs[i] & EEINST_USED ) { if( s_pInstCache->regs[i] & EEINST_USED ) {

View File

@ -39,7 +39,7 @@ static int g_x86checknext;
// use special x86 register allocation for ia32 // use special x86 register allocation for ia32
void _initX86regs() { void _initX86regs() {
memzero_obj(x86regs); memzero(x86regs);
g_x86AllocCounter = 0; g_x86AllocCounter = 0;
g_x86checknext = 0; g_x86checknext = 0;
} }
@ -467,7 +467,7 @@ static int s_mmxchecknext = 0;
void _initMMXregs() void _initMMXregs()
{ {
memzero_obj(mmxregs); memzero(mmxregs);
g_mmxAllocCounter = 0; g_mmxAllocCounter = 0;
s_mmxchecknext = 0; s_mmxchecknext = 0;
} }

View File

@ -404,8 +404,8 @@ void recResetEE( void )
memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3 memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3
memzero_ptr<m_recBlockAllocSize - Ps2MemSize::Base>( m_recBlockAlloc ); // Excluding the 32mb ram copy memzero_ptr<m_recBlockAllocSize - Ps2MemSize::Base>( m_recBlockAlloc ); // Excluding the 32mb ram copy
memzero_ptr<RECCONSTBUF_SIZE * sizeof(u32)>(recConstBuf); memzero_ptr<RECCONSTBUF_SIZE * sizeof(u32)>(recConstBuf);
memzero_obj( manual_page ); memzero( manual_page );
memzero_obj( manual_counter ); memzero( manual_counter );
ClearRecLUT((BASEBLOCK*)m_recBlockAlloc, ClearRecLUT((BASEBLOCK*)m_recBlockAlloc,
(((Ps2MemSize::Base + Ps2MemSize::Rom + Ps2MemSize::Rom1) / 4))); (((Ps2MemSize::Base + Ps2MemSize::Rom + Ps2MemSize::Rom1) / 4)));

View File

@ -541,7 +541,7 @@ void SuperVUAnalyzeOp(VURegs *VU, _vuopinfo *info, _VURegsNum* pCodeRegs)
// check upper flags // check upper flags
if (ptr[1] & 0x80000000) { // I flag if (ptr[1] & 0x80000000) { // I flag
info->cycle = vucycle; info->cycle = vucycle;
memzero_obj(*lregs); memzero(*lregs);
} }
else { else {

View File

@ -165,7 +165,7 @@ class VuInstruction
public: public:
VuInstruction() VuInstruction()
{ {
memzero_obj(*this); memzero(*this);
nParentPc = -1; nParentPc = -1;
vicached = -1; vicached = -1;
} }
@ -294,9 +294,9 @@ VuBaseBlock::VuBaseBlock()
cycles = 0; cycles = 0;
pcode = NULL; pcode = NULL;
id = 0; id = 0;
memzero_obj(pChildJumps); memzero(pChildJumps);
memzero_obj(startregs); memzero(startregs);
memzero_obj(endregs); memzero(endregs);
allocX86Regs = nStartx86 = nEndx86 = -1; allocX86Regs = nStartx86 = nEndx86 = -1;
prevFlagsOutOfBlock = 0; prevFlagsOutOfBlock = 0;
} }
@ -863,10 +863,10 @@ static VuFunctionHeader* SuperVURecompileProgram(u32 startpc, int vuindex)
// analyze the global graph // analyze the global graph
s_listBlocks.clear(); s_listBlocks.clear();
VUPIPELINES pipes; VUPIPELINES pipes;
memzero_obj(pipes.fmac); memzero(pipes.fmac);
memzero_obj(pipes.fdiv); memzero(pipes.fdiv);
memzero_obj(pipes.efu); memzero(pipes.efu);
memzero_obj(pipes.ialu); memzero(pipes.ialu);
SuperVUBuildBlocks(NULL, startpc, pipes); SuperVUBuildBlocks(NULL, startpc, pipes);
// fill parents // fill parents