Yay more header file cleanup chores! Removed most of the Windows.h dependencies from non-Win32 specific files, and fixed the annoying ARRAYSIZE warnings. Let's say it together: "We all should love C's archaic include system, because it makes Jake and Arcum work really hard for no good reason."

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@634 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-02-28 20:55:53 +00:00
parent a801b6f091
commit ebb5339418
60 changed files with 683 additions and 355 deletions

View File

@ -26,8 +26,9 @@
#define __LINUX__ #define __LINUX__
#endif #endif
#ifndef ARRAYSIZE // Renamed ARRAYSIZE to ArraySize -- looks nice and gets rid of Windows.h conflicts (air)
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) #ifndef ArraySize
#define ArraySize(x) (sizeof(x)/sizeof((x)[0]))
#endif #endif
#ifdef __LINUX__ #ifdef __LINUX__

View File

@ -2045,7 +2045,7 @@ void cdvdWrite16(u8 rt) // SCOMMAND
break; break;
case 0x8E: // sceMgReadData case 0x8E: // sceMgReadData
SetResultSize( std::min(16, cdvd.mg_size) ); SetResultSize( min(16, cdvd.mg_size) );
memcpy_fast(cdvd.Result, cdvd.mg_buffer, cdvd.ResultC); memcpy_fast(cdvd.Result, cdvd.mg_buffer, cdvd.ResultC);
cdvd.mg_size -= cdvd.ResultC; cdvd.mg_size -= cdvd.ResultC;
memcpy_fast(cdvd.mg_buffer, cdvd.mg_buffer+cdvd.ResultC, cdvd.mg_size); memcpy_fast(cdvd.mg_buffer, cdvd.mg_buffer+cdvd.ResultC, cdvd.mg_size);

View File

@ -43,7 +43,7 @@ int main(int argc, char *argv[])
efile = 0; efile = 0;
getcwd(MAIN_DIR, ARRAYSIZE(MAIN_DIR)); /* store main dir */ getcwd(MAIN_DIR, ArraySize(MAIN_DIR)); /* store main dir */
Console::Notice("MAIN_DIR is %s", params MAIN_DIR); Console::Notice("MAIN_DIR is %s", params MAIN_DIR);
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");

View File

@ -920,3 +920,17 @@ void SysMunmap(uptr base, u32 size)
munmap((uptr*)base, size); munmap((uptr*)base, size);
} }
void SysMemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution )
{
int lnxmode = 0;
switch( mode )
{
case Protect_NoAccess: break;
case Protect_ReadOnly: lnxmode = PROT_READ; break;
case Protect_ReadWrite: lnxmode = PROT_READ | PROT_WRITE; break;
}
if( allowExecution ) lnxmode |= PROT_EXECUTE;
mprotect( baseaddr, size, lnxmode );
}

View File

@ -52,6 +52,11 @@ namespace Threading
usleep(500); usleep(500);
} }
__forceinline void Sleep( int ms )
{
usleep( 1000*ms );
}
// For use in spin/wait loops, Acts as a hint to Intel CPUs and should, in theory // For use in spin/wait loops, Acts as a hint to Intel CPUs and should, in theory
// improve performance and reduce cpu power consumption. // improve performance and reduce cpu power consumption.
__forceinline void SpinWait() __forceinline void SpinWait()
@ -60,7 +65,7 @@ namespace Threading
// performance hint and isn't required). // performance hint and isn't required).
__asm__ ( "pause" ); __asm__ ( "pause" );
} }
void* Thread::_internal_callback( void* itsme ) void* Thread::_internal_callback( void* itsme )
{ {
jASSUME( itsme != NULL ); jASSUME( itsme != NULL );

View File

@ -449,7 +449,7 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
m_QueuedFrames = 0; m_QueuedFrames = 0;
break; break;
} }
Sleep( 2 ); // Sleep off quite a bit of time, since we're obviously *waaay* ahead. Threading::Sleep( 2 ); // Sleep off quite a bit of time, since we're obviously *waaay* ahead.
SpinWait(); SpinWait();
} }

View File

@ -126,7 +126,7 @@ void loadBiosRom( const char *ext, u8 *dest, long maxSize )
// if we made it this far, we have a successful file found: // if we made it this far, we have a successful file found:
FILE *fp = fopen(Bios1.c_str(), "rb"); FILE *fp = fopen(Bios1.c_str(), "rb");
fread(dest, 1, std::min( maxSize, filesize ), fp); fread(dest, 1, min( maxSize, filesize ), fp);
fclose(fp); fclose(fp);
} }
@ -406,6 +406,7 @@ void __fastcall _ext_memWrite16(u32 mem, u16 value)
MEM_LOG("Unknown Memory write16 to address %x with data %4.4x\n", mem, value); MEM_LOG("Unknown Memory write16 to address %x with data %4.4x\n", mem, value);
cpuTlbMissW(mem, cpuRegs.branch); cpuTlbMissW(mem, cpuRegs.branch);
} }
template<int p> template<int p>
void __fastcall _ext_memWrite32(u32 mem, u32 value) void __fastcall _ext_memWrite32(u32 mem, u32 value)
{ {
@ -422,6 +423,7 @@ void __fastcall _ext_memWrite32(u32 mem, u32 value)
MEM_LOG("Unknown Memory write32 to address %x with data %8.8x\n", mem, value); MEM_LOG("Unknown Memory write32 to address %x with data %8.8x\n", mem, value);
cpuTlbMissW(mem, cpuRegs.branch); cpuTlbMissW(mem, cpuRegs.branch);
} }
template<int p> template<int p>
void __fastcall _ext_memWrite64(u32 mem, const u64* value) void __fastcall _ext_memWrite64(u32 mem, const u64* value)
{ {
@ -437,6 +439,7 @@ void __fastcall _ext_memWrite64(u32 mem, const u64* value)
MEM_LOG("Unknown Memory write64 to address %x with data %8.8x_%8.8x\n", mem, (u32)(*value>>32), (u32)*value); MEM_LOG("Unknown Memory write64 to address %x with data %8.8x_%8.8x\n", mem, (u32)(*value>>32), (u32)*value);
cpuTlbMissW(mem, cpuRegs.branch); cpuTlbMissW(mem, cpuRegs.branch);
} }
template<int p> template<int p>
void __fastcall _ext_memWrite128(u32 mem, const u64 *value) void __fastcall _ext_memWrite128(u32 mem, const u64 *value)
{ {
@ -656,13 +659,7 @@ void memReset()
{ {
// VTLB Protection Preparations. // VTLB Protection Preparations.
#ifdef _WIN32 SysMemProtect( m_psAllMem, m_allMemSize, Protect_ReadWrite );
DWORD OldProtect;
// make sure can write
VirtualProtect(m_psAllMem, m_allMemSize, PAGE_READWRITE, &OldProtect);
#else
mprotect(m_psAllMem, m_allMemSize, PROT_READ|PROT_WRITE);
#endif
// Note!! Ideally the vtlb should only be initialized once, and then subsequent // Note!! Ideally the vtlb should only be initialized once, and then subsequent
// resets of the system hardware would only clear vtlb mappings, but since the // resets of the system hardware would only clear vtlb mappings, but since the
@ -810,7 +807,7 @@ void memReset()
} }
fp = fopen(Bios.c_str(), "rb"); fp = fopen(Bios.c_str(), "rb");
fread(PS2MEM_ROM, 1, std::min( (long)Ps2MemSize::Rom, filesize ), fp); fread(PS2MEM_ROM, 1, min( (long)Ps2MemSize::Rom, filesize ), fp);
fclose(fp); fclose(fp);
BiosVersion = GetBiosVersion(); BiosVersion = GetBiosVersion();

View File

@ -16,10 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
//////////
// Rewritten by zerofrog to add os virtual memory
//////////
#ifndef __MEMORY_H__ #ifndef __MEMORY_H__
#define __MEMORY_H__ #define __MEMORY_H__
@ -144,8 +140,6 @@ extern void memMapVUmicro();
void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ); void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * );
void __fastcall InstallLinuxExceptionHandler(); void __fastcall InstallLinuxExceptionHandler();
void __fastcall ReleaseLinuxExceptionHandler(); void __fastcall ReleaseLinuxExceptionHandler();
#else
int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps);
#endif #endif
#include "vtlb.h" #include "vtlb.h"

View File

@ -659,26 +659,7 @@ void ProcessFKeys(int fkey, int shift)
break; break;
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
case 10:
{
int num;
FILE* f;
BASEBLOCKEX** ppblocks = GetAllBaseBlocks(&num, 0);
f = fopen("perflog.txt", "w");
while(num-- > 0 ) {
if( ppblocks[0]->visited > 0 ) {
fprintf(f, "%u %u %u %u\n", ppblocks[0]->startpc, (u32)(ppblocks[0]->ltime.QuadPart / ppblocks[0]->visited), ppblocks[0]->visited, ppblocks[0]->size);
}
ppblocks[0]->visited = 0;
ppblocks[0]->ltime.QuadPart = 0;
ppblocks++;
}
fclose(f);
Console::Status( "perflog.txt written" );
break;
}
case 11: case 11:
if( mtgsThread != NULL ) { if( mtgsThread != NULL ) {
Console::Notice( "Cannot make gsstates in MTGS mode" ); Console::Notice( "Cannot make gsstates in MTGS mode" );

View File

@ -18,10 +18,6 @@
#ifndef __PATCH_H__ #ifndef __PATCH_H__
#define __PATCH_H__ #define __PATCH_H__
#ifdef _WIN32
#include<windows.h>
#endif
#include "PS2Etypes.h" #include "PS2Etypes.h"
// //

View File

@ -27,6 +27,8 @@
#ifndef _S_IFREG #ifndef _S_IFREG
#define _S_IFREG S_IFREG #define _S_IFREG S_IFREG
#endif #endif
#else
#include <direct.h>
#endif #endif
namespace Path namespace Path
@ -231,4 +233,15 @@ void GetRootDirectory( const string& src, string& dest )
else else
dest.assign( src.begin(), src.begin()+pos ); dest.assign( src.begin(), src.begin()+pos );
} }
void CreateDirectory( const string& src )
{
#ifdef _WIN32
_mkdir( src.c_str() );
#else
mkdir( src.c_str(), 0755);
#endif
} }
}

