git-svn-id: https://localhost/svn/Project64/trunk@44 111125ac-702d-7242-af9c-5ba8ae61c1ef

This commit is contained in:
zilmar 2010-09-22 21:43:42 +00:00
parent f92a2c67ba
commit aa45579e34
29 changed files with 534 additions and 513 deletions

Binary file not shown.

View File

@ -1,116 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "7zip"=".\SOURCE\7zip\7zip.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Common"=".\SOURCE\Common\Common.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "PjDirValidation"=".\SOURCE\PjDirValidation\PjDirValidation.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Common
End Project Dependency
}}}
###############################################################################
Project: "Project64"=".\Source\Project64\Project64.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Common
End Project Dependency
Begin Project Dependency
Project_Dep_Name 7zip
End Project Dependency
}}}
###############################################################################
Project: "RSP"=".\Source\RSP\RSP.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Common
End Project Dependency
Begin Project Dependency
Project_Dep_Name Settings
End Project Dependency
}}}
###############################################################################
Project: "Settings"=".\Source\Settings\Settings.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "WTL"=".\SOURCE\WTL\WTL.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

79
Project64.sln Normal file
View File

@ -0,0 +1,79 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7zip", "SOURCE\7zip\7zip.vcproj", "{3326E128-33AF-422C-BB7C-67CC6B915610}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "SOURCE\Common\Common.vcproj", "{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PjDirValidation", "SOURCE\PjDirValidation\PjDirValidation.vcproj", "{5AEBC82D-FA27-4EE1-8AF5-656C351DAE66}"
ProjectSection(ProjectDependencies) = postProject
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64", "Source\Project64\Project64.vcproj", "{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}"
ProjectSection(ProjectDependencies) = postProject
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421}
{3326E128-33AF-422C-BB7C-67CC6B915610} = {3326E128-33AF-422C-BB7C-67CC6B915610}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSP", "Source\RSP\RSP.vcproj", "{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}"
ProjectSection(ProjectDependencies) = postProject
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421}
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D} = {8B9961B1-88D9-4EA3-A752-507A00DD9F3D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Settings", "Source\Settings\Settings.vcproj", "{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTL", "SOURCE\WTL\WTL.vcproj", "{4BC6906B-213E-40D7-9FC7-1A93E228393D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
External Release|Win32 = External Release|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.ActiveCfg = Debug|Win32
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.Build.0 = Debug|Win32
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.ActiveCfg = External Release|Win32
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.Build.0 = External Release|Win32
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.ActiveCfg = Release|Win32
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.Build.0 = Release|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.ActiveCfg = Debug|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.Build.0 = Debug|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.ActiveCfg = External Release|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.Build.0 = External Release|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.ActiveCfg = Release|Win32
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.Build.0 = Release|Win32
{5AEBC82D-FA27-4EE1-8AF5-656C351DAE66}.Debug|Win32.ActiveCfg = Debug|Win32
{5AEBC82D-FA27-4EE1-8AF5-656C351DAE66}.External Release|Win32.ActiveCfg = Release|Win32
{5AEBC82D-FA27-4EE1-8AF5-656C351DAE66}.Release|Win32.ActiveCfg = Release|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Debug|Win32.ActiveCfg = Debug|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Debug|Win32.Build.0 = Debug|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.External Release|Win32.ActiveCfg = External Release|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.External Release|Win32.Build.0 = External Release|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Release|Win32.ActiveCfg = Release|Win32
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Release|Win32.Build.0 = Release|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.Debug|Win32.ActiveCfg = Debug|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.Debug|Win32.Build.0 = Debug|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.External Release|Win32.ActiveCfg = Release|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.External Release|Win32.Build.0 = Release|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.Release|Win32.ActiveCfg = Release|Win32
{A7ED562C-63F3-4B7E-B6B3-2CF7848752E1}.Release|Win32.Build.0 = Release|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Debug|Win32.ActiveCfg = Debug|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Debug|Win32.Build.0 = Debug|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.External Release|Win32.ActiveCfg = Release|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.External Release|Win32.Build.0 = Release|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Release|Win32.ActiveCfg = Release|Win32
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Release|Win32.Build.0 = Release|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Debug|Win32.ActiveCfg = Debug|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Debug|Win32.Build.0 = Debug|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.External Release|Win32.ActiveCfg = Release|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.External Release|Win32.Build.0 = Release|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Release|Win32.ActiveCfg = Release|Win32
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -120,6 +120,15 @@ int CIniFileBase::GetStringFromFile ( char * & String, char * &Data, int & MaxDa
int dwRead = m_File.Read(&Data[DataSize],MaxDataSize - DataSize); int dwRead = m_File.Read(&Data[DataSize],MaxDataSize - DataSize);
if (dwRead == 0) if (dwRead == 0)
{ {
if (DataSize > 0)
{
int len = DataSize + 1;
String = &Data[ReadPos];
String[len-1] = 0;
DataSize = 0;
ReadPos = 0;
return len;
}
return -1; return -1;
} }
DataSize += dwRead; DataSize += dwRead;

View File

@ -43,12 +43,12 @@ private:
int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos ); int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos );
bool MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection ); bool MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection );
const char * CleanLine ( char * const Line ); const char * CleanLine ( char * const Line );
void SaveCurrentSection ( void );
void ClearSectionPosList( long FilePos ); void ClearSectionPosList( long FilePos );
protected: protected:
void OpenIniFileReadOnly(); void OpenIniFileReadOnly();
void OpenIniFile(bool bCreate = true); void OpenIniFile(bool bCreate = true);
void SaveCurrentSection ( void );
public: public:
CIniFileBase( CFileBase & FileObject, LPCTSTR FileName ); CIniFileBase( CFileBase & FileObject, LPCTSTR FileName );
@ -113,6 +113,7 @@ public:
} }
virtual ~CIniFileT(void) virtual ~CIniFileT(void)
{ {
SaveCurrentSection();
} }
protected: protected:

View File

@ -10,37 +10,9 @@
#include "MemTest.h" #include "MemTest.h"
#ifdef MEM_LEAK_TEST #ifdef MEM_LEAK_TEST
typedef struct {
char File[300];
int line;
int size;
int order;
} DEBUG_LOCATION;
typedef std::map<void *, DEBUG_LOCATION> MEMLIST;
typedef MEMLIST::iterator MEMLIST_ITER;
class CMemList {
MEMLIST MemList;
HANDLE hSemaphone;
DWORD ThreadID;
enum INIT { Initialized = 123, NotInitialized };
INIT State;
int order;
public:
CMemList();
~CMemList();
void * AddItem ( size_t size, LPCSTR filename, int line );
void * AddItem ( size_t size, LPCSTR filename, int line, void * MemoryPtr );
void * ReAllocItem ( void * ptr, size_t size, LPCSTR filename, int line );
void removeItem ( void * ptr, bool FreePointer );
};
#include <shellapi.h> //Needed for ShellExecute #include <shellapi.h> //Needed for ShellExecute
#pragma comment(lib, "shell32.lib") //Needed for ShellExecute #pragma comment(lib, "shell32.lib") //Needed for ShellExecute
#include <tchar.h>
#undef new #undef new
#undef malloc #undef malloc
#undef realloc #undef realloc
@ -63,30 +35,53 @@ CMemList::CMemList() {
hSemaphone = CreateSemaphore(NULL, 1,1, NULL); hSemaphone = CreateSemaphore(NULL, 1,1, NULL);
State = Initialized; State = Initialized;
order = 0; order = 0;
LogAllocate = false;
ThreadID = 0;
m_hModule = NULL;
for (UINT_PTR TestLoc = ((UINT_PTR)::MemList) & ~0xFFF; TestLoc != 0; TestLoc -= 0x1000)
{
WORD HeaderID = *(WORD *)TestLoc;
if (HeaderID != 'ZM')
{
continue;
}
m_hModule = (HMODULE)TestLoc;
break;
}
} }
CMemList::~CMemList() { CMemList::~CMemList() {
int ItemsLeft = MemList.size(); size_t ItemsLeft = MemList.size();
if (ItemsLeft > 0) { if (ItemsLeft > 0) {
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR]; TCHAR path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH]; TCHAR fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer)); memset(path_buffer, 0, sizeof(path_buffer));
_splitpath( path_buffer, drive, dir, fname, ext ); memset(drive, 0, sizeof(drive));
_makepath( LogFileName, drive, dir, fname, "leak.csv" ); memset(dir, 0, sizeof(dir));
memset(fname, 0, sizeof(fname));
memset(ext, 0, sizeof(ext));
memset(LogFileName, 0, sizeof(LogFileName));
GetModuleFileName(m_hModule,path_buffer,sizeof(path_buffer));
_tsplitpath( path_buffer, drive, dir, fname, ext );
_tmakepath( LogFileName, drive, dir, fname, _T("leak.csv") );
HANDLE hLogFile; HANDLE hLogFile = INVALID_HANDLE_VALUE;
do do
{ {
hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hLogFile == INVALID_HANDLE_VALUE) if (hLogFile == INVALID_HANDLE_VALUE)
{ {
if (GetLastError() == ERROR_SHARING_VIOLATION) { if (GetLastError() == ERROR_SHARING_VIOLATION) {
std::string Msg = std::string(LogFileName) + "\nCan not be opened for writing please close app using this file\n\nTry Again ?"; TCHAR Msg[3000];
int Result = MessageBox(NULL,Msg.c_str(),"Memory Leak",MB_YESNO|MB_ICONQUESTION|MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION); _stprintf(Msg,TEXT("%s\nCan not be opened for writing please close app using this file\n\nTry Again ?"),LogFileName);
int Result = MessageBox(NULL,Msg,_T("Memory Leak"),MB_YESNO|MB_ICONQUESTION|MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
if (Result == IDNO) { if (Result == IDNO) {
break; break;
} }
@ -98,10 +93,10 @@ CMemList::~CMemList() {
{ {
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN); SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
DWORD dwWritten; DWORD dwWritten = 0;
char Msg[800]; char Msg[800];
_snprintf(Msg,sizeof(Msg),"Order, Source File, Line Number, Mem Size\r\n"); _snprintf(Msg,sizeof(Msg),"Order, Source File, Line Number, Mem Size\r\n");
WriteFile( hLogFile,Msg,strlen(Msg),&dwWritten,NULL ); WriteFile( hLogFile,Msg,(DWORD)strlen(Msg),&dwWritten,NULL );
for (MEMLIST_ITER item = MemList.begin(); item != MemList.end(); item++) for (MEMLIST_ITER item = MemList.begin(); item != MemList.end(); item++)
{ {
@ -110,14 +105,15 @@ CMemList::~CMemList() {
(*item).second.File, (*item).second.File,
(*item).second.line, (*item).second.line,
(*item).second.size); (*item).second.size);
WriteFile( hLogFile,Msg,strlen(Msg),&dwWritten,NULL ); WriteFile( hLogFile,Msg,(DWORD)strlen(Msg),&dwWritten,NULL );
} }
CloseHandle(hLogFile); CloseHandle(hLogFile);
} }
std::string Msg = std::string(fname) + std::string(ext) + "\n\nMemory Leaks detected\n\nOpen the Log File ?"; TCHAR Msg[3000];
int Result = MessageBox(NULL,Msg.c_str(),"Memory Leak",MB_YESNO|MB_ICONQUESTION|MB_SETFOREGROUND| MB_SERVICE_NOTIFICATION); _stprintf(Msg,TEXT("%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?"),fname,ext);
int Result = MessageBox(NULL,Msg,_T("Memory Leak"),MB_YESNO|MB_ICONQUESTION|MB_SETFOREGROUND| MB_SERVICE_NOTIFICATION);
if (Result == IDYES) { if (Result == IDYES) {
ShellExecute(NULL,"open",LogFileName,NULL,NULL,SW_SHOW); ShellExecute(NULL,_T("open"),LogFileName,NULL,NULL,SW_SHOW);
} }
} }
CloseHandle(hSemaphone); CloseHandle(hSemaphone);
@ -125,18 +121,18 @@ CMemList::~CMemList() {
State = NotInitialized; State = NotInitialized;
} }
void * CMemList::AddItem ( size_t size, char * filename, int line)
void * CMemList::AddItem ( size_t size, LPCSTR filename, int line)
{ {
void *res = malloc(size); void *res = malloc(size);
if (res == NULL) { if (res == NULL)
_asm int 3 {
return res;
} }
return AddItem(size,filename,line,res); RecordAddItem(res,size,filename,line);
return res;
} }
void * CMemList::AddItem ( size_t size, LPCSTR filename, int line, void * MemoryPtr ) void CMemList::RecordAddItem ( void * ptr, size_t size, const char * filename, int line)
{ {
__try { __try {
if (State == Initialized && hSemaphone != NULL) { if (State == Initialized && hSemaphone != NULL) {
@ -148,27 +144,32 @@ void * CMemList::AddItem ( size_t size, LPCSTR filename, int line, void * Memory
DEBUG_LOCATION info; DEBUG_LOCATION info;
strncpy(info.File,filename,sizeof(info.File)); strncpy(info.File,filename,sizeof(info.File));
info.line = line; info.line = line;
info.size = size; info.size = (int)size;
info.order = order++; info.order = order++;
MemList.insert(MEMLIST::value_type(MemoryPtr,info)); Insert(ptr, info);
long dwSemCount = 0; long dwSemCount = 0;
ThreadID = -1; ThreadID = (DWORD)-1;
ReleaseSemaphore(hSemaphone,1,&dwSemCount); ReleaseSemaphore(hSemaphone,1,&dwSemCount);
} }
} }
} __except (EXCEPTION_EXECUTE_HANDLER) { } __except (EXCEPTION_EXECUTE_HANDLER) {
_asm int 3 //_asm int 3
} }
return MemoryPtr;
} }
void * CMemList::ReAllocItem ( void * ptr, size_t size, LPCSTR filename, int line) void CMemList::Insert(void *res, DEBUG_LOCATION &info)
{
MemList.insert(MEMLIST::value_type(res,info));
}
void * CMemList::ReAllocItem ( void * ptr, size_t size, const char * filename, int line)
{ {
void *res = realloc(ptr, size); void *res = realloc(ptr, size);
if (res == NULL) if (res == NULL)
{ {
_asm int 3 return res;
} }
if (ptr != res) { if (ptr != res) {
__try { __try {
@ -181,52 +182,54 @@ void * CMemList::ReAllocItem ( void * ptr, size_t size, LPCSTR filename, int lin
DEBUG_LOCATION info; DEBUG_LOCATION info;
strncpy(info.File,filename,sizeof(info.File)); strncpy(info.File,filename,sizeof(info.File));
info.line = line; info.line = line;
info.size = size; info.size = (int)size;
info.order = order++; info.order = order++;
MemList.insert(MEMLIST::value_type(res,info)); Insert(res, info);
//remove old pointer //remove old pointer
MEMLIST_ITER item = MemList.find(ptr); Remove(ptr);
if (item != MemList.end()) {
MemList.erase(ptr);
}
long dwSemCount = 0; long dwSemCount = 0;
ThreadID = -1; ThreadID = (DWORD)-1;
ReleaseSemaphore(hSemaphone,1,&dwSemCount); ReleaseSemaphore(hSemaphone,1,&dwSemCount);
} }
} }
} __except (EXCEPTION_EXECUTE_HANDLER) { } __except (EXCEPTION_EXECUTE_HANDLER) {
_asm int 3 //_asm int 3
} }
} }
return res; return res;
} }
void CMemList::removeItem (void * ptr, bool FreePointer ) void CMemList::Remove(void *ptr)
{ {
if (FreePointer) //remove old pointer
{ MEMLIST_ITER item = MemList.find(ptr);
free(ptr); if (item != MemList.end()) {
MemList.erase(ptr);
} }
}
void CMemList::removeItem (void * ptr )
{
free(ptr);
__try { __try {
if (State == Initialized && hSemaphone != NULL) { if (State == Initialized && hSemaphone != NULL) {
DWORD CurrentThread = GetCurrentThreadId(); DWORD CurrentThread = GetCurrentThreadId();
DWORD Result = WaitForSingleObject(hSemaphone,CurrentThread != ThreadID ? 30000 : 0); DWORD Result = WaitForSingleObject(hSemaphone,CurrentThread != ThreadID ? 30000 : 0);
if (Result != WAIT_TIMEOUT) { if (Result != WAIT_TIMEOUT) {
ThreadID = CurrentThread; ThreadID = CurrentThread;
MEMLIST_ITER item = MemList.find(ptr);
if (item != MemList.end()) { Remove(ptr);
MemList.erase(ptr);
}
long dwSemCount = 0; long dwSemCount = 0;
ThreadID = -1; ThreadID = (DWORD)-1;
ReleaseSemaphore(hSemaphone,1,&dwSemCount); ReleaseSemaphore(hSemaphone,1,&dwSemCount);
} }
} }
}__except(EXCEPTION_EXECUTE_HANDLER ){ }__except(EXCEPTION_EXECUTE_HANDLER ){
_asm int 3 //_asm int 3
} }
} }
@ -242,11 +245,6 @@ void* MemTest_realloc (void* ptr, size_t size, char* filename, int line) {
return MemList()->ReAllocItem(ptr, size,filename,line); return MemList()->ReAllocItem(ptr, size,filename,line);
} }
void MemTest_free(void* ptr)
{
MemList()->removeItem(ptr,true);
}
void* operator new (size_t size, char* filename, int line) void* operator new (size_t size, char* filename, int line)
{ {
return MemList()->AddItem(size,filename,line); return MemList()->AddItem(size,filename,line);
@ -269,7 +267,7 @@ void* operator new [] (size_t size)
void operator delete ( void* ptr) void operator delete ( void* ptr)
{ {
MemList()->removeItem(ptr,true); MemList()->removeItem(ptr);
} }
void operator delete[](void* ptr) void operator delete[](void* ptr)
@ -289,7 +287,7 @@ LPVOID MemTest_VirtualAlloc(
if (ptr && lpAddress == NULL && (flAllocationType & MEM_RESERVE) != 0) if (ptr && lpAddress == NULL && (flAllocationType & MEM_RESERVE) != 0)
{ {
MemList()->AddItem(dwSize,filename,line,ptr); MemList()->RecordAddItem(ptr,dwSize,filename,line);
} }
return ptr; return ptr;
} }
@ -298,7 +296,7 @@ BOOL MemTest_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType )
{ {
if ((dwFreeType & MEM_RELEASE) != 0) if ((dwFreeType & MEM_RELEASE) != 0)
{ {
MemList()->removeItem(lpAddress,false); MemList()->removeItem(lpAddress);
} }
return VirtualFree(lpAddress,dwSize,dwFreeType); return VirtualFree(lpAddress,dwSize,dwFreeType);
} }

