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__
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
// Renamed ARRAYSIZE to ArraySize -- looks nice and gets rid of Windows.h conflicts (air)
#ifndef ArraySize
#define ArraySize(x) (sizeof(x)/sizeof((x)[0]))
#endif
#ifdef __LINUX__

View File

@ -2045,7 +2045,7 @@ void cdvdWrite16(u8 rt) // SCOMMAND
break;
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);
cdvd.mg_size -= cdvd.ResultC;
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;
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);
#ifdef ENABLE_NLS
setlocale(LC_ALL, "");

View File

@ -920,3 +920,17 @@ void SysMunmap(uptr base, u32 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);
}
__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
// improve performance and reduce cpu power consumption.
__forceinline void SpinWait()
@ -60,7 +65,7 @@ namespace Threading
// performance hint and isn't required).
__asm__ ( "pause" );
}
void* Thread::_internal_callback( void* itsme )
{
jASSUME( itsme != NULL );

View File

@ -449,7 +449,7 @@ void mtgsThreadObject::PostVsyncEnd( bool updategs )
m_QueuedFrames = 0;
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();
}

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:
FILE *fp = fopen(Bios1.c_str(), "rb");
fread(dest, 1, std::min( maxSize, filesize ), fp);
fread(dest, 1, min( maxSize, filesize ), 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);
cpuTlbMissW(mem, cpuRegs.branch);
}
template<int p>
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);
cpuTlbMissW(mem, cpuRegs.branch);
}
template<int p>
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);
cpuTlbMissW(mem, cpuRegs.branch);
}
template<int p>
void __fastcall _ext_memWrite128(u32 mem, const u64 *value)
{
@ -656,13 +659,7 @@ void memReset()
{
// VTLB Protection Preparations.
#ifdef _WIN32
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
SysMemProtect( m_psAllMem, m_allMemSize, Protect_ReadWrite );
// 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
@ -810,7 +807,7 @@ void memReset()
}
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);
BiosVersion = GetBiosVersion();

View File

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

View File