View File

@ -24,19 +24,21 @@ extern char MAIN_DIR[g_MaxPath];
namespace Path namespace Path
{ {
void Combine( std::string& dest, const std::string& srcPath, const std::string& srcFile ); extern void Combine( std::string& dest, const std::string& srcPath, const std::string& srcFile );
bool isRooted( const std::string& path ); extern bool isRooted( const std::string& path );
bool isDirectory( const std::string& path ); extern bool isDirectory( const std::string& path );
bool isFile( const std::string& path ); extern bool isFile( const std::string& path );
bool Exists( const std::string& path ); extern bool Exists( const std::string& path );
int getFileSize( const std::string& path ); extern int getFileSize( const std::string& path );
void ReplaceExtension( std::string& dest, const std::string& src, const std::string& ext ); extern void ReplaceExtension( std::string& dest, const std::string& src, const std::string& ext );
void ReplaceFilename( std::string& dest, const std::string& src, const std::string& newfilename ); extern void ReplaceFilename( std::string& dest, const std::string& src, const std::string& newfilename );
void GetFilename( const std::string& src, std::string& dest ); extern void GetFilename( const std::string& src, std::string& dest );
void GetDirectory( const std::string& src, std::string& dest ); extern void GetDirectory( const std::string& src, std::string& dest );
void GetRootDirectory( const std::string& src, std::string& dest ); extern void GetRootDirectory( const std::string& src, std::string& dest );
void Split( const std::string& src, std::string& destpath, std::string& destfile ); extern void Split( const std::string& src, std::string& destpath, std::string& destfile );
extern void CreateDirectory( const std::string& src );
} }

View File

@ -17,6 +17,7 @@
*/ */
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "RedtapeWindows.h"
#include "Common.h" #include "Common.h"
#include "PsxCommon.h" #include "PsxCommon.h"
@ -48,7 +49,7 @@ _GSsetupRecording GSsetupRecording;
_GSreset GSreset; _GSreset GSreset;
_GSwriteCSR GSwriteCSR; _GSwriteCSR GSwriteCSR;
_GSgetDriverInfo GSgetDriverInfo; _GSgetDriverInfo GSgetDriverInfo;
#ifdef _WIN32 #ifdef _WINDOWS_
_GSsetWindowInfo GSsetWindowInfo; _GSsetWindowInfo GSsetWindowInfo;
#endif #endif
_GSfreeze GSfreeze; _GSfreeze GSfreeze;

View File

@ -7,21 +7,6 @@
#ifndef _WIN32 #ifndef _WIN32
# include <unistd.h> # include <unistd.h>
#else
// For now Windows headers are needed by all modules, so include it here so
// that it compiles nice and fast...
// Force availability of to WinNT APIs (change to 0x600 to enable XP-specific APIs)
# define WINVER 0x0501
# define _WIN32_WINNT 0x0501
# include <windows.h>
// disable Windows versions of min/max -- we'll use the typesafe STL versions instead.
#undef min
#undef max
#endif #endif
// Include the STL junk that's actually handy. // Include the STL junk that's actually handy.
@ -59,6 +44,13 @@ using std::string; // we use it enough, so bring it into the global namespace.
#include "PS2Etypes.h" #include "PS2Etypes.h"
#include "StringUtils.h" #include "StringUtils.h"
typedef int BOOL;
# undef TRUE
# undef FALSE
# define TRUE 1
# define FALSE 0
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Compiler/OS specific macros and defines -- Begin Section // Compiler/OS specific macros and defines -- Begin Section
@ -77,11 +69,6 @@ using std::string; // we use it enough, so bring it into the global namespace.
# define __declspec(x) # define __declspec(x)
# endif # endif
// functions that linux lacks...
// fixme: this should probably be in a __LINUX__ conditional rather than
// a GCC conditional (since GCC on a windows platform would have these functions)
# define Sleep(seconds) usleep(1000*(seconds))
static __forceinline u32 timeGetTime() static __forceinline u32 timeGetTime()
{ {
struct timeb t; struct timeb t;
@ -89,13 +76,6 @@ static __forceinline u32 timeGetTime()
return (u32)(t.time*1000+t.millitm); return (u32)(t.time*1000+t.millitm);
} }
# define BOOL int
# undef TRUE
# undef FALSE
# define TRUE 1
# define FALSE 0
# ifndef strnicmp # ifndef strnicmp
# define strnicmp strncasecmp # define strnicmp strncasecmp
# endif # endif

View File

@ -26,6 +26,8 @@
#include "deci2_netmp.h" #include "deci2_netmp.h"
#include "deci2_ttyp.h" #include "deci2_ttyp.h"
#include "Threading.h"
#define PROTO_DCMP 0x0001 #define PROTO_DCMP 0x0001
#define PROTO_ITTYP 0x0110 #define PROTO_ITTYP 0x0110
#define PROTO_IDBGP 0x0130 #define PROTO_IDBGP 0x0130
@ -58,9 +60,7 @@ extern int ebrk_count, ibrk_count;
extern volatile long runStatus; extern volatile long runStatus;
extern int runCode, runCount; extern int runCode, runCount;
#ifdef _WIN32 extern Threading::Semaphore* runEvent;
extern HANDLE runEvent; //i don't like this;
#endif
extern int connected; extern int connected;
//when add linux code this might change //when add linux code this might change

View File

@ -379,9 +379,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char
Sleep(100);//first get the run thread to Wait state Sleep(100);//first get the run thread to Wait state
runCount=in->count; runCount=in->count;
runCode=in->code; runCode=in->code;
#ifdef _WIN32 runEvent->Post();//kick it
SetEvent(runEvent);//kick it
#endif
} }
break; break;
case 0x18://ok [without argc/argv stuff] case 0x18://ok [without argc/argv stuff]
@ -400,9 +398,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char
Sleep(1000);//first get the run thread to Wait state Sleep(1000);//first get the run thread to Wait state
runCount=0; runCount=0;
runCode=0xFF; runCode=0xFF;
#ifdef _WIN32 runEvent->Post();
SetEvent(runEvent);//awake it
#endif
out->h.length=sizeof(DECI2_DBGP_HEADER); out->h.length=sizeof(DECI2_DBGP_HEADER);
break; break;
} }

45
pcsx2/RedtapeWindows.h Normal file
View File

@ -0,0 +1,45 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
//////////////////////////////////////////////////////////////////////////////////////////
// Windows Redtape! No windows.h should be included without it!
//
// This header's purpose is to include windows.h with the correct OS version info, and
// to undefine some of windows.h's more evil macros (min/max). It also does a _WIN32
// check, so that we don't have to do it explicitly in every instance where it might
// be needed from non-Win32-specific files (ie, ix86_cpudetect.cpp)
#ifndef _REDTAPE_WINDOWS_H_
#define _REDTAPE_WINDOWS_H_
#ifdef _WIN32
// Force availability of to WinNT APIs (change to 0x600 to enable XP-specific APIs)
#ifndef WINVER
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
// disable Windows versions of min/max -- we'll use the typesafe STL versions instead.
#undef min
#undef max
#endif
#endif

View File

@ -6,7 +6,7 @@
// The profiler does not have a Linux version yet. // The profiler does not have a Linux version yet.
// So for now we turn it into duds for non-Win32 platforms. // So for now we turn it into duds for non-Win32 platforms.
#if !defined( _DEBUG ) && defined( WIN32 ) #ifdef _WIN32
void ProfilerInit(); void ProfilerInit();
void ProfilerTerm(); void ProfilerTerm();

View File

@ -56,15 +56,23 @@ u8 *SysMmapEx(uptr base, u32 size, uptr bounds, const char *caller="Unnamed");
// Unmaps a block allocated by SysMmap // Unmaps a block allocated by SysMmap
void SysMunmap(uptr base, u32 size); void SysMunmap(uptr base, u32 size);
// Writes text to the console.
// *DEPRECIATED* Use Console namespace methods instead.
void SysPrintf(const char *fmt, ...); // *DEPRECIATED*
static __forceinline void SysMunmap( void* base, u32 size ) static __forceinline void SysMunmap( void* base, u32 size )
{ {
SysMunmap( (uptr)base, size ); SysMunmap( (uptr)base, size );
} }
enum PageProtectionMode
{
Protect_NoAccess = 0,
Protect_ReadOnly,
Protect_ReadWrite
};
void SysMemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution=false );
// Writes text to the console.
// *DEPRECIATED* Use Console namespace methods instead.
void SysPrintf(const char *fmt, ...); // *DEPRECIATED*
#ifdef _MSC_VER #ifdef _MSC_VER
# define PCSX2_MEM_PROTECT_BEGIN() __try { # define PCSX2_MEM_PROTECT_BEGIN() __try {

View File