View File

@ -10,26 +10,57 @@
#pragma warning(disable:4786) #pragma warning(disable:4786)
#pragma warning(disable:4291) #pragma warning(disable:4291)
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#include <windows.h> #include <windows.h>
#include <map>
#ifdef __cplusplus #include <crtdbg.h>
#include <new>
#include <memory>
#include <malloc.h> #include <malloc.h>
#include <fstream>
#include <xdebug>
#include <xlocale>
#include <xlocnum>
#include <xlocmon>
#include <sstream>
#include <list>
extern "C" {
#endif
void* MemTest_malloc(size_t size, char* filename, int line);
void* MemTest_realloc(void* ptr, size_t size, char* filename, int line);
void MemTest_AddLeak(char* Comment);
void MemTest_free(void* ptr);
LPVOID MemTest_VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect, LPCSTR filename, int line);
BOOL MemTest_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
typedef struct {
char File[300];
int line;
int size;
int order;
} DEBUG_LOCATION;
typedef std::map<void *, DEBUG_LOCATION> MEMLIST;
typedef MEMLIST::iterator MEMLIST_ITER;
class CMemList {
MEMLIST MemList;
HANDLE hSemaphone;
DWORD ThreadID;
HMODULE m_hModule;
enum INIT { Initialized = 123, NotInitialized };
INIT State;
int order;
bool LogAllocate;
void Insert(void *res, DEBUG_LOCATION &info);
void Remove(void *ptr);
public:
CMemList();
~CMemList();
void * AddItem ( size_t size, char * filename, int line );
void * ReAllocItem ( void * ptr, size_t size, const char * filename, int line );
void removeItem ( void * ptr );
void RecordAddItem ( void * ptr, size_t size, const char * filename, int line );
};
void* operator new (size_t size ); void* operator new (size_t size );
void* operator new (size_t size, char* filename, int line); void* operator new (size_t size, char* filename, int line);
void* operator new [] (size_t size ); void* operator new [] (size_t size );
@ -37,18 +68,22 @@ void* operator new [] (size_t size, char* filename, int line);
void operator delete ( void* ptr); void operator delete ( void* ptr);
void operator delete[](void* ptr); void operator delete[](void* ptr);
void* MemTest_malloc(size_t size, char* filename, int line);
void* MemTest_realloc(void* ptr, size_t size, char* filename, int line);
void MemTest_AddLeak(char* Comment);
LPVOID MemTest_VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, LPCSTR filename, int line);
BOOL MemTest_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType );
#endif
#undef new #undef new
#define new new(__FILE__, __LINE__)
#endif
#endif
#undef malloc #undef malloc
#undef free #undef free
#define new new(__FILE__, __LINE__)
#define malloc(x) (MemTest_malloc((x),__FILE__, __LINE__)) #define malloc(x) (MemTest_malloc((x),__FILE__, __LINE__))
#define realloc(mem,x) (MemTest_realloc((mem),(x),__FILE__, __LINE__)) #define realloc(mem,x) (MemTest_realloc((mem),(x),__FILE__, __LINE__))
#define free(x) (MemTest_free (x)) #define free(x) (delete (x))
#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect ) \ #define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect ) \
(MemTest_VirtualAlloc((lpAddress), (dwSize), (flAllocationType), (flProtect),__FILE__, __LINE__)) (MemTest_VirtualAlloc((lpAddress), (dwSize), (flAllocationType), (flProtect),__FILE__, __LINE__))
#define VirtualFree(lpAddress, dwSize, dwFreeType ) \ #define VirtualFree(lpAddress, dwSize, dwFreeType ) \

View File