@ -659,26 +659,7 @@ void ProcessFKeys(int fkey, int shift)
break;
#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:
if( mtgsThread != NULL ) {
Console::Notice( "Cannot make gsstates in MTGS mode" );

View File

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

View File

@ -27,6 +27,8 @@
#ifndef _S_IFREG
#define _S_IFREG S_IFREG
#endif
#else
#include <direct.h>
#endif
namespace Path
@ -231,4 +233,15 @@ void GetRootDirectory( const string& src, string& dest )
else
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
{
void Combine( std::string& dest, const std::string& srcPath, const std::string& srcFile );
bool isRooted( const std::string& path );
bool isDirectory( const std::string& path );
bool isFile( const std::string& path );
bool Exists( const std::string& path );
int getFileSize( const std::string& path );
extern void Combine( std::string& dest, const std::string& srcPath, const std::string& srcFile );
extern bool isRooted( const std::string& path );
extern bool isDirectory( const std::string& path );
extern bool isFile( const std::string& path );
extern bool Exists( const std::string& path );
extern int getFileSize( const std::string& path );
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 );
void GetFilename( const std::string& src, std::string& dest );
void GetDirectory( const std::string& src, std::string& dest );
void GetRootDirectory( const std::string& src, std::string& dest );
void Split( const std::string& src, std::string& destpath, std::string& destfile );
extern void ReplaceExtension( std::string& dest, const std::string& src, const std::string& ext );
extern void ReplaceFilename( std::string& dest, const std::string& src, const std::string& newfilename );
extern void GetFilename( const std::string& src, std::string& dest );
extern void GetDirectory( const std::string& src, std::string& dest );
extern void GetRootDirectory( const std::string& src, std::string& dest );
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 "RedtapeWindows.h"
#include "Common.h"
#include "PsxCommon.h"
@ -48,7 +49,7 @@ _GSsetupRecording GSsetupRecording;
_GSreset GSreset;
_GSwriteCSR GSwriteCSR;
_GSgetDriverInfo GSgetDriverInfo;
#ifdef _WIN32
#ifdef _WINDOWS_
_GSsetWindowInfo GSsetWindowInfo;
#endif
_GSfreeze GSfreeze;

View File

@ -7,21 +7,6 @@
#ifndef _WIN32
# 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
// 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 "StringUtils.h"
typedef int BOOL;
# undef TRUE
# undef FALSE
# define TRUE 1
# define FALSE 0
////////////////////////////////////////////////////////////////////
// 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)
# 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()
{
struct timeb t;
@ -89,13 +76,6 @@ static __forceinline u32 timeGetTime()
return (u32)(t.time*1000+t.millitm);
}
# define BOOL int
# undef TRUE
# undef FALSE
# define TRUE 1
# define FALSE 0
# ifndef strnicmp
# define strnicmp strncasecmp
# endif

View File

@ -26,6 +26,8 @@
#include "deci2_netmp.h"
#include "deci2_ttyp.h"
#include "Threading.h"
#define PROTO_DCMP 0x0001
#define PROTO_ITTYP 0x0110
#define PROTO_IDBGP 0x0130
@ -58,9 +60,7 @@ extern int ebrk_count, ibrk_count;
extern volatile long runStatus;
extern int runCode, runCount;
#ifdef _WIN32
extern HANDLE runEvent; //i don't like this;
#endif
extern Threading::Semaphore* runEvent;
extern int connected;
//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
runCount=in->count;
runCode=in->code;
#ifdef _WIN32
SetEvent(runEvent);//kick it
#endif
runEvent->Post();//kick it
}
break;
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
runCount=0;
runCode=0xFF;
#ifdef _WIN32
SetEvent(runEvent);//awake it
#endif
runEvent->Post();
out->h.length=sizeof(DECI2_DBGP_HEADER);
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.
// So for now we turn it into duds for non-Win32 platforms.
#if !defined( _DEBUG ) && defined( WIN32 )
#ifdef _WIN32
void ProfilerInit();
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
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 )
{
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
# define PCSX2_MEM_PROTECT_BEGIN() __try {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,6 @@
*/
#include "PrecompiledHeader.h"
#include "win32.h"
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
*/
#include "PrecompiledHeader.h"
#include "Win32.h"
#include <commctrl.h>
#include <math.h>
#include "libintlmsc.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,6 +19,11 @@
#ifndef _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 <tchar.h>
@ -27,6 +32,9 @@
#define COMPILEDATE __DATE__
//Exception handler for the VTLB-based recompilers.
int SysPageFaultExceptionFilter(EXCEPTION_POINTERS* eps);
// --->> Ini Configuration [ini.c]
extern char g_WorkingFolder[g_MaxPath];

View File

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

View File

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

View File

@ -16,11 +16,8 @@
* 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 <commctrl.h>
#include "Common.h"
//#include "PsxCommon.h"
@ -833,15 +830,14 @@ const char *SysLibError() {
return NULL;
}
void SysCloseLibrary(void *lib) {
void SysCloseLibrary(void *lib)
{
FreeLibrary((HINSTANCE)lib);
}
void *SysMmap(uptr base, u32 size) {
void *mem;
mem = VirtualAlloc((void*)base, size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
return mem;
void *SysMmap(uptr base, u32 size)
{
return VirtualAlloc((void*)base, size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
}
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, 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 "Threading.h"
@ -58,7 +58,12 @@ namespace Threading
__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

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
*/
#include "PrecompiledHeader.h"
#include "../Win32.h"
#include <commctrl.h>
#include <vector>
using namespace std;

View File

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

View File

@ -16,8 +16,7 @@
* 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 "Paths.h"

View File

@ -53,7 +53,7 @@ struct BASEBLOCKEX
#ifdef PCSX2_DEVBUILD
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
};

View File

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

View File

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

View File

@ -519,20 +519,17 @@ u32 SuperVUGetVIAddr(int reg, int read)
void SuperVUDumpBlock(list<VuBaseBlock*>& blocks, int vuindex)
{
FILE *f;
char filename[ g_MaxPath ], str[256];
string filename;
char str[256];
u32 *mem;
u32 i;
#ifdef _WIN32
CreateDirectory("dumps", NULL);
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
Path::CreateDirectory( "dumps" );
ssprintf( filename, "dumps\\svu%cdump%.4X.txt", s_vu?'0':'1', s_pFnHeader->startpc );
//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, "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 );
}
LARGE_INTEGER svubase, svufinal;
static u64 svutime;
// uncomment to count svu exec time
//#define SUPERVU_COUNT
@ -2319,9 +2313,6 @@ void SuperVUCleanupProgram(u32 startpc, int vuindex)
// entry point of all vu programs from emulator calls
__declspec(naked) void SuperVUExecuteProgram(u32 startpc, int vuindex)
{
#ifdef SUPERVU_COUNT
QueryPerformanceCounter(&svubase);
#endif
__asm {
mov eax, dword ptr [esp]
mov s_TotalVUCycles, 0 // necessary to be here!
@ -2457,7 +2448,7 @@ static void SuperVURecompile()
FORIT(itblock, s_listBlocks) {
VuBaseBlock::LISTBLOCKS::iterator itchild;
assert( (*itblock)->blocks.size() <= ARRAYSIZE((*itblock)->pChildJumps) );
assert( (*itblock)->blocks.size() <= ArraySize((*itblock)->pChildJumps) );
int i = 0;
FORIT(itchild, (*itblock)->blocks) {
@ -2537,12 +2528,12 @@ void svudispfntemp()
if( ((vudump&8) && g_curdebugvu) || ((vudump&0x80) && !g_curdebugvu) ) { //&& g_vu1lastrec != g_vu1last ) {
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] )
break;
}
if( i == ARRAYSIZE(badaddrs) )
if( i == ArraySize(badaddrs) )
{
//static int curesp;
//__asm mov curesp, esp
@ -3882,19 +3873,6 @@ void recVUMI_JALR( VURegs* vuu, s32 info )
branch |= 4;
}
#ifdef SUPERVU_COUNT
void StopSVUCounter()
{
QueryPerformanceCounter(&svufinal);
svutime += (u32)(svufinal.QuadPart-svubase.QuadPart);
}
void StartSVUCounter()
{
QueryPerformanceCounter(&svubase);
}
#endif
#ifdef PCSX2_DEVBUILD
void vu1xgkick(u32* pMem, u32 addr)
{

View File

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

View File

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

View File

@ -30,10 +30,6 @@ u8 g_globalXMMSaved = 0;
PCSX2_ALIGNED16( static u64 g_globalMMXData[8] );
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.
@ -228,48 +224,3 @@ __forceinline void FreezeXMMRegs_(int save)
#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
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#if !defined(_WIN32)
#ifndef strnicmp
#define strnicmp strncasecmp

View File

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

View File

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

View File

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

View File

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

View File

@ -243,7 +243,7 @@ s32 CALLBACK SPU2init()
voices[i+24].memoffset = 0x400;
// 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].pLoop = voices[i].pStart = voices[i].pCurr = (u8*)spu2mem;
@ -294,7 +294,7 @@ s32 CALLBACK SPU2open(void *pDsp)
if ( g_bPlaySound ) {
// 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].len = 0;
@ -305,11 +305,11 @@ s32 CALLBACK SPU2open(void *pDsp)
s_pCurOutput = (s16*)s_pAudioBuffers[0].pbuf;
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_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000;
s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0;
// launch the thread
@ -355,7 +355,7 @@ void CALLBACK SPU2close()
delete g_pWavRecord; g_pWavRecord = 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);
}
@ -793,7 +793,7 @@ ENDX:
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
s_nDropPacket += NSFRAMES;
@ -820,16 +820,16 @@ ENDX:
u32 duration = (u32)(newtime-s_GlobalTimeStamp);
s_nDurations[s_nCurDuration] = 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_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;
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
}
@ -959,7 +959,7 @@ void* SPU2ThreadProc(void* lpParam)
SoundFeedVoiceData(s_pAudioBuffers[nReadBuf].pbuf, s_pAudioBuffers[nReadBuf].len);
// 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);
if ( s_bThreadExit ) break;
@ -1493,16 +1493,16 @@ void save_data(freezeData *data)
memcpy(spud->SPUStartCycle, SPUStartCycle, sizeof(SPUStartCycle));
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_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000;
s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0;
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);
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(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));
voices[i].pStart = (u8*)((uptr)spud->voices[i].pStart+(uptr)spu2mem);
@ -1565,12 +1565,12 @@ void load_data(freezeData *data)
s_GlobalTimeStamp = 0;
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_nTotalDuration = ARRAYSIZE(s_nDurations)*NSFRAMES*1000;
s_nTotalDuration = ArraySize(s_nDurations)*NSFRAMES*1000;
s_nCurDuration = 0;
s_nQueuedBuffers = 0;
s_nDropPacket = 0;