@ -87,16 +87,23 @@ namespace Threading
pthread_mutex_unlock( &mutex ); pthread_mutex_unlock( &mutex );
} }
#endif #endif
Semaphore::Semaphore() Semaphore::Semaphore()
{ {
sem_init( &sema, false, 0 ); sem_init( &sema, false, 0 );
} }
Semaphore::~Semaphore() Semaphore::~Semaphore()
{ {
sem_destroy( &sema ); sem_destroy( &sema );
} }
void Semaphore::Reset()
{
sem_destroy( &sema );
sem_init( &sema, false, 0 );
}
void Semaphore::Post() void Semaphore::Post()
{ {
sem_post( &sema ); sem_post( &sema );

View File

@ -49,6 +49,7 @@ namespace Threading
Semaphore(); Semaphore();
~Semaphore(); ~Semaphore();
void Reset();
void Post(); void Post();
void Post( int multiple ); void Post( int multiple );
void Wait(); void Wait();
@ -75,6 +76,9 @@ namespace Threading
// For use in spin/wait loops. // For use in spin/wait loops.
extern void SpinWait(); extern void SpinWait();
// sleeps the current thread for the given number of milliseconds.
extern void Sleep( int ms );
class Thread : NoncopyableObject class Thread : NoncopyableObject
{ {

View File

@ -589,8 +589,7 @@ void vtlb_free( void* pmem, uint size )
SafeSysMunmap( pmem, size ); SafeSysMunmap( pmem, size );
#else #else
// Make sure and unprotect memory first, since CrtDebug will try to write to it. // Make sure and unprotect memory first, since CrtDebug will try to write to it.
DWORD old; SysMemProtect( pmem, size, Protect_ReadWrite );
VirtualProtect( pmem, size, PAGE_READWRITE, &old );
safe_aligned_free( pmem ); safe_aligned_free( pmem );
#endif #endif
} }

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include "AboutDlg.h" #include "AboutDlg.h"

View File

@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include "Common.h" #include "Common.h"

View File

@ -16,13 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include <shlobj.h> #include <shlobj.h>
#include "common.h" #include "common.h"
#include "plugins.h" #include "plugins.h"
#include "resource.h"
struct ComboInitializer struct ComboInitializer
{ {

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include "Common.h" #include "Common.h"

View File

@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include "Common.h" #include "Common.h"
#include "resource.h" #include "resource.h"

View File

@ -16,11 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "win32.h" #include "win32.h"
#include "resource.h"
#include "R5900OpcodeTables.h" #include "R5900OpcodeTables.h"
#include "Debugger.h" #include "Debugger.h"
#include "Common.h" #include "Common.h"

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <windows.h> #include "RedtapeWindows.h"
#include <commdlg.h> #include <commdlg.h>
#include <stdio.h> #include <stdio.h>

View File

@ -16,12 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include <commdlg.h> #include <commdlg.h>
#include "resource.h"
#include "Debugger.h" #include "Debugger.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include "R5900.h" #include "R5900.h"

View File

@ -17,7 +17,6 @@
*/ */
#include "PrecompiledHeader.h"
#include "win32.h" #include "win32.h"
BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

View File

@ -16,10 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include <commctrl.h>
#include <math.h> #include <math.h>
#include "libintlmsc.h" #include "libintlmsc.h"

View File

@ -19,7 +19,6 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include <commctrl.h>
#include <math.h> #include <math.h>
#include "libintlmsc.h" #include "libintlmsc.h"

View File

@ -16,8 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
/************************** /**************************
* *
* patchbrowser.c contains all the src of patchbrowser window * patchbrowser.c contains all the src of patchbrowser window

View File

@ -16,10 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "Win32.h" #include "Win32.h"
#include <commctrl.h>
#include "Debugger.h" #include "Debugger.h"
#include "RDebugger.h" #include "RDebugger.h"
#include "Common.h" #include "Common.h"
@ -32,7 +30,7 @@ char message[1024]; //message to add to listbox
volatile long runStatus=STOP; volatile long runStatus=STOP;
int runCode=0, runCount=1; int runCode=0, runCount=1;
HANDLE runEvent=NULL; Threading::Semaphore* runEvent = NULL;
DECI2_DBGP_BRK ebrk[32], DECI2_DBGP_BRK ebrk[32],
ibrk[32]; ibrk[32];
@ -254,8 +252,8 @@ DWORD WINAPI Run2(LPVOID lpParam){
else{ else{
cpuRegs.CP0.n.EPC=cpuRegs.pc; cpuRegs.CP0.n.EPC=cpuRegs.pc;
psxRegs.CP0.n.EPC=psxRegs.pc; psxRegs.CP0.n.EPC=psxRegs.pc;
ResetEvent(runEvent); runEvent->Wait();
WaitForSingleObject(runEvent, INFINITE); //WaitForSingleObject(runEvent, INFINITE);
runStatus=RUN; runStatus=RUN;
} }
} }
@ -282,8 +280,8 @@ LRESULT WINAPI RemoteDebuggerProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
CREATE_SUSPENDED, &thid); CREATE_SUSPENDED, &thid);
runth=CreateThread(NULL, 0, Run2, (LPVOID)hDlg, runth=CreateThread(NULL, 0, Run2, (LPVOID)hDlg,
CREATE_SUSPENDED, &thid); CREATE_SUSPENDED, &thid);
runEvent=CreateEvent(NULL, TRUE, FALSE, "RunState"); runEvent = new Threading::Semaphore();
if (th==NULL || runth==NULL || runEvent==NULL){ if (th==NULL || runth==NULL ){
MessageBox(hDlg, _("Could not create threads or event"), 0, MB_OK); MessageBox(hDlg, _("Could not create threads or event"), 0, MB_OK);
connected=0; connected=0;
closesocket(serversocket); closesocket(serversocket);
@ -329,7 +327,7 @@ LRESULT WINAPI RemoteDebuggerProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
connected=0; connected=0;
CloseHandle(th); CloseHandle(th);
CloseHandle(runth); CloseHandle(runth);
CloseHandle(runEvent); safe_delete( runEvent );
closesocket(serversocket); closesocket(serversocket);
WSACleanup(); WSACleanup();
ClosePlugins( false ); ClosePlugins( false );

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <windows.h> #include "RedtapeWindows.h"
#include <commdlg.h> #include <commdlg.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,7 +1,5 @@
#include "PrecompiledHeader.h" #include "Win32.h"
#ifndef _DEBUG
#include "SamplProf.h" #include "SamplProf.h"
#include <map> #include <map>
@ -321,5 +319,3 @@ void ProfilerSetEnabled(bool Enabled)
else else
SuspendThread(hProfThread); SuspendThread(hProfThread);
} }
#endif

View File

@ -277,6 +277,24 @@
<File <File
RelativePath="..\AboutDlg.cpp" RelativePath="..\AboutDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\AboutDlg.h" RelativePath="..\AboutDlg.h"
@ -285,26 +303,134 @@
<File <File
RelativePath="..\AdvancedDlg.cpp" RelativePath="..\AdvancedDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\ConfigDlg.cpp" RelativePath="..\ConfigDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\CpuDlg.cpp" RelativePath="..\CpuDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\HacksDlg.cpp" RelativePath="..\HacksDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\ini.cpp" RelativePath="..\ini.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\McdConfigDlg.cpp" RelativePath="..\McdConfigDlg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\McdManagerDlg.cpp" RelativePath="..\McdManagerDlg.cpp"
@ -315,6 +441,8 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
@ -323,6 +451,8 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
@ -341,10 +471,46 @@
<File <File
RelativePath="..\PatchBrowser.cpp" RelativePath="..\PatchBrowser.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\RDebugger.cpp" RelativePath="..\RDebugger.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\RDebugger.h" RelativePath="..\RDebugger.h"
@ -357,16 +523,69 @@
<File <File
RelativePath="..\WinConsole.cpp" RelativePath="..\WinConsole.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\WindowsPCH.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\WinMain.cpp" RelativePath="..\WinMain.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Devel|Win32" Name="Devel|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
BufferSecurityCheck="false" BufferSecurityCheck="false"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
@ -397,12 +616,23 @@
<File <File
RelativePath="..\WinSysExec.cpp" RelativePath="..\WinSysExec.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Devel|Win32" Name="Devel|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
BufferSecurityCheck="false" BufferSecurityCheck="false"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
@ -440,6 +670,24 @@
<File <File
RelativePath=".\..\Debugger.cpp" RelativePath=".\..\Debugger.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\..\Debugger.h" RelativePath=".\..\Debugger.h"
@ -448,10 +696,46 @@
<File <File
RelativePath=".\..\DebugMemory.cpp" RelativePath=".\..\DebugMemory.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\Win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\Win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\..\Debugreg.cpp" RelativePath=".\..\Debugreg.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\Win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\Win32.pch"
/>
</FileConfiguration>
</File> </File>
</Filter> </Filter>
<Filter <Filter
@ -567,6 +851,10 @@
RelativePath="..\..\PrecompiledHeader.h" RelativePath="..\..\PrecompiledHeader.h"
> >
</File> </File>
<File
RelativePath="..\..\RedtapeWindows.h"
>
</File>
<File <File
RelativePath="..\..\SourceLog.cpp" RelativePath="..\..\SourceLog.cpp"
> >
@ -857,10 +1145,46 @@
<File <File
RelativePath="..\cheats\browser.cpp" RelativePath="..\cheats\browser.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="..\Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="..\Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\cheats\cheats.cpp" RelativePath="..\cheats\cheats.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="..\Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="..\Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\cheats\cheats.h" RelativePath="..\cheats\cheats.h"
@ -2164,10 +2488,6 @@
RelativePath="..\..\Console.cpp" RelativePath="..\..\Console.cpp"
> >
</File> </File>
<File
RelativePath="..\..\Exceptions.h"
>
</File>
<File <File
RelativePath="..\..\x86\fast_routines.cpp" RelativePath="..\..\x86\fast_routines.cpp"
> >
@ -2180,18 +2500,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\MemcpyFast.h"
>
</File>
<File
RelativePath="..\memzero.h"
>
</File>
<File
RelativePath="..\..\Paths.h"
>
</File>
<File <File
RelativePath="..\..\PathUtils.cpp" RelativePath="..\..\PathUtils.cpp"
> >
@ -2200,42 +2508,36 @@
RelativePath="..\..\Plugins.cpp" RelativePath="..\..\Plugins.cpp"
> >
</File> </File>
<File
RelativePath="..\..\Plugins.h"
>
</File>
<File
RelativePath="..\..\SafeArray.h"
>
</File>
<File <File
RelativePath="..\SamplProf.cpp" RelativePath="..\SamplProf.cpp"
> >
</File> <FileConfiguration
<File Name="Debug|Win32"
RelativePath="..\..\SamplProf.h" >
> <Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\..\SaveState.cpp" RelativePath="..\..\SaveState.cpp"
> >
</File> </File>
<File
RelativePath="..\..\SaveState.h"
>
</File>
<File <File
RelativePath="..\..\System.cpp" RelativePath="..\..\System.cpp"
> >
</File> </File>
<File
RelativePath="..\..\System.h"
>
</File>
<File
RelativePath="..\..\Threading.h"
>
</File>
<File <File
RelativePath="..\..\ThreadTools.cpp" RelativePath="..\..\ThreadTools.cpp"
> >
@ -2247,7 +2549,69 @@
<File <File
RelativePath="..\WinThreads.cpp" RelativePath="..\WinThreads.cpp"
> >
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
<FileConfiguration
Name="Devel|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="Win32.h"
PrecompiledHeaderFile="$(IntDir)\win32.pch"
/>
</FileConfiguration>
</File> </File>
<Filter
Name="Include"
>
<File
RelativePath="..\..\Exceptions.h"
>
</File>
<File
RelativePath="..\..\MemcpyFast.h"
>
</File>
<File
RelativePath="..\memzero.h"
>
</File>
<File
RelativePath="..\..\Paths.h"
>
</File>
<File
RelativePath="..\..\Plugins.h"
>
</File>
<File
RelativePath="..\..\SafeArray.h"
>
</File>
<File
RelativePath="..\..\SamplProf.h"
>
</File>
<File
RelativePath="..\..\SaveState.h"
>
</File>
<File
RelativePath="..\..\System.h"
>
</File>
<File
RelativePath="..\..\Threading.h"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Dynarec Emitter" Name="Dynarec Emitter"

View File

@ -19,6 +19,11 @@
#ifndef _PCSX2_WIN32_H__ #ifndef _PCSX2_WIN32_H__
#define _PCSX2_WIN32_H__ #define _PCSX2_WIN32_H__
#include "RedtapeWindows.h" // our "safe" include of windows (sets version and undefs uselessness)
#include <commctrl.h>
#include "PrecompiledHeader.h"
#include <windowsx.h> #include <windowsx.h>
#include <tchar.h> #include <tchar.h>
@ -27,6 +32,9 @@
#define COMPILEDATE __DATE__ #define COMPILEDATE __DATE__
//Exception handler for the VTLB-based recompilers.
int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps);
// --->> Ini Configuration [ini.c] // --->> Ini Configuration [ini.c]
extern char g_WorkingFolder[g_MaxPath]; extern char g_WorkingFolder[g_MaxPath];

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h" #include "Win32.h"
#include "System.h" #include "System.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"

View File

@ -20,7 +20,6 @@
#include "win32.h" #include "win32.h"
#include <winnt.h> #include <winnt.h>
#include <commctrl.h>
#include <direct.h> #include <direct.h>
#include <ntsecapi.h> #include <ntsecapi.h>

View File

@ -16,11 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h" #include "Win32.h"
#include "win32.h"
#include <winnt.h> #include <winnt.h>
#include <commctrl.h>
#include "Common.h" #include "Common.h"
//#include "PsxCommon.h" //#include "PsxCommon.h"
@ -833,15 +830,14 @@ const char *SysLibError() {
return NULL; return NULL;
} }
void SysCloseLibrary(void *lib) { void SysCloseLibrary(void *lib)
{
FreeLibrary((HINSTANCE)lib); FreeLibrary((HINSTANCE)lib);
} }
void *SysMmap(uptr base, u32 size) { void *SysMmap(uptr base, u32 size)
void *mem; {
return VirtualAlloc((void*)base, size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
mem = VirtualAlloc((void*)base, size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
return mem;
} }
void SysMunmap(uptr base, u32 size) void SysMunmap(uptr base, u32 size)
@ -850,3 +846,26 @@ void SysMunmap(uptr base, u32 size)
VirtualFree((void*)base, size, MEM_DECOMMIT); VirtualFree((void*)base, size, MEM_DECOMMIT);
VirtualFree((void*)base, 0, MEM_RELEASE); VirtualFree((void*)base, 0, MEM_RELEASE);
} }
void SysMemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution )
{
DWORD winmode = 0;
switch( mode )
{
case Protect_NoAccess:
winmode = ( allowExecution ) ? PAGE_EXECUTE : PAGE_NOACCESS;
break;
case Protect_ReadOnly:
winmode = ( allowExecution ) ? PAGE_EXECUTE_READ : PAGE_READONLY;
break;
case Protect_ReadWrite:
winmode = ( allowExecution ) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
break;
}
DWORD OldProtect; // enjoy my uselessness, yo!
VirtualProtect( baseaddr, size, winmode, &OldProtect );
}

View File

@ -17,7 +17,7 @@
*/ */
#include "PrecompiledHeader.h" #include "Win32.h"
#include "System.h" #include "System.h"
#include "Threading.h" #include "Threading.h"
@ -58,7 +58,12 @@ namespace Threading
__forceinline void Timeslice() __forceinline void Timeslice()
{ {
Sleep(0); ::Sleep(0);
}
__forceinline void Sleep( int ms )
{
::Sleep( 1000*ms );
} }
// For use in spin/wait loops, Acts as a hint to Intel CPUs and should, in theory // For use in spin/wait loops, Acts as a hint to Intel CPUs and should, in theory

View File

@ -0,0 +1 @@
#include "Win32.h"

View File

@ -16,10 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "../Win32.h" #include "../Win32.h"
#include <commctrl.h>
#include <vector> #include <vector>
using namespace std; using namespace std;

View File

@ -16,10 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h"
#include "../Win32.h" #include "../Win32.h"
#include <commctrl.h>
#include <vector> #include <vector>
#include "PS2Edefs.h" #include "PS2Edefs.h"

View File

@ -16,8 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "PrecompiledHeader.h" #include "Win32.h"
#include "win32.h"
#include "Common.h" #include "Common.h"
#include "Paths.h" #include "Paths.h"

View File

@ -53,7 +53,7 @@ struct BASEBLOCKEX
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
u32 visited; // number of times called u32 visited; // number of times called
LARGE_INTEGER ltime; // regs it assumes to have set already u64 ltime; // regs it assumes to have set already
#endif #endif
}; };

View File

@ -1076,7 +1076,7 @@ u32 _recIsRegWritten(EEINST* pinst, int size, u8 xmmtype, u8 reg)
u32 i, inst = 1; u32 i, inst = 1;
while(size-- > 0) { while(size-- > 0) {
for(i = 0; i < ARRAYSIZE(pinst->writeType); ++i) { for(i = 0; i < ArraySize(pinst->writeType); ++i) {
if ((pinst->writeType[i] == xmmtype) && (pinst->writeReg[i] == reg)) if ((pinst->writeType[i] == xmmtype) && (pinst->writeReg[i] == reg))
return inst; return inst;
} }
@ -1091,11 +1091,11 @@ u32 _recIsRegUsed(EEINST* pinst, int size, u8 xmmtype, u8 reg)
{ {
u32 i, inst = 1; u32 i, inst = 1;
while(size-- > 0) { while(size-- > 0) {
for(i = 0; i < ARRAYSIZE(pinst->writeType); ++i) { for(i = 0; i < ArraySize(pinst->writeType); ++i) {
if( pinst->writeType[i] == xmmtype && pinst->writeReg[i] == reg ) if( pinst->writeType[i] == xmmtype && pinst->writeReg[i] == reg )
return inst; return inst;
} }
for(i = 0; i < ARRAYSIZE(pinst->readType); ++i) { for(i = 0; i < ArraySize(pinst->readType); ++i) {
if( pinst->readType[i] == xmmtype && pinst->readReg[i] == reg ) if( pinst->readType[i] == xmmtype && pinst->readReg[i] == reg )
return inst; return inst;
} }
@ -1110,7 +1110,7 @@ void _recFillRegister(EEINST& pinst, int type, int reg, int write)
{ {
u32 i = 0; u32 i = 0;
if (write ) { if (write ) {
for(i = 0; i < ARRAYSIZE(pinst.writeType); ++i) { for(i = 0; i < ArraySize(pinst.writeType); ++i) {
if( pinst.writeType[i] == XMMTYPE_TEMP ) { if( pinst.writeType[i] == XMMTYPE_TEMP ) {
pinst.writeType[i] = type; pinst.writeType[i] = type;
pinst.writeReg[i] = reg; pinst.writeReg[i] = reg;
@ -1120,7 +1120,7 @@ void _recFillRegister(EEINST& pinst, int type, int reg, int write)
assert(0); assert(0);
} }
else { else {
for(i = 0; i < ARRAYSIZE(pinst.readType); ++i) { for(i = 0; i < ArraySize(pinst.readType); ++i) {
if( pinst.readType[i] == XMMTYPE_TEMP ) { if( pinst.readType[i] == XMMTYPE_TEMP ) {
pinst.readType[i] = type; pinst.readType[i] = type;
pinst.readReg[i] = reg; pinst.readReg[i] = reg;

View File

@ -164,7 +164,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
memzero_obj(used); memzero_obj(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 ) {
used[i] = 1; used[i] = 1;
numused++; numused++;
@ -172,13 +172,13 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
} }
fprintf(f, " "); fprintf(f, " ");
for(i = 0; i < ARRAYSIZE(s_pInstCache->regs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( used[i] ) fprintf(f, "%2d ", i); if( used[i] ) fprintf(f, "%2d ", i);
} }
fprintf(f, "\n"); fprintf(f, "\n");
fprintf(f, " "); fprintf(f, " ");
for(i = 0; i < ARRAYSIZE(s_pInstCache->regs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( used[i] ) fprintf(f, "%s ", disRNameGPR[i]); if( used[i] ) fprintf(f, "%s ", disRNameGPR[i]);
} }
fprintf(f, "\n"); fprintf(f, "\n");
@ -188,7 +188,7 @@ static void iIopDumpBlock( int startpc, u8 * ptr )
fprintf(f, "%2d: %2.2x ", i+1, pcur->info); fprintf(f, "%2d: %2.2x ", i+1, pcur->info);
count = 1; count = 1;
for(j = 0; j < ARRAYSIZE(s_pInstCache->regs); j++) { for(j = 0; j < ArraySize(s_pInstCache->regs); j++) {
if( used[j] ) { if( used[j] ) {
fprintf(f, "%2.2x%s", pcur->regs[j], ((count%8)&&count<numused)?"_":" "); fprintf(f, "%2.2x%s", pcur->regs[j], ((count%8)&&count<numused)?"_":" ");
++count; ++count;
@ -1421,7 +1421,7 @@ StartRecomp:
#ifdef _DEBUG #ifdef _DEBUG
// dump code // dump code
for(i = 0; i < ARRAYSIZE(s_psxrecblocks); ++i) { for(i = 0; i < ArraySize(s_psxrecblocks); ++i) {
if( startpc == s_psxrecblocks[i] ) { if( startpc == s_psxrecblocks[i] ) {
iIopDumpBlock(startpc, recPtr); iIopDumpBlock(startpc, recPtr);
} }
@ -1459,7 +1459,7 @@ StartRecomp:
AddBaseBlockEx(s_pCurBlockEx, 1); AddBaseBlockEx(s_pCurBlockEx, 1);
if( !(psxpc&0x10000000) ) if( !(psxpc&0x10000000) )
g_psxMaxRecMem = std::max( (psxpc&~0xa0000000), g_psxMaxRecMem ); g_psxMaxRecMem = max( (psxpc&~0xa0000000), g_psxMaxRecMem );
if( psxbranch == 2 ) { if( psxbranch == 2 ) {
_psxFlushCall(FLUSH_EVERYTHING); _psxFlushCall(FLUSH_EVERYTHING);

View File

@ -519,20 +519,17 @@ u32 SuperVUGetVIAddr(int reg, int read)
void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex) void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
{ {
FILE *f; FILE *f;
char filename[ g_MaxPath ], str[256]; string filename;
char str[256];
u32 *mem; u32 *mem;
u32 i; u32 i;
#ifdef _WIN32 Path::CreateDirectory( "dumps" );
CreateDirectory("dumps", NULL); ssprintf( filename, "dumps\\svu%cdump%.4X.txt", s_vu?'0':'1', s_pFnHeader->startpc );
sprintf_s( filename, g_MaxPath, "dumps\\svu%c_%.4X.txt", s_vu?'1':'0', s_pFnHeader->startpc );
#else
mkdir("dumps", 0755);
sprintf( filename, "dumps/svu%c_%.4X.txt", s_vu?'1':'0', s_pFnHeader->startpc );
#endif
//SysPrintf( "dump1 %x => %s\n", s_pFnHeader->startpc, filename ); //SysPrintf( "dump1 %x => %s\n", s_pFnHeader->startpc, filename );
f = fopen( filename, "w" ); f = fopen( filename.c_str(), "w" );
fprintf(f, "Format: upper_inst lower_inst\ntype f:vf_live_vars vf_used_vars i:vi_live_vars vi_used_vars inst_cycle pq_inst\n"); fprintf(f, "Format: upper_inst lower_inst\ntype f:vf_live_vars vf_used_vars i:vi_live_vars vi_used_vars inst_cycle pq_inst\n");
fprintf(f, "Type: %.2x - qread, %.2x - pread, %.2x - clip_write, %.2x - status_write\n" fprintf(f, "Type: %.2x - qread, %.2x - pread, %.2x - clip_write, %.2x - status_write\n"
@ -649,9 +646,6 @@ void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
fclose( f ); fclose( f );
} }
LARGE_INTEGER svubase, svufinal;
static u64 svutime;
// uncomment to count svu exec time // uncomment to count svu exec time
//#define SUPERVU_COUNT //#define SUPERVU_COUNT
@ -2319,9 +2313,6 @@ void SuperVUCleanupProgram(u32 startpc, int vuindex)
// entry point of all vu programs from emulator calls // entry point of all vu programs from emulator calls
__declspec(naked) void SuperVUExecuteProgram(u32 startpc, int vuindex) __declspec(naked) void SuperVUExecuteProgram(u32 startpc, int vuindex)
{ {
#ifdef SUPERVU_COUNT
QueryPerformanceCounter(&svubase);
#endif
__asm { __asm {
mov eax, dword ptr [esp] mov eax, dword ptr [esp]
mov s_TotalVUCycles, 0 // necessary to be here! mov s_TotalVUCycles, 0 // necessary to be here!
@ -2457,7 +2448,7 @@ static void SuperVURecompile()
FORIT(itblock, s_listBlocks) { FORIT(itblock, s_listBlocks) {
VuBaseBlock::LISTBLOCKS::iterator itchild; VuBaseBlock::LISTBLOCKS::iterator itchild;
assert( (*itblock)->blocks.size() <= ARRAYSIZE((*itblock)->pChildJumps) ); assert( (*itblock)->blocks.size() <= ArraySize((*itblock)->pChildJumps) );
int i = 0; int i = 0;
FORIT(itchild, (*itblock)->blocks) { FORIT(itchild, (*itblock)->blocks) {
@ -2537,12 +2528,12 @@ void svudispfntemp()
if( ((vudump&8) && g_curdebugvu) || ((vudump&0x80) && !g_curdebugvu) ) { //&& g_vu1lastrec != g_vu1last ) { if( ((vudump&8) && g_curdebugvu) || ((vudump&0x80) && !g_curdebugvu) ) { //&& g_vu1lastrec != g_vu1last ) {
if( skipparent != g_vu1lastrec ) { if( skipparent != g_vu1lastrec ) {
for(i = 0; i < ARRAYSIZE(badaddrs); ++i) { for(i = 0; i < ArraySize(badaddrs); ++i) {
if( s_svulast == badaddrs[i][1] && g_vu1lastrec == badaddrs[i][0] ) if( s_svulast == badaddrs[i][1] && g_vu1lastrec == badaddrs[i][0] )
break; break;
} }
if( i == ARRAYSIZE(badaddrs) ) if( i == ArraySize(badaddrs) )
{ {
//static int curesp; //static int curesp;
//__asm mov curesp, esp //__asm mov curesp, esp
@ -3882,19 +3873,6 @@ void recVUMI_JALR( VURegs* vuu, s32 info )
branch |= 4; branch |= 4;
} }
#ifdef SUPERVU_COUNT
void StopSVUCounter()
{
QueryPerformanceCounter(&svufinal);
svutime += (u32)(svufinal.QuadPart-svubase.QuadPart);
}
void StartSVUCounter()
{
QueryPerformanceCounter(&svubase);
}
#endif
#ifdef PCSX2_DEVBUILD #ifdef PCSX2_DEVBUILD
void vu1xgkick(u32* pMem, u32 addr) void vu1xgkick(u32* pMem, u32 addr)
{ {

View File

@ -42,6 +42,7 @@
#include "vtlb.h" #include "vtlb.h"
#include "SamplProf.h" #include "SamplProf.h"
#include "Paths.h"
using namespace R5900; using namespace R5900;
@ -135,7 +136,7 @@ BASEBLOCKEX* PC_GETBLOCKEX(BASEBLOCK* p)
static void iDumpBlock( int startpc, u8 * ptr ) static void iDumpBlock( int startpc, u8 * ptr )
{ {
FILE *f; FILE *f;
char filename[ g_MaxPath ]; string filename;
u32 i, j; u32 i, j;
EEINST* pcur; EEINST* pcur;
u8 used[34]; u8 used[34];
@ -143,13 +144,8 @@ static void iDumpBlock( int startpc, u8 * ptr )
int numused, count, fpunumused; int numused, count, fpunumused;
Console::Status( "dump1 %x:%x, %x", params startpc, pc, cpuRegs.cycle ); Console::Status( "dump1 %x:%x, %x", params startpc, pc, cpuRegs.cycle );
#ifdef _WIN32 Path::CreateDirectory( "dumps" );
CreateDirectory("dumps", NULL); ssprintf( filename, "dumps\\R5900dump%.8X.txt", startpc );
sprintf_s( filename, g_MaxPath, "dumps\\dump%.8X.txt", startpc);
#else
mkdir("dumps", 0755);
sprintf( filename, "dumps/dump%.8X.txt", startpc);
#endif
fflush( stdout ); fflush( stdout );
// f = fopen( "dump1", "wb" ); // f = fopen( "dump1", "wb" );
@ -159,7 +155,7 @@ static void iDumpBlock( int startpc, u8 * ptr )
// sprintf( command, "objdump -D --target=binary --architecture=i386 dump1 > %s", filename ); // sprintf( command, "objdump -D --target=binary --architecture=i386 dump1 > %s", filename );
// system( command ); // system( command );
f = fopen( filename, "w" ); f = fopen( filename.c_str(), "w" );
std::string output; std::string output;
@ -177,7 +173,7 @@ static void iDumpBlock( int startpc, u8 * ptr )
memzero_obj(used); memzero_obj(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 ) {
used[i] = 1; used[i] = 1;
numused++; numused++;
@ -186,7 +182,7 @@ static void iDumpBlock( int startpc, u8 * ptr )
memzero_obj(fpuused); memzero_obj(fpuused);
fpunumused = 0; fpunumused = 0;
for(i = 0; i < ARRAYSIZE(s_pInstCache->fpuregs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
if( s_pInstCache->fpuregs[i] & EEINST_USED ) { if( s_pInstCache->fpuregs[i] & EEINST_USED ) {
fpuused[i] = 1; fpuused[i] = 1;
fpunumused++; fpunumused++;
@ -194,19 +190,19 @@ static void iDumpBlock( int startpc, u8 * ptr )
} }
fprintf(f, " "); fprintf(f, " ");
for(i = 0; i < ARRAYSIZE(s_pInstCache->regs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( used[i] ) fprintf(f, "%2d ", i); if( used[i] ) fprintf(f, "%2d ", i);
} }
for(i = 0; i < ARRAYSIZE(s_pInstCache->fpuregs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
if( fpuused[i] ) fprintf(f, "%2d ", i); if( fpuused[i] ) fprintf(f, "%2d ", i);
} }
fprintf(f, "\n"); fprintf(f, "\n");
fprintf(f, " "); fprintf(f, " ");
for(i = 0; i < ARRAYSIZE(s_pInstCache->regs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->regs); ++i) {
if( used[i] ) fprintf(f, "%s ", disRNameGPR[i]); if( used[i] ) fprintf(f, "%s ", disRNameGPR[i]);
} }
for(i = 0; i < ARRAYSIZE(s_pInstCache->fpuregs); ++i) { for(i = 0; i < ArraySize(s_pInstCache->fpuregs); ++i) {
if( fpuused[i] ) fprintf(f, "%s ", i<32?"FR":"FA"); if( fpuused[i] ) fprintf(f, "%s ", i<32?"FR":"FA");
} }
fprintf(f, "\n"); fprintf(f, "\n");
@ -216,14 +212,14 @@ static void iDumpBlock( int startpc, u8 * ptr )
fprintf(f, "%2d: %2.2x ", i+1, pcur->info); fprintf(f, "%2d: %2.2x ", i+1, pcur->info);
count = 1; count = 1;
for(j = 0; j < ARRAYSIZE(s_pInstCache->regs); j++) { for(j = 0; j < ArraySize(s_pInstCache->regs); j++) {
if( used[j] ) { if( used[j] ) {
fprintf(f, "%2.2x%s", pcur->regs[j], ((count%8)&&count<numused)?"_":" "); fprintf(f, "%2.2x%s", pcur->regs[j], ((count%8)&&count<numused)?"_":" ");
++count; ++count;
} }
} }
count = 1; count = 1;
for(j = 0; j < ARRAYSIZE(s_pInstCache->fpuregs); j++) { for(j = 0; j < ArraySize(s_pInstCache->fpuregs); j++) {
if( fpuused[j] ) { if( fpuused[j] ) {
fprintf(f, "%2.2x%s", pcur->fpuregs[j], ((count%8)&&count<fpunumused)?"_":" "); fprintf(f, "%2.2x%s", pcur->fpuregs[j], ((count%8)&&count<fpunumused)?"_":" ");
++count; ++count;
@ -1884,7 +1880,7 @@ StartRecomp:
#ifdef _DEBUG #ifdef _DEBUG
// dump code // dump code
for(i = 0; i < ARRAYSIZE(s_recblocks); ++i) { for(i = 0; i < ArraySize(s_recblocks); ++i) {
if( startpc == s_recblocks[i] ) { if( startpc == s_recblocks[i] ) {
iDumpBlock(startpc, recPtr); iDumpBlock(startpc, recPtr);
} }

View File

@ -22,6 +22,8 @@
#include "Misc.h" #include "Misc.h"
#include "Threading.h" #include "Threading.h"
#include "RedtapeWindows.h"
#if defined (_MSC_VER) && _MSC_VER >= 1400 #if defined (_MSC_VER) && _MSC_VER >= 1400
extern "C" extern "C"

View File

@ -30,10 +30,6 @@ u8 g_globalXMMSaved = 0;
PCSX2_ALIGNED16( static u64 g_globalMMXData[8] ); PCSX2_ALIGNED16( static u64 g_globalMMXData[8] );
PCSX2_ALIGNED16( static u64 g_globalXMMData[2*XMMREGS] ); PCSX2_ALIGNED16( static u64 g_globalXMMData[2*XMMREGS] );
// performance counter vars.
LARGE_INTEGER lbase = {0}, lfinal = {0};
u32 s_pCurBlock_ltime;
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// SetCPUState -- for assugnment of SSE roundmodes and clampmodes. // SetCPUState -- for assugnment of SSE roundmodes and clampmodes.
@ -228,48 +224,3 @@ __forceinline void FreezeXMMRegs_(int save)
#endif // _MSC_VER #endif // _MSC_VER
} }
} }
#ifdef PCSX2_DEVBUILD
#ifdef _WIN32
__declspec(naked) void _StartPerfCounter()
{
__asm {
push eax
push ebx
push ecx
rdtsc
mov dword ptr [offset lbase], eax
mov dword ptr [offset lbase + 4], edx
pop ecx
pop ebx
pop eax
ret
}
}
__declspec(naked) void _StopPerfCounter()
{
__asm {
push eax
push ebx
push ecx
rdtsc
sub eax, dword ptr [offset lbase]
sbb edx, dword ptr [offset lbase + 4]
mov ecx, s_pCurBlock_ltime
add eax, dword ptr [ecx]
adc edx, dword ptr [ecx + 4]
mov dword ptr [ecx], eax
mov dword ptr [ecx + 4], edx
pop ecx
pop ebx
pop eax
ret
}
}
#endif // WIN32
#endif // PCSX2_DEVBUILD

View File

@ -28,10 +28,6 @@ using namespace std;
#pragma warning(disable:4996) //ignore the stricmp deprecated warning #pragma warning(disable:4996) //ignore the stricmp deprecated warning
#endif #endif
#ifdef _WIN32
#include <windows.h>
#endif
#if !defined(_WIN32) #if !defined(_WIN32)
#ifndef strnicmp #ifndef strnicmp
#define strnicmp strncasecmp #define strnicmp strncasecmp

View File

@ -84,7 +84,6 @@
AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib" AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib"
OutputFile="$(OutDir)\$(ProjectName)-dev.dll" OutputFile="$(OutDir)\$(ProjectName)-dev.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="true" GenerateManifest="true"
ModuleDefinitionFile=".\Spu2-X.def" ModuleDefinitionFile=".\Spu2-X.def"
GenerateDebugInformation="true" GenerateDebugInformation="true"
@ -176,7 +175,6 @@
AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib" AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib"
OutputFile="$(OutDir)\$(ProjectName)-dbg.dll" OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\Spu2-X.def" ModuleDefinitionFile=".\Spu2-X.def"
GenerateDebugInformation="true" GenerateDebugInformation="true"
RandomizedBaseAddress="1" RandomizedBaseAddress="1"
@ -275,7 +273,6 @@
AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib" AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib"
OutputFile="$(OutDir)\$(ProjectName).dll" OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\Spu2-X.def" ModuleDefinitionFile=".\Spu2-X.def"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"
@ -372,7 +369,6 @@
AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib" AdditionalDependencies="winmm.lib dsound.lib comctl32.lib soundtouch.lib"
OutputFile="$(OutDir)\$(ProjectName)-dbg.dll" OutputFile="$(OutDir)\$(ProjectName)-dbg.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\Spu2-X.def" ModuleDefinitionFile=".\Spu2-X.def"
GenerateDebugInformation="true" GenerateDebugInformation="true"
RandomizedBaseAddress="1" RandomizedBaseAddress="1"

View File

@ -124,7 +124,7 @@ void __forceinline KICK_VERTEX3()
{ {
/* tri fans need special processing */ /* tri fans need special processing */
if (gs.nTriFanVert == gs.primIndex) if (gs.nTriFanVert == gs.primIndex)
gs.primIndex = (gs.primIndex+1) % ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1) % ArraySize(gs.gsvertex);
} }
} }
} }
@ -136,7 +136,7 @@ void __fastcall GIFPackedRegHandlerXYZF2(u32* data)
gs.vertexregs.z = (data[2] >> 4) & 0xffffff; gs.vertexregs.z = (data[2] >> 4) & 0xffffff;
gs.vertexregs.f = (data[3] >> 4) & 0xff; gs.vertexregs.f = (data[3] >> 4) & 0xff;
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1) % ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1) % ArraySize(gs.gsvertex);
if( data[3] & 0x8000 ) { if( data[3] & 0x8000 ) {
KICK_VERTEX3(); KICK_VERTEX3();
@ -152,7 +152,7 @@ void __fastcall GIFPackedRegHandlerXYZ2(u32* data)
gs.vertexregs.y = (data[1] >> 0) & 0xffff; gs.vertexregs.y = (data[1] >> 0) & 0xffff;
gs.vertexregs.z = data[2]; gs.vertexregs.z = data[2];
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1) % ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1) % ArraySize(gs.gsvertex);
if( data[3] & 0x8000 ) { if( data[3] & 0x8000 ) {
KICK_VERTEX3(); KICK_VERTEX3();
@ -420,7 +420,7 @@ void __fastcall GIFRegHandlerXYZF2(u32* data)
gs.vertexregs.z = data[1] & 0xffffff; gs.vertexregs.z = data[1] & 0xffffff;
gs.vertexregs.f = data[1] >> 24; gs.vertexregs.f = data[1] >> 24;
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
KICK_VERTEX2(); KICK_VERTEX2();
} }
@ -431,7 +431,7 @@ void __fastcall GIFRegHandlerXYZ2(u32* data)
gs.vertexregs.y = (data[0] >> (16)) & 0xffff; gs.vertexregs.y = (data[0] >> (16)) & 0xffff;
gs.vertexregs.z = data[1]; gs.vertexregs.z = data[1];
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
KICK_VERTEX2(); KICK_VERTEX2();
} }
@ -481,7 +481,7 @@ void __fastcall GIFRegHandlerXYZF3(u32* data)
gs.vertexregs.z = data[1] & 0xffffff; gs.vertexregs.z = data[1] & 0xffffff;
gs.vertexregs.f = data[1] >> 24; gs.vertexregs.f = data[1] >> 24;
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
KICK_VERTEX3(); KICK_VERTEX3();
} }
@ -492,7 +492,7 @@ void __fastcall GIFRegHandlerXYZ3(u32* data)
gs.vertexregs.y = (data[0] >> (16)) & 0xffff; gs.vertexregs.y = (data[0] >> (16)) & 0xffff;
gs.vertexregs.z = data[1]; gs.vertexregs.z = data[1];
gs.gsvertex[gs.primIndex] = gs.vertexregs; gs.gsvertex[gs.primIndex] = gs.vertexregs;
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
KICK_VERTEX3(); KICK_VERTEX3();
} }

View File

@ -1055,13 +1055,13 @@ void ZeroGS::Destroy(BOOL bD3D)
vb[0].Destroy(); vb[0].Destroy();
vb[1].Destroy(); vb[1].Destroy();
for(int i = 0; i < ARRAYSIZE(pvs); ++i) { for(int i = 0; i < ArraySize(pvs); ++i) {
SAFE_RELEASE(pvs[i]); SAFE_RELEASE(pvs[i]);
} }
for(int i = 0; i < ARRAYSIZE(ppsRegular); ++i) { for(int i = 0; i < ArraySize(ppsRegular); ++i) {
SAFE_RELEASE(ppsRegular[i]); SAFE_RELEASE(ppsRegular[i]);
} }
for(int i = 0; i < ARRAYSIZE(ppsTexture); ++i) { for(int i = 0; i < ArraySize(ppsTexture); ++i) {
SAFE_RELEASE(ppsTexture[i]); SAFE_RELEASE(ppsTexture[i]);
} }
@ -1279,7 +1279,7 @@ HRESULT ZeroGS::LoadEffects()
} }
// clear the textures // clear the textures
for(int i = 0; i < ARRAYSIZE(ppsTexture); ++i) { for(int i = 0; i < ArraySize(ppsTexture); ++i) {
SAFE_RELEASE(ppsTexture[i]); SAFE_RELEASE(ppsTexture[i]);
} }
memset(ppsTexture, 0, sizeof(ppsTexture)); memset(ppsTexture, 0, sizeof(ppsTexture));
@ -1351,7 +1351,7 @@ LPD3DPS ZeroGS::LoadShadeEffect(int type, int texfilter, int fog, int testaem, i
int index = GET_SHADER_INDEX(type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, context, 0); int index = GET_SHADER_INDEX(type, texfilter, texwrap, fog, s_bWriteDepth, testaem, exactcolor, context, 0);
assert( index < ARRAYSIZE(ppsTexture) ); assert( index < ArraySize(ppsTexture) );
LPD3DPS* pps = ppsTexture+index; LPD3DPS* pps = ppsTexture+index;
if( *pps != NULL ) if( *pps != NULL )
@ -1461,7 +1461,7 @@ public:
HRESULT ZeroGS::LoadEffects() HRESULT ZeroGS::LoadEffects()
{ {
// clear the textures // clear the textures
for(int i = 0; i < ARRAYSIZE(ppsTexture); ++i) { for(int i = 0; i < ArraySize(ppsTexture); ++i) {
SAFE_RELEASE(ppsTexture[i]); SAFE_RELEASE(ppsTexture[i]);
} }
memset(ppsTexture, 0, sizeof(ppsTexture)); memset(ppsTexture, 0, sizeof(ppsTexture));
@ -1790,7 +1790,7 @@ int GetTexFilter(const tex1Info& tex1)
void ZeroGS::ReloadEffects() void ZeroGS::ReloadEffects()
{ {
#ifndef RELEASE_TO_PUBLIC #ifndef RELEASE_TO_PUBLIC
for(int i = 0; i < ARRAYSIZE(ppsTexture); ++i) { for(int i = 0; i < ArraySize(ppsTexture); ++i) {
SAFE_RELEASE(ppsTexture[i]); SAFE_RELEASE(ppsTexture[i]);
} }
memset(ppsTexture, 0, sizeof(ppsTexture)); memset(ppsTexture, 0, sizeof(ppsTexture));
@ -3457,12 +3457,12 @@ void ZeroGS::RenderCRTC(int interlace)
if( g_GameSettings & GAME_AUTORESET ) { if( g_GameSettings & GAME_AUTORESET ) {
s_nResolveCounts[s_nCurResolveIndex] = s_nResolved; s_nResolveCounts[s_nCurResolveIndex] = s_nResolved;
s_nCurResolveIndex = (s_nCurResolveIndex+1)%ARRAYSIZE(s_nResolveCounts); s_nCurResolveIndex = (s_nCurResolveIndex+1)%ArraySize(s_nResolveCounts);
int total = 0; int total = 0;
for(int i = 0; i < ARRAYSIZE(s_nResolveCounts); ++i) total += s_nResolveCounts[i]; for(int i = 0; i < ArraySize(s_nResolveCounts); ++i) total += s_nResolveCounts[i];
if( total / ARRAYSIZE(s_nResolveCounts) > 3 ) { if( total / ArraySize(s_nResolveCounts) > 3 ) {
if( s_nLastResolveReset > (int)(fFPS * 8) ) { if( s_nLastResolveReset > (int)(fFPS * 8) ) {
// reset // reset
DEBUG_LOG("ZeroGS: video mem reset\n"); DEBUG_LOG("ZeroGS: video mem reset\n");
@ -3566,7 +3566,7 @@ void ZeroGS::KickPoint()
Flush(prim->ctxt); Flush(prim->ctxt);
curvb.Lock(); curvb.Lock();
int last = (gs.primIndex+2)%ARRAYSIZE(gs.gsvertex); int last = (gs.primIndex+2)%ArraySize(gs.gsvertex);
VertexGPU* p = curvb.pbuf+curvb.dwCount; VertexGPU* p = curvb.pbuf+curvb.dwCount;
SET_VERTEX(&p[0], last, curvb); SET_VERTEX(&p[0], last, curvb);
@ -3594,8 +3594,8 @@ void ZeroGS::KickLine()
Flush(prim->ctxt); Flush(prim->ctxt);
curvb.Lock(); curvb.Lock();
int next = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); int next = (gs.primIndex+1)%ArraySize(gs.gsvertex);
int last = (gs.primIndex+2)%ARRAYSIZE(gs.gsvertex); int last = (gs.primIndex+2)%ArraySize(gs.gsvertex);
VertexGPU* p = curvb.pbuf+curvb.dwCount*2; VertexGPU* p = curvb.pbuf+curvb.dwCount*2;
SET_VERTEX(&p[0], next, curvb); SET_VERTEX(&p[0], next, curvb);
@ -3664,7 +3664,7 @@ void ZeroGS::KickTriangleFan()
// add 1 to skip the first vertex // add 1 to skip the first vertex
if( gs.primIndex == gs.nTriFanVert ) if( gs.primIndex == gs.nTriFanVert )
gs.primIndex = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); gs.primIndex = (gs.primIndex+1)%ArraySize(gs.gsvertex);
#ifdef PRIM_LOG #ifdef PRIM_LOG
OUTPUT_VERT(PRIM_LOG, p[0], 0); OUTPUT_VERT(PRIM_LOG, p[0], 0);
@ -3696,8 +3696,8 @@ void ZeroGS::KickSprite()
if (curvb.dwCount >= POINT_BUFFERFLUSH/3) Flush(prim->ctxt); if (curvb.dwCount >= POINT_BUFFERFLUSH/3) Flush(prim->ctxt);
curvb.Lock(); curvb.Lock();
int next = (gs.primIndex+1)%ARRAYSIZE(gs.gsvertex); int next = (gs.primIndex+1)%ArraySize(gs.gsvertex);
int last = (gs.primIndex+2)%ARRAYSIZE(gs.gsvertex); int last = (gs.primIndex+2)%ArraySize(gs.gsvertex);
// sprite is too small and AA shows lines (tek4) // sprite is too small and AA shows lines (tek4)
if( s_AAx ) if( s_AAx )

View File

@ -74,8 +74,8 @@ typedef D3DXMATRIX DXMAT;
#endif #endif
#define SETRS(state, val) pd3dDevice->SetRenderState(state, val) #define SETRS(state, val) pd3dDevice->SetRenderState(state, val)
#ifndef ARRAYSIZE #ifndef ArraySize
#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0])) #define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
#endif #endif
// all textures have this width // all textures have this width

View File

@ -243,7 +243,7 @@ s32 CALLBACK SPU2init()
voices[i+24].memoffset = 0x400; voices[i+24].memoffset = 0x400;
// init each channel // init each channel
for (u32 i = 0; i < ARRAYSIZE(voices); ++i) { for (u32 i = 0; i < ArraySize(voices); ++i) {
voices[i].chanid = i; voices[i].chanid = i;
voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem; voices[i].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem;
@ -294,7 +294,7 @@ s32 CALLBACK SPU2open(void *pDsp)
if ( g_bPlaySound ) { if ( g_bPlaySound ) {
// initialize the audio buffers // initialize the audio buffers
for (u32 i = 0; i < ARRAYSIZE(s_pAudioBuffers); ++i) for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i)
{ {
s_pAudioBuffers[i].pbuf = (u8*)_aligned_malloc(4*NSSIZE*NSFRAMES, 16); // 4 bytes for each sample s_pAudioBuffers[i].pbuf = (u8*)_aligned_malloc(4*NSSIZE*NSFRAMES, 16); // 4 bytes for each sample
s_pAudioBuffers[i].len = 0; s_pAudioBuffers[i].len = 0;
@ -305,11 +305,11 @@ s32 CALLBACK SPU2open(void *pDsp)
s_pCurOutput = (s16*)s_pAudioBuffers[0].pbuf; s_pCurOutput = (s16*)s_pAudioBuffers[0].pbuf;
assert( s_pCurOutput != NULL); assert( s_pCurOutput != NULL);
for (int i = 0; i < ARRAYSIZE(s_nDurations); ++i) for (int i = 0; i < ArraySize(s_nDurations); ++i)
{ {
s_nDurations[i] = NSFRAMES*1000; s_nDurations[i] = NSFRAMES*1000;
} }
s_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000; s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0; s_nCurDuration = 0;
// launch the thread // launch the thread
@ -355,7 +355,7 @@ void CALLBACK SPU2close()
delete g_pWavRecord; g_pWavRecord = NULL; delete g_pWavRecord; g_pWavRecord = NULL;
delete pSoundTouch; pSoundTouch = NULL; delete pSoundTouch; pSoundTouch = NULL;
for (u32 i = 0; i < ARRAYSIZE(s_pAudioBuffers); ++i) for (u32 i = 0; i < ArraySize(s_pAudioBuffers); ++i)
{ {
_aligned_free(s_pAudioBuffers[i].pbuf); _aligned_free(s_pAudioBuffers[i].pbuf);
} }
@ -793,7 +793,7 @@ ENDX:
LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES); LogRawSound(s_pAudioBuffers[s_nCurBuffer].pbuf, 4, s_pAudioBuffers[s_nCurBuffer].pbuf+2, 4, NSSIZE*NSFRAMES);
} }
if ( s_nQueuedBuffers >= ARRAYSIZE(s_pAudioBuffers)-1 ) if ( s_nQueuedBuffers >= ArraySize(s_pAudioBuffers)-1 )
{ {
//ZeroSPU2: dropping packets! game too fast //ZeroSPU2: dropping packets! game too fast
s_nDropPacket += NSFRAMES; s_nDropPacket += NSFRAMES;
@ -820,16 +820,16 @@ ENDX:
u32 duration = (u32)(newtime-s_GlobalTimeStamp); u32 duration = (u32)(newtime-s_GlobalTimeStamp);
s_nDurations[s_nCurDuration] = duration; s_nDurations[s_nCurDuration] = duration;
s_nTotalDuration = newtotal + duration; s_nTotalDuration = newtotal + duration;
s_nCurDuration = (s_nCurDuration+1)%ARRAYSIZE(s_nDurations); s_nCurDuration = (s_nCurDuration+1)%ArraySize(s_nDurations);
s_GlobalTimeStamp = newtime; s_GlobalTimeStamp = newtime;
s_pAudioBuffers[s_nCurBuffer].timestamp = timeGetTime(); s_pAudioBuffers[s_nCurBuffer].timestamp = timeGetTime();
s_pAudioBuffers[s_nCurBuffer].avgtime = s_nTotalDuration/ARRAYSIZE(s_nDurations); s_pAudioBuffers[s_nCurBuffer].avgtime = s_nTotalDuration/ArraySize(s_nDurations);
} }
s_pAudioBuffers[s_nCurBuffer].len = 4*NSSIZE*NSFRAMES; s_pAudioBuffers[s_nCurBuffer].len = 4*NSSIZE*NSFRAMES;
InterlockedExchangeAdd((long*)&s_nQueuedBuffers, 1); InterlockedExchangeAdd((long*)&s_nQueuedBuffers, 1);
s_nCurBuffer = (s_nCurBuffer+1)%ARRAYSIZE(s_pAudioBuffers); s_nCurBuffer = (s_nCurBuffer+1)%ArraySize(s_pAudioBuffers);
s_pAudioBuffers[s_nCurBuffer].newchannels = 0; // reset s_pAudioBuffers[s_nCurBuffer].newchannels = 0; // reset
} }
@ -959,7 +959,7 @@ void* SPU2ThreadProc(void* lpParam)
SoundFeedVoiceData(s_pAudioBuffers[nReadBuf].pbuf, s_pAudioBuffers[nReadBuf].len); SoundFeedVoiceData(s_pAudioBuffers[nReadBuf].pbuf, s_pAudioBuffers[nReadBuf].len);
// don't go to the next buffer unless there is more data buffered // don't go to the next buffer unless there is more data buffered
nReadBuf = (nReadBuf+1)%ARRAYSIZE(s_pAudioBuffers); nReadBuf = (nReadBuf+1)%ArraySize(s_pAudioBuffers);
InterlockedExchangeAdd((long*)&s_nQueuedBuffers, -1); InterlockedExchangeAdd((long*)&s_nQueuedBuffers, -1);
if ( s_bThreadExit ) break; if ( s_bThreadExit ) break;
@ -1493,16 +1493,16 @@ void save_data(freezeData *data)
memcpy(spud->SPUStartCycle, SPUStartCycle, sizeof(SPUStartCycle)); memcpy(spud->SPUStartCycle, SPUStartCycle, sizeof(SPUStartCycle));
memcpy(spud->SPUTargetCycle, SPUTargetCycle, sizeof(SPUTargetCycle)); memcpy(spud->SPUTargetCycle, SPUTargetCycle, sizeof(SPUTargetCycle));
for (i = 0; i < ARRAYSIZE(s_nDurations); ++i) for (i = 0; i < ArraySize(s_nDurations); ++i)
{ {
s_nDurations[i] = NSFRAMES*1000; s_nDurations[i] = NSFRAMES*1000;
} }
s_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000; s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0; s_nCurDuration = 0;
spud->voicesize = SPU_VOICE_STATE_SIZE; spud->voicesize = SPU_VOICE_STATE_SIZE;
for (i = 0; i < ARRAYSIZE(voices); ++i) for (i = 0; i < ArraySize(voices); ++i)
{ {
memcpy(&spud->voices[i], &voices[i], SPU_VOICE_STATE_SIZE); memcpy(&spud->voices[i], &voices[i], SPU_VOICE_STATE_SIZE);
spud->voices[i].pStart = (u8*)((uptr)voices[i].pStart-(uptr)spu2mem); spud->voices[i].pStart = (u8*)((uptr)voices[i].pStart-(uptr)spu2mem);
@ -1554,7 +1554,7 @@ void load_data(freezeData *data)
memcpy(SPUStartCycle, spud->SPUStartCycle, sizeof(SPUStartCycle)); memcpy(SPUStartCycle, spud->SPUStartCycle, sizeof(SPUStartCycle));
memcpy(SPUTargetCycle, spud->SPUTargetCycle, sizeof(SPUTargetCycle)); memcpy(SPUTargetCycle, spud->SPUTargetCycle, sizeof(SPUTargetCycle));
for (i = 0; i < ARRAYSIZE(voices); ++i) for (i = 0; i < ArraySize(voices); ++i)
{ {
memcpy(&voices[i], &spud->voices[i], min((int)SPU_VOICE_STATE_SIZE, spud->voicesize)); memcpy(&voices[i], &spud->voices[i], min((int)SPU_VOICE_STATE_SIZE, spud->voicesize));
voices[i].pStart = (u8*)((uptr)spud->voices[i].pStart+(uptr)spu2mem); voices[i].pStart = (u8*)((uptr)spud->voices[i].pStart+(uptr)spu2mem);
@ -1565,12 +1565,12 @@ void load_data(freezeData *data)
s_GlobalTimeStamp = 0; s_GlobalTimeStamp = 0;
g_startcount = 0xffffffff; g_startcount = 0xffffffff;
for (int i = 0; i < ARRAYSIZE(s_nDurations); ++i) for (int i = 0; i < ArraySize(s_nDurations); ++i)
{ {
s_nDurations[i] = NSFRAMES*1000; s_nDurations[i] = NSFRAMES*1000;
} }
s_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000; s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0; s_nCurDuration = 0;
s_nQueuedBuffers = 0; s_nQueuedBuffers = 0;
s_nDropPacket = 0; s_nDropPacket = 0;