@ -37,11 +37,11 @@ CTraceModule * CTraceLog::RemoveTraceModule ( CTraceModule * TraceModule )
{ {
CGuard Guard(m_CS); CGuard Guard(m_CS);
for (int i = 0; i < (int)m_Modules.size(); i++ ) for (std::vector<CTraceModule *>::iterator itr = m_Modules.begin(); itr != m_Modules.end(); itr++)
{ {
if (m_Modules[i] == TraceModule) if ((*itr) == TraceModule)
{ {
m_Modules.erase(&m_Modules[i]); m_Modules.erase(itr);
return TraceModule; return TraceModule;
} }
} }

View File

@ -310,14 +310,14 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C
int numrepeats = (Code.Command & 0x0000FF00) >> 8; int numrepeats = (Code.Command & 0x0000FF00) >> 8;
int offset = Code.Command & 0x000000FF; int offset = Code.Command & 0x000000FF;
int incr = Code.Value; int incr = Code.Value;
int count; int i;
switch (NextCodeEntry.Command & 0xFF000000) { switch (NextCodeEntry.Command & 0xFF000000) {
case 0x10000000: // Xplorer64 case 0x10000000: // Xplorer64
case 0x80000000: case 0x80000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF); Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value; wMemory = NextCodeEntry.Value;
for (count=0; count<numrepeats; count++) { for (i=0; i<numrepeats; i++) {
_MMU->SB_VAddr(Address,wMemory); _MMU->SB_VAddr(Address,wMemory);
Address += offset; Address += offset;
wMemory += incr; wMemory += incr;
@ -327,7 +327,7 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C
case 0x81000000: case 0x81000000:
Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF); Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF);
wMemory = NextCodeEntry.Value; wMemory = NextCodeEntry.Value;
for (count=0; count<numrepeats; count++) { for (i=0; i<numrepeats; i++) {
_MMU->SH_VAddr(Address,wMemory); _MMU->SH_VAddr(Address,wMemory);
Address += offset; Address += offset;
wMemory += incr; wMemory += incr;
@ -554,7 +554,7 @@ bool CCheats::CheatUsesCodeExtensions (const stdstr &LineEntry) {
const char *ReadPos = &(LineEntry.c_str())[EndOfName + 2]; const char *ReadPos = &(LineEntry.c_str())[EndOfName + 2];
bool CodeExtension = false; bool CodeExtension = false;
for (int count = 0; count < MaxGSEntries && CodeExtension == false; count ++) { for (int i = 0; i < MaxGSEntries && CodeExtension == false; i ++) {
if (strchr(ReadPos,' ') == NULL) { break; } if (strchr(ReadPos,' ') == NULL) { break; }
ReadPos = strchr(ReadPos,' ') + 1; ReadPos = strchr(ReadPos,' ') + 1;
if (ReadPos[0] == '?' && ReadPos[1]== '?') { CodeExtension = true; } if (ReadPos[0] == '?' && ReadPos[1]== '?') { CodeExtension = true; }
@ -574,11 +574,11 @@ void CCheats::RefreshCheatManager(void)
m_DeleteingEntries = true; m_DeleteingEntries = true;
TreeView_DeleteAllItems((HWND)m_hCheatTree); TreeView_DeleteAllItems((HWND)m_hCheatTree);
m_DeleteingEntries = false; m_DeleteingEntries = false;
for (int count = 0; count < MaxCheats; count ++ ) { for (int i = 0; i < MaxCheats; i ++ ) {
stdstr Name = GetCheatName(count,true); stdstr Name = GetCheatName(i,true);
if (Name.length() == 0) { break; } if (Name.length() == 0) { break; }
AddCodeLayers(count,Name,(WND_HANDLE)TVI_ROOT, _Settings->LoadBoolIndex(Cheat_Active,count) != 0); AddCodeLayers(i,Name,(WND_HANDLE)TVI_ROOT, _Settings->LoadBoolIndex(Cheat_Active,i) != 0);
} }
} }
@ -742,27 +742,28 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO
CCheats * _this = (CCheats *)GetProp((HWND)hDlg,"Class"); CCheats * _this = (CCheats *)GetProp((HWND)hDlg,"Class");
stdstr NewCheatName = GetDlgItemStr(hDlg,IDC_CODE_NAME); stdstr NewCheatName = GetDlgItemStr(hDlg,IDC_CODE_NAME);
for (int count = 0; count < MaxCheats; count ++) { int i = 0;
if (_this->m_EditCheat == count) for (i = 0; i < MaxCheats; i ++) {
if (_this->m_EditCheat == i)
{ {
continue; continue;
} }
stdstr CheatName(_this->GetCheatName(count,false)); stdstr CheatName(_this->GetCheatName(i,false));
if (CheatName.length() == 0) if (CheatName.length() == 0)
{ {
if (_this->m_EditCheat < 0) if (_this->m_EditCheat < 0)
{ {
_this->m_EditCheat = count; _this->m_EditCheat = i;
} }
break; break;
} }
if (stricmp(CheatName.c_str(),NewCheatName.c_str()) == 0) { if (_stricmp(CheatName.c_str(),NewCheatName.c_str()) == 0) {
_Notify->DisplayError(GS(MSG_CHEAT_NAME_IN_USE)); _Notify->DisplayError(GS(MSG_CHEAT_NAME_IN_USE));
SetFocus(GetDlgItem((HWND)hDlg,IDC_CODE_NAME)); SetFocus(GetDlgItem((HWND)hDlg,IDC_CODE_NAME));
return true; return true;
} }
} }
if (_this->m_EditCheat < 0 && count == MaxCheats) { if (_this->m_EditCheat < 0 && i == MaxCheats) {
_Notify->DisplayError(GS(MSG_MAX_CHEATS)); _Notify->DisplayError(GS(MSG_MAX_CHEATS));
return true; return true;
} }
@ -830,7 +831,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO
LPCSTR ReadPos = strrchr(String,'"') + 2; LPCSTR ReadPos = strrchr(String,'"') + 2;
stdstr Buffer; stdstr Buffer;
do { do {
char * End = strchr(ReadPos,','); char * End = strchr((char *)ReadPos,',');
if (End) if (End)
{ {
Buffer.append(ReadPos,End - ReadPos); Buffer.append(ReadPos,End - ReadPos);
@ -853,7 +854,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO
if (ReadPos) { if (ReadPos) {
ReadPos += 1; ReadPos += 1;
do { do {
char * End = strchr(ReadPos,','); char * End = strchr((char *)ReadPos,',');
if (End) if (End)
{ {
Buffer.append(ReadPos,End - ReadPos); Buffer.append(ReadPos,End - ReadPos);
@ -1133,7 +1134,7 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW
//Update cheat listing with new extention //Update cheat listing with new extention
stdstr CheatName(_this->GetCheatName(item.lParam,true)); stdstr CheatName(_this->GetCheatName(item.lParam,true));
char * Cheat = strrchr(CheatName.c_str(),'\\'); char * Cheat = strrchr((char *)CheatName.c_str(),'\\');
if (Cheat == NULL) { if (Cheat == NULL) {
Cheat = const_cast<char *>(CheatName.c_str()); Cheat = const_cast<char *>(CheatName.c_str());
} else { } else {
@ -1525,8 +1526,8 @@ void CCheats::MenuSetText ( MENU_HANDLE hMenu, int MenuPos, const char * Title,
MenuInfo.cch = 256; MenuInfo.cch = 256;
GetMenuItemInfo((HMENU)hMenu,MenuPos,true,&MenuInfo); GetMenuItemInfo((HMENU)hMenu,MenuPos,true,&MenuInfo);
if (strchr(Title,'\t') != NULL) { *(strchr(Title,'\t')) = '\0'; }
strcpy(String,Title); strcpy(String,Title);
if (strchr(String,'\t') != NULL) { *(strchr(String,'\t')) = '\0'; }
if (ShotCut) { sprintf(String,"%s\t%s",String,ShotCut); } if (ShotCut) { sprintf(String,"%s\t%s",String,ShotCut); }
SetMenuItemInfo((HMENU)hMenu,MenuPos,true,&MenuInfo); SetMenuItemInfo((HMENU)hMenu,MenuPos,true,&MenuInfo);
} }

View File

@ -2,15 +2,17 @@ class CDMA
{ {
CDMA(); CDMA();
public:
void SP_DMA_READ ( void );
void SP_DMA_WRITE ( void );
void PI_DMA_READ ( void );
void PI_DMA_WRITE ( void );
protected: protected:
CDMA (CFlashram & FlashRam, CSram & Sram); CDMA (CFlashram & FlashRam, CSram & Sram);
void PI_DMA_READ ( void );
void PI_DMA_WRITE ( void );
//void SI_DMA_READ ( void ); //void SI_DMA_READ ( void );
//void SI_DMA_WRITE ( void ); //void SI_DMA_WRITE ( void );
void SP_DMA_READ ( void );
void SP_DMA_WRITE ( void );
private: private:
CFlashram & m_FlashRam; CFlashram & m_FlashRam;

View File

@ -34,10 +34,10 @@ void CMipsMemoryVM::Reset( bool EraseMemory )
{ {
memset(m_TLB_ReadMap,0,(0xFFFFF * sizeof(DWORD))); memset(m_TLB_ReadMap,0,(0xFFFFF * sizeof(DWORD)));
memset(m_TLB_WriteMap,0,(0xFFFFF * sizeof(DWORD))); memset(m_TLB_WriteMap,0,(0xFFFFF * sizeof(DWORD)));
for (DWORD count = 0x80000000; count < 0xC0000000; count += 0x1000) for (DWORD address = 0x80000000; address < 0xC0000000; address += 0x1000)
{ {
m_TLB_ReadMap[count >> 12] = ((DWORD)m_RDRAM + (count & 0x1FFFFFFF)) - count; m_TLB_ReadMap[address >> 12] = ((DWORD)m_RDRAM + (address & 0x1FFFFFFF)) - address;
m_TLB_WriteMap[count >> 12] = ((DWORD)m_RDRAM + (count & 0x1FFFFFFF)) - count; m_TLB_WriteMap[address >> 12] = ((DWORD)m_RDRAM + (address & 0x1FFFFFFF)) - address;
} }
if (_Settings->LoadDword(Rdb_TLB_VAddrStart) != 0) if (_Settings->LoadDword(Rdb_TLB_VAddrStart) != 0)
@ -46,9 +46,9 @@ void CMipsMemoryVM::Reset( bool EraseMemory )
DWORD Len = _Settings->LoadDword(Rdb_TLB_VAddrLen); //0x01000000; DWORD Len = _Settings->LoadDword(Rdb_TLB_VAddrLen); //0x01000000;
DWORD PAddr = _Settings->LoadDword(Rdb_TLB_PAddrStart); //0x10034b30; DWORD PAddr = _Settings->LoadDword(Rdb_TLB_PAddrStart); //0x10034b30;
DWORD End = Start + Len; DWORD End = Start + Len;
for (count = Start; count < End; count += 0x1000) { for (DWORD address = Start; address < End; address += 0x1000) {
m_TLB_ReadMap[count >> 12] = ((DWORD)m_RDRAM + (count - Start + PAddr)) - count; m_TLB_ReadMap[address >> 12] = ((DWORD)m_RDRAM + (address - Start + PAddr)) - address;
m_TLB_WriteMap[count >> 12] = ((DWORD)m_RDRAM + (count - Start + PAddr)) - count; m_TLB_WriteMap[address >> 12] = ((DWORD)m_RDRAM + (address - Start + PAddr)) - address;
} }
} }
} }
@ -415,7 +415,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) {
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ;
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)this,x86_ECX); MoveConstToX86reg((DWORD)this,x86_ECX);
Call_Direct(AddressOf(CMipsMemoryVM::UpdateHalfLine),"CMipsMemoryVM::UpdateHalfLine"); Call_Direct(AddressOf(&CMipsMemoryVM::UpdateHalfLine),"CMipsMemoryVM::UpdateHalfLine");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
MoveVariableToX86reg(&m_HalfLine,"m_HalfLine",Reg); MoveVariableToX86reg(&m_HalfLine,"m_HalfLine",Reg);
break; break;
@ -434,7 +434,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) {
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ;
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Audio,x86_ECX); MoveConstToX86reg((DWORD)_Audio,x86_ECX);
Call_Direct(AddressOf(CAudio::GetLength),"CAudio::GetLength"); Call_Direct(AddressOf(&CAudio::GetLength),"CAudio::GetLength");
MoveX86regToVariable(x86_EAX,&m_TempValue,"m_TempValue"); MoveX86regToVariable(x86_EAX,&m_TempValue,"m_TempValue");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
MoveVariableToX86reg(&m_TempValue,"m_TempValue",Reg); MoveVariableToX86reg(&m_TempValue,"m_TempValue",Reg);
@ -455,7 +455,7 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) {
{ {
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Audio,x86_ECX); MoveConstToX86reg((DWORD)_Audio,x86_ECX);
Call_Direct(AddressOf(CAudio::GetStatus),"GetStatus"); Call_Direct(AddressOf(&CAudio::GetStatus),"GetStatus");
MoveX86regToVariable(x86_EAX,&m_TempValue,"m_TempValue"); MoveX86regToVariable(x86_EAX,&m_TempValue,"m_TempValue");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
MoveVariableToX86reg(&m_TempValue,"m_TempValue",Reg); MoveVariableToX86reg(&m_TempValue,"m_TempValue",Reg);
@ -680,7 +680,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
MoveConstToVariable(Value,&_Reg->SP_RD_LEN_REG,"SP_RD_LEN_REG"); MoveConstToVariable(Value,&_Reg->SP_RD_LEN_REG,"SP_RD_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::SP_DMA_READ),"CDMA::SP_DMA_READ"); Call_Direct(AddressOf(&CDMA::SP_DMA_READ),"CDMA::SP_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04040010: case 0x04040010:
@ -723,7 +723,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
OrConstToVariable(MI_INTR_SP,&_Reg->MI_INTR_REG,"MI_INTR_REG"); OrConstToVariable(MI_INTR_SP,&_Reg->MI_INTR_REG,"MI_INTR_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
if ( ( Value & SP_CLR_INTR ) != 0) { if ( ( Value & SP_CLR_INTR ) != 0) {
@ -732,7 +732,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
Call_Direct(RunRsp,"RunRsp"); Call_Direct(RunRsp,"RunRsp");
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} else { } else {
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
@ -839,7 +839,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
AndConstToVariable(~MI_INTR_VI,&_Reg->MI_INTR_REG,"MI_INTR_REG"); AndConstToVariable(~MI_INTR_VI,&_Reg->MI_INTR_REG,"MI_INTR_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04400014: MoveConstToVariable(Value,&_Reg->VI_BURST_REG,"VI_BURST_REG"); break; case 0x04400014: MoveConstToVariable(Value,&_Reg->VI_BURST_REG,"VI_BURST_REG"); break;
@ -865,7 +865,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
{ {
X86BreakPoint(__FILE__,__LINE__); X86BreakPoint(__FILE__,__LINE__);
MoveConstToX86reg((DWORD)_Audio,x86_ECX); MoveConstToX86reg((DWORD)_Audio,x86_ECX);
Call_Direct(AddressOf(CAudio::LenChanged),"LenChanged"); Call_Direct(AddressOf(&CAudio::LenChanged),"LenChanged");
} else { } else {
Call_Direct(_Plugins->Audio()->LenChanged,"AiLenChanged"); Call_Direct(_Plugins->Audio()->LenChanged,"AiLenChanged");
} }
@ -883,7 +883,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
#endif #endif
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04500010: case 0x04500010:
@ -905,14 +905,14 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
MoveConstToVariable(Value,&_Reg->PI_RD_LEN_REG,"PI_RD_LEN_REG"); MoveConstToVariable(Value,&_Reg->PI_RD_LEN_REG,"PI_RD_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::PI_DMA_READ),"CDMA::PI_DMA_READ"); Call_Direct(AddressOf(&CDMA::PI_DMA_READ),"CDMA::PI_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x0460000C: case 0x0460000C:
MoveConstToVariable(Value,&_Reg->PI_WR_LEN_REG,"PI_WR_LEN_REG"); MoveConstToVariable(Value,&_Reg->PI_WR_LEN_REG,"PI_WR_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::PI_DMA_WRITE),"CDMA::PI_DMA_WRITE"); Call_Direct(AddressOf(&CDMA::PI_DMA_WRITE),"CDMA::PI_DMA_WRITE");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04600010: case 0x04600010:
@ -920,7 +920,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
AndConstToVariable(~MI_INTR_PI,&_Reg->MI_INTR_REG,"MI_INTR_REG"); AndConstToVariable(~MI_INTR_PI,&_Reg->MI_INTR_REG,"MI_INTR_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
break; break;
@ -949,14 +949,14 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
MoveConstToVariable(Value,&_Reg->SI_PIF_ADDR_RD64B_REG,"SI_PIF_ADDR_RD64B_REG"); MoveConstToVariable(Value,&_Reg->SI_PIF_ADDR_RD64B_REG,"SI_PIF_ADDR_RD64B_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX); MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX);
Call_Direct(AddressOf(CPifRam::SI_DMA_READ),"CPifRam::SI_DMA_READ"); Call_Direct(AddressOf(&CPifRam::SI_DMA_READ),"CPifRam::SI_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04800010: case 0x04800010:
MoveConstToVariable(Value,&_Reg->SI_PIF_ADDR_WR64B_REG,"SI_PIF_ADDR_WR64B_REG"); MoveConstToVariable(Value,&_Reg->SI_PIF_ADDR_WR64B_REG,"SI_PIF_ADDR_WR64B_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX); MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX);
Call_Direct(AddressOf(CPifRam::SI_DMA_WRITE),"CPifRam::SI_DMA_WRITE"); Call_Direct(AddressOf(&CPifRam::SI_DMA_WRITE),"CPifRam::SI_DMA_WRITE");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04800018: case 0x04800018:
@ -964,7 +964,7 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
AndConstToVariable(~SI_STATUS_INTERRUPT,&_Reg->SI_STATUS_REG,"SI_STATUS_REG"); AndConstToVariable(~SI_STATUS_INTERRUPT,&_Reg->SI_STATUS_REG,"SI_STATUS_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
default: default:
@ -1008,14 +1008,14 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
MoveX86regToVariable(Reg,&_Reg->SP_RD_LEN_REG,"SP_RD_LEN_REG"); MoveX86regToVariable(Reg,&_Reg->SP_RD_LEN_REG,"SP_RD_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::SP_DMA_READ),"CDMA::SP_DMA_READ"); Call_Direct(AddressOf(&CDMA::SP_DMA_READ),"CDMA::SP_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x0404000C: case 0x0404000C:
MoveX86regToVariable(Reg,&_Reg->SP_WR_LEN_REG,"SP_WR_LEN_REG"); MoveX86regToVariable(Reg,&_Reg->SP_WR_LEN_REG,"SP_WR_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::SP_DMA_WRITE),"CDMA::SP_DMA_WRITE"); Call_Direct(AddressOf(&CDMA::SP_DMA_WRITE),"CDMA::SP_DMA_WRITE");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04040010: case 0x04040010:
@ -1102,7 +1102,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
AndConstToVariable(~MI_INTR_VI,&_Reg->MI_INTR_REG,"MI_INTR_REG"); AndConstToVariable(~MI_INTR_VI,&_Reg->MI_INTR_REG,"MI_INTR_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04400014: MoveX86regToVariable(Reg,&_Reg->VI_BURST_REG,"VI_BURST_REG"); break; case 0x04400014: MoveX86regToVariable(Reg,&_Reg->VI_BURST_REG,"VI_BURST_REG"); break;
@ -1131,7 +1131,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
if (_Settings->LoadBool(Game_FixedAudio)) if (_Settings->LoadBool(Game_FixedAudio))
{ {
MoveConstToX86reg((DWORD)_Audio,x86_ECX); MoveConstToX86reg((DWORD)_Audio,x86_ECX);
Call_Direct(AddressOf(CAudio::LenChanged),"LenChanged"); Call_Direct(AddressOf(&CAudio::LenChanged),"LenChanged");
} else { } else {
Call_Direct(_Plugins->Audio()->LenChanged,"_Plugins->Audio()->LenChanged"); Call_Direct(_Plugins->Audio()->LenChanged,"_Plugins->Audio()->LenChanged");
} }
@ -1146,7 +1146,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
AndConstToVariable(~MI_INTR_AI,&_Reg->m_AudioIntrReg,"m_AudioIntrReg"); AndConstToVariable(~MI_INTR_AI,&_Reg->m_AudioIntrReg,"m_AudioIntrReg");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04500010: case 0x04500010:
@ -1167,14 +1167,14 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
MoveX86regToVariable(Reg,&_Reg->PI_RD_LEN_REG,"PI_RD_LEN_REG"); MoveX86regToVariable(Reg,&_Reg->PI_RD_LEN_REG,"PI_RD_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::PI_DMA_READ),"CDMA::PI_DMA_READ"); Call_Direct(AddressOf(&CDMA::PI_DMA_READ),"CDMA::PI_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x0460000C: case 0x0460000C:
MoveX86regToVariable(Reg,&_Reg->PI_WR_LEN_REG,"PI_WR_LEN_REG"); MoveX86regToVariable(Reg,&_Reg->PI_WR_LEN_REG,"PI_WR_LEN_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX); MoveConstToX86reg((ULONG)((CDMA *)this),x86_ECX);
Call_Direct(AddressOf(CDMA::PI_DMA_WRITE),"CDMA::PI_DMA_WRITE"); Call_Direct(AddressOf(&CDMA::PI_DMA_WRITE),"CDMA::PI_DMA_WRITE");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04600010: case 0x04600010:
@ -1182,7 +1182,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
AndConstToVariable(~MI_INTR_PI,&_Reg->MI_INTR_REG,"MI_INTR_REG"); AndConstToVariable(~MI_INTR_PI,&_Reg->MI_INTR_REG,"MI_INTR_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
MoveX86regToVariable(Reg,&_Reg->VI_ORIGIN_REG,"VI_ORIGIN_REG"); MoveX86regToVariable(Reg,&_Reg->VI_ORIGIN_REG,"VI_ORIGIN_REG");
@ -1222,14 +1222,14 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
MoveX86regToVariable(Reg,&_Reg->SI_PIF_ADDR_RD64B_REG,"SI_PIF_ADDR_RD64B_REG"); MoveX86regToVariable(Reg,&_Reg->SI_PIF_ADDR_RD64B_REG,"SI_PIF_ADDR_RD64B_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX); MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX);
Call_Direct(AddressOf(CPifRam::SI_DMA_READ),"CPifRam::SI_DMA_READ"); Call_Direct(AddressOf(&CPifRam::SI_DMA_READ),"CPifRam::SI_DMA_READ");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04800010: case 0x04800010:
MoveX86regToVariable(Reg,&_Reg->SI_PIF_ADDR_WR64B_REG,"SI_PIF_ADDR_WR64B_REG"); MoveX86regToVariable(Reg,&_Reg->SI_PIF_ADDR_WR64B_REG,"SI_PIF_ADDR_WR64B_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX); MoveConstToX86reg((DWORD)((CPifRam *)this),x86_ECX);
Call_Direct(AddressOf(CPifRam::SI_DMA_WRITE),"CPifRam::SI_DMA_WRITE"); Call_Direct(AddressOf(&CPifRam::SI_DMA_WRITE),"CPifRam::SI_DMA_WRITE");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 0x04800018: case 0x04800018:
@ -1237,7 +1237,7 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr )
AndConstToVariable(~SI_STATUS_INTERRUPT,&_Reg->SI_STATUS_REG,"SI_STATUS_REG"); AndConstToVariable(~SI_STATUS_INTERRUPT,&_Reg->SI_STATUS_REG,"SI_STATUS_REG");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
default: default:
@ -3474,7 +3474,7 @@ void CMipsMemoryVM::Compile_StoreInstructClean (x86Reg AddressReg, int Length )
PushImm32(strLen.c_str(),Length); PushImm32(strLen.c_str(),Length);
Push(AddressReg); Push(AddressReg);
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX); MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt"); Call_Direct(AddressOf(&CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
JmpLabel8("MemCheckDone",0); JmpLabel8("MemCheckDone",0);
BYTE * MemCheckDone = m_RecompPos - 1; BYTE * MemCheckDone = m_RecompPos - 1;
@ -3495,7 +3495,7 @@ void CMipsMemoryVM::Compile_StoreInstructClean (x86Reg AddressReg, int Length )
PushImm32(strLen.c_str(),Length); PushImm32(strLen.c_str(),Length);
Push(AddressReg); Push(AddressReg);
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX); MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt"); Call_Direct(AddressOf(&CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
CPU_Message(" "); CPU_Message(" ");

View File

@ -84,7 +84,7 @@ void CPifRam::PifRamRead (void)
} }
break; break;
} }
} while( CurPos < 0x40 ); }
if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(-1,NULL); } if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(-1,NULL); }
} }

View File

@ -350,7 +350,7 @@ void CN64System::StartEmulation2 ( bool NewThread )
stdstr Status = _Settings->LoadString(Rdb_Status); stdstr Status = _Settings->LoadString(Rdb_Status);
char String[100]; char String[100];
RomIniFile.GetString("Rom Status",stdstr_f("%s.AutoFullScreen", Status.c_str).c_str(),"true",String,sizeof(String)); RomIniFile.GetString("Rom Status",stdstr_f("%s.AutoFullScreen", Status.c_str()).c_str(),"true",String,sizeof(String));
if (_stricmp(String,"true") == 0) if (_stricmp(String,"true") == 0)
{ {
_Notify->ChangeFullScreen(); _Notify->ChangeFullScreen();

View File

@ -191,7 +191,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
{ {
MoveConstToX86reg(TargetPC,x86_EDX); MoveConstToX86reg(TargetPC,x86_EDX);
MoveConstToX86reg((DWORD)&m_Functions,x86_ECX); MoveConstToX86reg((DWORD)&m_Functions,x86_ECX);
Call_Direct(AddressOf(CFunctionMap::CompilerFindFunction), "CFunctionMap::CompilerFindFunction"); Call_Direct(AddressOf(&CFunctionMap::CompilerFindFunction), "CFunctionMap::CompilerFindFunction");
MoveX86RegToX86Reg(x86_EAX,x86_ECX); MoveX86RegToX86Reg(x86_EAX,x86_ECX);
JecxzLabel8("NullPointer",0); JecxzLabel8("NullPointer",0);
BYTE * Jump = m_RecompPos - 1; BYTE * Jump = m_RecompPos - 1;
@ -239,7 +239,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
break; break;
case CExitInfo::DoCPU_Action: case CExitInfo::DoCPU_Action:
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX); MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
Call_Direct(AddressOf(CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents"); Call_Direct(AddressOf(&CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
ExitCodeBlock(); ExitCodeBlock();
break; break;
@ -248,7 +248,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
bool bDelay = m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT; bool bDelay = m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT;
PushImm32(bDelay ? "true" : "false", bDelay); PushImm32(bDelay ? "true" : "false", bDelay);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::DoSysCallException), "CRegisters::DoSysCallException"); Call_Direct(AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
ExitCodeBlock(); ExitCodeBlock();
} }
@ -259,7 +259,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
PushImm32("1",1); PushImm32("1",1);
PushImm32(bDelay ? "true" : "false", bDelay); PushImm32(bDelay ? "true" : "false", bDelay);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException"); Call_Direct(AddressOf(&CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
ExitCodeBlock(); ExitCodeBlock();
} }
@ -376,7 +376,7 @@ void CCodeSection::GenerateSectionLinkage (void)
// check if there is an existing section // check if there is an existing section
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX); MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::CompileDelaySlot), "CRecompiler::CompileDelaySlot"); Call_Direct(AddressOf(&CRecompiler::CompileDelaySlot), "CRecompiler::CompileDelaySlot");
JmpDirectReg(x86_EAX); JmpDirectReg(x86_EAX);
ExitCodeBlock(); ExitCodeBlock();
return; return;

View File

@ -305,7 +305,7 @@ void CRecompilerOps::BNE_Compare (void)
{ {
BYTE *Jump; BYTE *Jump;
if (m_Section->IsKnown(m_Opcode.rs) && m_Section->IsKnown(m_Opcode.rt)) { if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt)) {
if (IsConst(m_Opcode.rs) && IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rs) && IsConst(m_Opcode.rt)) {
if (Is64Bit(m_Opcode.rs) || Is64Bit(m_Opcode.rt)) { if (Is64Bit(m_Opcode.rs) || Is64Bit(m_Opcode.rt)) {
CRecompilerOps::UnknownOpcode(); CRecompilerOps::UnknownOpcode();
@ -322,8 +322,8 @@ void CRecompilerOps::BNE_Compare (void)
ProtectGPR(m_Opcode.rt); ProtectGPR(m_Opcode.rt);
CompX86RegToX86Reg( CompX86RegToX86Reg(
m_Section->Is32Bit(m_Opcode.rs)?Map_TempReg(x86_Any,m_Opcode.rs,TRUE):MipsRegMapHi(m_Opcode.rs), Is32Bit(m_Opcode.rs)?Map_TempReg(x86_Any,m_Opcode.rs,TRUE):MipsRegMapHi(m_Opcode.rs),
m_Section->Is32Bit(m_Opcode.rt)?Map_TempReg(x86_Any,m_Opcode.rt,TRUE):MipsRegMapHi(m_Opcode.rt) Is32Bit(m_Opcode.rt)?Map_TempReg(x86_Any,m_Opcode.rt,TRUE):MipsRegMapHi(m_Opcode.rt)
); );
if (m_Section->m_Jump.FallThrough) { if (m_Section->m_Jump.FallThrough) {
@ -369,9 +369,9 @@ void CRecompilerOps::BNE_Compare (void)
DWORD MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (Is64Bit(ConstReg) || Is64Bit(MappedReg)) { if (Is64Bit(ConstReg) || Is64Bit(MappedReg)) {
if (m_Section->Is32Bit(ConstReg) || m_Section->Is32Bit(MappedReg)) { if (Is32Bit(ConstReg) || Is32Bit(MappedReg)) {
ProtectGPR(MappedReg); ProtectGPR(MappedReg);
if (m_Section->Is32Bit(MappedReg)) { if (Is32Bit(MappedReg)) {
CompConstToX86reg(Map_TempReg(x86_Any,MappedReg,TRUE),MipsRegHi(ConstReg)); CompConstToX86reg(Map_TempReg(x86_Any,MappedReg,TRUE),MipsRegHi(ConstReg));
} else { } else {
CompConstToX86reg(MipsRegMapHi(MappedReg),cMipsRegLo_S(ConstReg) >> 31); CompConstToX86reg(MipsRegMapHi(MappedReg),cMipsRegLo_S(ConstReg) >> 31);
@ -418,14 +418,14 @@ void CRecompilerOps::BNE_Compare (void)
} }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rs) || m_Section->IsKnown(m_Opcode.rt)) { } else if (IsKnown(m_Opcode.rs) || IsKnown(m_Opcode.rt)) {
DWORD KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; DWORD KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
DWORD UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
CompConstToVariable(MipsRegHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(MipsRegHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else if (m_Section->IsSigned(KnownReg)) { } else if (IsSigned(KnownReg)) {
CompConstToVariable((cMipsRegLo_S(KnownReg) >> 31),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable((cMipsRegLo_S(KnownReg) >> 31),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else { } else {
CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
@ -433,7 +433,7 @@ void CRecompilerOps::BNE_Compare (void)
} else { } else {
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
CompX86regToVariable(MipsRegMapHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompX86regToVariable(MipsRegMapHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else if (m_Section->IsSigned(KnownReg)) { } else if (IsSigned(KnownReg)) {
ProtectGPR(KnownReg); ProtectGPR(KnownReg);
CompX86regToVariable(Map_TempReg(x86_Any,KnownReg,TRUE),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompX86regToVariable(Map_TempReg(x86_Any,KnownReg,TRUE),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else { } else {
@ -503,7 +503,7 @@ void CRecompilerOps::BNE_Compare (void)
void CRecompilerOps::BEQ_Compare (void) { void CRecompilerOps::BEQ_Compare (void) {
BYTE *Jump; BYTE *Jump;
if (m_Section->IsKnown(m_Opcode.rs) && m_Section->IsKnown(m_Opcode.rt)) { if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt)) {
if (IsConst(m_Opcode.rs) && IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rs) && IsConst(m_Opcode.rt)) {
if (Is64Bit(m_Opcode.rs) || Is64Bit(m_Opcode.rt)) { if (Is64Bit(m_Opcode.rs) || Is64Bit(m_Opcode.rt)) {
CRecompilerOps::UnknownOpcode(); CRecompilerOps::UnknownOpcode();
@ -520,8 +520,8 @@ void CRecompilerOps::BEQ_Compare (void) {
ProtectGPR(m_Opcode.rt); ProtectGPR(m_Opcode.rt);
CompX86RegToX86Reg( CompX86RegToX86Reg(
m_Section->Is32Bit(m_Opcode.rs)?Map_TempReg(x86_Any,m_Opcode.rs,TRUE):MipsRegMapHi(m_Opcode.rs), Is32Bit(m_Opcode.rs)?Map_TempReg(x86_Any,m_Opcode.rs,TRUE):MipsRegMapHi(m_Opcode.rs),
m_Section->Is32Bit(m_Opcode.rt)?Map_TempReg(x86_Any,m_Opcode.rt,TRUE):MipsRegMapHi(m_Opcode.rt) Is32Bit(m_Opcode.rt)?Map_TempReg(x86_Any,m_Opcode.rt,TRUE):MipsRegMapHi(m_Opcode.rt)
); );
if (m_Section->m_Cont.FallThrough) { if (m_Section->m_Cont.FallThrough) {
JneLabel8("continue",0); JneLabel8("continue",0);
@ -566,8 +566,8 @@ void CRecompilerOps::BEQ_Compare (void) {
DWORD MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (Is64Bit(ConstReg) || Is64Bit(MappedReg)) { if (Is64Bit(ConstReg) || Is64Bit(MappedReg)) {
if (m_Section->Is32Bit(ConstReg) || m_Section->Is32Bit(MappedReg)) { if (Is32Bit(ConstReg) || Is32Bit(MappedReg)) {
if (m_Section->Is32Bit(MappedReg)) { if (Is32Bit(MappedReg)) {
ProtectGPR(MappedReg); ProtectGPR(MappedReg);
CompConstToX86reg(Map_TempReg(x86_Any,MappedReg,TRUE),MipsRegHi(ConstReg)); CompConstToX86reg(Map_TempReg(x86_Any,MappedReg,TRUE),MipsRegHi(ConstReg));
} else { } else {
@ -615,14 +615,14 @@ void CRecompilerOps::BEQ_Compare (void) {
} }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rs) || m_Section->IsKnown(m_Opcode.rt)) { } else if (IsKnown(m_Opcode.rs) || IsKnown(m_Opcode.rt)) {
DWORD KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; DWORD KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
DWORD UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
CompConstToVariable(MipsRegHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(MipsRegHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else if (m_Section->IsSigned(KnownReg)) { } else if (IsSigned(KnownReg)) {
CompConstToVariable(cMipsRegLo_S(KnownReg) >> 31,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(cMipsRegLo_S(KnownReg) >> 31,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else { } else {
CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
@ -631,7 +631,7 @@ void CRecompilerOps::BEQ_Compare (void) {
ProtectGPR(KnownReg); ProtectGPR(KnownReg);
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
CompX86regToVariable(cMipsRegMapHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompX86regToVariable(cMipsRegMapHi(KnownReg),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else if (m_Section->IsSigned(KnownReg)) { } else if (IsSigned(KnownReg)) {
CompX86regToVariable(Map_TempReg(x86_Any,KnownReg,TRUE),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompX86regToVariable(Map_TempReg(x86_Any,KnownReg,TRUE),&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
} else { } else {
CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]); CompConstToVariable(0,&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg]);
@ -696,7 +696,7 @@ void CRecompilerOps::BEQ_Compare (void) {
void CRecompilerOps::BGTZ_Compare (void) { void CRecompilerOps::BGTZ_Compare (void) {
if (IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
if (m_Section->MipsReg_S(m_Opcode.rs) > 0) { if (MipsReg_S(m_Opcode.rs) > 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
@ -704,7 +704,7 @@ void CRecompilerOps::BGTZ_Compare (void) {
m_Section->m_Cont.FallThrough = TRUE; m_Section->m_Cont.FallThrough = TRUE;
} }
} else { } else {
if (m_Section->MipsRegLo_S(m_Opcode.rs) > 0) { if (MipsRegLo_S(m_Opcode.rs) > 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
@ -712,7 +712,7 @@ void CRecompilerOps::BGTZ_Compare (void) {
m_Section->m_Cont.FallThrough = TRUE; m_Section->m_Cont.FallThrough = TRUE;
} }
} }
} else if (IsMapped(m_Opcode.rs) && m_Section->Is32Bit(m_Opcode.rs)) { } else if (IsMapped(m_Opcode.rs) && Is32Bit(m_Opcode.rs)) {
CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0); CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0);
if (m_Section->m_Jump.FallThrough) { if (m_Section->m_Jump.FallThrough) {
JleLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 ); JleLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 );
@ -778,15 +778,15 @@ void CRecompilerOps::BGTZ_Compare (void) {
void CRecompilerOps::BLEZ_Compare (void) { void CRecompilerOps::BLEZ_Compare (void) {
if (IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
if (m_Section->MipsReg_S(m_Opcode.rs) <= 0) { if (MipsReg_S(m_Opcode.rs) <= 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
m_Section->m_Jump.FallThrough = FALSE; m_Section->m_Jump.FallThrough = FALSE;
m_Section->m_Cont.FallThrough = TRUE; m_Section->m_Cont.FallThrough = TRUE;
} }
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
if (m_Section->MipsRegLo_S(m_Opcode.rs) <= 0) { if (MipsRegLo_S(m_Opcode.rs) <= 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
@ -803,7 +803,7 @@ void CRecompilerOps::BLEZ_Compare (void) {
} }
} }
} else { } else {
if (IsMapped(m_Opcode.rs) && m_Section->Is32Bit(m_Opcode.rs)) { if (IsMapped(m_Opcode.rs) && Is32Bit(m_Opcode.rs)) {
CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0); CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0);
if (m_Section->m_Jump.FallThrough) { if (m_Section->m_Jump.FallThrough) {
JgLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 ); JgLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 );
@ -870,15 +870,15 @@ void CRecompilerOps::BLEZ_Compare (void) {
void CRecompilerOps::BLTZ_Compare (void) { void CRecompilerOps::BLTZ_Compare (void) {
if (IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
if (m_Section->MipsReg_S(m_Opcode.rs) < 0) { if (MipsReg_S(m_Opcode.rs) < 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
m_Section->m_Jump.FallThrough = FALSE; m_Section->m_Jump.FallThrough = FALSE;
m_Section->m_Cont.FallThrough = TRUE; m_Section->m_Cont.FallThrough = TRUE;
} }
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
if (m_Section->MipsRegLo_S(m_Opcode.rs) < 0) { if (MipsRegLo_S(m_Opcode.rs) < 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
@ -904,7 +904,7 @@ void CRecompilerOps::BLTZ_Compare (void) {
JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0); JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0);
m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4); m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4);
} }
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0); CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0);
if (m_Section->m_Jump.FallThrough) { if (m_Section->m_Jump.FallThrough) {
JgeLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 ); JgeLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 );
@ -922,7 +922,7 @@ void CRecompilerOps::BLTZ_Compare (void) {
m_Section->m_Jump.FallThrough = FALSE; m_Section->m_Jump.FallThrough = FALSE;
m_Section->m_Cont.FallThrough = TRUE; m_Section->m_Cont.FallThrough = TRUE;
} }
} else if (m_Section->IsUnknown(m_Opcode.rs)) { } else if (IsUnknown(m_Opcode.rs)) {
CompConstToVariable(0,&_GPR[m_Opcode.rs].W[1],CRegName::GPR_Hi[m_Opcode.rs]); CompConstToVariable(0,&_GPR[m_Opcode.rs].W[1],CRegName::GPR_Hi[m_Opcode.rs]);
if (m_Section->m_Jump.FallThrough) { if (m_Section->m_Jump.FallThrough) {
JgeLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 ); JgeLabel32 (m_Section->m_Cont.BranchLabel.c_str(), 0 );
@ -946,8 +946,8 @@ void CRecompilerOps::BGEZ_Compare (void) {
DisplayError("BGEZ 1"); DisplayError("BGEZ 1");
#endif #endif
CRecompilerOps::UnknownOpcode(); CRecompilerOps::UnknownOpcode();
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
if (m_Section->MipsRegLo_S(m_Opcode.rs) >= 0) { if (MipsRegLo_S(m_Opcode.rs) >= 0) {
m_Section->m_Jump.FallThrough = TRUE; m_Section->m_Jump.FallThrough = TRUE;
m_Section->m_Cont.FallThrough = FALSE; m_Section->m_Cont.FallThrough = FALSE;
} else { } else {
@ -973,7 +973,7 @@ void CRecompilerOps::BGEZ_Compare (void) {
JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0); JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0);
m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4); m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4);
} }
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0); CompConstToX86reg(cMipsRegMapLo(m_Opcode.rs),0);
if (m_Section->m_Cont.FallThrough) { if (m_Section->m_Cont.FallThrough) {
JgeLabel32 ( m_Section->m_Jump.BranchLabel.c_str(), 0 ); JgeLabel32 ( m_Section->m_Jump.BranchLabel.c_str(), 0 );
@ -1161,8 +1161,8 @@ void CRecompilerOps::SLTIU (void) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
__int64 Immediate = (__int64)((short)m_Opcode.immediate); __int64 Immediate = (__int64)((short)m_Opcode.immediate);
Result = m_Section->MipsReg(m_Opcode.rs) < ((unsigned)(Immediate))?1:0; Result = MipsReg(m_Opcode.rs) < ((unsigned)(Immediate))?1:0;
} else if (m_Section->Is32Bit(m_Opcode.rs)) { } else if (Is32Bit(m_Opcode.rs)) {
Result = cMipsRegLo(m_Opcode.rs) < ((unsigned)((short)m_Opcode.immediate))?1:0; Result = cMipsRegLo(m_Opcode.rs) < ((unsigned)((short)m_Opcode.immediate))?1:0;
} }
UnMap_GPR(m_Opcode.rt, FALSE); UnMap_GPR(m_Opcode.rt, FALSE);
@ -1220,9 +1220,9 @@ void CRecompilerOps::SLTI (void)
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
__int64 Immediate = (__int64)((short)m_Opcode.immediate); __int64 Immediate = (__int64)((short)m_Opcode.immediate);
Result = (__int64)m_Section->MipsReg(m_Opcode.rs) < Immediate?1:0; Result = (__int64)MipsReg(m_Opcode.rs) < Immediate?1:0;
} else if (m_Section->Is32Bit(m_Opcode.rs)) { } else if (Is32Bit(m_Opcode.rs)) {
Result = m_Section->MipsRegLo_S(m_Opcode.rs) < (short)m_Opcode.immediate?1:0; Result = MipsRegLo_S(m_Opcode.rs) < (short)m_Opcode.immediate?1:0;
} }
UnMap_GPR(m_Opcode.rt, FALSE); UnMap_GPR(m_Opcode.rt, FALSE);
MipsRegState(m_Opcode.rt) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rt) = CRegInfo::STATE_CONST_32;
@ -1317,7 +1317,7 @@ void CRecompilerOps::ORI (void) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
Map_GPR_64bit(m_Opcode.rt,m_Opcode.rs); Map_GPR_64bit(m_Opcode.rt,m_Opcode.rs);
} else { } else {
Map_GPR_32bit(m_Opcode.rt,m_Section->IsSigned(m_Opcode.rs),m_Opcode.rs); Map_GPR_32bit(m_Opcode.rt,IsSigned(m_Opcode.rs),m_Opcode.rs);
} }
OrConstToX86Reg(m_Opcode.immediate,cMipsRegMapLo(m_Opcode.rt)); OrConstToX86Reg(m_Opcode.immediate,cMipsRegMapLo(m_Opcode.rt));
} else { } else {
@ -1336,8 +1336,8 @@ void CRecompilerOps::XORI (void) {
MipsRegHi(m_Opcode.rt) = MipsRegHi(m_Opcode.rs); MipsRegHi(m_Opcode.rt) = MipsRegHi(m_Opcode.rs);
MipsRegLo(m_Opcode.rt) = cMipsRegLo(m_Opcode.rs) ^ m_Opcode.immediate; MipsRegLo(m_Opcode.rt) = cMipsRegLo(m_Opcode.rs) ^ m_Opcode.immediate;
} else { } else {
if (IsMapped(m_Opcode.rs) && m_Section->Is32Bit(m_Opcode.rs)) { if (IsMapped(m_Opcode.rs) && Is32Bit(m_Opcode.rs)) {
Map_GPR_32bit(m_Opcode.rt,m_Section->IsSigned(m_Opcode.rs),m_Opcode.rs); Map_GPR_32bit(m_Opcode.rt,IsSigned(m_Opcode.rs),m_Opcode.rs);
} else { } else {
Map_GPR_64bit(m_Opcode.rt,m_Opcode.rs); Map_GPR_64bit(m_Opcode.rt,m_Opcode.rs);
} }
@ -1403,7 +1403,7 @@ void CRecompilerOps::CACHE (void){
Push(x86_EAX); Push(x86_EAX);
} }
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX); MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt"); Call_Direct(AddressOf(&CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 1: case 1:
@ -1630,7 +1630,7 @@ void CRecompilerOps::SPECIAL_SRA (void) {
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegLo(m_Opcode.rd) = m_Section->MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa; MipsRegLo(m_Opcode.rd) = MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa;
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
return; return;
} }
@ -1664,7 +1664,7 @@ void CRecompilerOps::SPECIAL_SRLV (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Opcode.rd == 0) { return; } if (m_Opcode.rd == 0) { return; }
if (m_Section->IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) { if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) {
DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x1F); DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x1F);
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
@ -1686,11 +1686,11 @@ void CRecompilerOps::SPECIAL_SRAV (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Opcode.rd == 0) { return; } if (m_Opcode.rd == 0) { return; }
if (m_Section->IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) { if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) {
DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x1F); DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x1F);
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegLo(m_Opcode.rd) = m_Section->MipsRegLo_S(m_Opcode.rt) >> Shift; MipsRegLo(m_Opcode.rd) = MipsRegLo_S(m_Opcode.rt) >> Shift;
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
return; return;
} }
@ -1836,19 +1836,19 @@ void CRecompilerOps::SPECIAL_MFLO (void) {
void CRecompilerOps::SPECIAL_MTLO (void) { void CRecompilerOps::SPECIAL_MTLO (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) { if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
MoveConstToVariable(MipsRegHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]"); MoveConstToVariable(MipsRegHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]");
} else if (m_Section->IsSigned(m_Opcode.rs) && ((cMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) { } else if (IsSigned(m_Opcode.rs) && ((cMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) {
MoveConstToVariable(0xFFFFFFFF,&_RegLO->UW[1],"_RegLO->UW[1]"); MoveConstToVariable(0xFFFFFFFF,&_RegLO->UW[1],"_RegLO->UW[1]");
} else { } else {
MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]"); MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]");
} }
MoveConstToVariable(cMipsRegLo(m_Opcode.rs), &_RegLO->UW[0],"_RegLO->UW[0]"); MoveConstToVariable(cMipsRegLo(m_Opcode.rs), &_RegLO->UW[0],"_RegLO->UW[0]");
} else if (m_Section->IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
MoveX86regToVariable(MipsRegMapHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]"); MoveX86regToVariable(MipsRegMapHi(m_Opcode.rs),&_RegLO->UW[1],"_RegLO->UW[1]");
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,TRUE),&_RegLO->UW[1],"_RegLO->UW[1]"); MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,TRUE),&_RegLO->UW[1],"_RegLO->UW[1]");
} else { } else {
MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]"); MoveConstToVariable(0,&_RegLO->UW[1],"_RegLO->UW[1]");
@ -1872,19 +1872,19 @@ void CRecompilerOps::SPECIAL_MFHI (void) {
void CRecompilerOps::SPECIAL_MTHI (void) { void CRecompilerOps::SPECIAL_MTHI (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) { if (IsKnown(m_Opcode.rs) && IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
MoveConstToVariable(MipsRegHi(m_Opcode.rs),&_RegHI->UW[1],"_RegHI->UW[1]"); MoveConstToVariable(MipsRegHi(m_Opcode.rs),&_RegHI->UW[1],"_RegHI->UW[1]");
} else if (m_Section->IsSigned(m_Opcode.rs) && ((cMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) { } else if (IsSigned(m_Opcode.rs) && ((cMipsRegLo(m_Opcode.rs) & 0x80000000) != 0)) {
MoveConstToVariable(0xFFFFFFFF,&_RegHI->UW[1],"_RegHI->UW[1]"); MoveConstToVariable(0xFFFFFFFF,&_RegHI->UW[1],"_RegHI->UW[1]");
} else { } else {
MoveConstToVariable(0,&_RegHI->UW[1],"_RegHI->UW[1]"); MoveConstToVariable(0,&_RegHI->UW[1],"_RegHI->UW[1]");
} }
MoveConstToVariable(cMipsRegLo(m_Opcode.rs), &_RegHI->UW[0],"_RegHI->UW[0]"); MoveConstToVariable(cMipsRegLo(m_Opcode.rs), &_RegHI->UW[0],"_RegHI->UW[0]");
} else if (m_Section->IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rs) && IsMapped(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rs)) {
MoveX86regToVariable(MipsRegMapHi(m_Opcode.rs),&_RegHI->UW[1],"_RegHI->UW[1]"); MoveX86regToVariable(MipsRegMapHi(m_Opcode.rs),&_RegHI->UW[1],"_RegHI->UW[1]");
} else if (m_Section->IsSigned(m_Opcode.rs)) { } else if (IsSigned(m_Opcode.rs)) {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,TRUE),&_RegHI->UW[1],"_RegHI->UW[1]"); MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,TRUE),&_RegHI->UW[1],"_RegHI->UW[1]");
} else { } else {
MoveConstToVariable(0,&_RegHI->UW[1],"_RegHI->UW[1]"); MoveConstToVariable(0,&_RegHI->UW[1],"_RegHI->UW[1]");
@ -1944,8 +1944,8 @@ void CRecompilerOps::SPECIAL_DSRLV (void) {
DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x3F); DWORD Shift = (cMipsRegLo(m_Opcode.rs) & 0x3F);
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt); MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt);
m_Section->MipsReg(m_Opcode.rd) = m_Section->MipsReg(m_Opcode.rd) >> Shift; MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) >> Shift;
if ((MipsRegHi(m_Opcode.rd) == 0) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) == 0) { if ((MipsRegHi(m_Opcode.rd) == 0) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) == 0) {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if ((MipsRegHi(m_Opcode.rd) == 0xFFFFFFFF) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) != 0) { } else if ((MipsRegHi(m_Opcode.rd) == 0xFFFFFFFF) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) != 0) {
@ -2330,7 +2330,7 @@ void CRecompilerOps::SPECIAL_ADD (void) {
Map_GPR_32bit(m_Opcode.rd,TRUE, source1); Map_GPR_32bit(m_Opcode.rd,TRUE, source1);
if (IsConst(source2)) { if (IsConst(source2)) {
AddConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegLo(source2)); AddConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegLo(source2));
} else if (m_Section->IsKnown(source2) && IsMapped(source2)) { } else if (IsKnown(source2) && IsMapped(source2)) {
AddX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); AddX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} else { } else {
AddVariableToX86reg(cMipsRegMapLo(m_Opcode.rd),&_GPR[source2].W[0],CRegName::GPR_Lo[source2]); AddVariableToX86reg(cMipsRegMapLo(m_Opcode.rd),&_GPR[source2].W[0],CRegName::GPR_Lo[source2]);
@ -2355,7 +2355,7 @@ void CRecompilerOps::SPECIAL_ADDU (void) {
Map_GPR_32bit(m_Opcode.rd,TRUE, source1); Map_GPR_32bit(m_Opcode.rd,TRUE, source1);
if (IsConst(source2)) { if (IsConst(source2)) {
AddConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegLo(source2)); AddConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegLo(source2));
} else if (m_Section->IsKnown(source2) && IsMapped(source2)) { } else if (IsKnown(source2) && IsMapped(source2)) {
AddX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); AddX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} else { } else {
AddVariableToX86reg(cMipsRegMapLo(m_Opcode.rd),&_GPR[source2].W[0],CRegName::GPR_Lo[source2]); AddVariableToX86reg(cMipsRegMapLo(m_Opcode.rd),&_GPR[source2].W[0],CRegName::GPR_Lo[source2]);
@ -2419,22 +2419,22 @@ void CRecompilerOps::SPECIAL_SUBU (void) {
void CRecompilerOps::SPECIAL_AND (void) void CRecompilerOps::SPECIAL_AND (void)
{ {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
m_Section->MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) =
(Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt)) & (Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt)) &
(Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs)); (Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs));
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
} }
} else { } else {
m_Section->MipsReg(m_Opcode.rd) = cMipsRegLo(m_Opcode.rt) & m_Section->MipsReg(m_Opcode.rs); MipsReg(m_Opcode.rd) = cMipsRegLo(m_Opcode.rt) & MipsReg(m_Opcode.rs);
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} }
} else if (IsMapped(m_Opcode.rt) && IsMapped(m_Opcode.rs)) { } else if (IsMapped(m_Opcode.rt) && IsMapped(m_Opcode.rs)) {
@ -2443,17 +2443,17 @@ void CRecompilerOps::SPECIAL_AND (void)
ProtectGPR(source1); ProtectGPR(source1);
ProtectGPR(source2); ProtectGPR(source2);
if (m_Section->Is32Bit(source1) && m_Section->Is32Bit(source2)) { if (Is32Bit(source1) && Is32Bit(source2)) {
int Sign = (m_Section->IsSigned(m_Opcode.rt) && m_Section->IsSigned(m_Opcode.rs))?TRUE:FALSE; int Sign = (IsSigned(m_Opcode.rt) && IsSigned(m_Opcode.rs))?TRUE:FALSE;
Map_GPR_32bit(m_Opcode.rd,Sign,source1); Map_GPR_32bit(m_Opcode.rd,Sign,source1);
AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} else if (m_Section->Is32Bit(source1) || m_Section->Is32Bit(source2)) { } else if (Is32Bit(source1) || Is32Bit(source2)) {
if (m_Section->IsUnsigned(m_Section->Is32Bit(source1)?source1:source2)) { if (IsUnsigned(Is32Bit(source1)?source1:source2)) {
Map_GPR_32bit(m_Opcode.rd,FALSE,source1); Map_GPR_32bit(m_Opcode.rd,FALSE,source1);
AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} else { } else {
Map_GPR_64bit(m_Opcode.rd,source1); Map_GPR_64bit(m_Opcode.rd,source1);
if (m_Section->Is32Bit(source2)) { if (Is32Bit(source2)) {
AndX86RegToX86Reg(MipsRegMapHi(m_Opcode.rd),Map_TempReg(x86_Any,source2,TRUE)); AndX86RegToX86Reg(MipsRegMapHi(m_Opcode.rd),Map_TempReg(x86_Any,source2,TRUE));
} else { } else {
AndX86RegToX86Reg(MipsRegMapHi(m_Opcode.rd),MipsRegMapHi(source2)); AndX86RegToX86Reg(MipsRegMapHi(m_Opcode.rd),MipsRegMapHi(source2));
@ -2470,7 +2470,7 @@ void CRecompilerOps::SPECIAL_AND (void)
int MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; int MappedReg = IsConst(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (Is64Bit(ConstReg)) { if (Is64Bit(ConstReg)) {
if (m_Section->Is32Bit(MappedReg) && m_Section->IsUnsigned(MappedReg)) { if (Is32Bit(MappedReg) && IsUnsigned(MappedReg)) {
if (cMipsRegLo(ConstReg) == 0) { if (cMipsRegLo(ConstReg) == 0) {
Map_GPR_32bit(m_Opcode.rd,FALSE, 0); Map_GPR_32bit(m_Opcode.rd,FALSE, 0);
} else { } else {
@ -2479,7 +2479,7 @@ void CRecompilerOps::SPECIAL_AND (void)
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value);
} }
} else { } else {
__int64 Value = m_Section->MipsReg(ConstReg); __int64 Value = MipsReg(ConstReg);
Map_GPR_64bit(m_Opcode.rd,MappedReg); Map_GPR_64bit(m_Opcode.rd,MappedReg);
AndConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),(DWORD)(Value >> 32)); AndConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),(DWORD)(Value >> 32));
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value);
@ -2487,15 +2487,15 @@ void CRecompilerOps::SPECIAL_AND (void)
} else if (Is64Bit(MappedReg)) { } else if (Is64Bit(MappedReg)) {
DWORD Value = cMipsRegLo(ConstReg); DWORD Value = cMipsRegLo(ConstReg);
if (Value != 0) { if (Value != 0) {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(ConstReg)?TRUE:FALSE,MappedReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(ConstReg)?TRUE:FALSE,MappedReg);
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value);
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(ConstReg)?TRUE:FALSE, 0); Map_GPR_32bit(m_Opcode.rd,IsSigned(ConstReg)?TRUE:FALSE, 0);
} }
} else { } else {
DWORD Value = cMipsRegLo(ConstReg); DWORD Value = cMipsRegLo(ConstReg);
int Sign = FALSE; int Sign = FALSE;
if (m_Section->IsSigned(ConstReg) && m_Section->IsSigned(MappedReg)) { Sign = TRUE; } if (IsSigned(ConstReg) && IsSigned(MappedReg)) { Sign = TRUE; }
if (Value != 0) { if (Value != 0) {
Map_GPR_32bit(m_Opcode.rd,Sign,MappedReg); Map_GPR_32bit(m_Opcode.rd,Sign,MappedReg);
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value);
@ -2504,19 +2504,19 @@ void CRecompilerOps::SPECIAL_AND (void)
} }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
DWORD KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; DWORD KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
DWORD UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
unsigned __int64 Value = m_Section->MipsReg(KnownReg); unsigned __int64 Value = MipsReg(KnownReg);
Map_GPR_64bit(m_Opcode.rd,UnknownReg); Map_GPR_64bit(m_Opcode.rd,UnknownReg);
AndConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),(DWORD)(Value >> 32)); AndConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),(DWORD)(Value >> 32));
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value);
} else { } else {
DWORD Value = cMipsRegLo(KnownReg); DWORD Value = cMipsRegLo(KnownReg);
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(KnownReg),UnknownReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(KnownReg),UnknownReg);
AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value); AndConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),(DWORD)Value);
} }
} else { } else {
@ -2527,7 +2527,7 @@ void CRecompilerOps::SPECIAL_AND (void)
AndVariableToX86Reg(&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg],MipsRegMapHi(m_Opcode.rd)); AndVariableToX86Reg(&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg],MipsRegMapHi(m_Opcode.rd));
AndVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegMapLo(m_Opcode.rd)); AndVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegMapLo(m_Opcode.rd));
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(KnownReg),KnownReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(KnownReg),KnownReg);
AndVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegMapLo(m_Opcode.rd)); AndVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegMapLo(m_Opcode.rd));
} }
} else { } else {
@ -2536,7 +2536,7 @@ void CRecompilerOps::SPECIAL_AND (void)
AndX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapHi(KnownReg)); AndX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapHi(KnownReg));
AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(KnownReg)); AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(KnownReg));
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(KnownReg),UnknownReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(KnownReg),UnknownReg);
AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(KnownReg)); AndX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(KnownReg));
} }
} }
@ -2551,16 +2551,16 @@ void CRecompilerOps::SPECIAL_AND (void)
void CRecompilerOps::SPECIAL_OR (void) { void CRecompilerOps::SPECIAL_OR (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
m_Section->MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) =
(Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt)) | (Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt)) |
(Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs)); (Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs));
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -2595,9 +2595,9 @@ void CRecompilerOps::SPECIAL_OR (void) {
unsigned __int64 Value; unsigned __int64 Value;
if (Is64Bit(ConstReg)) { if (Is64Bit(ConstReg)) {
Value = m_Section->MipsReg(ConstReg); Value = MipsReg(ConstReg);
} else { } else {
Value = m_Section->IsSigned(ConstReg)?m_Section->MipsRegLo_S(ConstReg):cMipsRegLo(ConstReg); Value = IsSigned(ConstReg)?MipsRegLo_S(ConstReg):cMipsRegLo(ConstReg);
} }
Map_GPR_64bit(m_Opcode.rd,MappedReg); Map_GPR_64bit(m_Opcode.rd,MappedReg);
if ((Value >> 32) != 0) { if ((Value >> 32) != 0) {
@ -2612,14 +2612,14 @@ void CRecompilerOps::SPECIAL_OR (void) {
if (Value != 0) { OrConstToX86Reg(Value,cMipsRegMapLo(m_Opcode.rd)); } if (Value != 0) { OrConstToX86Reg(Value,cMipsRegMapLo(m_Opcode.rd)); }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
int KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; int KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
int UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; int UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
unsigned __int64 Value; unsigned __int64 Value;
Value = Is64Bit(KnownReg)?m_Section->MipsReg(KnownReg):m_Section->MipsRegLo_S(KnownReg); Value = Is64Bit(KnownReg)?MipsReg(KnownReg):MipsRegLo_S(KnownReg);
Map_GPR_64bit(m_Opcode.rd,UnknownReg); Map_GPR_64bit(m_Opcode.rd,UnknownReg);
if ((Value >> 32) != 0) { if ((Value >> 32) != 0) {
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd)); OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd));
@ -2653,7 +2653,7 @@ void CRecompilerOps::SPECIAL_XOR (void) {
MipsRegLo(m_Opcode.rd) = 0; MipsRegLo(m_Opcode.rd) = 0;
return; return;
} }
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
@ -2675,15 +2675,15 @@ void CRecompilerOps::SPECIAL_XOR (void) {
Map_GPR_64bit(m_Opcode.rd,source1); Map_GPR_64bit(m_Opcode.rd,source1);
if (Is64Bit(source2)) { if (Is64Bit(source2)) {
XorX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapHi(source2)); XorX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),cMipsRegMapHi(source2));
} else if (m_Section->IsSigned(source2)) { } else if (IsSigned(source2)) {
XorX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),Map_TempReg(x86_Any,source2,TRUE)); XorX86RegToX86Reg(cMipsRegMapHi(m_Opcode.rd),Map_TempReg(x86_Any,source2,TRUE));
} }
XorX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); XorX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} else { } else {
if (m_Section->IsSigned(m_Opcode.rt) != m_Section->IsSigned(m_Opcode.rs)) { if (IsSigned(m_Opcode.rt) != IsSigned(m_Opcode.rs)) {
Map_GPR_32bit(m_Opcode.rd,TRUE,source1); Map_GPR_32bit(m_Opcode.rd,TRUE,source1);
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(m_Opcode.rt),source1); Map_GPR_32bit(m_Opcode.rd,IsSigned(m_Opcode.rt),source1);
} }
XorX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); XorX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
} }
@ -2694,32 +2694,32 @@ void CRecompilerOps::SPECIAL_XOR (void) {
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
DWORD ConstHi, ConstLo; DWORD ConstHi, ConstLo;
ConstHi = m_Section->Is32Bit(ConstReg)?(DWORD)(m_Section->MipsRegLo_S(ConstReg) >> 31):MipsRegHi(ConstReg); ConstHi = Is32Bit(ConstReg)?(DWORD)(MipsRegLo_S(ConstReg) >> 31):MipsRegHi(ConstReg);
ConstLo = cMipsRegLo(ConstReg); ConstLo = cMipsRegLo(ConstReg);
Map_GPR_64bit(m_Opcode.rd,MappedReg); Map_GPR_64bit(m_Opcode.rd,MappedReg);
if (ConstHi != 0) { XorConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),ConstHi); } if (ConstHi != 0) { XorConstToX86Reg(cMipsRegMapHi(m_Opcode.rd),ConstHi); }
if (ConstLo != 0) { XorConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),ConstLo); } if (ConstLo != 0) { XorConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),ConstLo); }
} else { } else {
int Value = cMipsRegLo(ConstReg); int Value = cMipsRegLo(ConstReg);
if (m_Section->IsSigned(m_Opcode.rt) != m_Section->IsSigned(m_Opcode.rs)) { if (IsSigned(m_Opcode.rt) != IsSigned(m_Opcode.rs)) {
Map_GPR_32bit(m_Opcode.rd,TRUE, MappedReg); Map_GPR_32bit(m_Opcode.rd,TRUE, MappedReg);
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(MappedReg)?TRUE:FALSE, MappedReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(MappedReg)?TRUE:FALSE, MappedReg);
} }
if (Value != 0) { XorConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value); } if (Value != 0) { XorConstToX86Reg(cMipsRegMapLo(m_Opcode.rd),Value); }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
int KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; int KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
int UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; int UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
unsigned __int64 Value; unsigned __int64 Value;
if (Is64Bit(KnownReg)) { if (Is64Bit(KnownReg)) {
Value = m_Section->MipsReg(KnownReg); Value = MipsReg(KnownReg);
} else { } else {
if (m_Section->IsSigned(KnownReg)) { if (IsSigned(KnownReg)) {
Value = (int)cMipsRegLo(KnownReg); Value = (int)cMipsRegLo(KnownReg);
} else { } else {
Value = cMipsRegLo(KnownReg); Value = cMipsRegLo(KnownReg);
@ -2747,7 +2747,7 @@ void CRecompilerOps::SPECIAL_XOR (void) {
void CRecompilerOps::SPECIAL_NOR (void) { void CRecompilerOps::SPECIAL_NOR (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
@ -2774,10 +2774,10 @@ void CRecompilerOps::SPECIAL_NOR (void) {
NotX86Reg(cMipsRegMapLo(m_Opcode.rd)); NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
} else { } else {
ProtectGPR(source2); ProtectGPR(source2);
if (m_Section->IsSigned(m_Opcode.rt) != m_Section->IsSigned(m_Opcode.rs)) { if (IsSigned(m_Opcode.rt) != IsSigned(m_Opcode.rs)) {
Map_GPR_32bit(m_Opcode.rd,TRUE,source1); Map_GPR_32bit(m_Opcode.rd,TRUE,source1);
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(m_Opcode.rt),source1); Map_GPR_32bit(m_Opcode.rd,IsSigned(m_Opcode.rt),source1);
} }
OrX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2)); OrX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
NotX86Reg(cMipsRegMapLo(m_Opcode.rd)); NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
@ -2790,9 +2790,9 @@ void CRecompilerOps::SPECIAL_NOR (void) {
unsigned __int64 Value; unsigned __int64 Value;
if (Is64Bit(ConstReg)) { if (Is64Bit(ConstReg)) {
Value = m_Section->MipsReg(ConstReg); Value = MipsReg(ConstReg);
} else { } else {
Value = m_Section->IsSigned(ConstReg)?m_Section->MipsRegLo_S(ConstReg):cMipsRegLo(ConstReg); Value = IsSigned(ConstReg)?MipsRegLo_S(ConstReg):cMipsRegLo(ConstReg);
} }
Map_GPR_64bit(m_Opcode.rd,MappedReg); Map_GPR_64bit(m_Opcode.rd,MappedReg);
if ((Value >> 32) != 0) { if ((Value >> 32) != 0) {
@ -2805,23 +2805,23 @@ void CRecompilerOps::SPECIAL_NOR (void) {
NotX86Reg(cMipsRegMapLo(m_Opcode.rd)); NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
} else { } else {
int Value = cMipsRegLo(ConstReg); int Value = cMipsRegLo(ConstReg);
if (m_Section->IsSigned(m_Opcode.rt) != m_Section->IsSigned(m_Opcode.rs)) { if (IsSigned(m_Opcode.rt) != IsSigned(m_Opcode.rs)) {
Map_GPR_32bit(m_Opcode.rd,TRUE, MappedReg); Map_GPR_32bit(m_Opcode.rd,TRUE, MappedReg);
} else { } else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(MappedReg)?TRUE:FALSE, MappedReg); Map_GPR_32bit(m_Opcode.rd,IsSigned(MappedReg)?TRUE:FALSE, MappedReg);
} }
if (Value != 0) { OrConstToX86Reg(Value,cMipsRegMapLo(m_Opcode.rd)); } if (Value != 0) { OrConstToX86Reg(Value,cMipsRegMapLo(m_Opcode.rd)); }
NotX86Reg(cMipsRegMapLo(m_Opcode.rd)); NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
int KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; int KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
int UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; int UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
unsigned __int64 Value; unsigned __int64 Value;
Value = Is64Bit(KnownReg)?m_Section->MipsReg(KnownReg):m_Section->MipsRegLo_S(KnownReg); Value = Is64Bit(KnownReg)?MipsReg(KnownReg):MipsRegLo_S(KnownReg);
Map_GPR_64bit(m_Opcode.rd,UnknownReg); Map_GPR_64bit(m_Opcode.rd,UnknownReg);
if ((Value >> 32) != 0) { if ((Value >> 32) != 0) {
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd)); OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd));
@ -2848,7 +2848,7 @@ void CRecompilerOps::SPECIAL_NOR (void) {
void CRecompilerOps::SPECIAL_SLT (void) { void CRecompilerOps::SPECIAL_SLT (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
DisplayError("1"); DisplayError("1");
@ -2856,7 +2856,7 @@ void CRecompilerOps::SPECIAL_SLT (void) {
} else { } else {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
if (m_Section->MipsRegLo_S(m_Opcode.rs) < m_Section->MipsRegLo_S(m_Opcode.rt)) { if (MipsRegLo_S(m_Opcode.rs) < MipsRegLo_S(m_Opcode.rt)) {
MipsRegLo(m_Opcode.rd) = 1; MipsRegLo(m_Opcode.rd) = 1;
} else { } else {
MipsRegLo(m_Opcode.rd) = 0; MipsRegLo(m_Opcode.rd) = 0;
@ -2910,7 +2910,7 @@ void CRecompilerOps::SPECIAL_SLT (void) {
CompConstToX86reg( CompConstToX86reg(
Is64Bit(MappedReg)?cMipsRegMapHi(MappedReg):Map_TempReg(x86_Any,MappedReg,TRUE), Is64Bit(MappedReg)?cMipsRegMapHi(MappedReg):Map_TempReg(x86_Any,MappedReg,TRUE),
Is64Bit(ConstReg)?MipsRegHi(ConstReg):(m_Section->MipsRegLo_S(ConstReg) >> 31) Is64Bit(ConstReg)?MipsRegHi(ConstReg):(MipsRegLo_S(ConstReg) >> 31)
); );
JeLabel8("Low Compare",0); JeLabel8("Low Compare",0);
Jump[0] = m_RecompPos - 1; Jump[0] = m_RecompPos - 1;
@ -2958,9 +2958,9 @@ void CRecompilerOps::SPECIAL_SLT (void) {
} }
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
DWORD KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; DWORD KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
DWORD UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
BYTE *Jump[2]; BYTE *Jump[2];
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
@ -3033,7 +3033,7 @@ void CRecompilerOps::SPECIAL_SLTU (void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC)); CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Opcode.rd == 0) { return; } if (m_Opcode.rd == 0) { return; }
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) { if (IsKnown(m_Opcode.rt) && IsKnown(m_Opcode.rs)) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) { if (Is64Bit(m_Opcode.rt) || Is64Bit(m_Opcode.rs)) {
#ifndef EXTERNAL_RELEASE #ifndef EXTERNAL_RELEASE
@ -3097,7 +3097,7 @@ void CRecompilerOps::SPECIAL_SLTU (void) {
ProtectGPR(MappedReg); ProtectGPR(MappedReg);
MappedRegLo = cMipsRegMapLo(MappedReg); MappedRegLo = cMipsRegMapLo(MappedReg);
MappedRegHi = cMipsRegMapHi(MappedReg); MappedRegHi = cMipsRegMapHi(MappedReg);
if (m_Section->Is32Bit(MappedReg)) { if (Is32Bit(MappedReg)) {
MappedRegHi = Map_TempReg(x86_Any,MappedReg,TRUE); MappedRegHi = Map_TempReg(x86_Any,MappedReg,TRUE);
} }
@ -3142,9 +3142,9 @@ void CRecompilerOps::SPECIAL_SLTU (void) {
MoveVariableToX86reg(&m_BranchCompare,"m_BranchCompare",cMipsRegMapLo(m_Opcode.rd)); MoveVariableToX86reg(&m_BranchCompare,"m_BranchCompare",cMipsRegMapLo(m_Opcode.rd));
} }
} }
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) { } else if (IsKnown(m_Opcode.rt) || IsKnown(m_Opcode.rs)) {
DWORD KnownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs; DWORD KnownReg = IsKnown(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
DWORD UnknownReg = m_Section->IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt; DWORD UnknownReg = IsKnown(m_Opcode.rt)?m_Opcode.rs:m_Opcode.rt;
BYTE *Jump[2]; BYTE *Jump[2];
if (IsConst(KnownReg)) { if (IsConst(KnownReg)) {
@ -3219,12 +3219,12 @@ void CRecompilerOps::SPECIAL_DADD (void) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) =
Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs) + Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs) +
Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt); Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt);
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3254,10 +3254,10 @@ void CRecompilerOps::SPECIAL_DADDU (void) {
if (m_Opcode.rd == 0) { return; } if (m_Opcode.rd == 0) { return; }
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
__int64 ValRs = Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs); __int64 ValRs = Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs);
__int64 ValRt = Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt); __int64 ValRt = Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt);
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = ValRs + ValRt; MipsReg(m_Opcode.rd) = ValRs + ValRt;
if ((MipsRegHi(m_Opcode.rd) == 0) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) == 0) { if ((MipsRegHi(m_Opcode.rd) == 0) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) == 0) {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if ((MipsRegHi(m_Opcode.rd) == 0xFFFFFFFF) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) != 0) { } else if ((MipsRegHi(m_Opcode.rd) == 0xFFFFFFFF) && (cMipsRegLo(m_Opcode.rd) & 0x80000000) != 0) {
@ -3291,12 +3291,12 @@ void CRecompilerOps::SPECIAL_DSUB (void) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) =
Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs) - Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs) -
Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt); Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt);
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3334,12 +3334,12 @@ void CRecompilerOps::SPECIAL_DSUBU (void) {
if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) { if (IsConst(m_Opcode.rt) && IsConst(m_Opcode.rs)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = MipsReg(m_Opcode.rd) =
Is64Bit(m_Opcode.rs)?m_Section->MipsReg(m_Opcode.rs):(__int64)m_Section->MipsRegLo_S(m_Opcode.rs) - Is64Bit(m_Opcode.rs)?MipsReg(m_Opcode.rs):(__int64)MipsRegLo_S(m_Opcode.rs) -
Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt); Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt);
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3378,10 +3378,10 @@ void CRecompilerOps::SPECIAL_DSLL (void) {
{ {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt) << m_Opcode.sa; MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt) << m_Opcode.sa;
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3401,10 +3401,10 @@ void CRecompilerOps::SPECIAL_DSRL (void) {
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?m_Section->MipsReg(m_Opcode.rt):(QWORD)m_Section->MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa; MipsReg(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?MipsReg(m_Opcode.rt):(QWORD)MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa;
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3423,10 +3423,10 @@ void CRecompilerOps::SPECIAL_DSRA (void) {
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); } if (IsMapped(m_Opcode.rd)) { UnMap_GPR(m_Opcode.rd, FALSE); }
m_Section->MipsReg_S(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?m_Section->MipsReg_S(m_Opcode.rt):(__int64)m_Section->MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa; MipsReg_S(m_Opcode.rd) = Is64Bit(m_Opcode.rt)?MipsReg_S(m_Opcode.rt):(__int64)MipsRegLo_S(m_Opcode.rt) >> m_Opcode.sa;
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3446,9 +3446,9 @@ void CRecompilerOps::SPECIAL_DSLL32 (void) {
if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); } if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegHi(m_Opcode.rd) = cMipsRegLo(m_Opcode.rt) << m_Opcode.sa; MipsRegHi(m_Opcode.rd) = cMipsRegLo(m_Opcode.rt) << m_Opcode.sa;
MipsRegLo(m_Opcode.rd) = 0; MipsRegLo(m_Opcode.rd) = 0;
if (m_Section->MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){ if (MipsRegLo_S(m_Opcode.rd) < 0 && MipsRegHi_S(m_Opcode.rd) == -1){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else if (m_Section->MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){ } else if (MipsRegLo_S(m_Opcode.rd) >= 0 && MipsRegHi_S(m_Opcode.rd) == 0){
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
} else { } else {
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_64;
@ -3484,7 +3484,7 @@ void CRecompilerOps::SPECIAL_DSRL32 (void) {
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); } if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
MipsRegLo(m_Opcode.rd) = (DWORD)(m_Section->MipsReg(m_Opcode.rt) >> (m_Opcode.sa + 32)); MipsRegLo(m_Opcode.rd) = (DWORD)(MipsReg(m_Opcode.rt) >> (m_Opcode.sa + 32));
} else if (IsMapped(m_Opcode.rt)) { } else if (IsMapped(m_Opcode.rt)) {
ProtectGPR(m_Opcode.rt); ProtectGPR(m_Opcode.rt);
if (Is64Bit(m_Opcode.rt)) { if (Is64Bit(m_Opcode.rt)) {
@ -3518,7 +3518,7 @@ void CRecompilerOps::SPECIAL_DSRA32 (void) {
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); } if (m_Opcode.rt != m_Opcode.rd) { UnMap_GPR(m_Opcode.rd, FALSE); }
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32; MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
MipsRegLo(m_Opcode.rd) = (DWORD)(m_Section->MipsReg_S(m_Opcode.rt) >> (m_Opcode.sa + 32)); MipsRegLo(m_Opcode.rd) = (DWORD)(MipsReg_S(m_Opcode.rt) >> (m_Opcode.sa + 32));
} else if (IsMapped(m_Opcode.rt)) { } else if (IsMapped(m_Opcode.rt)) {
ProtectGPR(m_Opcode.rt); ProtectGPR(m_Opcode.rt);
if (Is64Bit(m_Opcode.rt)) { if (Is64Bit(m_Opcode.rt)) {
@ -3556,7 +3556,7 @@ void CRecompilerOps::COP0_MF(void) {
UpdateCounters(m_RegWorkingSet,false, true); UpdateCounters(m_RegWorkingSet,false, true);
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
Map_GPR_32bit(m_Opcode.rt,TRUE,-1); Map_GPR_32bit(m_Opcode.rt,TRUE,-1);
@ -3598,7 +3598,7 @@ void CRecompilerOps::COP0_MT (void) {
UpdateCounters(m_RegWorkingSet,false,true); UpdateCounters(m_RegWorkingSet,false,true);
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]); MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
@ -3610,7 +3610,7 @@ void CRecompilerOps::COP0_MT (void) {
AndConstToVariable(~CAUSE_IP7,&_Reg->FAKE_CAUSE_REGISTER,"FAKE_CAUSE_REGISTER"); AndConstToVariable(~CAUSE_IP7,&_Reg->FAKE_CAUSE_REGISTER,"FAKE_CAUSE_REGISTER");
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer"); Call_Direct(AddressOf(&CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 9: //Count case 9: //Count
@ -3619,7 +3619,7 @@ void CRecompilerOps::COP0_MT (void) {
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ;
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
if (IsConst(m_Opcode.rt)) { if (IsConst(m_Opcode.rt)) {
MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]); MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
@ -3630,7 +3630,7 @@ void CRecompilerOps::COP0_MT (void) {
} }
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer"); Call_Direct(AddressOf(&CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
case 12: //Status case 12: //Status
@ -3657,7 +3657,7 @@ void CRecompilerOps::COP0_MT (void) {
//BreakPoint(__FILE__,__LINE__); //m_Section->CompileExit(m_CompilePC+4,m_RegWorkingSet,ExitResetRecompCode,FALSE,JneLabel32); //BreakPoint(__FILE__,__LINE__); //m_Section->CompileExit(m_CompilePC+4,m_RegWorkingSet,ExitResetRecompCode,FALSE,JneLabel32);
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
break; break;
@ -3693,7 +3693,7 @@ void CRecompilerOps::COP0_MT (void) {
} }
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_Reg,x86_ECX); MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts"); Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
break; break;
default: default:
@ -3710,7 +3710,7 @@ void CRecompilerOps::COP0_CO_TLBR( void) {
if (!g_UseTlb) { return; } if (!g_UseTlb) { return; }
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_TLB,x86_ECX); MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::ReadEntry),"CTLB::ReadEntry"); Call_Direct(AddressOf(&CTLB::ReadEntry),"CTLB::ReadEntry");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
@ -3723,7 +3723,7 @@ void CRecompilerOps::COP0_CO_TLBWI( void) {
AndConstToX86Reg(x86_ECX,0x1F); AndConstToX86Reg(x86_ECX,0x1F);
Push(x86_ECX); Push(x86_ECX);
MoveConstToX86reg((DWORD)_TLB,x86_ECX); MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::WriteEntry),"CTLB::WriteEntry"); Call_Direct(AddressOf(&CTLB::WriteEntry),"CTLB::WriteEntry");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
@ -3754,7 +3754,7 @@ void CRecompilerOps::COP0_CO_TLBP( void) {
if (!g_UseTlb) { return; } if (!g_UseTlb) { return; }
BeforeCallDirect(m_RegWorkingSet); BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_TLB,x86_ECX); MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::Probe), "CTLB::TLB_Probe"); Call_Direct(AddressOf(&CTLB::Probe), "CTLB::TLB_Probe");
AfterCallDirect(m_RegWorkingSet); AfterCallDirect(m_RegWorkingSet);
} }
@ -4700,7 +4700,7 @@ void CRecompilerOps::UpdateCounters ( CRegInfo & RegSet, bool CheckTimer, bool C
PushImm32(stdstr_f("%d",RegSet.GetBlockCycleCount()).c_str(),RegSet.GetBlockCycleCount()); PushImm32(stdstr_f("%d",RegSet.GetBlockCycleCount()).c_str(),RegSet.GetBlockCycleCount());
PushImm32("_SyncSystem",(DWORD)_SyncSystem); PushImm32("_SyncSystem",(DWORD)_SyncSystem);
MoveConstToX86reg((DWORD)_System,x86_ECX); MoveConstToX86reg((DWORD)_System,x86_ECX);
Call_Direct(AddressOf(CN64System::UpdateSyncCPU),"CN64System::UpdateSyncCPU"); Call_Direct(AddressOf(&CN64System::UpdateSyncCPU),"CN64System::UpdateSyncCPU");
AfterCallDirect(RegSet); AfterCallDirect(RegSet);
} }
WriteX86Comment("Update Counter"); WriteX86Comment("Update Counter");
@ -4719,7 +4719,7 @@ void CRecompilerOps::UpdateCounters ( CRegInfo & RegSet, bool CheckTimer, bool C
BYTE * Jump = m_RecompPos - 1; BYTE * Jump = m_RecompPos - 1;
Pushad(); Pushad();
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::TimerDone),"CSystemTimer::TimerDone"); Call_Direct(AddressOf(&CSystemTimer::TimerDone),"CSystemTimer::TimerDone");
Popad(); Popad();
CPU_Message(""); CPU_Message("");

View File

@ -279,7 +279,7 @@ void CSettings::AddHowToHandleSetting ()
// cheats // cheats
AddHandler(Cheat_Entry, new CSettingTypeCheats("")); AddHandler(Cheat_Entry, new CSettingTypeCheats(""));
AddHandler(Cheat_Active, new CSettingTypeGameIndex("Cheat","",(bool)false)); AddHandler(Cheat_Active, new CSettingTypeGameIndex("Cheat","",(DWORD)false));
AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat",".exten","??? - Not Set")); AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat",".exten","??? - Not Set"));
AddHandler(Cheat_Notes, new CSettingTypeCheats("_N")); AddHandler(Cheat_Notes, new CSettingTypeCheats("_N"));
AddHandler(Cheat_Options, new CSettingTypeCheats("_O")); AddHandler(Cheat_Options, new CSettingTypeCheats("_O"));
@ -298,7 +298,7 @@ DWORD CSettings::FindGameSetting ( CSettings * _this, char * Name )
} }
CSettingTypeGame * GameSetting = (CSettingTypeGame *)Setting; CSettingTypeGame * GameSetting = (CSettingTypeGame *)Setting;
if (stricmp(GameSetting->GetKeyName(),Name) != 0) if (_stricmp(GameSetting->GetKeyName(),Name) != 0)
{ {
continue; continue;
} }
@ -586,7 +586,7 @@ bool CSettings::LoadString ( SettingID Type, char * Buffer, int BufferSize )
stdstr Value; stdstr Value;
bRes = FindInfo->second->Load(0,Value); bRes = FindInfo->second->Load(0,Value);
int len = BufferSize; int len = BufferSize;
if ((Value.length() + 1) < len) if ((Value.length() + 1) < (size_t)len)
{ {
len = Value.length() + 1; len = Value.length() + 1;
} }

View File

@ -770,11 +770,13 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
default: default:
if (_this->m_Menu) { if (_this->m_Menu) {
if (LOWORD(wParam) > 5000 && LOWORD(wParam) <= 5100 ) { if (LOWORD(wParam) > 5000 && LOWORD(wParam) <= 5100 ) {
if (_Plugins->RSP() && _Plugins->RSP()->ProcessMenuItem != NULL) { if (_Plugins->RSP())
{
_Plugins->RSP()->ProcessMenuItem(LOWORD(wParam)); _Plugins->RSP()->ProcessMenuItem(LOWORD(wParam));
} }
} else if (LOWORD(wParam) > 5100 && LOWORD(wParam) <= 5200 ) { } else if (LOWORD(wParam) > 5100 && LOWORD(wParam) <= 5200 ) {
if (_Plugins->Gfx() && _Plugins->Gfx()->ProcessMenuItem != NULL) { if (_Plugins->Gfx())
{
WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Starting"); WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Starting");
_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam)); _Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam));
WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Done"); WriteTrace(TraceGfxPlugin,"ProcessMenuItem: Done");

View File

@ -155,9 +155,9 @@ void CNotification::AddRecentDir ( const char * RomDir ) {
if (HIWORD(RomDir) == NULL) { return; } if (HIWORD(RomDir) == NULL) { return; }
//Get Information about the stored rom list //Get Information about the stored rom list
int MaxRememberedDirs = _Settings->LoadDword(Directory_RecentGameDirCount); size_t MaxRememberedDirs = _Settings->LoadDword(Directory_RecentGameDirCount);
strlist RecentDirs; strlist RecentDirs;
int i; size_t i;
for (i = 0; i < MaxRememberedDirs; i ++ ) for (i = 0; i < MaxRememberedDirs; i ++ )
{ {
stdstr RecentDir = _Settings->LoadStringIndex(Directory_RecentGameDirIndex,i); stdstr RecentDir = _Settings->LoadStringIndex(Directory_RecentGameDirIndex,i);
@ -195,9 +195,9 @@ void CNotification::AddRecentRom ( const char * ImagePath ) {
if (HIWORD(ImagePath) == NULL) { return; } if (HIWORD(ImagePath) == NULL) { return; }
//Get Information about the stored rom list //Get Information about the stored rom list
int MaxRememberedFiles = _Settings->LoadDword(File_RecentGameFileCount); size_t MaxRememberedFiles = _Settings->LoadDword(File_RecentGameFileCount);
strlist RecentGames; strlist RecentGames;
int i; size_t i;
for (i = 0; i < MaxRememberedFiles; i ++ ) for (i = 0; i < MaxRememberedFiles; i ++ )
{ {
stdstr RecentGame = _Settings->LoadStringIndex(File_RecentGameFileIndex,i); stdstr RecentGame = _Settings->LoadStringIndex(File_RecentGameFileIndex,i);

View File

@ -109,7 +109,7 @@ int CRomBrowser::CalcSortPosition (DWORD lParam)
break; break;
} }
int index; size_t index;
for (index = 0; index < m_Fields.size(); index++) for (index = 0; index < m_Fields.size(); index++)
{ {
if (_stricmp(m_Fields[index].Name(),SortFieldName.c_str()) == 0) { break; } if (_stricmp(m_Fields[index].Name(),SortFieldName.c_str()) == 0) { break; }
@ -124,7 +124,7 @@ int CRomBrowser::CalcSortPosition (DWORD lParam)
int LastTestPos = -1; int LastTestPos = -1;
while (Start < End) while (Start < End)
{ {
int TestPos = floor((Start + End) / 2); int TestPos = (int)floor((float)((Start + End) / 2));
if (LastTestPos == TestPos) if (LastTestPos == TestPos)
{ {
TestPos += 1; TestPos += 1;
@ -157,11 +157,11 @@ int CRomBrowser::CalcSortPosition (DWORD lParam)
else else
{ {
//Find new start //Find new start
float Left = Start; float Left = (float)Start;
float Right = TestPos; float Right = (float)TestPos;
while (Left < Right) while (Left < Right)
{ {
int NewTestPos = floor((Left + Right) / 2); int NewTestPos = (int)floor((Left + Right) / 2);
if (LastTestPos == NewTestPos) if (LastTestPos == NewTestPos)
{ {
NewTestPos += 1; NewTestPos += 1;
@ -181,18 +181,18 @@ int CRomBrowser::CalcSortPosition (DWORD lParam)
{ {
break; break;
} }
Right = NewTestPos; Right = (float)NewTestPos;
} }
if (Result > 0) if (Result > 0)
{ {
Left = NewTestPos; Left = (float)NewTestPos;
} }
} }
Start = Right; Start = (float)Right;
//Find new end //Find new end
Left = TestPos; Left = (float)TestPos;
Right = End; Right = End;
while (Left < Right) while (Left < Right)
{ {
@ -784,7 +784,7 @@ bool CRomBrowser::IsValidRomImage ( BYTE Test[4] ) {
bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, int * RomSize, FILE_FORMAT & FileFormat) { bool CRomBrowser::LoadDataFromRomFile(char * FileName,BYTE * Data,int DataLen, int * RomSize, FILE_FORMAT & FileFormat) {
BYTE Test[4]; BYTE Test[4];
if (strnicmp(&FileName[strlen(FileName)-4], ".ZIP",4) == 0 ){ if (_strnicmp(&FileName[strlen(FileName)-4], ".ZIP",4) == 0 ){
int len, port = 0, FoundRom; int len, port = 0, FoundRom;
unz_file_info info; unz_file_info info;
char zname[132]; char zname[132];
@ -951,8 +951,8 @@ void CRomBrowser::MenuSetText ( MENU_HANDLE hMenu, int MenuPos, const char * Tit
MenuInfo.cch = 256; MenuInfo.cch = 256;
GetMenuItemInfo((HMENU)hMenu,MenuPos,TRUE,&MenuInfo); GetMenuItemInfo((HMENU)hMenu,MenuPos,TRUE,&MenuInfo);
if (strchr(Title,'\t') != NULL) { *(strchr(Title,'\t')) = '\0'; }
strcpy(String,Title); strcpy(String,Title);
if (strchr(String,'\t') != NULL) { *(strchr(String,'\t')) = '\0'; }
if (ShotCut) { sprintf(String,"%s\t%s",String,ShotCut); } if (ShotCut) { sprintf(String,"%s\t%s",String,ShotCut); }
SetMenuItemInfo((HMENU)hMenu,MenuPos,TRUE,&MenuInfo); SetMenuItemInfo((HMENU)hMenu,MenuPos,TRUE,&MenuInfo);
} }
@ -1473,12 +1473,22 @@ void CRomBrowser::SaveRomListColoumnInfo(void) {
lvColumn.mask = LVCF_WIDTH; lvColumn.mask = LVCF_WIDTH;
for (int Coloumn = 0;ListView_GetColumn((HWND)m_hRomList,Coloumn,&lvColumn); Coloumn++) { for (int Coloumn = 0;ListView_GetColumn((HWND)m_hRomList,Coloumn,&lvColumn); Coloumn++) {
for (int index = 0; index < m_Fields.size(); index++) { int index;
if (m_Fields[index].Pos() == Coloumn) { break; } bool bFound = false;
} for (index = 0; index < m_Fields.size(); index++)
if (m_Fields[index].ColWidth() != lvColumn.cx)
{ {
m_Fields[index].SetColWidth(lvColumn.cx); if (m_Fields[index].Pos() == Coloumn)
{
bFound = true;
break;
}
}
if (bFound)
{
if (m_Fields[index].ColWidth() != lvColumn.cx)
{
m_Fields[index].SetColWidth(lvColumn.cx);
}
} }
} }
WriteTrace(TraceDebug,"SaveRomListColoumnInfo - Done"); WriteTrace(TraceDebug,"SaveRomListColoumnInfo - Done");

View File

@ -4,9 +4,9 @@ class CConfigSettingSection;
class CSettingsPage; class CSettingsPage;
class CSettingConfig : class CSettingConfig :
private CDialogImpl<CSettingConfig> public CDialogImpl<CSettingConfig>
{ {
public:
BEGIN_MSG_MAP_EX(CSettingConfig) BEGIN_MSG_MAP_EX(CSettingConfig)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked) COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked)

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
class COptionsDirectoriesPage : class COptionsDirectoriesPage :
private CDialogImpl<COptionsDirectoriesPage>, public CDialogImpl<COptionsDirectoriesPage>,
public CSettingsPage public CSettingsPage
{ {

View File

@ -165,7 +165,7 @@ void COptionsShortCutsPage::OnAssignClicked ( UINT Code, int id, HWND ctl )
return; return;
} }
WORD key = SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,index,0); WORD key = (WORD)SendDlgItemMessage(IDC_VIRTUALKEY,CB_GETITEMDATA,index,0);
bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED);
bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED);
@ -208,7 +208,7 @@ void COptionsShortCutsPage::OnShortCutChanged ( UINT Code, int id, HWND ctl )
//Get the virtual key info //Get the virtual key info
int index = m_VirtualKeyList.GetCurSel(); int index = m_VirtualKeyList.GetCurSel();
if (index < 0) { return; } if (index < 0) { return; }
WORD key = m_VirtualKeyList.GetItemData(index); WORD key = (WORD)m_VirtualKeyList.GetItemData(index);
bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED); bool bCtrl = (SendDlgItemMessage(IDC_CTL,BM_GETCHECK, 0,0) == BST_CHECKED);
bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bAlt = (SendDlgItemMessage(IDC_ALT,BM_GETCHECK, 0,0) == BST_CHECKED);
bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED); bool bShift = (SendDlgItemMessage(IDC_SHIFT,BM_GETCHECK, 0,0) == BST_CHECKED);
@ -287,7 +287,7 @@ BOOL CALLBACK KeyPromptDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
void COptionsShortCutsPage::InputGetKeys (void) void COptionsShortCutsPage::InputGetKeys (void)
{ {
HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_Key_Prompt),m_hWnd,KeyPromptDlgProc,(LPARAM)GetDlgItem(IDC_VIRTUALKEY)); HWND hKeyDlg = CreateDialogParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_Key_Prompt),m_hWnd,KeyPromptDlgProc,(LPARAM)::GetDlgItem(m_hWnd,IDC_VIRTUALKEY));
::EnableWindow(GetParent(),false); ::EnableWindow(GetParent(),false);
MSG msg; MSG msg;
@ -312,7 +312,7 @@ void COptionsShortCutsPage::InputGetKeys (void)
SendDlgItemMessage(IDC_CTL,BM_SETCHECK, (GetKeyState(VK_CONTROL) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_CTL,BM_SETCHECK, (GetKeyState(VK_CONTROL) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0);
SendDlgItemMessage(IDC_ALT,BM_SETCHECK, (GetKeyState(VK_MENU) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_ALT,BM_SETCHECK, (GetKeyState(VK_MENU) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0);
SendDlgItemMessage(IDC_SHIFT,BM_SETCHECK, (GetKeyState(VK_SHIFT) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0); SendDlgItemMessage(IDC_SHIFT,BM_SETCHECK, (GetKeyState(VK_SHIFT) & 0x80) != 0 ? BST_CHECKED : BST_UNCHECKED,0);
SendMessage(WM_COMMAND,MAKELPARAM(IDC_VIRTUALKEY,LBN_SELCHANGE),(LPARAM)GetDlgItem(IDC_VIRTUALKEY)); SendMessage(WM_COMMAND,MAKELPARAM(IDC_VIRTUALKEY,LBN_SELCHANGE),(LPARAM)::GetDlgItem(m_hWnd,IDC_VIRTUALKEY));
SetForegroundWindow(GetParent()); SetForegroundWindow(GetParent());
::DestroyWindow(hKeyDlg); ::DestroyWindow(hKeyDlg);
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
class CGeneralOptionsPage : class CGeneralOptionsPage :
private CSettingsPageImpl<CGeneralOptionsPage>, public CSettingsPageImpl<CGeneralOptionsPage>,
public CSettingsPage public CSettingsPage
{ {

View File

@ -8,7 +8,7 @@ CConfigSettingSection::CConfigSettingSection( LPCSTR PageTitle ) :
CConfigSettingSection::~CConfigSettingSection () CConfigSettingSection::~CConfigSettingSection ()
{ {
for (int i = 0; i < m_Pages.size(); i++) for (size_t i = 0; i < m_Pages.size(); i++)
{ {
delete m_Pages[i]; delete m_Pages[i];
} }
@ -22,7 +22,7 @@ void CConfigSettingSection::AddPage(CSettingsPage * Page )
CSettingsPage * CConfigSettingSection::GetPage ( int PageNo ) CSettingsPage * CConfigSettingSection::GetPage ( int PageNo )
{ {
if (PageNo < 0 || PageNo >= m_Pages.size()) if (PageNo < 0 || PageNo >= (int)m_Pages.size())
{ {
return NULL; return NULL;
} }

View File

@ -226,7 +226,7 @@ END
IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158 IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158
STYLE WS_CHILD STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,6,8,91,10 LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,6,8,91,10
EDITTEXT IDC_GOOD_NAME,102,7,109,12,ES_AUTOHSCROLL | ES_READONLY EDITTEXT IDC_GOOD_NAME,102,7,109,12,ES_AUTOHSCROLL | ES_READONLY
@ -715,7 +715,7 @@ END
IDD_Settings_GameRecompiler DIALOGEX 0, 0, 230, 156 IDD_Settings_GameRecompiler DIALOGEX 0, 0, 230, 156
STYLE WS_CHILD STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
LTEXT "CPU core style:",IDC_CPU_TYPE_TEXT,4,11,106,10 LTEXT "CPU core style:",IDC_CPU_TYPE_TEXT,4,11,106,10
COMBOBOX IDC_CPU_TYPE,113,8,99,49,CBS_DROPDOWNLIST | WS_VSCROLL | COMBOBOX IDC_CPU_TYPE,113,8,99,49,CBS_DROPDOWNLIST | WS_VSCROLL |
@ -1087,8 +1087,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,7,51,43 FILEVERSION 1,7,51,44
PRODUCTVERSION 1,7,51,43 PRODUCTVERSION 1,7,51,44
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -1106,14 +1106,14 @@ BEGIN
VALUE "Comments", "\0" VALUE "Comments", "\0"
VALUE "CompanyName", " \0" VALUE "CompanyName", " \0"
VALUE "FileDescription", "Project64\0" VALUE "FileDescription", "Project64\0"
VALUE "FileVersion", "1, 7, 51, 43\0" VALUE "FileVersion", "1, 7, 51, 44\0"
VALUE "InternalName", "Project64\0" VALUE "InternalName", "Project64\0"
VALUE "LegalCopyright", "Copyright © 2010\0" VALUE "LegalCopyright", "Copyright © 2010\0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Project64.exe\0" VALUE "OriginalFilename", "Project64.exe\0"
VALUE "PrivateBuild", "\0" VALUE "PrivateBuild", "\0"
VALUE "ProductName", " Project64\0" VALUE "ProductName", " Project64\0"
VALUE "ProductVersion", "1, 7, 51, 43\0" VALUE "ProductVersion", "1, 7, 51, 44\0"
VALUE "SpecialBuild", "\0" VALUE "SpecialBuild", "\0"
END END
END END

View File

@ -2933,9 +2933,9 @@ public:
if ( m_bTileBackground ) if ( m_bTileBackground )
{ {
// calculate tile image maximum rows and columns // calculate tile image maximum rows and columns
div_t divRows = div( rcClient.Height(), sizBackground.cy ); div_t divRows = div( (int)rcClient.Height(), (int)sizBackground.cy );
int nTileRows = divRows.rem > 0 ? divRows.quot + 1 : divRows.quot; int nTileRows = divRows.rem > 0 ? divRows.quot + 1 : divRows.quot;
div_t divColumns = div( rcClient.Width(), sizBackground.cx ); div_t divColumns = div( (int)rcClient.Width(), (int)sizBackground.cx );
int nTileColumns = divColumns.rem > 0 ? divColumns.quot + 1 : divColumns.quot; int nTileColumns = divColumns.rem > 0 ? divColumns.quot + 1 : divColumns.quot;
// draw tiled background image // draw tiled background image

View File

@ -80,7 +80,7 @@ public:
return TRUE; return TRUE;
stdstr strValue; stdstr strValue;
int nValueLength = GetWindowTextLength(); UINT nValueLength = GetWindowTextLength();
strValue.reserve(nValueLength + 1); strValue.reserve(nValueLength + 1);
strValue.resize(nValueLength); strValue.resize(nValueLength);
GetWindowText( (LPTSTR)strValue.c_str(), nValueLength + 1); GetWindowText( (LPTSTR)strValue.c_str(), nValueLength + 1);
@ -136,7 +136,7 @@ public:
int nDecimalIndex = -1; int nDecimalIndex = -1;
int nDigitIndex = -1; int nDigitIndex = -1;
for ( int nCharIndex = 0; nCharIndex < strNewValue.length(); nCharIndex++ ) for ( size_t nCharIndex = 0; nCharIndex < strNewValue.length(); nCharIndex++ )
{ {
TCHAR nCharValue = strNewValue[ nCharIndex ]; TCHAR nCharValue = strNewValue[ nCharIndex ];
if (( m_nFlags & ITEM_FLAGS_EDIT_HEX ) && if (( m_nFlags & ITEM_FLAGS_EDIT_HEX ) &&

View File

@ -206,7 +206,7 @@ void TestValidBinaryThread ( )
stdstr_f PostData("%s=","Data"); stdstr_f PostData("%s=","Data");
BYTE * Input = (BYTE *)PostInfo.c_str(); BYTE * Input = (BYTE *)PostInfo.c_str();
BYTE PreviousChar = 0xAA; BYTE PreviousChar = 0xAA;
for (int x = 0; x < PostInfo.size(); x++) for (size_t x = 0; x < PostInfo.size(); x++)
{ {
PostData += stdstr_f("%02X",(BYTE)(Input[x] ^ PreviousChar)); PostData += stdstr_f("%02X",(BYTE)(Input[x] ^ PreviousChar));
PreviousChar = Input[x]; PreviousChar = Input[x];
@ -277,7 +277,7 @@ void TestValidBinaryThread ( )
WriteTraceF(TraceValidate,"v9: %s",Result_md5.hex_digest()); WriteTraceF(TraceValidate,"v9: %s",Result_md5.hex_digest());
#endif #endif
//if good MD5 //if good MD5
if (stricmp(Result_md5.hex_digest(),"FB2CDD258756A5472BD24BABF2EC9F66") == 0) // Good Md5 if (_stricmp(Result_md5.hex_digest(),"FB2CDD258756A5472BD24BABF2EC9F66") == 0) // Good Md5
{ {
if (LastRunItem > 0) if (LastRunItem > 0)
{ {
@ -290,7 +290,7 @@ void TestValidBinaryThread ( )
} }
DefaultResult = true; DefaultResult = true;
} }
else if (stricmp(Result_md5.hex_digest(),"9030FF575A9B687DC868B966CB7C02D4") == 0) // Bad MD5 else if (_stricmp(Result_md5.hex_digest(),"9030FF575A9B687DC868B966CB7C02D4") == 0) // Bad MD5
{ {
if (LastRunItem > 0) if (LastRunItem > 0)
{ {

View File

@ -61,7 +61,7 @@ void FixUPXIssue ( BYTE * ProgramLocation )
SetFilePointer(hFile,(8 + SizeOfSections) * -1,0,FILE_END); SetFilePointer(hFile,(8 + SizeOfSections) * -1,0,FILE_END);
ReadFile(hFile,Section,SizeOfSections,&dwRead,NULL); ReadFile(hFile,Section,SizeOfSections,&dwRead,NULL);
for (int count = 0; count < NoOfSections; count ++ ) for (DWORD count = 0; count < NoOfSections; count ++ )
{ {
LPVOID Address = ProgramLocation + Section[count].VirtualAddress; LPVOID Address = ProgramLocation + Section[count].VirtualAddress;
MEMORY_BASIC_INFORMATION Buffer; MEMORY_BASIC_INFORMATION Buffer;