Change NULL to nullptr
This commit is contained in:
parent
a48f8d1a62
commit
cf58754414
|
@ -31,7 +31,7 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
CDateTime::CDateTime()
|
CDateTime::CDateTime()
|
||||||
{
|
{
|
||||||
m_time = time(NULL);
|
m_time = time(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CDateTime::Format(const char * format)
|
std::string CDateTime::Format(const char * format)
|
||||||
|
@ -15,6 +15,6 @@ std::string CDateTime::Format(const char * format)
|
||||||
|
|
||||||
CDateTime & CDateTime::SetToNow(void)
|
CDateTime & CDateTime::SetToNow(void)
|
||||||
{
|
{
|
||||||
m_time = time(NULL);
|
m_time = time(nullptr);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ CFile::CFile() :
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
m_hFile(INVALID_HANDLE_VALUE),
|
m_hFile(INVALID_HANDLE_VALUE),
|
||||||
#else
|
#else
|
||||||
m_hFile(NULL),
|
m_hFile(nullptr),
|
||||||
#endif
|
#endif
|
||||||
m_bCloseOnDelete(false)
|
m_bCloseOnDelete(false)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) :
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
m_hFile(INVALID_HANDLE_VALUE),
|
m_hFile(INVALID_HANDLE_VALUE),
|
||||||
#else
|
#else
|
||||||
m_hFile(NULL),
|
m_hFile(nullptr),
|
||||||
#endif
|
#endif
|
||||||
m_bCloseOnDelete(true)
|
m_bCloseOnDelete(true)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ CFile::~CFile()
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete)
|
if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete)
|
||||||
#else
|
#else
|
||||||
if (m_hFile != NULL && m_bCloseOnDelete)
|
if (m_hFile != nullptr && m_bCloseOnDelete)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
|
@ -63,7 +63,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpszFileName == NULL || strlen(lpszFileName) == 0)
|
if (lpszFileName == nullptr || strlen(lpszFileName) == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
// Map modeNoInherit flag
|
// Map modeNoInherit flag
|
||||||
SECURITY_ATTRIBUTES sa;
|
SECURITY_ATTRIBUTES sa;
|
||||||
sa.nLength = sizeof(sa);
|
sa.nLength = sizeof(sa);
|
||||||
sa.lpSecurityDescriptor = NULL;
|
sa.lpSecurityDescriptor = nullptr;
|
||||||
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
|
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
|
||||||
|
|
||||||
// Map creation flags
|
// Map creation flags
|
||||||
|
@ -110,7 +110,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt file creation
|
// Attempt file creation
|
||||||
HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE hFile = ::CreateFileA(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{ //#define ERROR_PATH_NOT_FOUND 3L
|
{ //#define ERROR_PATH_NOT_FOUND 3L
|
||||||
//ULONG err = GetLastError();
|
//ULONG err = GetLastError();
|
||||||
|
@ -151,7 +151,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
(nOpenFlags & CFileBase::modeReadWrite) == CFileBase::modeReadWrite)
|
(nOpenFlags & CFileBase::modeReadWrite) == CFileBase::modeReadWrite)
|
||||||
{
|
{
|
||||||
m_hFile = fopen(lpszFileName, "rb+");
|
m_hFile = fopen(lpszFileName, "rb+");
|
||||||
if (m_hFile != NULL)
|
if (m_hFile != nullptr)
|
||||||
{
|
{
|
||||||
SeekToBegin();
|
SeekToBegin();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
else if ((nOpenFlags & CFileBase::modeRead) == CFileBase::modeRead)
|
else if ((nOpenFlags & CFileBase::modeRead) == CFileBase::modeRead)
|
||||||
{
|
{
|
||||||
m_hFile = fopen(lpszFileName, "rb");
|
m_hFile = fopen(lpszFileName, "rb");
|
||||||
if (m_hFile != NULL)
|
if (m_hFile != nullptr)
|
||||||
{
|
{
|
||||||
SeekToBegin();
|
SeekToBegin();
|
||||||
}
|
}
|
||||||
|
@ -183,10 +183,10 @@ bool CFile::Close()
|
||||||
}
|
}
|
||||||
m_hFile = INVALID_HANDLE_VALUE;
|
m_hFile = INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
if (m_hFile != NULL)
|
if (m_hFile != nullptr)
|
||||||
{
|
{
|
||||||
fclose((FILE *)m_hFile);
|
fclose((FILE *)m_hFile);
|
||||||
m_hFile = NULL;
|
m_hFile = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_bCloseOnDelete = false;
|
m_bCloseOnDelete = false;
|
||||||
|
@ -208,7 +208,7 @@ bool CFile::IsOpen(void) const
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
return m_hFile != INVALID_HANDLE_VALUE;
|
return m_hFile != INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
return m_hFile != NULL;
|
return m_hFile != nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ bool CFile::Write(const void* lpBuf, uint32_t nCount)
|
||||||
|
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
ULONG nWritten = 0;
|
ULONG nWritten = 0;
|
||||||
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
|
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, nullptr))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
|
||||||
|
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
DWORD dwRead = 0;
|
DWORD dwRead = 0;
|
||||||
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
|
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, nullptr))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -279,14 +279,14 @@ uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
|
||||||
int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
|
int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
|
||||||
{
|
{
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom);
|
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, nullptr, (ULONG)nFrom);
|
||||||
if (dwNew == (ULONG)-1)
|
if (dwNew == (ULONG)-1)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return dwNew;
|
return dwNew;
|
||||||
#else
|
#else
|
||||||
if (m_hFile == NULL)
|
if (m_hFile == nullptr)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ int32_t CFile::Seek(int32_t lOff, SeekPosition nFrom)
|
||||||
uint32_t CFile::GetPosition() const
|
uint32_t CFile::GetPosition() const
|
||||||
{
|
{
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
|
return ::SetFilePointer(m_hFile, 0, nullptr, FILE_CURRENT);
|
||||||
#else
|
#else
|
||||||
return (uint32_t)ftell((FILE *)m_hFile);
|
return (uint32_t)ftell((FILE *)m_hFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,7 @@ CIniFileBase::CIniFileBase(CFileBase & FileObject, const char * FileName) :
|
||||||
m_File(FileObject),
|
m_File(FileObject),
|
||||||
m_FileName(FileName),
|
m_FileName(FileName),
|
||||||
m_CurrentSectionDirty(false),
|
m_CurrentSectionDirty(false),
|
||||||
m_SortFunction(NULL)
|
m_SortFunction(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ int CIniFileBase::GetStringFromFile(char * & String, std::unique_ptr<char> &Data
|
||||||
// Increase buffer size
|
// Increase buffer size
|
||||||
int NewMaxDataSize = MaxDataSize + BufferIncrease;
|
int NewMaxDataSize = MaxDataSize + BufferIncrease;
|
||||||
char * NewBuffer = new char[NewMaxDataSize];
|
char * NewBuffer = new char[NewMaxDataSize];
|
||||||
if (NewBuffer == NULL)
|
if (NewBuffer == nullptr)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ void CIniFileBase::SaveCurrentSection(void)
|
||||||
|
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||||
std::unique_ptr<char> Data;
|
std::unique_ptr<char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
|
|
||||||
// Skip first line as it is the section name
|
// Skip first line as it is the section name
|
||||||
int StartPos = m_CurrentSectionFilePos;
|
int StartPos = m_CurrentSectionFilePos;
|
||||||
|
@ -245,7 +245,7 @@ void CIniFileBase::SaveCurrentSection(void)
|
||||||
std::unique_ptr<char> LineData;
|
std::unique_ptr<char> LineData;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (m_SortFunction != NULL)
|
if (m_SortFunction != nullptr)
|
||||||
{
|
{
|
||||||
KeyValueVector data;
|
KeyValueVector data;
|
||||||
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
|
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
|
||||||
|
@ -297,7 +297,7 @@ bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool Change
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<char> Data;
|
std::unique_ptr<char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||||
|
|
||||||
FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName));
|
FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName));
|
||||||
|
@ -386,7 +386,7 @@ bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool Change
|
||||||
if (strlen(CleanLine(Input)) <= 1) { continue; }
|
if (strlen(CleanLine(Input)) <= 1) { continue; }
|
||||||
if (Input[0] == '[') { break; }
|
if (Input[0] == '[') { break; }
|
||||||
char * Pos = strchr(Input, '=');
|
char * Pos = strchr(Input, '=');
|
||||||
if (Pos == NULL) { continue; }
|
if (Pos == nullptr) { continue; }
|
||||||
char * Value = &Pos[1];
|
char * Value = &Pos[1];
|
||||||
|
|
||||||
char * Pos1 = Pos - 1;
|
char * Pos1 = Pos - 1;
|
||||||
|
@ -408,10 +408,10 @@ const char * CIniFileBase::CleanLine(char * Line)
|
||||||
char * Pos = Line;
|
char * Pos = Line;
|
||||||
|
|
||||||
// Remove any comment from the line
|
// Remove any comment from the line
|
||||||
while (Pos != NULL)
|
while (Pos != nullptr)
|
||||||
{
|
{
|
||||||
Pos = strchr(Pos, '/');
|
Pos = strchr(Pos, '/');
|
||||||
if (Pos != NULL)
|
if (Pos != nullptr)
|
||||||
{
|
{
|
||||||
if (Pos[1] == '/')
|
if (Pos[1] == '/')
|
||||||
{
|
{
|
||||||
|
@ -510,7 +510,7 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
|
||||||
{
|
{
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, NextLine = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, NextLine = 0, result;
|
||||||
std::unique_ptr <char> Data;
|
std::unique_ptr <char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
|
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
|
||||||
|
@ -570,7 +570,7 @@ bool CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyName,
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
lpSectionName = "default";
|
lpSectionName = "default";
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ uint32_t CIniFileBase::GetString(const char * lpSectionName, const char * lpKeyN
|
||||||
|
|
||||||
std::string strSection;
|
std::string strSection;
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
strSection = "default";
|
strSection = "default";
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ bool CIniFileBase::GetNumber(const char * lpSectionName, const char * lpKeyName,
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
lpSectionName = "default";
|
lpSectionName = "default";
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ void CIniFileBase::SaveString(const char * lpSectionName, const char * lpKeyNam
|
||||||
}
|
}
|
||||||
std::string strSection;
|
std::string strSection;
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
strSection = "default";
|
strSection = "default";
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ bool CIniFileBase::EntryExists(const char * lpSectionName, const char * lpKeyNam
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
lpSectionName = "default";
|
lpSectionName = "default";
|
||||||
}
|
}
|
||||||
|
@ -770,7 +770,7 @@ void CIniFileBase::GetKeyList(const char * lpSectionName, strlist &List)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
lpSectionName = "default";
|
lpSectionName = "default";
|
||||||
}
|
}
|
||||||
|
@ -794,7 +794,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
|
||||||
|
|
||||||
std::string strSection;
|
std::string strSection;
|
||||||
|
|
||||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
if (lpSectionName == nullptr || strlen(lpSectionName) == 0)
|
||||||
{
|
{
|
||||||
strSection = "default";
|
strSection = "default";
|
||||||
}
|
}
|
||||||
|
@ -807,7 +807,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
|
||||||
|
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||||
std::unique_ptr <char> Data;
|
std::unique_ptr <char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
|
result = GetStringFromFile(Input, Data, MaxDataSize, DataSize, ReadPos);
|
||||||
|
@ -815,7 +815,7 @@ void CIniFileBase::GetKeyValueData(const char * lpSectionName, KeyValueData & Li
|
||||||
if (strlen(CleanLine(Input)) <= 1) { continue; }
|
if (strlen(CleanLine(Input)) <= 1) { continue; }
|
||||||
if (Input[0] == '[') { break; }
|
if (Input[0] == '[') { break; }
|
||||||
char * Pos = strchr(Input, '=');
|
char * Pos = strchr(Input, '=');
|
||||||
if (Pos == NULL) { continue; }
|
if (Pos == nullptr) { continue; }
|
||||||
Pos[0] = 0;
|
Pos[0] = 0;
|
||||||
|
|
||||||
List.insert(KeyValueData::value_type(Input, &Pos[1]));
|
List.insert(KeyValueData::value_type(Input, &Pos[1]));
|
||||||
|
@ -882,7 +882,7 @@ std::string CIniFileBase::FormatStr(const char * strFormat, ...)
|
||||||
size_t nlen = _vscprintf(strFormat, args) + 1;
|
size_t nlen = _vscprintf(strFormat, args) + 1;
|
||||||
char * buffer = (char *)alloca(nlen * sizeof(char));
|
char * buffer = (char *)alloca(nlen * sizeof(char));
|
||||||
buffer[nlen - 1] = 0;
|
buffer[nlen - 1] = 0;
|
||||||
if (buffer != NULL)
|
if (buffer != nullptr)
|
||||||
{
|
{
|
||||||
vsprintf(buffer, strFormat, args);
|
vsprintf(buffer, strFormat, args);
|
||||||
FormatedStr = buffer;
|
FormatedStr = buffer;
|
||||||
|
|
|
@ -19,7 +19,7 @@ CLog::~CLog (void)
|
||||||
|
|
||||||
bool CLog::Open( const char * FileName, LOG_OPEN_MODE mode /* = Log_New */)
|
bool CLog::Open( const char * FileName, LOG_OPEN_MODE mode /* = Log_New */)
|
||||||
{
|
{
|
||||||
if (FileName == NULL)
|
if (FileName == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
|
||||||
size_t nlen = _vscprintf(Message, args) + 1;
|
size_t nlen = _vscprintf(Message, args) + 1;
|
||||||
char * Msg = (char *)alloca(nlen * sizeof(char));
|
char * Msg = (char *)alloca(nlen * sizeof(char));
|
||||||
Msg[nlen - 1] = 0;
|
Msg[nlen - 1] = 0;
|
||||||
if (Msg != NULL)
|
if (Msg != nullptr)
|
||||||
{
|
{
|
||||||
vsprintf(Msg, Message, args);
|
vsprintf(Msg, Message, args);
|
||||||
Log(Msg);
|
Log(Msg);
|
||||||
|
|
|
@ -46,8 +46,8 @@ CMemList *MemList(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CMemList::CMemList() :
|
CMemList::CMemList() :
|
||||||
m_MemList(NULL),
|
m_MemList(nullptr),
|
||||||
m_hModule(NULL),
|
m_hModule(nullptr),
|
||||||
m_cs({0}),
|
m_cs({0}),
|
||||||
m_NextOrder(1)
|
m_NextOrder(1)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ CMemList::~CMemList()
|
||||||
DumpItems();
|
DumpItems();
|
||||||
}
|
}
|
||||||
delete m_MemList;
|
delete m_MemList;
|
||||||
m_MemList = NULL;
|
m_MemList = nullptr;
|
||||||
DeleteCriticalSection(&m_cs);
|
DeleteCriticalSection(&m_cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,14 +128,14 @@ void CMemList::DumpItems(void)
|
||||||
HANDLE hLogFile = INVALID_HANDLE_VALUE;
|
HANDLE hLogFile = INVALID_HANDLE_VALUE;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
hLogFile = CreateFileA( LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
|
hLogFile = CreateFileA( LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr );
|
||||||
if (hLogFile == INVALID_HANDLE_VALUE)
|
if (hLogFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_SHARING_VIOLATION)
|
if (GetLastError() == ERROR_SHARING_VIOLATION)
|
||||||
{
|
{
|
||||||
char Msg[3000];
|
char Msg[3000];
|
||||||
sprintf(Msg, "%s\nCan not be opened for writing please close app using this file\n\nTry Again ?", LogFileName);
|
sprintf(Msg, "%s\nCan not be opened for writing please close app using this file\n\nTry Again ?", LogFileName);
|
||||||
int Result = MessageBoxA(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
int Result = MessageBoxA(nullptr, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||||
if (Result == IDNO)
|
if (Result == IDNO)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -146,33 +146,33 @@ void CMemList::DumpItems(void)
|
||||||
|
|
||||||
if (hLogFile != INVALID_HANDLE_VALUE)
|
if (hLogFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
|
SetFilePointer(hLogFile, 0, nullptr, FILE_BEGIN);
|
||||||
|
|
||||||
DWORD dwWritten = 0;
|
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, (DWORD)strlen(Msg), &dwWritten, NULL);
|
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, nullptr);
|
||||||
|
|
||||||
for (MEMLIST_ITER item = m_MemList->begin(); item != m_MemList->end(); item++)
|
for (MEMLIST_ITER item = m_MemList->begin(); item != m_MemList->end(); item++)
|
||||||
{
|
{
|
||||||
_snprintf(Msg, sizeof(Msg), "%d,%s, %d, %d\r\n", (*item).second.order, (*item).second.File, (*item).second.line, (*item).second.size);
|
_snprintf(Msg, sizeof(Msg), "%d,%s, %d, %d\r\n", (*item).second.order, (*item).second.File, (*item).second.line, (*item).second.size);
|
||||||
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
|
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, nullptr);
|
||||||
}
|
}
|
||||||
CloseHandle(hLogFile);
|
CloseHandle(hLogFile);
|
||||||
}
|
}
|
||||||
char Msg[3000];
|
char Msg[3000];
|
||||||
sprintf(Msg, "%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?", fname, ext);
|
sprintf(Msg, "%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?", fname, ext);
|
||||||
int Result = MessageBoxA(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
int Result = MessageBoxA(nullptr, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||||
if (Result == IDYES)
|
if (Result == IDYES)
|
||||||
{
|
{
|
||||||
ShellExecuteA(NULL, "open", LogFileName, NULL, NULL, SW_SHOW);
|
ShellExecuteA(nullptr, "open", LogFileName, nullptr, nullptr, SW_SHOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* AllocateMemory(size_t size, const char* filename, unsigned int line)
|
void* AllocateMemory(size_t size, const char* filename, unsigned int line)
|
||||||
{
|
{
|
||||||
void * res = malloc(size);
|
void * res = malloc(size);
|
||||||
if (res == NULL)
|
if (res == nullptr)
|
||||||
{
|
{
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ void* AllocateAddressSpace(size_t size, void * base_address)
|
||||||
void * ptr = mmap((void*)0, size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
void * ptr = mmap((void*)0, size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||||
if (ptr == MAP_FAILED)
|
if (ptr == MAP_FAILED)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
msync(ptr, size, MS_SYNC | MS_INVALIDATE);
|
msync(ptr, size, MS_SYNC | MS_INVALIDATE);
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -80,7 +80,7 @@ void* CommitMemory(void* addr, size_t size, MEM_PROTECTION memProtection)
|
||||||
int OsMemProtection;
|
int OsMemProtection;
|
||||||
if (!TranslateFromMemProtect(memProtection, OsMemProtection))
|
if (!TranslateFromMemProtect(memProtection, OsMemProtection))
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return VirtualAlloc(addr, size, MEM_COMMIT, OsMemProtection);
|
return VirtualAlloc(addr, size, MEM_COMMIT, OsMemProtection);
|
||||||
|
@ -118,11 +118,11 @@ bool ProtectMemory(void* addr, size_t size, MEM_PROTECTION memProtection, MEM_PR
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD OldOsProtect;
|
DWORD OldOsProtect;
|
||||||
BOOL res = VirtualProtect(addr, size, OsMemProtection, &OldOsProtect);
|
BOOL res = VirtualProtect(addr, size, OsMemProtection, &OldOsProtect);
|
||||||
if (OldProtect != NULL)
|
if (OldProtect != nullptr)
|
||||||
{
|
{
|
||||||
if (!TranslateToMemProtect(OldOsProtect, *OldProtect))
|
if (!TranslateToMemProtect(OldOsProtect, *OldProtect))
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res != 0;
|
return res != 0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ int _vscprintf(const char * format, va_list pargs)
|
||||||
int retval;
|
int retval;
|
||||||
va_list argcopy;
|
va_list argcopy;
|
||||||
va_copy(argcopy, pargs);
|
va_copy(argcopy, pargs);
|
||||||
retval = vsnprintf(NULL, 0, format, argcopy);
|
retval = vsnprintf(nullptr, 0, format, argcopy);
|
||||||
va_end(argcopy);
|
va_end(argcopy);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
CRandom::CRandom()
|
CRandom::CRandom()
|
||||||
{
|
{
|
||||||
m_state = (uint32_t)time(NULL);
|
m_state = (uint32_t)time(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRandom::CRandom(uint32_t state_value)
|
CRandom::CRandom(uint32_t state_value)
|
||||||
|
|
|
@ -71,7 +71,7 @@ void stdstr::ArgFormat(const char * strFormat, va_list & args)
|
||||||
size_t nlen = _vscprintf(strFormat, args) + 1;
|
size_t nlen = _vscprintf(strFormat, args) + 1;
|
||||||
char * buffer = (char *)alloca(nlen * sizeof(char));
|
char * buffer = (char *)alloca(nlen * sizeof(char));
|
||||||
buffer[nlen - 1] = 0;
|
buffer[nlen - 1] = 0;
|
||||||
if (buffer != NULL)
|
if (buffer != nullptr)
|
||||||
{
|
{
|
||||||
vsprintf(buffer, strFormat, args);
|
vsprintf(buffer, strFormat, args);
|
||||||
*this = buffer;
|
*this = buffer;
|
||||||
|
@ -200,22 +200,22 @@ stdstr & stdstr::FromUTF16(const wchar_t * UTF16Source, bool * bSuccess)
|
||||||
{
|
{
|
||||||
bool bConverted = false;
|
bool bConverted = false;
|
||||||
|
|
||||||
if (UTF16Source == NULL)
|
if (UTF16Source == nullptr)
|
||||||
{
|
{
|
||||||
*this = "";
|
*this = "";
|
||||||
bConverted = true;
|
bConverted = true;
|
||||||
}
|
}
|
||||||
else if (wcslen(UTF16Source) > 0)
|
else if (wcslen(UTF16Source) > 0)
|
||||||
{
|
{
|
||||||
uint32_t nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, NULL, 0, NULL, NULL);
|
uint32_t nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, nullptr, 0, nullptr, nullptr);
|
||||||
if (nNeeded > 0)
|
if (nNeeded > 0)
|
||||||
{
|
{
|
||||||
char * buf = (char *)alloca(nNeeded + 1);
|
char * buf = (char *)alloca(nNeeded + 1);
|
||||||
if (buf != NULL)
|
if (buf != nullptr)
|
||||||
{
|
{
|
||||||
memset(buf, 0, nNeeded + 1);
|
memset(buf, 0, nNeeded + 1);
|
||||||
|
|
||||||
nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, buf, nNeeded, NULL, NULL);
|
nNeeded = WideCharToMultiByte(CODEPAGE_UTF8, 0, UTF16Source, -1, buf, nNeeded, nullptr, nullptr);
|
||||||
if (nNeeded)
|
if (nNeeded)
|
||||||
{
|
{
|
||||||
*this = buf;
|
*this = buf;
|
||||||
|
@ -236,11 +236,11 @@ std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) const
|
||||||
bool bConverted = false;
|
bool bConverted = false;
|
||||||
std::wstring res;
|
std::wstring res;
|
||||||
|
|
||||||
DWORD nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), NULL, 0);
|
DWORD nNeeded = MultiByteToWideChar(CodePage, 0, this->c_str(), (int)this->length(), nullptr, 0);
|
||||||
if (nNeeded > 0)
|
if (nNeeded > 0)
|
||||||
{
|
{
|
||||||
wchar_t * buf = (wchar_t *)alloca((nNeeded + 1) * sizeof(wchar_t));
|
wchar_t * buf = (wchar_t *)alloca((nNeeded + 1) * sizeof(wchar_t));
|
||||||
if (buf != NULL)
|
if (buf != nullptr)
|
||||||
{
|
{
|
||||||
memset(buf, 0, (nNeeded + 1) * sizeof(wchar_t));
|
memset(buf, 0, (nNeeded + 1) * sizeof(wchar_t));
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ public:
|
||||||
stdstr & TrimRight(const char * chars2remove = "\t ");
|
stdstr & TrimRight(const char * chars2remove = "\t ");
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = NULL);
|
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = nullptr);
|
||||||
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = NULL) const;
|
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = nullptr) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ArgFormat(const char * strFormat, va_list & args);
|
void ArgFormat(const char * strFormat, va_list & args);
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
SyncEvent::SyncEvent(bool bManualReset)
|
SyncEvent::SyncEvent(bool bManualReset)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_Event = CreateEvent(NULL, bManualReset, FALSE, NULL);
|
m_Event = CreateEvent(nullptr, bManualReset, FALSE, nullptr);
|
||||||
#else
|
#else
|
||||||
m_signalled = false;
|
m_signalled = false;
|
||||||
m_Event = new pthread_mutex_t;
|
m_Event = new pthread_mutex_t;
|
||||||
m_cond = new pthread_cond_t;
|
m_cond = new pthread_cond_t;
|
||||||
pthread_mutex_init((pthread_mutex_t*)m_Event, NULL);
|
pthread_mutex_init((pthread_mutex_t*)m_Event, nullptr);
|
||||||
pthread_cond_init((pthread_cond_t*)m_cond, NULL);
|
pthread_cond_init((pthread_cond_t*)m_cond, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) :
|
CThread::CThread(CTHREAD_START_ROUTINE lpStartAddress) :
|
||||||
m_StartAddress(lpStartAddress),
|
m_StartAddress(lpStartAddress),
|
||||||
m_lpThreadParameter(NULL),
|
m_lpThreadParameter(nullptr),
|
||||||
m_thread(NULL),
|
m_thread(nullptr),
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
m_running(false),
|
m_running(false),
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,13 +44,13 @@ bool CThread::Start(void * lpThreadParameter)
|
||||||
WriteTrace(TraceThread, TraceDebug, "Start");
|
WriteTrace(TraceThread, TraceDebug, "Start");
|
||||||
m_lpThreadParameter = lpThreadParameter;
|
m_lpThreadParameter = lpThreadParameter;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadWrapper, this, 0, (LPDWORD)&m_threadID);
|
m_thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)ThreadWrapper, this, 0, (LPDWORD)&m_threadID);
|
||||||
#else
|
#else
|
||||||
pthread_t * thread_id = new pthread_t;
|
pthread_t * thread_id = new pthread_t;
|
||||||
|
|
||||||
m_thread = (void*)thread_id;
|
m_thread = (void*)thread_id;
|
||||||
|
|
||||||
int res = pthread_create(thread_id, NULL, (void *(*)(void *))ThreadWrapper, this);
|
int res = pthread_create(thread_id, nullptr, (void *(*)(void *))ThreadWrapper, this);
|
||||||
#endif
|
#endif
|
||||||
WriteTrace(TraceThread, TraceDebug, "Done");
|
WriteTrace(TraceThread, TraceDebug, "Done");
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,7 +64,7 @@ void * CThread::ThreadWrapper (CThread * _this)
|
||||||
_this->m_running = true;
|
_this->m_running = true;
|
||||||
WriteTrace(TraceThread, TraceDebug, "Thread is running");
|
WriteTrace(TraceThread, TraceDebug, "Thread is running");
|
||||||
#endif
|
#endif
|
||||||
void * res = NULL;
|
void * res = nullptr;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
|
#if defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
|
||||||
|
@ -87,7 +87,7 @@ void * CThread::ThreadWrapper (CThread * _this)
|
||||||
pthread_t * thread_id = (pthread_t *)_this->m_thread;
|
pthread_t * thread_id = (pthread_t *)_this->m_thread;
|
||||||
delete thread_id;
|
delete thread_id;
|
||||||
#endif
|
#endif
|
||||||
_this->m_thread = NULL;
|
_this->m_thread = nullptr;
|
||||||
WriteTrace(TraceThread, TraceDebug, "Done");
|
WriteTrace(TraceThread, TraceDebug, "Done");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ void * CThread::ThreadWrapper (CThread * _this)
|
||||||
bool CThread::isRunning(void) const
|
bool CThread::isRunning(void) const
|
||||||
{
|
{
|
||||||
WriteTrace(TraceThread, TraceDebug, "Start");
|
WriteTrace(TraceThread, TraceDebug, "Start");
|
||||||
if (m_thread == NULL)
|
if (m_thread == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceThread, TraceDebug, "Done (res: false), m_thread is null");
|
WriteTrace(TraceThread, TraceDebug, "Done (res: false), m_thread is null");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
typedef std::map<uint32_t, stdstr> ModuleNameMap;
|
typedef std::map<uint32_t, stdstr> ModuleNameMap;
|
||||||
|
|
||||||
uint32_t * g_ModuleLogLevel = NULL;
|
uint32_t * g_ModuleLogLevel = nullptr;
|
||||||
static bool g_TraceClosed = false;
|
static bool g_TraceClosed = false;
|
||||||
static ModuleNameMap g_ModuleNames;
|
static ModuleNameMap g_ModuleNames;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void WriteTraceFull(uint32_t module, uint8_t severity, const char * file, int li
|
||||||
size_t nlen = _vscprintf(format, args) + 1;
|
size_t nlen = _vscprintf(format, args) + 1;
|
||||||
char * Message = (char *)alloca(nlen * sizeof(char));
|
char * Message = (char *)alloca(nlen * sizeof(char));
|
||||||
Message[nlen - 1] = 0;
|
Message[nlen - 1] = 0;
|
||||||
if (Message != NULL)
|
if (Message != nullptr)
|
||||||
{
|
{
|
||||||
vsprintf(Message, format, args);
|
vsprintf(Message, format, args);
|
||||||
GetTraceObjet().TraceMessage(module, severity, file, line, function, Message);
|
GetTraceObjet().TraceMessage(module, severity, file, line, function, Message);
|
||||||
|
@ -74,7 +74,7 @@ void CloseTrace(void)
|
||||||
if (g_ModuleLogLevel)
|
if (g_ModuleLogLevel)
|
||||||
{
|
{
|
||||||
delete g_ModuleLogLevel;
|
delete g_ModuleLogLevel;
|
||||||
g_ModuleLogLevel = NULL;
|
g_ModuleLogLevel = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void TraceSetMaxModule(uint32_t MaxModule, uint8_t DefaultSeverity)
|
||||||
if (g_ModuleLogLevel)
|
if (g_ModuleLogLevel)
|
||||||
{
|
{
|
||||||
delete g_ModuleLogLevel;
|
delete g_ModuleLogLevel;
|
||||||
g_ModuleLogLevel = NULL;
|
g_ModuleLogLevel = nullptr;
|
||||||
}
|
}
|
||||||
g_ModuleLogLevel = new uint32_t[MaxModule];
|
g_ModuleLogLevel = new uint32_t[MaxModule];
|
||||||
for (uint32_t i = 0; i < MaxModule; i++)
|
for (uint32_t i = 0; i < MaxModule; i++)
|
||||||
|
@ -119,7 +119,7 @@ CTraceModule * CTraceLog::RemoveTraceModule(CTraceModule * TraceModule)
|
||||||
return TraceModule;
|
return TraceModule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceLog::CloseTrace(void)
|
void CTraceLog::CloseTrace(void)
|
||||||
|
@ -130,7 +130,7 @@ void CTraceLog::CloseTrace(void)
|
||||||
if (g_ModuleLogLevel)
|
if (g_ModuleLogLevel)
|
||||||
{
|
{
|
||||||
delete g_ModuleLogLevel;
|
delete g_ModuleLogLevel;
|
||||||
g_ModuleLogLevel = NULL;
|
g_ModuleLogLevel = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ CTraceModule * TraceAddModule(CTraceModule * TraceModule)
|
||||||
{
|
{
|
||||||
if (g_TraceClosed)
|
if (g_TraceClosed)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
GetTraceObjet().AddTraceModule(TraceModule);
|
GetTraceObjet().AddTraceModule(TraceModule);
|
||||||
return TraceModule;
|
return TraceModule;
|
||||||
|
@ -235,7 +235,7 @@ void CTraceFileLog::Write(uint32_t module, uint8_t severity, const char * /*file
|
||||||
localtime_r(<ime, &result);
|
localtime_r(<ime, &result);
|
||||||
|
|
||||||
struct timeval curTime;
|
struct timeval curTime;
|
||||||
gettimeofday(&curTime, NULL);
|
gettimeofday(&curTime, nullptr);
|
||||||
int milliseconds = curTime.tv_usec / 1000;
|
int milliseconds = curTime.tv_usec / 1000;
|
||||||
|
|
||||||
stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", result.tm_year+1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec, milliseconds, CThread::GetCurrentThreadId());
|
stdstr_f timestamp("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d,", result.tm_year+1900, result.tm_mon+1, result.tm_mday, result.tm_hour, result.tm_min, result.tm_sec, milliseconds, CThread::GetCurrentThreadId());
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
pjutil::DynLibHandle pjutil::DynLibOpen(const char *pccLibraryPath, bool ShowErrors)
|
pjutil::DynLibHandle pjutil::DynLibOpen(const char *pccLibraryPath, bool ShowErrors)
|
||||||
{
|
{
|
||||||
if (pccLibraryPath == NULL)
|
if (pccLibraryPath == nullptr)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
UINT LastErrorMode = SetErrorMode(ShowErrors ? 0 : SEM_FAILCRITICALERRORS);
|
UINT LastErrorMode = SetErrorMode(ShowErrors ? 0 : SEM_FAILCRITICALERRORS);
|
||||||
|
@ -28,8 +28,8 @@ pjutil::DynLibHandle pjutil::DynLibOpen(const char *pccLibraryPath, bool ShowErr
|
||||||
|
|
||||||
void * pjutil::DynLibGetProc(pjutil::DynLibHandle LibHandle, const char * ProcedureName)
|
void * pjutil::DynLibGetProc(pjutil::DynLibHandle LibHandle, const char * ProcedureName)
|
||||||
{
|
{
|
||||||
if (ProcedureName == NULL)
|
if (ProcedureName == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return GetProcAddress((HMODULE)LibHandle, ProcedureName);
|
return GetProcAddress((HMODULE)LibHandle, ProcedureName);
|
||||||
|
@ -40,7 +40,7 @@ void * pjutil::DynLibGetProc(pjutil::DynLibHandle LibHandle, const char * Proced
|
||||||
|
|
||||||
void pjutil::DynLibClose(pjutil::DynLibHandle LibHandle)
|
void pjutil::DynLibClose(pjutil::DynLibHandle LibHandle)
|
||||||
{
|
{
|
||||||
if (LibHandle != NULL)
|
if (LibHandle != nullptr)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FreeLibrary((HMODULE)LibHandle);
|
FreeLibrary((HMODULE)LibHandle);
|
||||||
|
@ -99,14 +99,14 @@ bool pjutil::TerminatedExistingExe()
|
||||||
stdstr_f Caption("Terminate %s", ModuleName.c_str());
|
stdstr_f Caption("Terminate %s", ModuleName.c_str());
|
||||||
|
|
||||||
AskedUser = true;
|
AskedUser = true;
|
||||||
int res = MessageBox(NULL, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
int res = MessageBox(nullptr, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
||||||
if (res != IDYES)
|
if (res != IDYES)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
|
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
|
||||||
if (hHandle != NULL)
|
if (hHandle != nullptr)
|
||||||
{
|
{
|
||||||
if (TerminateProcess(hHandle, 0))
|
if (TerminateProcess(hHandle, 0))
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ bool pjutil::TerminatedExistingExe()
|
||||||
{
|
{
|
||||||
stdstr_f Message("Failed to terminate pid %d", lppe.th32ProcessID);
|
stdstr_f Message("Failed to terminate pid %d", lppe.th32ProcessID);
|
||||||
stdstr_f Caption("Terminate %s failed!", ModuleName.c_str());
|
stdstr_f Caption("Terminate %s failed!", ModuleName.c_str());
|
||||||
MessageBox(NULL, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
MessageBox(nullptr, Message.ToUTF16().c_str(), Caption.ToUTF16().c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
CloseHandle(hHandle);
|
CloseHandle(hHandle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ void MD5::init()
|
||||||
::memset(digest, 0, sizeof(digest));
|
::memset(digest, 0, sizeof(digest));
|
||||||
::memset(buffer, 0, sizeof(buffer));
|
::memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
m_hex_digest = NULL;
|
m_hex_digest = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constants for MD5Transform routine.
|
// Constants for MD5Transform routine.
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
#endif
|
#endif
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
// g_ModuleLogLevel may be NULL while AppInit() is still in session in path.cpp.
|
// g_ModuleLogLevel may be nullptr while AppInit() is still in session in path.cpp.
|
||||||
// The added check to compare to NULL here is at least a temporary workaround.
|
// The added check to compare to nullptr here is at least a temporary workaround.
|
||||||
|
|
||||||
#undef WriteTrace
|
#undef WriteTrace
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); }
|
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != nullptr && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __FUNCTION__, (format), ## __VA_ARGS__); }
|
||||||
#else
|
#else
|
||||||
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != NULL && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); }
|
#define WriteTrace(m, s, format, ...) if (g_ModuleLogLevel != nullptr && g_ModuleLogLevel[(m)] >= (s)) { WriteTraceFull((m), (s), __FILE__, __LINE__, __PRETTY_FUNCTION__, (format), ## __VA_ARGS__); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
@ -43,7 +43,7 @@ const char DIRECTORY_DELIMITER2 = '\\';
|
||||||
#endif
|
#endif
|
||||||
const char EXTENSION_DELIMITER = '.';
|
const char EXTENSION_DELIMITER = '.';
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void * CPath::m_hInst = NULL;
|
void * CPath::m_hInst = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
@ -69,9 +69,9 @@ inline void CPath::Init()
|
||||||
{
|
{
|
||||||
m_dwFindFileAttributes = 0;
|
m_dwFindFileAttributes = 0;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_hFindFile = NULL;
|
m_hFindFile = nullptr;
|
||||||
#else
|
#else
|
||||||
m_OpenedDir = NULL;
|
m_OpenedDir = nullptr;
|
||||||
m_FindWildcard = "";
|
m_FindWildcard = "";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -81,16 +81,16 @@ inline void CPath::Init()
|
||||||
inline void CPath::Exit()
|
inline void CPath::Exit()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (m_hFindFile != NULL)
|
if (m_hFindFile != nullptr)
|
||||||
{
|
{
|
||||||
FindClose(m_hFindFile);
|
FindClose(m_hFindFile);
|
||||||
m_hFindFile = NULL;
|
m_hFindFile = nullptr;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (m_OpenedDir != NULL)
|
if (m_OpenedDir != nullptr)
|
||||||
{
|
{
|
||||||
closedir((DIR*)m_OpenedDir);
|
closedir((DIR*)m_OpenedDir);
|
||||||
m_OpenedDir = NULL;
|
m_OpenedDir = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ Returns extension completely without delimiters, e.g. "doc"
|
||||||
Globals:
|
Globals:
|
||||||
I/O:
|
I/O:
|
||||||
Task: Return the individual components of this path.
|
Task: Return the individual components of this path.
|
||||||
For any given argument, you can pass NULL if you are not
|
For any given argument, you can pass nullptr if you are not
|
||||||
interested in that component.
|
interested in that component.
|
||||||
Do not rely on pNames being <= 8 characters, extensions
|
Do not rely on pNames being <= 8 characters, extensions
|
||||||
being <= 3 characters, or drives being 1 character
|
being <= 3 characters, or drives being 1 character
|
||||||
|
@ -296,7 +296,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
|
||||||
|
|
||||||
const char * BasePath = m_strPath.c_str();
|
const char * BasePath = m_strPath.c_str();
|
||||||
const char * DriveDir = strrchr(BasePath, DRIVE_DELIMITER);
|
const char * DriveDir = strrchr(BasePath, DRIVE_DELIMITER);
|
||||||
if (DriveDir != NULL)
|
if (DriveDir != nullptr)
|
||||||
{
|
{
|
||||||
size_t len = sizeof(buff_dir) < (DriveDir - BasePath) ? sizeof(buff_drive) : DriveDir - BasePath;
|
size_t len = sizeof(buff_dir) < (DriveDir - BasePath) ? sizeof(buff_drive) : DriveDir - BasePath;
|
||||||
strncpy(buff_drive, BasePath, len);
|
strncpy(buff_drive, BasePath, len);
|
||||||
|
@ -304,7 +304,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * last = strrchr(BasePath, DIRECTORY_DELIMITER);
|
const char * last = strrchr(BasePath, DIRECTORY_DELIMITER);
|
||||||
if (last != NULL)
|
if (last != nullptr)
|
||||||
{
|
{
|
||||||
size_t len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
|
size_t len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
|
@ -323,7 +323,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
|
||||||
strncpy(buff_dir, BasePath, sizeof(buff_dir));
|
strncpy(buff_dir, BasePath, sizeof(buff_dir));
|
||||||
}
|
}
|
||||||
char * ext = strrchr(buff_name, '.');
|
char * ext = strrchr(buff_name, '.');
|
||||||
if (ext != NULL)
|
if (ext != nullptr)
|
||||||
{
|
{
|
||||||
strncpy(buff_ext, ext + 1, sizeof(buff_ext));
|
strncpy(buff_ext, ext + 1, sizeof(buff_ext));
|
||||||
*ext = '\0';
|
*ext = '\0';
|
||||||
|
@ -362,7 +362,7 @@ void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::stri
|
||||||
|
|
||||||
const char * BasePath = m_strPath.c_str();
|
const char * BasePath = m_strPath.c_str();
|
||||||
const char * last = strrchr(BasePath,DIRECTORY_DELIMITER);
|
const char * last = strrchr(BasePath,DIRECTORY_DELIMITER);
|
||||||
if (last != NULL)
|
if (last != nullptr)
|
||||||
{
|
{
|
||||||
int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
|
int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
|
@ -381,7 +381,7 @@ void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::stri
|
||||||
strncpy(buff_dir,BasePath,sizeof(buff_dir));
|
strncpy(buff_dir,BasePath,sizeof(buff_dir));
|
||||||
}
|
}
|
||||||
char * ext = strrchr(buff_name,'.');
|
char * ext = strrchr(buff_name,'.');
|
||||||
if (ext != NULL)
|
if (ext != nullptr)
|
||||||
{
|
{
|
||||||
strncpy(buff_ext,ext + 1,sizeof(buff_ext));
|
strncpy(buff_ext,ext + 1,sizeof(buff_ext));
|
||||||
*ext = '\0';
|
*ext = '\0';
|
||||||
|
@ -433,7 +433,7 @@ std::string CPath::GetDriveDirectory(void) const
|
||||||
void CPath::GetDirectory(std::string& rDirectory) const
|
void CPath::GetDirectory(std::string& rDirectory) const
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetComponents(NULL, &rDirectory);
|
GetComponents(nullptr, &rDirectory);
|
||||||
#else
|
#else
|
||||||
GetComponents(&rDirectory);
|
GetComponents(&rDirectory);
|
||||||
#endif
|
#endif
|
||||||
|
@ -454,9 +454,9 @@ void CPath::GetNameExtension(std::string& rNameExtension) const
|
||||||
std::string Extension;
|
std::string Extension;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetComponents(NULL, NULL, &Name, &Extension);
|
GetComponents(nullptr, nullptr, &Name, &Extension);
|
||||||
#else
|
#else
|
||||||
GetComponents(NULL, &Name, &Extension);
|
GetComponents(nullptr, &Name, &Extension);
|
||||||
#endif
|
#endif
|
||||||
rNameExtension = Name;
|
rNameExtension = Name;
|
||||||
if (!Extension.empty())
|
if (!Extension.empty())
|
||||||
|
@ -478,9 +478,9 @@ std::string CPath::GetNameExtension(void) const
|
||||||
void CPath::GetName(std::string& rName) const
|
void CPath::GetName(std::string& rName) const
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetComponents(NULL, NULL, &rName);
|
GetComponents(nullptr, nullptr, &rName);
|
||||||
#else
|
#else
|
||||||
GetComponents(NULL, &rName);
|
GetComponents(nullptr, &rName);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,9 +496,9 @@ std::string CPath::GetName(void) const
|
||||||
void CPath::GetExtension(std::string& rExtension) const
|
void CPath::GetExtension(std::string& rExtension) const
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetComponents(NULL, NULL, NULL, &rExtension);
|
GetComponents(nullptr, nullptr, nullptr, &rExtension);
|
||||||
#else
|
#else
|
||||||
GetComponents(NULL, NULL, &rExtension);
|
GetComponents(nullptr, nullptr, &rExtension);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ void CPath::SetComponents(const char * lpszDrive, const char * lpszDirectory, co
|
||||||
char buff_fullname[MAX_PATH];
|
char buff_fullname[MAX_PATH];
|
||||||
|
|
||||||
memset(buff_fullname, 0, sizeof(buff_fullname));
|
memset(buff_fullname, 0, sizeof(buff_fullname));
|
||||||
if (lpszDirectory == NULL || strlen(lpszDirectory) == 0)
|
if (lpszDirectory == nullptr || strlen(lpszDirectory) == 0)
|
||||||
{
|
{
|
||||||
static char empty_dir[] = { DIRECTORY_DELIMITER, '\0' };
|
static char empty_dir[] = { DIRECTORY_DELIMITER, '\0' };
|
||||||
lpszDirectory = empty_dir;
|
lpszDirectory = empty_dir;
|
||||||
|
@ -597,7 +597,7 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con
|
||||||
char buff_fullname[260];
|
char buff_fullname[260];
|
||||||
|
|
||||||
memset(buff_fullname, 0, sizeof(buff_fullname));
|
memset(buff_fullname, 0, sizeof(buff_fullname));
|
||||||
if (lpszDirectory != NULL && lpszDirectory[0] != '\0')
|
if (lpszDirectory != nullptr && lpszDirectory[0] != '\0')
|
||||||
{
|
{
|
||||||
if (lpszDirectory[0] != DIRECTORY_DELIMITER) { buff_fullname[0] = DIRECTORY_DELIMITER; }
|
if (lpszDirectory[0] != DIRECTORY_DELIMITER) { buff_fullname[0] = DIRECTORY_DELIMITER; }
|
||||||
strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname) - 1);
|
strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname) - 1);
|
||||||
|
@ -607,11 +607,11 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con
|
||||||
buff_fullname[nLength] = DIRECTORY_DELIMITER;
|
buff_fullname[nLength] = DIRECTORY_DELIMITER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lpszName != NULL)
|
if (lpszName != nullptr)
|
||||||
{
|
{
|
||||||
strncat(buff_fullname,lpszName,sizeof(buff_fullname) - 1);
|
strncat(buff_fullname,lpszName,sizeof(buff_fullname) - 1);
|
||||||
}
|
}
|
||||||
if (lpszExtension != NULL && lpszExtension[0] != '\0')
|
if (lpszExtension != nullptr && lpszExtension[0] != '\0')
|
||||||
{
|
{
|
||||||
if (lpszExtension[0] != '.')
|
if (lpszExtension[0] != '.')
|
||||||
{
|
{
|
||||||
|
@ -635,7 +635,7 @@ void CPath::SetDrive(char chDrive)
|
||||||
std::string Name;
|
std::string Name;
|
||||||
std::string Extension;
|
std::string Extension;
|
||||||
|
|
||||||
GetComponents(NULL, &Directory, &Name, &Extension);
|
GetComponents(nullptr, &Directory, &Name, &Extension);
|
||||||
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
|
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -660,10 +660,10 @@ void CPath::SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute /*= fa
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::string Drive;
|
std::string Drive;
|
||||||
GetComponents(&Drive, NULL, &Name, &Extension);
|
GetComponents(&Drive, nullptr, &Name, &Extension);
|
||||||
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
|
SetComponents(Drive.c_str(), Directory.c_str(), Name.c_str(), Extension.c_str());
|
||||||
#else
|
#else
|
||||||
GetComponents(NULL, &Name, &Extension);
|
GetComponents(nullptr, &Name, &Extension);
|
||||||
SetComponents(Directory.c_str(), Name.c_str(), Extension.c_str());
|
SetComponents(Directory.c_str(), Name.c_str(), Extension.c_str());
|
||||||
#endif
|
#endif
|
||||||
WriteTrace(TracePath, TraceDebug, "Done (m_strPath: \"%s\")", m_strPath.c_str());
|
WriteTrace(TracePath, TraceDebug, "Done (m_strPath: \"%s\")", m_strPath.c_str());
|
||||||
|
@ -685,8 +685,8 @@ void CPath::SetDriveDirectory(const char * lpszDriveDirectory)
|
||||||
cleanPathString(DriveDirectory);
|
cleanPathString(DriveDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetComponents(NULL, NULL, &Name, &Extension);
|
GetComponents(nullptr, nullptr, &Name, &Extension);
|
||||||
SetComponents(NULL, DriveDirectory.c_str(), Name.c_str(), Extension.c_str());
|
SetComponents(nullptr, DriveDirectory.c_str(), Name.c_str(), Extension.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -699,10 +699,10 @@ void CPath::SetName(const char * lpszName)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::string Drive;
|
std::string Drive;
|
||||||
GetComponents(&Drive, &Directory, NULL, &Extension);
|
GetComponents(&Drive, &Directory, nullptr, &Extension);
|
||||||
SetComponents(Drive.c_str(), Directory.c_str(), lpszName, Extension.c_str());
|
SetComponents(Drive.c_str(), Directory.c_str(), lpszName, Extension.c_str());
|
||||||
#else
|
#else
|
||||||
GetComponents(&Directory, NULL, &Extension);
|
GetComponents(&Directory, nullptr, &Extension);
|
||||||
SetComponents(Directory.c_str(), lpszName, Extension.c_str());
|
SetComponents(Directory.c_str(), lpszName, Extension.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -721,10 +721,10 @@ void CPath::SetName(int iName)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::string Drive;
|
std::string Drive;
|
||||||
GetComponents(&Drive, &Directory, NULL, &Extension);
|
GetComponents(&Drive, &Directory, nullptr, &Extension);
|
||||||
SetComponents(Drive.c_str(), Directory.c_str(), sName, Extension.c_str());
|
SetComponents(Drive.c_str(), Directory.c_str(), sName, Extension.c_str());
|
||||||
#else
|
#else
|
||||||
GetComponents(&Directory, NULL, &Extension);
|
GetComponents(&Directory, nullptr, &Extension);
|
||||||
SetComponents(Directory.c_str(), sName, Extension.c_str());
|
SetComponents(Directory.c_str(), sName, Extension.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -777,10 +777,10 @@ void CPath::SetNameExtension(const char * lpszNameExtension)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::string Drive;
|
std::string Drive;
|
||||||
GetComponents(&Drive, &Directory);
|
GetComponents(&Drive, &Directory);
|
||||||
SetComponents(Drive.c_str(), Directory.c_str(), lpszNameExtension, NULL);
|
SetComponents(Drive.c_str(), Directory.c_str(), lpszNameExtension, nullptr);
|
||||||
#else
|
#else
|
||||||
GetComponents(&Directory);
|
GetComponents(&Directory);
|
||||||
SetComponents(Directory.c_str(), lpszNameExtension, NULL);
|
SetComponents(Directory.c_str(), lpszNameExtension, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ deepest directory (the one we're exiting) in it
|
||||||
Task: Remove deepest subdirectory from path
|
Task: Remove deepest subdirectory from path
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CPath::UpDirectory(std::string *pLastDirectory /*= NULL*/)
|
void CPath::UpDirectory(std::string *pLastDirectory /*= nullptr*/)
|
||||||
{
|
{
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ void CPath::UpDirectory(std::string *pLastDirectory /*= NULL*/)
|
||||||
|
|
||||||
std::string::size_type nDelimiter = Directory.rfind(DIRECTORY_DELIMITER);
|
std::string::size_type nDelimiter = Directory.rfind(DIRECTORY_DELIMITER);
|
||||||
|
|
||||||
if (pLastDirectory != NULL)
|
if (pLastDirectory != nullptr)
|
||||||
{
|
{
|
||||||
*pLastDirectory = Directory.substr(nDelimiter);
|
*pLastDirectory = Directory.substr(nDelimiter);
|
||||||
StripLeadingBackslash(*pLastDirectory);
|
StripLeadingBackslash(*pLastDirectory);
|
||||||
|
@ -940,7 +940,7 @@ bool CPath::DirectoryExists() const
|
||||||
HANDLE hFindFile = FindFirstFileA((const char *)TestPath, &FindData); // Find anything
|
HANDLE hFindFile = FindFirstFileA((const char *)TestPath, &FindData); // Find anything
|
||||||
bool res = (hFindFile != INVALID_HANDLE_VALUE);
|
bool res = (hFindFile != INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
if (hFindFile != NULL) // Make sure we close the search
|
if (hFindFile != nullptr) // Make sure we close the search
|
||||||
{
|
{
|
||||||
FindClose(hFindFile);
|
FindClose(hFindFile);
|
||||||
}
|
}
|
||||||
|
@ -968,7 +968,7 @@ bool CPath::Exists() const
|
||||||
HANDLE hFindFile = FindFirstFileA(m_strPath.c_str(), &FindData);
|
HANDLE hFindFile = FindFirstFileA(m_strPath.c_str(), &FindData);
|
||||||
bool bSuccess = (hFindFile != INVALID_HANDLE_VALUE);
|
bool bSuccess = (hFindFile != INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
if (hFindFile != NULL) // Make sure we close the search
|
if (hFindFile != nullptr) // Make sure we close the search
|
||||||
{
|
{
|
||||||
FindClose(hFindFile);
|
FindClose(hFindFile);
|
||||||
}
|
}
|
||||||
|
@ -1049,7 +1049,7 @@ we will make sure the target file is writable first
|
||||||
|
|
||||||
bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||||
{
|
{
|
||||||
if (lpcszTargetFile == NULL)
|
if (lpcszTargetFile == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||||
bool res = true;
|
bool res = true;
|
||||||
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for reading",m_strPath.c_str());
|
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for reading",m_strPath.c_str());
|
||||||
FILE * infile = fopen(m_strPath.c_str(), "rb");
|
FILE * infile = fopen(m_strPath.c_str(), "rb");
|
||||||
if(infile == NULL)
|
if(infile == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s",m_strPath.c_str());
|
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s",m_strPath.c_str());
|
||||||
res = false;
|
res = false;
|
||||||
|
@ -1091,12 +1091,12 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||||
WriteTrace(TracePath, TraceDebug, "Opened \"%s\"",m_strPath.c_str());
|
WriteTrace(TracePath, TraceDebug, "Opened \"%s\"",m_strPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE * outfile = NULL;
|
FILE * outfile = nullptr;
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for writing",lpcszTargetFile);
|
WriteTrace(TracePath, TraceDebug, "Opening \"%s\" for writing",lpcszTargetFile);
|
||||||
outfile = fopen(lpcszTargetFile, "wb");
|
outfile = fopen(lpcszTargetFile, "wb");
|
||||||
if (outfile == NULL)
|
if (outfile == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s errno=%d",lpcszTargetFile, errno);
|
WriteTrace(TracePath, TraceWarning, "Failed to open m_strPath = %s errno=%d",lpcszTargetFile, errno);
|
||||||
res = false;
|
res = false;
|
||||||
|
@ -1150,11 +1150,11 @@ bool CPath::CopyTo(const char * lpcszTargetFile, bool bOverwrite)
|
||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (infile != NULL)
|
if (infile != nullptr)
|
||||||
{
|
{
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
}
|
}
|
||||||
if (outfile != NULL)
|
if (outfile != nullptr)
|
||||||
{
|
{
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
}
|
}
|
||||||
|
@ -1281,7 +1281,7 @@ bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_OpenedDir = opendir(Directory.c_str());
|
m_OpenedDir = opendir(Directory.c_str());
|
||||||
if (m_OpenedDir == NULL) return false;
|
if (m_OpenedDir == nullptr) return false;
|
||||||
return FindNext();
|
return FindNext();
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
|
@ -1293,7 +1293,7 @@ bool CPath::FindFirst(uint32_t dwAttributes /*= FIND_ATTRIBUTE_FILES*/)
|
||||||
bool CPath::FindNext()
|
bool CPath::FindNext()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (m_hFindFile == NULL)
|
if (m_hFindFile == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1471,7 @@ bool CPath::DirectoryCreate(bool bCreateIntermediates /*= TRUE*/)
|
||||||
GetDriveDirectory(PathText);
|
GetDriveDirectory(PathText);
|
||||||
StripTrailingBackslash(PathText);
|
StripTrailingBackslash(PathText);
|
||||||
WriteTrace(TracePath, TraceDebug, "Create %s",PathText.c_str());
|
WriteTrace(TracePath, TraceDebug, "Create %s",PathText.c_str());
|
||||||
bSuccess = ::CreateDirectoryA(PathText.c_str(), NULL) != 0;
|
bSuccess = ::CreateDirectoryA(PathText.c_str(), nullptr) != 0;
|
||||||
#else
|
#else
|
||||||
GetDirectory(PathText);
|
GetDirectory(PathText);
|
||||||
StripTrailingBackslash(PathText);
|
StripTrailingBackslash(PathText);
|
||||||
|
@ -1608,7 +1608,7 @@ void CPath::EnsureLeadingBackslash(std::string & Directory) const
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
bool CPath::wildcmp(const char *wild, const char *string)
|
bool CPath::wildcmp(const char *wild, const char *string)
|
||||||
{
|
{
|
||||||
const char *cp = NULL, *mp = NULL;
|
const char *cp = nullptr, *mp = nullptr;
|
||||||
|
|
||||||
while ((*string) && (*wild != '*'))
|
while ((*string) && (*wild != '*'))
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,9 +44,9 @@ public:
|
||||||
CPath(const std::string& strPath, const char * NameExten);
|
CPath(const std::string& strPath, const char * NameExten);
|
||||||
CPath(const std::string& strPath, const std::string& NameExten);
|
CPath(const std::string& strPath, const std::string& NameExten);
|
||||||
|
|
||||||
CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = NULL);
|
CPath(DIR_CURRENT_DIRECTORY sdt, const char * NameExten = nullptr);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = NULL);
|
CPath(DIR_MODULE_DIRECTORY sdt, const char * NameExten = nullptr);
|
||||||
CPath(DIR_MODULE_FILE sdt);
|
CPath(DIR_MODULE_FILE sdt);
|
||||||
#endif
|
#endif
|
||||||
virtual ~CPath();
|
virtual ~CPath();
|
||||||
|
@ -77,9 +77,9 @@ public:
|
||||||
std::string GetLastDirectory(void) const;
|
std::string GetLastDirectory(void) const;
|
||||||
void GetFullyQualified(std::string& rFullyQualified) const;
|
void GetFullyQualified(std::string& rFullyQualified) const;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void GetComponents(std::string* pDrive = NULL, std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
|
void GetComponents(std::string* pDrive = nullptr, std::string* pDirectory = nullptr, std::string* pName = nullptr, std::string* pExtension = nullptr) const;
|
||||||
#else
|
#else
|
||||||
void GetComponents(std::string* pDirectory = NULL, std::string* pName = NULL, std::string* pExtension = NULL) const;
|
void GetComponents(std::string* pDirectory = nullptr, std::string* pName = nullptr, std::string* pExtension = nullptr) const;
|
||||||
#endif
|
#endif
|
||||||
// Get other state
|
// Get other state
|
||||||
bool IsEmpty() const { return m_strPath.empty(); }
|
bool IsEmpty() const { return m_strPath.empty(); }
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
void SetExtension(const char * lpszExtension);
|
void SetExtension(const char * lpszExtension);
|
||||||
void SetExtension(int iExtension);
|
void SetExtension(int iExtension);
|
||||||
void AppendDirectory(const char * lpszSubDirectory);
|
void AppendDirectory(const char * lpszSubDirectory);
|
||||||
void UpDirectory(std::string* pLastDirectory = NULL);
|
void UpDirectory(std::string* pLastDirectory = nullptr);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension);
|
void SetComponents(const char * lpszDrive, const char * lpszDirectory, const char * lpszName, const char * lpszExtension);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -140,7 +140,7 @@ void RegionSection(CFile &TargetIniFile, Files &files, const char * Region, cons
|
||||||
{
|
{
|
||||||
const char * Section = SectionItr->c_str();
|
const char * Section = SectionItr->c_str();
|
||||||
const char * pos = strstr(Section, searchStr.c_str());
|
const char * pos = strstr(Section, searchStr.c_str());
|
||||||
if (pos == NULL)
|
if (pos == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -341,14 +341,14 @@ bool ConvertCheatOptions(const char * OptionValue, std::string& Options)
|
||||||
{
|
{
|
||||||
NewOptions += NewOptions.empty() ? "$" : ",$";
|
NewOptions += NewOptions.empty() ? "$" : ",$";
|
||||||
const char* End = strchr(ReadPos, ',');
|
const char* End = strchr(ReadPos, ',');
|
||||||
std::string Item = End != NULL ? std::string(ReadPos, End - ReadPos) : ReadPos;
|
std::string Item = End != nullptr ? std::string(ReadPos, End - ReadPos) : ReadPos;
|
||||||
ReadPos = strchr(ReadPos, '$');
|
ReadPos = strchr(ReadPos, '$');
|
||||||
if (ReadPos != NULL)
|
if (ReadPos != nullptr)
|
||||||
{
|
{
|
||||||
ReadPos += 1;
|
ReadPos += 1;
|
||||||
}
|
}
|
||||||
const char* Name = strchr(Item.c_str(), ' ');
|
const char* Name = strchr(Item.c_str(), ' ');
|
||||||
if (Name == NULL)
|
if (Name == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
{
|
{
|
||||||
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
|
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
|
||||||
ReadPos = strchr(ReadPos, ' ');
|
ReadPos = strchr(ReadPos, ' ');
|
||||||
if (ReadPos == NULL)
|
if (ReadPos == nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
std::string ValueStr = ReadPos;
|
std::string ValueStr = ReadPos;
|
||||||
const char* ValuePos = ReadPos;
|
const char* ValuePos = ReadPos;
|
||||||
ReadPos = strchr(ReadPos, ',');
|
ReadPos = strchr(ReadPos, ',');
|
||||||
if (ReadPos != NULL)
|
if (ReadPos != nullptr)
|
||||||
{
|
{
|
||||||
ValueStr.resize(ReadPos - ValuePos);
|
ValueStr.resize(ReadPos - ValuePos);
|
||||||
ReadPos++;
|
ReadPos++;
|
||||||
|
@ -422,7 +422,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
{
|
{
|
||||||
case 0xE8000000:
|
case 0xE8000000:
|
||||||
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x80000000;
|
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x80000000;
|
||||||
if (strchr(ValueStr.c_str(), '?') != NULL)
|
if (strchr(ValueStr.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
||||||
{
|
{
|
||||||
|
@ -455,7 +455,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
break;
|
break;
|
||||||
case 0xE9000000:
|
case 0xE9000000:
|
||||||
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x81000000;
|
CodeCommand = (ConvertXP64Address(CodeCommand) & 0xFFFFFF) | 0x81000000;
|
||||||
if (strchr(ValueStr.c_str(), '?') != NULL)
|
if (strchr(ValueStr.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
||||||
{
|
{
|
||||||
|
@ -497,7 +497,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
break;
|
break;
|
||||||
case 0x10000000:
|
case 0x10000000:
|
||||||
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x80000000, ValueStr.c_str()));
|
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x80000000, ValueStr.c_str()));
|
||||||
if (strchr(ValueStr.c_str(), '?') != NULL)
|
if (strchr(ValueStr.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
||||||
{
|
{
|
||||||
|
@ -532,7 +532,7 @@ bool ConvertCheatEntry(std::string& CheatEntry, std::string& CheatOptions)
|
||||||
break;
|
break;
|
||||||
case 0x11000000:
|
case 0x11000000:
|
||||||
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x81000000, ValueStr.c_str()));
|
Entries.push_back(stdstr_f("%08X %s", (CodeCommand & 0xFFFFFF) | 0x81000000, ValueStr.c_str()));
|
||||||
if (strchr(ValueStr.c_str(), '?') != NULL)
|
if (strchr(ValueStr.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
if (strncmp(ValueStr.c_str(), "????", 4) == 0)
|
||||||
{
|
{
|
||||||
|
@ -666,7 +666,7 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
|
||||||
{
|
{
|
||||||
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
|
uint32_t CodeCommand = strtoul(ReadPos, 0, 16);
|
||||||
ReadPos = strchr(ReadPos, ' ');
|
ReadPos = strchr(ReadPos, ' ');
|
||||||
if (ReadPos == NULL)
|
if (ReadPos == nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -674,7 +674,7 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
|
||||||
std::string ValueStr = ReadPos;
|
std::string ValueStr = ReadPos;
|
||||||
const char * ValuePos = ReadPos;
|
const char * ValuePos = ReadPos;
|
||||||
ReadPos = strchr(ReadPos, ',');
|
ReadPos = strchr(ReadPos, ',');
|
||||||
if (ReadPos != NULL)
|
if (ReadPos != nullptr)
|
||||||
{
|
{
|
||||||
ValueStr.resize(ReadPos - ValuePos);
|
ValueStr.resize(ReadPos - ValuePos);
|
||||||
ReadPos++;
|
ReadPos++;
|
||||||
|
@ -697,14 +697,14 @@ bool ParseCheatEntry(const stdstr & CheatEntry, const stdstr& CheatOptions, CEnh
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const char* End = strchr(ReadPos, ',');
|
const char* End = strchr(ReadPos, ',');
|
||||||
std::string Item = End != NULL ? std::string(ReadPos, End - ReadPos) : ReadPos;
|
std::string Item = End != nullptr ? std::string(ReadPos, End - ReadPos) : ReadPos;
|
||||||
ReadPos = strchr(ReadPos, '$');
|
ReadPos = strchr(ReadPos, '$');
|
||||||
if (ReadPos != NULL)
|
if (ReadPos != nullptr)
|
||||||
{
|
{
|
||||||
ReadPos += 1;
|
ReadPos += 1;
|
||||||
}
|
}
|
||||||
const char* Name = strchr(Item.c_str(), ' ');
|
const char* Name = strchr(Item.c_str(), ' ');
|
||||||
if (Name == NULL)
|
if (Name == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ bool g_romopen = false;
|
||||||
uint32_t g_Dacrate = 0, hack = 0;
|
uint32_t g_Dacrate = 0, hack = 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DirectSoundDriver * g_SoundDriver = NULL;
|
DirectSoundDriver * g_SoundDriver = nullptr;
|
||||||
#else
|
#else
|
||||||
OpenSLESDriver * g_SoundDriver = NULL;
|
OpenSLESDriver * g_SoundDriver = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void PluginInit(void)
|
void PluginInit(void)
|
||||||
|
@ -60,7 +60,7 @@ EXPORT void CALL PluginLoaded(void)
|
||||||
{
|
{
|
||||||
PluginInit();
|
PluginInit();
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||||
if (g_settings != NULL)
|
if (g_settings != nullptr)
|
||||||
{
|
{
|
||||||
g_settings->SetSyncViaAudioEnabled(true);
|
g_settings->SetSyncViaAudioEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ EXPORT uint32_t CALL AiReadLength(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
if (g_SoundDriver != NULL)
|
if (g_SoundDriver != nullptr)
|
||||||
{
|
{
|
||||||
*g_AudioInfo.AI_LEN_REG = g_SoundDriver->AI_ReadLength();
|
*g_AudioInfo.AI_LEN_REG = g_SoundDriver->AI_ReadLength();
|
||||||
len = *g_AudioInfo.AI_LEN_REG;
|
len = *g_AudioInfo.AI_LEN_REG;
|
||||||
|
@ -164,11 +164,11 @@ EXPORT void CALL AiUpdate(int32_t Wait)
|
||||||
EXPORT void CALL CloseDLL(void)
|
EXPORT void CALL CloseDLL(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||||
if (g_SoundDriver != NULL)
|
if (g_SoundDriver != nullptr)
|
||||||
{
|
{
|
||||||
g_SoundDriver->AI_Shutdown();
|
g_SoundDriver->AI_Shutdown();
|
||||||
delete g_SoundDriver;
|
delete g_SoundDriver;
|
||||||
g_SoundDriver = NULL;
|
g_SoundDriver = nullptr;
|
||||||
}
|
}
|
||||||
CleanupAudioSettings();
|
CleanupAudioSettings();
|
||||||
StopTrace();
|
StopTrace();
|
||||||
|
@ -211,7 +211,7 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
|
||||||
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info)
|
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
|
||||||
if (g_SoundDriver != NULL)
|
if (g_SoundDriver != nullptr)
|
||||||
{
|
{
|
||||||
g_SoundDriver->AI_Shutdown();
|
g_SoundDriver->AI_Shutdown();
|
||||||
delete g_SoundDriver;
|
delete g_SoundDriver;
|
||||||
|
@ -279,7 +279,7 @@ extern "C" void UseUnregisteredSetting(int /*SettingID*/)
|
||||||
void SetTimerResolution(void)
|
void SetTimerResolution(void)
|
||||||
{
|
{
|
||||||
HMODULE hMod = GetModuleHandle(L"ntdll.dll");
|
HMODULE hMod = GetModuleHandle(L"ntdll.dll");
|
||||||
if (hMod != NULL)
|
if (hMod != nullptr)
|
||||||
{
|
{
|
||||||
typedef LONG(NTAPI* tNtSetTimerResolution)(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
|
typedef LONG(NTAPI* tNtSetTimerResolution)(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
|
||||||
tNtSetTimerResolution NtSetTimerResolution = (tNtSetTimerResolution)GetProcAddress(hMod, "NtSetTimerResolution");
|
tNtSetTimerResolution NtSetTimerResolution = (tNtSetTimerResolution)GetProcAddress(hMod, "NtSetTimerResolution");
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "SettingsID.h"
|
#include "SettingsID.h"
|
||||||
#include "AudioSettings.h"
|
#include "AudioSettings.h"
|
||||||
|
|
||||||
CSettings * g_settings = NULL;
|
CSettings * g_settings = nullptr;
|
||||||
|
|
||||||
CSettings::CSettings() :
|
CSettings::CSettings() :
|
||||||
m_Set_SyncViaAudioEnabled(0),
|
m_Set_SyncViaAudioEnabled(0),
|
||||||
|
@ -80,14 +80,14 @@ void CSettings::RegisterSettings(void)
|
||||||
m_Set_log_dir = FindSystemSettingId("Dir:Log");
|
m_Set_log_dir = FindSystemSettingId("Dir:Log");
|
||||||
|
|
||||||
SetModuleName("Audio");
|
SetModuleName("Audio");
|
||||||
RegisterSetting(Set_Volume, Data_DWORD_General, "Volume", "Settings", 100, NULL);
|
RegisterSetting(Set_Volume, Data_DWORD_General, "Volume", "Settings", 100, nullptr);
|
||||||
RegisterSetting(Set_Logging_MD5, Data_DWORD_General, "MD5", "Logging", g_ModuleLogLevel[TraceMD5], NULL);
|
RegisterSetting(Set_Logging_MD5, Data_DWORD_General, "MD5", "Logging", g_ModuleLogLevel[TraceMD5], nullptr);
|
||||||
RegisterSetting(Set_Logging_Thread, Data_DWORD_General, "Thread", "Logging", g_ModuleLogLevel[TraceThread], NULL);
|
RegisterSetting(Set_Logging_Thread, Data_DWORD_General, "Thread", "Logging", g_ModuleLogLevel[TraceThread], nullptr);
|
||||||
RegisterSetting(Set_Logging_Path, Data_DWORD_General, "Path", "Logging", g_ModuleLogLevel[TracePath], NULL);
|
RegisterSetting(Set_Logging_Path, Data_DWORD_General, "Path", "Logging", g_ModuleLogLevel[TracePath], nullptr);
|
||||||
RegisterSetting(Set_Logging_InitShutdown, Data_DWORD_General, "InitShutdown", "Logging", g_ModuleLogLevel[TraceAudioInitShutdown], NULL);
|
RegisterSetting(Set_Logging_InitShutdown, Data_DWORD_General, "InitShutdown", "Logging", g_ModuleLogLevel[TraceAudioInitShutdown], nullptr);
|
||||||
RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceAudioInterface], NULL);
|
RegisterSetting(Set_Logging_Interface, Data_DWORD_General, "Interface", "Logging", g_ModuleLogLevel[TraceAudioInterface], nullptr);
|
||||||
RegisterSetting(Set_Logging_Driver, Data_DWORD_General, "Driver", "Logging", g_ModuleLogLevel[TraceAudioDriver], NULL);
|
RegisterSetting(Set_Logging_Driver, Data_DWORD_General, "Driver", "Logging", g_ModuleLogLevel[TraceAudioDriver], nullptr);
|
||||||
RegisterSetting(Set_Buffer, Data_DWORD_Game, "Buffer", "", 4, NULL);
|
RegisterSetting(Set_Buffer, Data_DWORD_Game, "Buffer", "", 4, nullptr);
|
||||||
LogLevelChanged();
|
LogLevelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void CSettings::ReadSettings(void)
|
||||||
|
|
||||||
void SetupAudioSettings(void)
|
void SetupAudioSettings(void)
|
||||||
{
|
{
|
||||||
if (g_settings == NULL)
|
if (g_settings == nullptr)
|
||||||
{
|
{
|
||||||
g_settings = new CSettings;
|
g_settings = new CSettings;
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,6 @@ void CleanupAudioSettings(void)
|
||||||
if (g_settings)
|
if (g_settings)
|
||||||
{
|
{
|
||||||
delete g_settings;
|
delete g_settings;
|
||||||
g_settings = NULL;
|
g_settings = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
DirectSoundDriver::DirectSoundDriver() :
|
DirectSoundDriver::DirectSoundDriver() :
|
||||||
m_AudioIsDone(true),
|
m_AudioIsDone(true),
|
||||||
m_LOCK_SIZE(0),
|
m_LOCK_SIZE(0),
|
||||||
m_lpds(NULL),
|
m_lpds(nullptr),
|
||||||
m_lpdsb(NULL),
|
m_lpdsb(nullptr),
|
||||||
m_lpdsbuf(NULL),
|
m_lpdsbuf(nullptr),
|
||||||
m_handleAudioThread(NULL),
|
m_handleAudioThread(nullptr),
|
||||||
m_dwAudioThreadId(0)
|
m_dwAudioThreadId(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ bool DirectSoundDriver::Initialize()
|
||||||
|
|
||||||
CGuard guard(m_CS);
|
CGuard guard(m_CS);
|
||||||
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
|
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
|
||||||
HRESULT hr = DirectSoundCreate8(NULL, &lpds, NULL);
|
HRESULT hr = DirectSoundCreate8(nullptr, &lpds, nullptr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceWarning, "Unable to DirectSoundCreate (hr: 0x%08X)", hr);
|
WriteTrace(TraceAudioDriver, TraceWarning, "Unable to DirectSoundCreate (hr: 0x%08X)", hr);
|
||||||
|
@ -53,13 +53,13 @@ bool DirectSoundDriver::Initialize()
|
||||||
if (lpdsbuf)
|
if (lpdsbuf)
|
||||||
{
|
{
|
||||||
IDirectSoundBuffer_Release(lpdsbuf);
|
IDirectSoundBuffer_Release(lpdsbuf);
|
||||||
lpdsbuf = NULL;
|
lpdsbuf = nullptr;
|
||||||
}
|
}
|
||||||
DSBUFFERDESC dsPrimaryBuff = { 0 };
|
DSBUFFERDESC dsPrimaryBuff = { 0 };
|
||||||
dsPrimaryBuff.dwSize = sizeof(DSBUFFERDESC);
|
dsPrimaryBuff.dwSize = sizeof(DSBUFFERDESC);
|
||||||
dsPrimaryBuff.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME;
|
dsPrimaryBuff.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRLVOLUME;
|
||||||
dsPrimaryBuff.dwBufferBytes = 0;
|
dsPrimaryBuff.dwBufferBytes = 0;
|
||||||
dsPrimaryBuff.lpwfxFormat = NULL;
|
dsPrimaryBuff.lpwfxFormat = nullptr;
|
||||||
|
|
||||||
WAVEFORMATEX wfm = { 0 };
|
WAVEFORMATEX wfm = { 0 };
|
||||||
wfm.wFormatTag = WAVE_FORMAT_PCM;
|
wfm.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
|
@ -70,7 +70,7 @@ bool DirectSoundDriver::Initialize()
|
||||||
wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;
|
wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;
|
||||||
|
|
||||||
LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
|
LPDIRECTSOUNDBUFFER & lpdsb = (LPDIRECTSOUNDBUFFER &)m_lpdsb;
|
||||||
hr = lpds->CreateSoundBuffer(&dsPrimaryBuff, &lpdsb, NULL);
|
hr = lpds->CreateSoundBuffer(&dsPrimaryBuff, &lpdsb, nullptr);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
lpdsb->SetFormat(&wfm);
|
lpdsb->SetFormat(&wfm);
|
||||||
|
@ -82,7 +82,7 @@ bool DirectSoundDriver::Initialize()
|
||||||
|
|
||||||
void DirectSoundDriver::StopAudio()
|
void DirectSoundDriver::StopAudio()
|
||||||
{
|
{
|
||||||
if (m_handleAudioThread != NULL)
|
if (m_handleAudioThread != nullptr)
|
||||||
{
|
{
|
||||||
m_AudioIsDone = true;
|
m_AudioIsDone = true;
|
||||||
if (WaitForSingleObject((HANDLE)m_handleAudioThread, 5000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject((HANDLE)m_handleAudioThread, 5000) == WAIT_TIMEOUT)
|
||||||
|
@ -92,20 +92,20 @@ void DirectSoundDriver::StopAudio()
|
||||||
TerminateThread((HANDLE)m_handleAudioThread, 1);
|
TerminateThread((HANDLE)m_handleAudioThread, 1);
|
||||||
}
|
}
|
||||||
CloseHandle((HANDLE)m_handleAudioThread);
|
CloseHandle((HANDLE)m_handleAudioThread);
|
||||||
m_handleAudioThread = NULL;
|
m_handleAudioThread = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectSoundDriver::StartAudio()
|
void DirectSoundDriver::StartAudio()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
|
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
|
||||||
if (m_handleAudioThread == NULL)
|
if (m_handleAudioThread == nullptr)
|
||||||
{
|
{
|
||||||
m_AudioIsDone = false;
|
m_AudioIsDone = false;
|
||||||
m_handleAudioThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)stAudioThreadProc, this, 0, (LPDWORD)&m_dwAudioThreadId);
|
m_handleAudioThread = CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)stAudioThreadProc, this, 0, (LPDWORD)&m_dwAudioThreadId);
|
||||||
|
|
||||||
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
||||||
if (lpdsbuf != NULL)
|
if (lpdsbuf != nullptr)
|
||||||
{
|
{
|
||||||
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
|
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ void DirectSoundDriver::SetVolume(uint32_t Volume)
|
||||||
{
|
{
|
||||||
dsVolume = DSBVOLUME_MIN;
|
dsVolume = DSBVOLUME_MIN;
|
||||||
}
|
}
|
||||||
if (lpdsb != NULL)
|
if (lpdsb != nullptr)
|
||||||
{
|
{
|
||||||
lpdsb->SetVolume(dsVolume);
|
lpdsb->SetVolume(dsVolume);
|
||||||
}
|
}
|
||||||
|
@ -159,16 +159,16 @@ void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
|
||||||
|
|
||||||
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
|
LPDIRECTSOUND8 & lpds = (LPDIRECTSOUND8 &)m_lpds;
|
||||||
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
LPDIRECTSOUNDBUFFER & lpdsbuf = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
||||||
if (lpds != NULL)
|
if (lpds != nullptr)
|
||||||
{
|
{
|
||||||
HRESULT hr = lpds->CreateSoundBuffer(&dsbdesc, &lpdsbuf, NULL);
|
HRESULT hr = lpds->CreateSoundBuffer(&dsbdesc, &lpdsbuf, nullptr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceWarning, "CreateSoundBuffer failed (hr: 0x%08X)", hr);
|
WriteTrace(TraceAudioDriver, TraceWarning, "CreateSoundBuffer failed (hr: 0x%08X)", hr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpdsbuf != NULL)
|
if (lpdsbuf != nullptr)
|
||||||
{
|
{
|
||||||
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
|
lpdsbuf->Play(0, 0, DSBPLAY_LOOPING);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ void DirectSoundDriver::SetSegmentSize(uint32_t length, uint32_t SampleRate)
|
||||||
void DirectSoundDriver::AudioThreadProc()
|
void DirectSoundDriver::AudioThreadProc()
|
||||||
{
|
{
|
||||||
LPDIRECTSOUNDBUFFER & lpdsbuff = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
LPDIRECTSOUNDBUFFER & lpdsbuff = (LPDIRECTSOUNDBUFFER &)m_lpdsbuf;
|
||||||
while (lpdsbuff == NULL && !m_AudioIsDone)
|
while (lpdsbuff == nullptr && !m_AudioIsDone)
|
||||||
{
|
{
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
}
|
}
|
||||||
|
@ -196,17 +196,17 @@ void DirectSoundDriver::AudioThreadProc()
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t next_pos = 0, write_pos = 0, last_pos = 0;
|
uint32_t next_pos = 0, write_pos = 0, last_pos = 0;
|
||||||
while (lpdsbuff != NULL && !m_AudioIsDone)
|
while (lpdsbuff != nullptr && !m_AudioIsDone)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceVerbose, "last_pos: 0x%08X write_pos: 0x%08X next_pos: 0x%08X", last_pos, write_pos, next_pos);
|
WriteTrace(TraceAudioDriver, TraceVerbose, "last_pos: 0x%08X write_pos: 0x%08X next_pos: 0x%08X", last_pos, write_pos, next_pos);
|
||||||
while (last_pos == write_pos)
|
while (last_pos == write_pos)
|
||||||
{ // Cycle around until a new buffer position is available
|
{ // Cycle around until a new buffer position is available
|
||||||
if (lpdsbuff == NULL)
|
if (lpdsbuff == nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint32_t play_pos = 0;
|
uint32_t play_pos = 0;
|
||||||
if (lpdsbuff == NULL || FAILED(lpdsbuff->GetCurrentPosition((unsigned long*)&play_pos, NULL)))
|
if (lpdsbuff == nullptr || FAILED(lpdsbuff->GetCurrentPosition((unsigned long*)&play_pos, nullptr)))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceDebug, "Error getting audio position...");
|
WriteTrace(TraceAudioDriver, TraceDebug, "Error getting audio position...");
|
||||||
m_AudioIsDone = true;
|
m_AudioIsDone = true;
|
||||||
|
|
|
@ -52,13 +52,13 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Pointer to the primary audio buffer */
|
/* Pointer to the primary audio buffer */
|
||||||
uint8_t * g_primaryBuffer = NULL;
|
uint8_t * g_primaryBuffer = nullptr;
|
||||||
|
|
||||||
/* Size of the primary buffer */
|
/* Size of the primary buffer */
|
||||||
uint32_t g_primaryBufferBytes = 0;
|
uint32_t g_primaryBufferBytes = 0;
|
||||||
|
|
||||||
/* Pointer to secondary buffers */
|
/* Pointer to secondary buffers */
|
||||||
uint8_t ** g_secondaryBuffers = NULL;
|
uint8_t ** g_secondaryBuffers = nullptr;
|
||||||
|
|
||||||
/* Size of a single secondary buffer */
|
/* Size of a single secondary buffer */
|
||||||
uint32_t g_secondaryBufferBytes = 0;
|
uint32_t g_secondaryBufferBytes = 0;
|
||||||
|
@ -86,18 +86,18 @@ bool g_critical_failure = false;
|
||||||
threadLock g_lock;
|
threadLock g_lock;
|
||||||
|
|
||||||
/* Engine interfaces */
|
/* Engine interfaces */
|
||||||
SLObjectItf g_engineObject = NULL;
|
SLObjectItf g_engineObject = nullptr;
|
||||||
SLEngineItf g_engineEngine = NULL;
|
SLEngineItf g_engineEngine = nullptr;
|
||||||
|
|
||||||
/* Output mix interfaces */
|
/* Output mix interfaces */
|
||||||
SLObjectItf g_outputMixObject = NULL;
|
SLObjectItf g_outputMixObject = nullptr;
|
||||||
|
|
||||||
/* Player interfaces */
|
/* Player interfaces */
|
||||||
SLObjectItf g_playerObject = NULL;
|
SLObjectItf g_playerObject = nullptr;
|
||||||
SLPlayItf g_playerPlay = NULL;
|
SLPlayItf g_playerPlay = nullptr;
|
||||||
|
|
||||||
/* Buffer queue interfaces */
|
/* Buffer queue interfaces */
|
||||||
SLAndroidSimpleBufferQueueItf g_bufferQueue = NULL;
|
SLAndroidSimpleBufferQueueItf g_bufferQueue = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool CreatePrimaryBuffer(void)
|
static bool CreatePrimaryBuffer(void)
|
||||||
|
@ -109,9 +109,9 @@ static bool CreatePrimaryBuffer(void)
|
||||||
|
|
||||||
g_primaryBuffer = new uint8_t[primaryBytes];
|
g_primaryBuffer = new uint8_t[primaryBytes];
|
||||||
|
|
||||||
if (g_primaryBuffer == NULL)
|
if (g_primaryBuffer == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "g_primaryBuffer == NULL");
|
WriteTrace(TraceAudioInitShutdown, TraceError, "g_primaryBuffer == nullptr");
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -129,34 +129,34 @@ static void CloseAudio(void)
|
||||||
g_secondaryBufferIndex = 0;
|
g_secondaryBufferIndex = 0;
|
||||||
|
|
||||||
/* Delete Primary buffer */
|
/* Delete Primary buffer */
|
||||||
if (g_primaryBuffer != NULL)
|
if (g_primaryBuffer != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_primaryBuffer (%p)", g_primaryBuffer);
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_primaryBuffer (%p)", g_primaryBuffer);
|
||||||
g_primaryBufferBytes = 0;
|
g_primaryBufferBytes = 0;
|
||||||
delete[] g_primaryBuffer;
|
delete[] g_primaryBuffer;
|
||||||
g_primaryBuffer = NULL;
|
g_primaryBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete Secondary buffers */
|
/* Delete Secondary buffers */
|
||||||
if (g_secondaryBuffers != NULL)
|
if (g_secondaryBuffers != nullptr)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < SECONDARY_BUFFER_NBR; i++)
|
for (uint32_t i = 0; i < SECONDARY_BUFFER_NBR; i++)
|
||||||
{
|
{
|
||||||
if (g_secondaryBuffers[i] != NULL)
|
if (g_secondaryBuffers[i] != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers[%d] (%p)", i, g_secondaryBuffers[i]);
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers[%d] (%p)", i, g_secondaryBuffers[i]);
|
||||||
delete[] g_secondaryBuffers[i];
|
delete[] g_secondaryBuffers[i];
|
||||||
g_secondaryBuffers[i] = NULL;
|
g_secondaryBuffers[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_secondaryBufferBytes = 0;
|
g_secondaryBufferBytes = 0;
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers (%p)", g_secondaryBuffers);
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Delete g_secondaryBuffers (%p)", g_secondaryBuffers);
|
||||||
delete[] g_secondaryBuffers;
|
delete[] g_secondaryBuffers;
|
||||||
g_secondaryBuffers = NULL;
|
g_secondaryBuffers = nullptr;
|
||||||
}
|
}
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
/* Destroy buffer queue audio player object, and invalidate all associated interfaces */
|
/* Destroy buffer queue audio player object, and invalidate all associated interfaces */
|
||||||
if (g_playerObject != NULL)
|
if (g_playerObject != nullptr)
|
||||||
{
|
{
|
||||||
SLuint32 state = SL_PLAYSTATE_PLAYING;
|
SLuint32 state = SL_PLAYSTATE_PLAYING;
|
||||||
(*g_playerPlay)->SetPlayState(g_playerPlay, SL_PLAYSTATE_STOPPED);
|
(*g_playerPlay)->SetPlayState(g_playerPlay, SL_PLAYSTATE_STOPPED);
|
||||||
|
@ -167,24 +167,24 @@ static void CloseAudio(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
(*g_playerObject)->Destroy(g_playerObject);
|
(*g_playerObject)->Destroy(g_playerObject);
|
||||||
g_playerObject = NULL;
|
g_playerObject = nullptr;
|
||||||
g_playerPlay = NULL;
|
g_playerPlay = nullptr;
|
||||||
g_bufferQueue = NULL;
|
g_bufferQueue = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy output mix object, and invalidate all associated interfaces */
|
/* Destroy output mix object, and invalidate all associated interfaces */
|
||||||
if (g_outputMixObject != NULL)
|
if (g_outputMixObject != nullptr)
|
||||||
{
|
{
|
||||||
(*g_outputMixObject)->Destroy(g_outputMixObject);
|
(*g_outputMixObject)->Destroy(g_outputMixObject);
|
||||||
g_outputMixObject = NULL;
|
g_outputMixObject = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy engine object, and invalidate all associated interfaces */
|
/* Destroy engine object, and invalidate all associated interfaces */
|
||||||
if (g_engineObject != NULL)
|
if (g_engineObject != nullptr)
|
||||||
{
|
{
|
||||||
(*g_engineObject)->Destroy(g_engineObject);
|
(*g_engineObject)->Destroy(g_engineObject);
|
||||||
g_engineObject = NULL;
|
g_engineObject = nullptr;
|
||||||
g_engineEngine = NULL;
|
g_engineEngine = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy thread Locks */
|
/* Destroy thread Locks */
|
||||||
|
@ -207,9 +207,9 @@ static bool CreateSecondaryBuffers(void)
|
||||||
/* Allocate number of secondary buffers */
|
/* Allocate number of secondary buffers */
|
||||||
g_secondaryBuffers = new uint8_t *[SECONDARY_BUFFER_NBR];
|
g_secondaryBuffers = new uint8_t *[SECONDARY_BUFFER_NBR];
|
||||||
|
|
||||||
if (g_secondaryBuffers == NULL)
|
if (g_secondaryBuffers == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "g_secondaryBuffers == NULL");
|
WriteTrace(TraceAudioInitShutdown, TraceError, "g_secondaryBuffers == nullptr");
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done (res: false)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ static bool CreateSecondaryBuffers(void)
|
||||||
{
|
{
|
||||||
g_secondaryBuffers[i] = new uint8_t[secondaryBytes];
|
g_secondaryBuffers[i] = new uint8_t[secondaryBytes];
|
||||||
|
|
||||||
if (g_secondaryBuffers[i] == NULL)
|
if (g_secondaryBuffers[i] == nullptr)
|
||||||
{
|
{
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
|
@ -243,10 +243,10 @@ static int resample(unsigned char *input, int /*input_avail*/, int oldsamplerate
|
||||||
spx_uint32_t in_len, out_len;
|
spx_uint32_t in_len, out_len;
|
||||||
if (Resample == RESAMPLER_SPEEX)
|
if (Resample == RESAMPLER_SPEEX)
|
||||||
{
|
{
|
||||||
if (spx_state == NULL)
|
if (spx_state == nullptr)
|
||||||
{
|
{
|
||||||
spx_state = speex_resampler_init(2, oldsamplerate, newsamplerate, ResampleQuality, &error);
|
spx_state = speex_resampler_init(2, oldsamplerate, newsamplerate, ResampleQuality, &error);
|
||||||
if (spx_state == NULL)
|
if (spx_state == nullptr)
|
||||||
{
|
{
|
||||||
memset(output, 0, output_needed);
|
memset(output, 0, output_needed);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -284,10 +284,10 @@ static int resample(unsigned char *input, int /*input_avail*/, int oldsamplerate
|
||||||
}
|
}
|
||||||
memset(_src, 0, _src_len);
|
memset(_src, 0, _src_len);
|
||||||
memset(_dest, 0, _dest_len);
|
memset(_dest, 0, _dest_len);
|
||||||
if (src_state == NULL)
|
if (src_state == nullptr)
|
||||||
{
|
{
|
||||||
src_state = src_new(ResampleQuality, 2, &error);
|
src_state = src_new(ResampleQuality, 2, &error);
|
||||||
if (src_state == NULL)
|
if (src_state == nullptr)
|
||||||
{
|
{
|
||||||
memset(output, 0, output_needed);
|
memset(output, 0, output_needed);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -365,7 +365,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_GameFreq == freq && g_primaryBuffer != NULL)
|
if (g_GameFreq == freq && g_primaryBuffer != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceInfo, "we are already using this frequency, so ignore it (freq: %d)", freq);
|
WriteTrace(TraceAudioInitShutdown, TraceInfo, "we are already using this frequency, so ignore it (freq: %d)", freq);
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
|
||||||
|
@ -433,7 +433,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
/* Create thread Locks to ensure synchronization between callback and processing code */
|
/* Create thread Locks to ensure synchronization between callback and processing code */
|
||||||
if (pthread_mutex_init(&(g_lock.mutex), (pthread_mutexattr_t*)NULL) != 0)
|
if (pthread_mutex_init(&(g_lock.mutex), (pthread_mutexattr_t*)nullptr) != 0)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_mutex_init failed");
|
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_mutex_init failed");
|
||||||
CloseAudio();
|
CloseAudio();
|
||||||
|
@ -441,7 +441,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
|
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Done");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pthread_cond_init(&(g_lock.cond), (pthread_condattr_t*)NULL) != 0)
|
if (pthread_cond_init(&(g_lock.cond), (pthread_condattr_t*)nullptr) != 0)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_cond_init failed");
|
WriteTrace(TraceAudioInitShutdown, TraceError, "pthread_cond_init failed");
|
||||||
CloseAudio();
|
CloseAudio();
|
||||||
|
@ -454,7 +454,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
pthread_mutex_unlock(&(g_lock.mutex));
|
pthread_mutex_unlock(&(g_lock.mutex));
|
||||||
|
|
||||||
/* Engine object */
|
/* Engine object */
|
||||||
SLresult result = slCreateEngine(&g_engineObject, 0, NULL, 0, NULL, NULL);
|
SLresult result = slCreateEngine(&g_engineObject, 0, nullptr, 0, nullptr, nullptr);
|
||||||
if (result != SL_RESULT_SUCCESS)
|
if (result != SL_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine failed (result: %d)", result);
|
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine failed (result: %d)", result);
|
||||||
|
@ -481,7 +481,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
if (result == SL_RESULT_SUCCESS)
|
if (result == SL_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Output mix object */
|
/* Output mix object */
|
||||||
result = (*g_engineEngine)->CreateOutputMix(g_engineEngine, &g_outputMixObject, 0, NULL, NULL);
|
result = (*g_engineEngine)->CreateOutputMix(g_engineEngine, &g_outputMixObject, 0, nullptr, nullptr);
|
||||||
if (result != SL_RESULT_SUCCESS)
|
if (result != SL_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine->CreateOutputMix failed (result: %d)", result);
|
WriteTrace(TraceAudioInitShutdown, TraceError, "slCreateEngine->CreateOutputMix failed (result: %d)", result);
|
||||||
|
@ -508,7 +508,7 @@ void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize)
|
||||||
|
|
||||||
/* Configure audio sink */
|
/* Configure audio sink */
|
||||||
SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, g_outputMixObject };
|
SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, g_outputMixObject };
|
||||||
SLDataSink audioSnk = { &loc_outmix, NULL };
|
SLDataSink audioSnk = { &loc_outmix, nullptr };
|
||||||
|
|
||||||
/* Create audio player */
|
/* Create audio player */
|
||||||
const SLInterfaceID ids1[] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE };
|
const SLInterfaceID ids1[] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE };
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
SoundDriverBase::SoundDriverBase() :
|
SoundDriverBase::SoundDriverBase() :
|
||||||
m_MaxBufferSize(MAX_SIZE),
|
m_MaxBufferSize(MAX_SIZE),
|
||||||
m_AI_DMAPrimaryBuffer(NULL),
|
m_AI_DMAPrimaryBuffer(nullptr),
|
||||||
m_AI_DMASecondaryBuffer(NULL),
|
m_AI_DMASecondaryBuffer(nullptr),
|
||||||
m_AI_DMAPrimaryBytes(0),
|
m_AI_DMAPrimaryBytes(0),
|
||||||
m_AI_DMASecondaryBytes(0),
|
m_AI_DMASecondaryBytes(0),
|
||||||
m_CurrentReadLoc(0),
|
m_CurrentReadLoc(0),
|
||||||
|
@ -51,7 +51,7 @@ void SoundDriverBase::AI_LenChanged(uint8_t *start, uint32_t length)
|
||||||
CGuard guard(m_CS);
|
CGuard guard(m_CS);
|
||||||
BufferAudio();
|
BufferAudio();
|
||||||
|
|
||||||
if (m_AI_DMASecondaryBuffer != NULL)
|
if (m_AI_DMASecondaryBuffer != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceDebug, "Discarding previous secondary buffer");
|
WriteTrace(TraceAudioDriver, TraceDebug, "Discarding previous secondary buffer");
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ void SoundDriverBase::AI_LenChanged(uint8_t *start, uint32_t length)
|
||||||
if (m_AI_DMAPrimaryBytes == 0)
|
if (m_AI_DMAPrimaryBytes == 0)
|
||||||
{
|
{
|
||||||
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer;
|
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer;
|
||||||
m_AI_DMASecondaryBuffer = NULL;
|
m_AI_DMASecondaryBuffer = nullptr;
|
||||||
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes;
|
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes;
|
||||||
m_AI_DMASecondaryBytes = 0;
|
m_AI_DMASecondaryBytes = 0;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void SoundDriverBase::AI_Startup()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
|
WriteTrace(TraceAudioDriver, TraceDebug, "Start");
|
||||||
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes = 0;
|
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes = 0;
|
||||||
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer = NULL;
|
m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer = nullptr;
|
||||||
m_MaxBufferSize = MAX_SIZE;
|
m_MaxBufferSize = MAX_SIZE;
|
||||||
m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0;
|
m_CurrentReadLoc = m_CurrentWriteLoc = m_BufferRemaining = 0;
|
||||||
if (Initialize())
|
if (Initialize())
|
||||||
|
@ -107,7 +107,7 @@ uint32_t SoundDriverBase::AI_ReadLength()
|
||||||
void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length)
|
void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length)
|
||||||
{
|
{
|
||||||
static uint8_t nullBuff[MAX_SIZE];
|
static uint8_t nullBuff[MAX_SIZE];
|
||||||
uint8_t *ptrStart = start != NULL ? start : nullBuff;
|
uint8_t *ptrStart = start != nullptr ? start : nullBuff;
|
||||||
uint32_t writePtr = 0, bytesToMove = length;
|
uint32_t writePtr = 0, bytesToMove = length;
|
||||||
|
|
||||||
if (bytesToMove > m_MaxBufferSize)
|
if (bytesToMove > m_MaxBufferSize)
|
||||||
|
@ -166,7 +166,7 @@ void SoundDriverBase::BufferAudio()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioDriver, TraceVerbose, "Emptied Primary Buffer");
|
WriteTrace(TraceAudioDriver, TraceVerbose, "Emptied Primary Buffer");
|
||||||
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes; m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer; // Switch
|
m_AI_DMAPrimaryBytes = m_AI_DMASecondaryBytes; m_AI_DMAPrimaryBuffer = m_AI_DMASecondaryBuffer; // Switch
|
||||||
m_AI_DMASecondaryBytes = 0; m_AI_DMASecondaryBuffer = NULL;
|
m_AI_DMASecondaryBytes = 0; m_AI_DMASecondaryBuffer = nullptr;
|
||||||
*g_AudioInfo.AI_STATUS_REG = AI_STATUS_DMA_BUSY;
|
*g_AudioInfo.AI_STATUS_REG = AI_STATUS_DMA_BUSY;
|
||||||
*g_AudioInfo.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL;
|
*g_AudioInfo.AI_STATUS_REG &= ~AI_STATUS_FIFO_FULL;
|
||||||
*g_AudioInfo.MI_INTR_REG |= MI_INTR_AI;
|
*g_AudioInfo.MI_INTR_REG |= MI_INTR_AI;
|
||||||
|
|
|
@ -26,19 +26,19 @@ class AndroidLogger : public CTraceModule
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static AndroidLogger * g_AndroidLogger = NULL;
|
static AndroidLogger * g_AndroidLogger = nullptr;
|
||||||
#endif
|
#endif
|
||||||
static CTraceFileLog * g_LogFile = NULL;
|
static CTraceFileLog * g_LogFile = nullptr;
|
||||||
|
|
||||||
void SetupTrace(void)
|
void SetupTrace(void)
|
||||||
{
|
{
|
||||||
if (g_LogFile != NULL)
|
if (g_LogFile != nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if (g_AndroidLogger == NULL)
|
if (g_AndroidLogger == nullptr)
|
||||||
{
|
{
|
||||||
g_AndroidLogger = new AndroidLogger();
|
g_AndroidLogger = new AndroidLogger();
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ void SetupTrace(void)
|
||||||
|
|
||||||
void StartTrace(void)
|
void StartTrace(void)
|
||||||
{
|
{
|
||||||
const char * log_dir = g_settings ? g_settings->log_dir() : NULL;
|
const char * log_dir = g_settings ? g_settings->log_dir() : nullptr;
|
||||||
if (log_dir == NULL || log_dir[0] == '\0')
|
if (log_dir == nullptr || log_dir[0] == '\0')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,6 @@ void StopTrace(void)
|
||||||
{
|
{
|
||||||
TraceRemoveModule(g_LogFile);
|
TraceRemoveModule(g_LogFile);
|
||||||
delete g_LogFile;
|
delete g_LogFile;
|
||||||
g_LogFile = NULL;
|
g_LogFile = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ m_blockIndex(0xFFFFFFFF),
|
||||||
m_outBuffer(0),
|
m_outBuffer(0),
|
||||||
m_outBufferSize(0),
|
m_outBufferSize(0),
|
||||||
m_NotfyCallback(NotfyCallbackDefault),
|
m_NotfyCallback(NotfyCallbackDefault),
|
||||||
m_NotfyCallbackInfo(NULL),
|
m_NotfyCallbackInfo(nullptr),
|
||||||
m_db(NULL),
|
m_db(nullptr),
|
||||||
m_Opened(false)
|
m_Opened(false)
|
||||||
{
|
{
|
||||||
memset(&m_FileName, 0, sizeof(m_FileName));
|
memset(&m_FileName, 0, sizeof(m_FileName));
|
||||||
|
@ -39,7 +39,7 @@ m_Opened(false)
|
||||||
//PrintError("can not open input file");
|
//PrintError("can not open input file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_FileSize = GetFileSize(m_archiveStream.file.handle, NULL);
|
m_FileSize = GetFileSize(m_archiveStream.file.handle, nullptr);
|
||||||
|
|
||||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], ext[_MAX_EXT];
|
char drive[_MAX_DRIVE], dir[_MAX_DIR], ext[_MAX_EXT];
|
||||||
_splitpath(FileName, drive, dir, m_FileName, ext);
|
_splitpath(FileName, drive, dir, m_FileName, ext);
|
||||||
|
@ -59,7 +59,7 @@ m_Opened(false)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//SzArEx_Open will delete the passed db if it fails
|
//SzArEx_Open will delete the passed db if it fails
|
||||||
m_db = NULL;
|
m_db = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ C7zip::~C7zip(void)
|
||||||
if (m_db)
|
if (m_db)
|
||||||
{
|
{
|
||||||
delete m_db;
|
delete m_db;
|
||||||
m_db = NULL;
|
m_db = nullptr;
|
||||||
}
|
}
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
SetNotificationCallback(NULL,NULL);
|
SetNotificationCallback(nullptr,nullptr);
|
||||||
SzArDbExFree(&m_db, m_allocImp.Free);
|
SzArDbExFree(&m_db, m_allocImp.Free);
|
||||||
|
|
||||||
if (m_archiveStream.File)
|
if (m_archiveStream.File)
|
||||||
|
@ -94,7 +94,7 @@ void C7zip::SetNotificationCallback(LP7ZNOTIFICATION NotfyFnc, void * CBInfo)
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
void C7zip::StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this )
|
void C7zip::StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _this )
|
||||||
{
|
{
|
||||||
CFileItem * File = _this->m_CurrentFile >= 0 ? _this->FileItem(_this->m_CurrentFile) : NULL;
|
CFileItem * File = _this->m_CurrentFile >= 0 ? _this->FileItem(_this->m_CurrentFile) : nullptr;
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ void C7zip::StatusUpdate(_7Z_STATUS status, int Value1, int Value2, C7zip * _thi
|
||||||
bool C7zip::GetFile(int index, Byte * Data, size_t DataLen)
|
bool C7zip::GetFile(int index, Byte * Data, size_t DataLen)
|
||||||
{
|
{
|
||||||
m_CurrentFile = -1;
|
m_CurrentFile = -1;
|
||||||
if (Data == NULL || DataLen == 0)
|
if (Data == nullptr || DataLen == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ void * C7zip::AllocAllocImp(void * /*p*/, size_t size)
|
||||||
|
|
||||||
void C7zip::AllocFreeImp(void * /*p*/, void *address)
|
void C7zip::AllocFreeImp(void * /*p*/, void *address)
|
||||||
{
|
{
|
||||||
if (address != NULL)
|
if (address != nullptr)
|
||||||
{
|
{
|
||||||
free(address);
|
free(address);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ SRes C7zip::SzFileReadImp(void *object, void *buffer, size_t *processedSize)
|
||||||
{
|
{
|
||||||
CFileInStream *p = (CFileInStream *)object;
|
CFileInStream *p = (CFileInStream *)object;
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
if (!ReadFile(p->file.handle, buffer, *processedSize, &dwRead, NULL))
|
if (!ReadFile(p->file.handle, buffer, *processedSize, &dwRead, nullptr))
|
||||||
{
|
{
|
||||||
return SZ_ERROR_FAIL;
|
return SZ_ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
|
||||||
default:
|
default:
|
||||||
return SZ_ERROR_FAIL;
|
return SZ_ERROR_FAIL;
|
||||||
}
|
}
|
||||||
*pos = SetFilePointer(s->file.handle, (LONG)*pos, NULL, dwMoveMethod);
|
*pos = SetFilePointer(s->file.handle, (LONG)*pos, nullptr, dwMoveMethod);
|
||||||
if (*pos == INVALID_SET_FILE_POINTER)
|
if (*pos == INVALID_SET_FILE_POINTER)
|
||||||
{
|
{
|
||||||
return SZ_ERROR_FAIL;
|
return SZ_ERROR_FAIL;
|
||||||
|
@ -208,9 +208,9 @@ SRes C7zip::SzFileSeekImp(void *p, Int64 *pos, ESzSeek origin)
|
||||||
|
|
||||||
const char * C7zip::FileName(char * FileName, int SizeOfFileName) const
|
const char * C7zip::FileName(char * FileName, int SizeOfFileName) const
|
||||||
{
|
{
|
||||||
if (FileName == NULL)
|
if (FileName == nullptr)
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
int Len = strlen(m_FileName);
|
int Len = strlen(m_FileName);
|
||||||
if (Len > (SizeOfFileName - 1))
|
if (Len > (SizeOfFileName - 1))
|
||||||
|
@ -225,12 +225,12 @@ const char * C7zip::FileName(char * FileName, int SizeOfFileName) const
|
||||||
std::wstring C7zip::FileNameIndex(int index)
|
std::wstring C7zip::FileNameIndex(int index)
|
||||||
{
|
{
|
||||||
std::wstring filename;
|
std::wstring filename;
|
||||||
if (m_db == NULL || m_db->FileNameOffsets == 0)
|
if (m_db == nullptr || m_db->FileNameOffsets == 0)
|
||||||
{
|
{
|
||||||
/* no filename */
|
/* no filename */
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
int namelen = SzArEx_GetFileNameUtf16(m_db, index, NULL);
|
int namelen = SzArEx_GetFileNameUtf16(m_db, index, nullptr);
|
||||||
if (namelen <= 0)
|
if (namelen <= 0)
|
||||||
{
|
{
|
||||||
/* no filename */
|
/* no filename */
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
typedef void (*LP7ZNOTIFICATION)(const char * Status, void * CBInfo);
|
typedef void (*LP7ZNOTIFICATION)(const char * Status, void * CBInfo);
|
||||||
|
|
||||||
inline int NumFiles(void) const { return m_db ? m_db->db.NumFiles : 0; }
|
inline int NumFiles(void) const { return m_db ? m_db->db.NumFiles : 0; }
|
||||||
inline CSzFileItem * FileItem(int index) const { return m_db ? &m_db->db.Files[index] : NULL; }
|
inline CSzFileItem * FileItem(int index) const { return m_db ? &m_db->db.Files[index] : nullptr; }
|
||||||
inline int FileSize(void) const { return m_FileSize; }
|
inline int FileSize(void) const { return m_FileSize; }
|
||||||
inline bool OpenSuccess(void) const { return m_Opened; }
|
inline bool OpenSuccess(void) const { return m_Opened; }
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ void SetTraceModuleNames(void);
|
||||||
static void IncreaseThreadPriority(void);
|
static void IncreaseThreadPriority(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static CTraceFileLog * g_LogFile = NULL;
|
static CTraceFileLog * g_LogFile = nullptr;
|
||||||
|
|
||||||
void LogFlushChanged(CTraceFileLog * LogFile)
|
void LogFlushChanged(CTraceFileLog * LogFile)
|
||||||
{
|
{
|
||||||
|
@ -104,30 +104,30 @@ void SetupTrace(void)
|
||||||
{
|
{
|
||||||
AddLogModule();
|
AddLogModule();
|
||||||
|
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceMD5, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceThread, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceThread, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TracePath, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TracePath, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceSettings, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceUnknown, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceAppInit, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceRSP, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceAudio, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceRegisterCache, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceRecompiler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceTLB, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceProtectedMEM, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceUserInterface, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceRomList, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceRomList, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_TraceExceptionHandler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->RegisterChangeCB(Debugger_TraceExceptionHandler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||||
UpdateTraceLevel(NULL);
|
UpdateTraceLevel(nullptr);
|
||||||
|
|
||||||
WriteTrace(TraceAppInit, TraceInfo, "Application Starting %s", VER_FILE_VERSION_STR);
|
WriteTrace(TraceAppInit, TraceInfo, "Application Starting %s", VER_FILE_VERSION_STR);
|
||||||
}
|
}
|
||||||
|
@ -136,35 +136,35 @@ void CleanupTrace(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAppCleanup, TraceDebug, "Done");
|
WriteTrace(TraceAppCleanup, TraceDebug, "Done");
|
||||||
|
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceMD5, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceMD5, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceThread, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceThread, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TracePath, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TracePath, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceSettings, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceSettings, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceUnknown, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceUnknown, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceAppInit, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceAppInit, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceRSP, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceRSP, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceAudio, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceAudio, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceRegisterCache, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceRegisterCache, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceRecompiler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceRecompiler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceTLB, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceTLB, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceProtectedMEM, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceProtectedMEM, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceUserInterface, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceUserInterface, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceRomList, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceRomList, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_TraceExceptionHandler, NULL, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
g_Settings->UnregisterChangeCB(Debugger_TraceExceptionHandler, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceDone(void)
|
void TraceDone(void)
|
||||||
{
|
{
|
||||||
CloseTrace();
|
CloseTrace();
|
||||||
if (g_LogFile) { delete g_LogFile; g_LogFile = NULL; }
|
if (g_LogFile) { delete g_LogFile; g_LogFile = nullptr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * AppName(void)
|
const char * AppName(void)
|
||||||
|
@ -220,7 +220,7 @@ bool AppInit(CNotification * Notify, const char * BaseDirectory, int argc, char
|
||||||
g_Notify = Notify;
|
g_Notify = Notify;
|
||||||
InitializeLog();
|
InitializeLog();
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Starting (BaseDirectory: %s)", BaseDirectory ? BaseDirectory : "null");
|
WriteTrace(TraceAppInit, TraceDebug, "Starting (BaseDirectory: %s)", BaseDirectory ? BaseDirectory : "null");
|
||||||
if (Notify == NULL)
|
if (Notify == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAppInit, TraceError, "No Notification class passed");
|
WriteTrace(TraceAppInit, TraceError, "No Notification class passed");
|
||||||
return false;
|
return false;
|
||||||
|
@ -283,13 +283,13 @@ void AppCleanup(void)
|
||||||
WriteTrace(TraceAppCleanup, TraceDebug, "cleaning up global objects");
|
WriteTrace(TraceAppCleanup, TraceDebug, "cleaning up global objects");
|
||||||
CleanupTrace();
|
CleanupTrace();
|
||||||
|
|
||||||
if (g_Enhancements) { delete g_Enhancements; g_Enhancements = NULL; }
|
if (g_Enhancements) { delete g_Enhancements; g_Enhancements = nullptr; }
|
||||||
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
|
if (g_Rom) { delete g_Rom; g_Rom = nullptr; }
|
||||||
if (g_DDRom) { delete g_DDRom; g_DDRom = NULL; }
|
if (g_DDRom) { delete g_DDRom; g_DDRom = nullptr; }
|
||||||
if (g_Disk) { delete g_Disk; g_Disk = NULL; }
|
if (g_Disk) { delete g_Disk; g_Disk = nullptr; }
|
||||||
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
|
if (g_Plugins) { delete g_Plugins; g_Plugins = nullptr; }
|
||||||
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
|
if (g_Settings) { delete g_Settings; g_Settings = nullptr; }
|
||||||
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
|
if (g_Lang) { delete g_Lang; g_Lang = nullptr; }
|
||||||
|
|
||||||
CMipsMemoryVM::FreeReservedMemory();
|
CMipsMemoryVM::FreeReservedMemory();
|
||||||
TraceDone();
|
TraceDone();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
|
|
||||||
CFile * CLogging::m_hLogFile = NULL;
|
CFile * CLogging::m_hLogFile = nullptr;
|
||||||
|
|
||||||
void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
|
void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
|
||||||
{
|
{
|
||||||
|
@ -578,7 +578,7 @@ void CLogging::LogMessage(const char * Message, ...)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_hLogFile == NULL)
|
if (m_hLogFile == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ void CLogging::StartLog(void)
|
||||||
StopLog();
|
StopLog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_hLogFile != NULL)
|
if (m_hLogFile != nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -613,6 +613,6 @@ void CLogging::StopLog(void)
|
||||||
if (m_hLogFile)
|
if (m_hLogFile)
|
||||||
{
|
{
|
||||||
delete m_hLogFile;
|
delete m_hLogFile;
|
||||||
m_hLogFile = NULL;
|
m_hLogFile = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,9 +18,9 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
||||||
WriteTrace(TraceExceptionHandler, TraceVerbose, "MemAddress: %X", MemAddress);
|
WriteTrace(TraceExceptionHandler, TraceVerbose, "MemAddress: %X", MemAddress);
|
||||||
uint32_t * Reg;
|
uint32_t * Reg;
|
||||||
|
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceExceptionHandler, TraceError, "g_MMU == NULL");
|
WriteTrace(TraceExceptionHandler, TraceError, "g_MMU == nullptr");
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
||||||
uint8_t * TypePos = (uint8_t *)*(context.Eip);
|
uint8_t * TypePos = (uint8_t *)*(context.Eip);
|
||||||
WriteTrace(TraceExceptionHandler, TraceVerbose, "TypePos[0] = %02X TypePos[1] = %02X", TypePos[0], TypePos[2]);
|
WriteTrace(TraceExceptionHandler, TraceVerbose, "TypePos[0] = %02X TypePos[1] = %02X", TypePos[0], TypePos[2]);
|
||||||
|
|
||||||
Reg = NULL;
|
Reg = nullptr;
|
||||||
if (*TypePos == 0xF3 && (*(TypePos + 1) == 0xA4 || *(TypePos + 1) == 0xA5))
|
if (*TypePos == 0xF3 && (*(TypePos + 1) == 0xA4 || *(TypePos + 1) == 0xA5))
|
||||||
{
|
{
|
||||||
uint32_t Start = (*context.Edi - (uint32_t)g_MMU->m_RDRAM);
|
uint32_t Start = (*context.Edi - (uint32_t)g_MMU->m_RDRAM);
|
||||||
|
@ -169,7 +169,7 @@ bool CMipsMemoryVM::FilterX86Exception(uint32_t MemAddress, X86_CONTEXT & contex
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Reg == NULL)
|
if (Reg == nullptr)
|
||||||
{
|
{
|
||||||
if (HaveDebugger())
|
if (HaveDebugger())
|
||||||
{
|
{
|
||||||
|
@ -764,7 +764,7 @@ bool CMipsMemoryVM::SetupSegvHandler(void)
|
||||||
struct sigaction sig_act;
|
struct sigaction sig_act;
|
||||||
sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
|
sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
|
||||||
sig_act.sa_sigaction = segv_handler;
|
sig_act.sa_sigaction = segv_handler;
|
||||||
return sigaction(SIGSEGV, &sig_act, NULL) == 0;
|
return sigaction(SIGSEGV, &sig_act, nullptr) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontext)
|
void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontext)
|
||||||
|
@ -826,7 +826,7 @@ void CMipsMemoryVM::segv_handler(int signal, siginfo_t *siginfo, void *sigcontex
|
||||||
int32_t CMipsMemoryVM::MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer)
|
int32_t CMipsMemoryVM::MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer)
|
||||||
{
|
{
|
||||||
#if defined(_M_IX86) && defined(_WIN32)
|
#if defined(_M_IX86) && defined(_WIN32)
|
||||||
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION || g_MMU == NULL)
|
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION || g_MMU == nullptr)
|
||||||
{
|
{
|
||||||
if (HaveDebugger())
|
if (HaveDebugger())
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CLanguage * g_Lang = NULL;
|
CLanguage * g_Lang = nullptr;
|
||||||
|
|
||||||
void CLanguage::LoadDefaultStrings(void)
|
void CLanguage::LoadDefaultStrings(void)
|
||||||
{
|
{
|
||||||
|
@ -646,7 +646,7 @@ bool CLanguage::LoadCurrentStrings(void)
|
||||||
|
|
||||||
//Process the file
|
//Process the file
|
||||||
FILE *file = fopen(Filename.c_str(), "rb");
|
FILE *file = fopen(Filename.c_str(), "rb");
|
||||||
if (file == NULL)
|
if (file == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ const std::string & CLanguage::GetString(LanguageStringID StringID)
|
||||||
std::string CLanguage::GetLangString(const char * FileName, LanguageStringID ID)
|
std::string CLanguage::GetLangString(const char * FileName, LanguageStringID ID)
|
||||||
{
|
{
|
||||||
FILE *file = fopen(FileName, "rb");
|
FILE *file = fopen(FileName, "rb");
|
||||||
if (file == NULL)
|
if (file == nullptr)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ void CN64System::StartEmulationThread(CThread * thread)
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitialize(nullptr);
|
||||||
|
|
||||||
EmulationStarting(thread);
|
EmulationStarting(thread);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ void CN64System::StartEmulationThread(CThread * thread)
|
||||||
void CN64System::CloseCpu()
|
void CN64System::CloseCpu()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Start");
|
WriteTrace(TraceN64System, TraceDebug, "Start");
|
||||||
if (m_thread == NULL)
|
if (m_thread == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ void CN64System::CloseCpu()
|
||||||
}
|
}
|
||||||
|
|
||||||
CThread * hThread = m_thread;
|
CThread * hThread = m_thread;
|
||||||
m_thread = NULL;
|
m_thread = nullptr;
|
||||||
for (int count = 0; count < 200; count++)
|
for (int count = 0; count < 200; count++)
|
||||||
{
|
{
|
||||||
if (hThread == NULL || !hThread->isRunning())
|
if (hThread == nullptr || !hThread->isRunning())
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Thread no longer running");
|
WriteTrace(TraceN64System, TraceDebug, "Thread no longer running");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -268,14 +268,14 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
|
||||||
|
|
||||||
void CEnhancement::SetName(const char * Name)
|
void CEnhancement::SetName(const char * Name)
|
||||||
{
|
{
|
||||||
std::string NewName = stdstr(Name != NULL ? Name : "").Trim("\t ,");
|
std::string NewName = stdstr(Name != nullptr ? Name : "").Trim("\t ,");
|
||||||
if (NewName == m_Name)
|
if (NewName == m_Name)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Delete();
|
CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).Delete();
|
||||||
CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).Delete();
|
CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).Delete();
|
||||||
m_Name = stdstr(Name != NULL ? Name : "").Trim("\t ,");
|
m_Name = stdstr(Name != nullptr ? Name : "").Trim("\t ,");
|
||||||
m_NameAndExtension = m_Name;
|
m_NameAndExtension = m_Name;
|
||||||
if (m_Active != m_OnByDefault) { CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).SetActive(m_OnByDefault); }
|
if (m_Active != m_OnByDefault) { CSettingEnhancementActive(m_Name.c_str(), m_Ident.c_str(), m_OnByDefault).SetActive(m_OnByDefault); }
|
||||||
if (OptionSelected()) { CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SetOption(SelectedOption()); }
|
if (OptionSelected()) { CSettingEnhancementSelectedOption(m_Name.c_str(), m_Ident.c_str()).SetOption(SelectedOption()); }
|
||||||
|
@ -284,7 +284,7 @@ void CEnhancement::SetName(const char * Name)
|
||||||
|
|
||||||
void CEnhancement::SetNote(const char * Note)
|
void CEnhancement::SetNote(const char * Note)
|
||||||
{
|
{
|
||||||
m_Note = Note != NULL ? Note : "";
|
m_Note = Note != nullptr ? Note : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEnhancement::SetEntries(const CodeEntries & Entries)
|
void CEnhancement::SetEntries(const CodeEntries & Entries)
|
||||||
|
@ -372,7 +372,7 @@ void CEnhancement::CheckValid(void)
|
||||||
case 0xD1000000:
|
case 0xD1000000:
|
||||||
case 0xD2000000:
|
case 0xD2000000:
|
||||||
case 0xD3000000:
|
case 0xD3000000:
|
||||||
if (strchr(itr->Value.c_str(), '?') != NULL)
|
if (strchr(itr->Value.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
if (strncmp(itr->Value.c_str(), "????", 4) == 0)
|
if (strncmp(itr->Value.c_str(), "????", 4) == 0)
|
||||||
{
|
{
|
||||||
|
@ -408,7 +408,7 @@ void CEnhancement::CheckValid(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x50000000:
|
case 0x50000000:
|
||||||
if (strchr(itr->Value.c_str(), '?') != NULL)
|
if (strchr(itr->Value.c_str(), '?') != nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ bool CEnhancmentFile::MoveToSection(const char * Section, bool ChangeCurrentSect
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<char> Data;
|
std::unique_ptr<char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||||
|
|
||||||
FILELOC_ITR iter = m_SectionsPos.find(std::string(Section));
|
FILELOC_ITR iter = m_SectionsPos.find(std::string(Section));
|
||||||
|
@ -385,7 +385,7 @@ void CEnhancmentFile::SaveCurrentSection(void)
|
||||||
|
|
||||||
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
|
||||||
std::unique_ptr<char> Data;
|
std::unique_ptr<char> Data;
|
||||||
char *Input = NULL;
|
char *Input = nullptr;
|
||||||
|
|
||||||
//Skip first line as it is the section name
|
//Skip first line as it is the section name
|
||||||
int StartPos = m_CurrentSectionFilePos;
|
int StartPos = m_CurrentSectionFilePos;
|
||||||
|
@ -460,7 +460,7 @@ int CEnhancmentFile::GetStringFromFile(char * & String, std::unique_ptr<char> &
|
||||||
//Increase buffer size
|
//Increase buffer size
|
||||||
int NewMaxDataSize = MaxDataSize + BufferIncrease;
|
int NewMaxDataSize = MaxDataSize + BufferIncrease;
|
||||||
char * NewBuffer = new char[NewMaxDataSize];
|
char * NewBuffer = new char[NewMaxDataSize];
|
||||||
if (NewBuffer == NULL)
|
if (NewBuffer == nullptr)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -492,10 +492,10 @@ const char * CEnhancmentFile::CleanLine(char * Line)
|
||||||
char * Pos = Line;
|
char * Pos = Line;
|
||||||
|
|
||||||
//Remove any comment from the line
|
//Remove any comment from the line
|
||||||
while (Pos != NULL)
|
while (Pos != nullptr)
|
||||||
{
|
{
|
||||||
Pos = strchr(Pos, '/');
|
Pos = strchr(Pos, '/');
|
||||||
if (Pos != NULL)
|
if (Pos != nullptr)
|
||||||
{
|
{
|
||||||
if (Pos[1] == '/')
|
if (Pos[1] == '/')
|
||||||
{
|
{
|
||||||
|
|
|
@ -322,22 +322,22 @@ void CEnhancements::LoadActive(CEnhancementList & List, CPlugins * Plugins)
|
||||||
for (size_t i = 0, n = PluginList.size(); i < n; i++)
|
for (size_t i = 0, n = PluginList.size(); i < n; i++)
|
||||||
{
|
{
|
||||||
std::string PluginName = stdstr(PluginList[i]).Trim();
|
std::string PluginName = stdstr(PluginList[i]).Trim();
|
||||||
if (Plugins->Gfx() != NULL && strstr(Plugins->Gfx()->PluginName(), PluginName.c_str()) != nullptr)
|
if (Plugins->Gfx() != nullptr && strstr(Plugins->Gfx()->PluginName(), PluginName.c_str()) != nullptr)
|
||||||
{
|
{
|
||||||
LoadEntry = true;
|
LoadEntry = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Plugins->Audio() != NULL && strstr(Plugins->Audio()->PluginName(), PluginName.c_str()) != nullptr)
|
if (Plugins->Audio() != nullptr && strstr(Plugins->Audio()->PluginName(), PluginName.c_str()) != nullptr)
|
||||||
{
|
{
|
||||||
LoadEntry = true;
|
LoadEntry = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Plugins->RSP() != NULL && strstr(Plugins->RSP()->PluginName(), PluginName.c_str()) != nullptr)
|
if (Plugins->RSP() != nullptr && strstr(Plugins->RSP()->PluginName(), PluginName.c_str()) != nullptr)
|
||||||
{
|
{
|
||||||
LoadEntry = true;
|
LoadEntry = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Plugins->Control() != NULL && strstr(Plugins->Control()->PluginName(), PluginName.c_str()) != nullptr)
|
if (Plugins->Control() != nullptr && strstr(Plugins->Control()->PluginName(), PluginName.c_str()) != nullptr)
|
||||||
{
|
{
|
||||||
LoadEntry = true;
|
LoadEntry = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <Project64-core/ExceptionHandler.h>
|
#include <Project64-core/ExceptionHandler.h>
|
||||||
#include <Project64-core/Debugger.h>
|
#include <Project64-core/Debugger.h>
|
||||||
|
|
||||||
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = NULL;
|
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = nullptr;
|
||||||
|
|
||||||
void ExecuteInterpreterOps(uint32_t /*Cycles*/)
|
void ExecuteInterpreterOps(uint32_t /*Cycles*/)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +242,7 @@ void CInterpreterCPU::InPermLoop()
|
||||||
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
|
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
|
||||||
(g_Reg->STATUS_REGISTER & 0xFF00) == 0)
|
(g_Reg->STATUS_REGISTER & 0xFF00) == 0)
|
||||||
{
|
{
|
||||||
if (g_Plugins->Gfx()->UpdateScreen != NULL)
|
if (g_Plugins->Gfx()->UpdateScreen != nullptr)
|
||||||
{
|
{
|
||||||
g_Plugins->Gfx()->UpdateScreen();
|
g_Plugins->Gfx()->UpdateScreen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3042,7 +3042,7 @@ void R4300iOp::UnknownOpcode()
|
||||||
|
|
||||||
strcat(Message, "\n\nDo you wish to enter the debugger ?");
|
strcat(Message, "\n\nDo you wish to enter the debugger ?");
|
||||||
|
|
||||||
response = MessageBox(NULL, Message, GS(MSG_MSGBOX_ERROR_TITLE), MB_YESNO | MB_ICONERROR);
|
response = MessageBox(nullptr, Message, GS(MSG_MSGBOX_ERROR_TITLE), MB_YESNO | MB_ICONERROR);
|
||||||
if (response == IDYES)
|
if (response == IDYES)
|
||||||
{
|
{
|
||||||
Enter_R4300i_Commands_Window();
|
Enter_R4300i_Commands_Window();
|
||||||
|
|
|
@ -82,7 +82,7 @@ void CAudio::LenChanged()
|
||||||
m_Status = 0;
|
m_Status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Plugins->Audio()->AiLenChanged != NULL)
|
if (g_Plugins->Audio()->AiLenChanged != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudio, TraceDebug, "Calling plugin AiLenChanged");
|
WriteTrace(TraceAudio, TraceDebug, "Calling plugin AiLenChanged");
|
||||||
g_Plugins->Audio()->AiLenChanged();
|
g_Plugins->Audio()->AiLenChanged();
|
||||||
|
|
|
@ -79,7 +79,7 @@ void DiskCommand()
|
||||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_CHNG;
|
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_CHNG;
|
||||||
//F-Zero X + Expansion Kit fix so it doesn't enable "swapping" at boot
|
//F-Zero X + Expansion Kit fix so it doesn't enable "swapping" at boot
|
||||||
dd_swapdelay = 0;
|
dd_swapdelay = 0;
|
||||||
if (g_Disk != NULL)
|
if (g_Disk != nullptr)
|
||||||
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
||||||
break;
|
break;
|
||||||
case 0x00120000:
|
case 0x00120000:
|
||||||
|
@ -181,7 +181,7 @@ void DiskReset(void)
|
||||||
WriteTrace(TraceN64System, TraceDebug, "DD RESET");
|
WriteTrace(TraceN64System, TraceDebug, "DD RESET");
|
||||||
g_Reg->ASIC_STATUS |= DD_STATUS_RST_STATE;
|
g_Reg->ASIC_STATUS |= DD_STATUS_RST_STATE;
|
||||||
dd_swapdelay = 0;
|
dd_swapdelay = 0;
|
||||||
if (g_Disk != NULL)
|
if (g_Disk != nullptr)
|
||||||
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
g_Reg->ASIC_STATUS |= DD_STATUS_DISK_PRES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void DiskGapSectorCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delay Disk Swapping by removing the disk for a certain amount of time, then insert the newly loaded disk (after 50 Status Register reads, here).
|
//Delay Disk Swapping by removing the disk for a certain amount of time, then insert the newly loaded disk (after 50 Status Register reads, here).
|
||||||
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != NULL && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
|
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != nullptr && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
|
||||||
{
|
{
|
||||||
dd_swapdelay++;
|
dd_swapdelay++;
|
||||||
if (dd_swapdelay >= 50)
|
if (dd_swapdelay >= 50)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CFlashram::CFlashram(bool ReadOnly) :
|
CFlashram::CFlashram(bool ReadOnly) :
|
||||||
m_FlashRamPointer(NULL),
|
m_FlashRamPointer(nullptr),
|
||||||
m_FlashFlag(FLASHRAM_MODE_NOPES),
|
m_FlashFlag(FLASHRAM_MODE_NOPES),
|
||||||
m_FlashStatus(0),
|
m_FlashStatus(0),
|
||||||
m_FlashRAM_Offset(0),
|
m_FlashRAM_Offset(0),
|
||||||
|
|
|
@ -26,7 +26,7 @@ static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF))
|
else if ((address >= 0xA000) && (address <= 0xBFFF))
|
||||||
{
|
{
|
||||||
//Read from RAM
|
//Read from RAM
|
||||||
if (gb_cart->ram == NULL)
|
if (gb_cart->ram == nullptr)
|
||||||
{
|
{
|
||||||
//No RAM to write to
|
//No RAM to write to
|
||||||
return;
|
return;
|
||||||
|
@ -50,7 +50,7 @@ static void write_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, cons
|
||||||
if ((address >= 0xA000) && (address <= 0xBFFF))
|
if ((address >= 0xA000) && (address <= 0xBFFF))
|
||||||
{
|
{
|
||||||
//Write to RAM
|
//Write to RAM
|
||||||
if (gb_cart->ram == NULL)
|
if (gb_cart->ram == nullptr)
|
||||||
{
|
{
|
||||||
//No RAM to write to
|
//No RAM to write to
|
||||||
return;
|
return;
|
||||||
|
@ -85,7 +85,7 @@ static void read_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) //Read from RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) //Read from RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -151,7 +151,7 @@ static void write_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -180,7 +180,7 @@ static void read_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -209,14 +209,14 @@ static void write_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
}
|
}
|
||||||
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
|
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
gb_cart->ram_bank = data[0] & 0x07;
|
gb_cart->ram_bank = data[0] & 0x07;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -229,7 +229,7 @@ static void write_gb_cart_mbc2(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
|
|
||||||
void memoryUpdateMBC3Clock(struct gb_cart* gb_cart)
|
void memoryUpdateMBC3Clock(struct gb_cart* gb_cart)
|
||||||
{
|
{
|
||||||
time_t now = time(NULL);
|
time_t now = time(nullptr);
|
||||||
time_t diff = now - gb_cart->rtc_last_time;
|
time_t diff = now - gb_cart->rtc_last_time;
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
// update the clock according to the last update time
|
// update the clock according to the last update time
|
||||||
|
@ -284,7 +284,7 @@ static void read_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, uint8_t
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper Bounds of memory map
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
if (gb_cart->ram_bank <= 0x03)
|
if (gb_cart->ram_bank <= 0x03)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +333,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
}
|
}
|
||||||
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM/Clock bank select
|
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM/Clock bank select
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
bank = data[0];
|
bank = data[0];
|
||||||
if (gb_cart->has_rtc && (bank >= 0x8 && bank <= 0xc))
|
if (gb_cart->has_rtc && (bank >= 0x8 && bank <= 0xc))
|
||||||
|
@ -363,7 +363,7 @@ static void write_gb_cart_mbc3(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
if (gb_cart->ram_bank <= 0x03)
|
if (gb_cart->ram_bank <= 0x03)
|
||||||
{
|
{
|
||||||
|
@ -410,7 +410,7 @@ static void read_gb_cart_mbc5(struct gb_cart * gb_cart, uint16_t address, uint8_
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -442,14 +442,14 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const
|
||||||
}
|
}
|
||||||
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
|
else if ((address >= 0x4000) && (address <= 0x5FFF)) // RAM bank select
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
gb_cart->ram_bank = data[0] & 0x0f;
|
gb_cart->ram_bank = data[0] & 0x0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
offset = (address - 0xA000) + (gb_cart->ram_bank * 0x2000);
|
||||||
if (offset < gb_cart->ram_size)
|
if (offset < gb_cart->ram_size)
|
||||||
|
@ -489,7 +489,7 @@ static void read_gb_cart_pocket_cam(struct gb_cart * gb_cart, uint16_t address,
|
||||||
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
else if ((address >= 0xA000) && (address <= 0xC000)) //Upper bounds of memory map
|
||||||
{
|
{
|
||||||
//Check to see if where currently in register mode
|
//Check to see if where currently in register mode
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
if (gb_cart->ram_bank & 0x10)
|
if (gb_cart->ram_bank & 0x10)
|
||||||
{
|
{
|
||||||
|
@ -526,7 +526,7 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
|
||||||
}
|
}
|
||||||
else if ((address >= 0x4000) && (address <= 0x4FFF)) // Camera Register & RAM bank select
|
else if ((address >= 0x4000) && (address <= 0x4FFF)) // Camera Register & RAM bank select
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
if (data[0] & 0x10)
|
if (data[0] & 0x10)
|
||||||
{
|
{
|
||||||
|
@ -542,7 +542,7 @@ static void write_gb_cart_pocket_cam(struct gb_cart* gb_cart, uint16_t address,
|
||||||
}
|
}
|
||||||
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
else if ((address >= 0xA000) && (address <= 0xBFFF)) // Write to RAM
|
||||||
{
|
{
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
{
|
{
|
||||||
if (gb_cart->ram_bank & 0x10)
|
if (gb_cart->ram_bank & 0x10)
|
||||||
{
|
{
|
||||||
|
@ -675,7 +675,7 @@ static const struct parsed_cart_type* parse_cart_type(uint8_t cart_type)
|
||||||
case 0xFD: return &GB_CART_TYPES[26];
|
case 0xFD: return &GB_CART_TYPES[26];
|
||||||
case 0xFE: return &GB_CART_TYPES[27];
|
case 0xFE: return &GB_CART_TYPES[27];
|
||||||
case 0xFF: return &GB_CART_TYPES[28];
|
case 0xFF: return &GB_CART_TYPES[28];
|
||||||
default: return NULL;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
||||||
/* get and parse cart type */
|
/* get and parse cart type */
|
||||||
uint8_t cart_type = rom.get()[0x147];
|
uint8_t cart_type = rom.get()[0x147];
|
||||||
type = parse_cart_type(cart_type);
|
type = parse_cart_type(cart_type);
|
||||||
if (type == NULL)
|
if (type == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
||||||
if (ram_size != 0)
|
if (ram_size != 0)
|
||||||
{
|
{
|
||||||
ram.reset(new uint8_t[ram_size]);
|
ram.reset(new uint8_t[ram_size]);
|
||||||
if (ram.get() == NULL)
|
if (ram.get() == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -802,10 +802,10 @@ void GBCart::save_gb_cart(struct gb_cart* gb_cart)
|
||||||
|
|
||||||
void GBCart::release_gb_cart(struct gb_cart* gb_cart)
|
void GBCart::release_gb_cart(struct gb_cart* gb_cart)
|
||||||
{
|
{
|
||||||
if (gb_cart->rom != NULL)
|
if (gb_cart->rom != nullptr)
|
||||||
delete gb_cart->rom;
|
delete gb_cart->rom;
|
||||||
|
|
||||||
if (gb_cart->ram != NULL)
|
if (gb_cart->ram != nullptr)
|
||||||
delete gb_cart->ram;
|
delete gb_cart->ram;
|
||||||
|
|
||||||
memset(gb_cart, 0, sizeof(*gb_cart));
|
memset(gb_cart, 0, sizeof(*gb_cart));
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Common/MemoryManagement.h>
|
#include <Common/MemoryManagement.h>
|
||||||
|
|
||||||
uint8_t * CMipsMemoryVM::m_Reserve1 = NULL;
|
uint8_t * CMipsMemoryVM::m_Reserve1 = nullptr;
|
||||||
uint8_t * CMipsMemoryVM::m_Reserve2 = NULL;
|
uint8_t * CMipsMemoryVM::m_Reserve2 = nullptr;
|
||||||
uint32_t CMipsMemoryVM::m_MemLookupAddress = 0;
|
uint32_t CMipsMemoryVM::m_MemLookupAddress = 0;
|
||||||
MIPS_DWORD CMipsMemoryVM::m_MemLookupValue;
|
MIPS_DWORD CMipsMemoryVM::m_MemLookupValue;
|
||||||
bool CMipsMemoryVM::m_MemLookupValid = true;
|
bool CMipsMemoryVM::m_MemLookupValid = true;
|
||||||
|
@ -27,20 +27,20 @@ CMipsMemoryVM::CMipsMemoryVM(bool SavesReadOnly) :
|
||||||
CSram(SavesReadOnly),
|
CSram(SavesReadOnly),
|
||||||
CDMA(*this, *this),
|
CDMA(*this, *this),
|
||||||
m_RomMapped(false),
|
m_RomMapped(false),
|
||||||
m_Rom(NULL),
|
m_Rom(nullptr),
|
||||||
m_RomSize(0),
|
m_RomSize(0),
|
||||||
m_RomWrittenTo(false),
|
m_RomWrittenTo(false),
|
||||||
m_RomWroteValue(0),
|
m_RomWroteValue(0),
|
||||||
m_HalfLine(0),
|
m_HalfLine(0),
|
||||||
m_HalfLineCheck(false),
|
m_HalfLineCheck(false),
|
||||||
m_FieldSerration(0),
|
m_FieldSerration(0),
|
||||||
m_TLB_ReadMap(NULL),
|
m_TLB_ReadMap(nullptr),
|
||||||
m_TLB_WriteMap(NULL),
|
m_TLB_WriteMap(nullptr),
|
||||||
m_RDRAM(NULL),
|
m_RDRAM(nullptr),
|
||||||
m_DMEM(NULL),
|
m_DMEM(nullptr),
|
||||||
m_IMEM(NULL),
|
m_IMEM(nullptr),
|
||||||
m_DDRomMapped(false),
|
m_DDRomMapped(false),
|
||||||
m_DDRom(NULL),
|
m_DDRom(nullptr),
|
||||||
m_DDRomSize(0)
|
m_DDRomSize(0)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(Game_RDRamSize, this, (CSettings::SettingChangedFunc)RdramChanged);
|
g_Settings->RegisterChangeCB(Game_RDRamSize, this, (CSettings::SettingChangedFunc)RdramChanged);
|
||||||
|
@ -109,37 +109,37 @@ void CMipsMemoryVM::FreeReservedMemory()
|
||||||
if (m_Reserve1)
|
if (m_Reserve1)
|
||||||
{
|
{
|
||||||
FreeAddressSpace(m_Reserve1, 0x20000000);
|
FreeAddressSpace(m_Reserve1, 0x20000000);
|
||||||
m_Reserve1 = NULL;
|
m_Reserve1 = nullptr;
|
||||||
}
|
}
|
||||||
if (m_Reserve2)
|
if (m_Reserve2)
|
||||||
{
|
{
|
||||||
FreeAddressSpace(m_Reserve2, 0x20000000);
|
FreeAddressSpace(m_Reserve2, 0x20000000);
|
||||||
m_Reserve2 = NULL;
|
m_Reserve2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
{
|
{
|
||||||
if (m_RDRAM != NULL)
|
if (m_RDRAM != nullptr)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SyncSystem && m_RDRAM == NULL && m_Reserve1 != NULL)
|
if (!SyncSystem && m_RDRAM == nullptr && m_Reserve1 != nullptr)
|
||||||
{
|
{
|
||||||
m_RDRAM = m_Reserve1;
|
m_RDRAM = m_Reserve1;
|
||||||
m_Reserve1 = NULL;
|
m_Reserve1 = nullptr;
|
||||||
}
|
}
|
||||||
if (SyncSystem && m_RDRAM == NULL && m_Reserve2 != NULL)
|
if (SyncSystem && m_RDRAM == nullptr && m_Reserve2 != nullptr)
|
||||||
{
|
{
|
||||||
m_RDRAM = m_Reserve2;
|
m_RDRAM = m_Reserve2;
|
||||||
m_Reserve2 = NULL;
|
m_Reserve2 = nullptr;
|
||||||
}
|
}
|
||||||
if (m_RDRAM == NULL)
|
if (m_RDRAM == nullptr)
|
||||||
{
|
{
|
||||||
m_RDRAM = (uint8_t *)AllocateAddressSpace(0x20000000);
|
m_RDRAM = (uint8_t *)AllocateAddressSpace(0x20000000);
|
||||||
}
|
}
|
||||||
if (m_RDRAM == NULL)
|
if (m_RDRAM == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000);
|
WriteTrace(TraceN64System, TraceError, "Failed to Reserve RDRAM (Size: 0x%X)", 0x20000000);
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -147,14 +147,14 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
m_AllocatedRdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||||
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == NULL)
|
if (CommitMemory(m_RDRAM, m_AllocatedRdramSize, MEM_READWRITE) == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate RDRAM (Size: 0x%X)", m_AllocatedRdramSize);
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CommitMemory(m_RDRAM + 0x04000000, 0x2000, MEM_READWRITE) == NULL)
|
if (CommitMemory(m_RDRAM + 0x04000000, 0x2000, MEM_READWRITE) == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate DMEM/IMEM (Size: 0x%X)", 0x2000);
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -169,7 +169,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
m_RomMapped = true;
|
m_RomMapped = true;
|
||||||
m_Rom = m_RDRAM + 0x10000000;
|
m_Rom = m_RDRAM + 0x10000000;
|
||||||
m_RomSize = g_Rom->GetRomSize();
|
m_RomSize = g_Rom->GetRomSize();
|
||||||
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == NULL)
|
if (CommitMemory(m_Rom, g_Rom->GetRomSize(), MEM_READWRITE) == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize());
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_Rom->GetRomSize());
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -187,14 +187,14 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
}
|
}
|
||||||
|
|
||||||
//64DD IPL
|
//64DD IPL
|
||||||
if (g_DDRom != NULL)
|
if (g_DDRom != nullptr)
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(Game_LoadRomToMemory))
|
if (g_Settings->LoadBool(Game_LoadRomToMemory))
|
||||||
{
|
{
|
||||||
m_DDRomMapped = true;
|
m_DDRomMapped = true;
|
||||||
m_DDRom = m_RDRAM + 0x06000000;
|
m_DDRom = m_RDRAM + 0x06000000;
|
||||||
m_DDRomSize = g_DDRom->GetRomSize();
|
m_DDRomSize = g_DDRom->GetRomSize();
|
||||||
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == NULL)
|
if (CommitMemory(m_DDRom, g_DDRom->GetRomSize(), MEM_READWRITE) == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_DDRom->GetRomSize());
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate Rom (Size: 0x%X)", g_DDRom->GetRomSize());
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -215,7 +215,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
CPifRam::Reset();
|
CPifRam::Reset();
|
||||||
|
|
||||||
m_TLB_ReadMap = new size_t[0x100000];
|
m_TLB_ReadMap = new size_t[0x100000];
|
||||||
if (m_TLB_ReadMap == NULL)
|
if (m_TLB_ReadMap == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0x100000 * sizeof(size_t));
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_ReadMap (Size: 0x%X)", 0x100000 * sizeof(size_t));
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -223,7 +223,7 @@ bool CMipsMemoryVM::Initialize(bool SyncSystem)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TLB_WriteMap = new size_t[0x100000];
|
m_TLB_WriteMap = new size_t[0x100000];
|
||||||
if (m_TLB_WriteMap == NULL)
|
if (m_TLB_WriteMap == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
|
WriteTrace(TraceN64System, TraceError, "Failed to Allocate m_TLB_WriteMap (Size: 0x%X)", 0xFFFFF * sizeof(size_t));
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
|
@ -239,11 +239,11 @@ void CMipsMemoryVM::FreeMemory()
|
||||||
{
|
{
|
||||||
if (DecommitMemory(m_RDRAM, 0x20000000))
|
if (DecommitMemory(m_RDRAM, 0x20000000))
|
||||||
{
|
{
|
||||||
if (m_Reserve1 == NULL)
|
if (m_Reserve1 == nullptr)
|
||||||
{
|
{
|
||||||
m_Reserve1 = m_RDRAM;
|
m_Reserve1 = m_RDRAM;
|
||||||
}
|
}
|
||||||
else if (m_Reserve2 == NULL)
|
else if (m_Reserve2 == nullptr)
|
||||||
{
|
{
|
||||||
m_Reserve2 = m_RDRAM;
|
m_Reserve2 = m_RDRAM;
|
||||||
}
|
}
|
||||||
|
@ -256,19 +256,19 @@ void CMipsMemoryVM::FreeMemory()
|
||||||
{
|
{
|
||||||
FreeAddressSpace(m_RDRAM, 0x20000000);
|
FreeAddressSpace(m_RDRAM, 0x20000000);
|
||||||
}
|
}
|
||||||
m_RDRAM = NULL;
|
m_RDRAM = nullptr;
|
||||||
m_IMEM = NULL;
|
m_IMEM = nullptr;
|
||||||
m_DMEM = NULL;
|
m_DMEM = nullptr;
|
||||||
}
|
}
|
||||||
if (m_TLB_ReadMap)
|
if (m_TLB_ReadMap)
|
||||||
{
|
{
|
||||||
delete[] m_TLB_ReadMap;
|
delete[] m_TLB_ReadMap;
|
||||||
m_TLB_ReadMap = NULL;
|
m_TLB_ReadMap = nullptr;
|
||||||
}
|
}
|
||||||
if (m_TLB_WriteMap)
|
if (m_TLB_WriteMap)
|
||||||
{
|
{
|
||||||
delete[] m_TLB_WriteMap;
|
delete[] m_TLB_WriteMap;
|
||||||
m_TLB_WriteMap = NULL;
|
m_TLB_WriteMap = nullptr;
|
||||||
}
|
}
|
||||||
CPifRam::Reset();
|
CPifRam::Reset();
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ bool CMipsMemoryVM::LW_VAddr(uint32_t VAddr, uint32_t& Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* BaseAddress = (uint8_t*)m_TLB_ReadMap[VAddr >> 12];
|
uint8_t* BaseAddress = (uint8_t*)m_TLB_ReadMap[VAddr >> 12];
|
||||||
if (BaseAddress == NULL)
|
if (BaseAddress == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ void CMipsMemoryVM::RdramChanged(CMipsMemoryVM * _this)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void * result = CommitMemory(_this->m_RDRAM + old_size, new_size - old_size, MEM_READWRITE);
|
void * result = CommitMemory(_this->m_RDRAM + old_size, new_size - old_size, MEM_READWRITE);
|
||||||
if (result == NULL)
|
if (result == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceError, "failed to allocate extended memory");
|
WriteTrace(TraceN64System, TraceError, "failed to allocate extended memory");
|
||||||
g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR));
|
g_Notify->FatalError(GS(MSG_MEM_ALLOC_ERROR));
|
||||||
|
@ -1340,7 +1340,7 @@ void CMipsMemoryVM::Load32AudioInterface(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_Plugins->Audio()->AiReadLength != NULL)
|
if (g_Plugins->Audio()->AiReadLength != nullptr)
|
||||||
{
|
{
|
||||||
m_MemLookupValue.UW[0] = g_Plugins->Audio()->AiReadLength();
|
m_MemLookupValue.UW[0] = g_Plugins->Audio()->AiReadLength();
|
||||||
}
|
}
|
||||||
|
@ -1433,7 +1433,7 @@ void CMipsMemoryVM::Load32SerialInterface(void)
|
||||||
void CMipsMemoryVM::Load32CartridgeDomain1Address1(void)
|
void CMipsMemoryVM::Load32CartridgeDomain1Address1(void)
|
||||||
{
|
{
|
||||||
//64DD IPL ROM
|
//64DD IPL ROM
|
||||||
if (g_DDRom != NULL && (m_MemLookupAddress & 0xFFFFFF) < g_MMU->m_DDRomSize)
|
if (g_DDRom != nullptr && (m_MemLookupAddress & 0xFFFFFF) < g_MMU->m_DDRomSize)
|
||||||
{
|
{
|
||||||
m_MemLookupValue.UW[0] = *(uint32_t *)&g_MMU->m_DDRom[(m_MemLookupAddress & 0xFFFFFF)];
|
m_MemLookupValue.UW[0] = *(uint32_t *)&g_MMU->m_DDRom[(m_MemLookupAddress & 0xFFFFFF)];
|
||||||
}
|
}
|
||||||
|
@ -1949,7 +1949,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
|
||||||
if (g_Reg->VI_STATUS_REG != m_MemLookupValue.UW[0])
|
if (g_Reg->VI_STATUS_REG != m_MemLookupValue.UW[0])
|
||||||
{
|
{
|
||||||
g_Reg->VI_STATUS_REG = m_MemLookupValue.UW[0];
|
g_Reg->VI_STATUS_REG = m_MemLookupValue.UW[0];
|
||||||
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
|
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
g_Plugins->Gfx()->ViStatusChanged();
|
g_Plugins->Gfx()->ViStatusChanged();
|
||||||
}
|
}
|
||||||
|
@ -1963,7 +1963,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
g_Reg->VI_ORIGIN_REG = (m_MemLookupValue.UW[0] & 0xFFFFFF);
|
g_Reg->VI_ORIGIN_REG = (m_MemLookupValue.UW[0] & 0xFFFFFF);
|
||||||
//if (UpdateScreen != NULL )
|
//if (UpdateScreen != nullptr )
|
||||||
//{
|
//{
|
||||||
// UpdateScreen();
|
// UpdateScreen();
|
||||||
//}
|
//}
|
||||||
|
@ -1972,7 +1972,7 @@ void CMipsMemoryVM::Write32VideoInterface(void)
|
||||||
if (g_Reg->VI_WIDTH_REG != m_MemLookupValue.UW[0])
|
if (g_Reg->VI_WIDTH_REG != m_MemLookupValue.UW[0])
|
||||||
{
|
{
|
||||||
g_Reg->VI_WIDTH_REG = m_MemLookupValue.UW[0];
|
g_Reg->VI_WIDTH_REG = m_MemLookupValue.UW[0];
|
||||||
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
|
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
|
||||||
{
|
{
|
||||||
g_Plugins->Gfx()->ViWidthChanged();
|
g_Plugins->Gfx()->ViWidthChanged();
|
||||||
}
|
}
|
||||||
|
@ -2013,7 +2013,7 @@ void CMipsMemoryVM::Write32AudioInterface(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_Plugins->Audio()->AiLenChanged != NULL)
|
if (g_Plugins->Audio()->AiLenChanged != nullptr)
|
||||||
{
|
{
|
||||||
g_Plugins->Audio()->AiLenChanged();
|
g_Plugins->Audio()->AiLenChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ void CPifRam::PifRamRead()
|
||||||
}
|
}
|
||||||
if (g_Plugins->Control()->ReadController)
|
if (g_Plugins->Control()->ReadController)
|
||||||
{
|
{
|
||||||
g_Plugins->Control()->ReadController(-1, NULL);
|
g_Plugins->Control()->ReadController(-1, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ void CPifRam::PifRamWrite()
|
||||||
m_PifRam[0x3F] = 0;
|
m_PifRam[0x3F] = 0;
|
||||||
if (g_Plugins->Control()->ControllerCommand)
|
if (g_Plugins->Control()->ControllerCommand)
|
||||||
{
|
{
|
||||||
g_Plugins->Control()->ControllerCommand(-1, NULL);
|
g_Plugins->Control()->ControllerCommand(-1, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,17 +40,17 @@ const char * CRegName::FPR_Ctrl[32] = { "Revision", "Unknown", "Unknown", "Unkno
|
||||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||||
"Unknown", "Unknown", "FCSR" };
|
"Unknown", "Unknown", "FCSR" };
|
||||||
|
|
||||||
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = NULL;
|
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = nullptr;
|
||||||
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
|
MIPS_DWORD * CSystemRegisters::_GPR = nullptr;
|
||||||
MIPS_DWORD * CSystemRegisters::_FPR = NULL;
|
MIPS_DWORD * CSystemRegisters::_FPR = nullptr;
|
||||||
uint32_t * CSystemRegisters::_CP0 = NULL;
|
uint32_t * CSystemRegisters::_CP0 = nullptr;
|
||||||
MIPS_DWORD * CSystemRegisters::_RegHI = NULL;
|
MIPS_DWORD * CSystemRegisters::_RegHI = nullptr;
|
||||||
MIPS_DWORD * CSystemRegisters::_RegLO = NULL;
|
MIPS_DWORD * CSystemRegisters::_RegLO = nullptr;
|
||||||
float ** CSystemRegisters::_FPR_S;
|
float ** CSystemRegisters::_FPR_S;
|
||||||
double ** CSystemRegisters::_FPR_D;
|
double ** CSystemRegisters::_FPR_D;
|
||||||
uint32_t * CSystemRegisters::_FPCR = NULL;
|
uint32_t * CSystemRegisters::_FPCR = nullptr;
|
||||||
uint32_t * CSystemRegisters::_LLBit = NULL;
|
uint32_t * CSystemRegisters::_LLBit = nullptr;
|
||||||
int32_t * CSystemRegisters::_RoundingModel = NULL;
|
int32_t * CSystemRegisters::_RoundingModel = nullptr;
|
||||||
|
|
||||||
CP0registers::CP0registers(uint32_t * _CP0) :
|
CP0registers::CP0registers(uint32_t * _CP0) :
|
||||||
INDEX_REGISTER(_CP0[0]),
|
INDEX_REGISTER(_CP0[0]),
|
||||||
|
|
|
@ -21,7 +21,7 @@ void Rumblepak::WriteTo(int32_t Control, uint32_t address, uint8_t * data)
|
||||||
{
|
{
|
||||||
if ((address) == 0xC000)
|
if ((address) == 0xC000)
|
||||||
{
|
{
|
||||||
if (g_Plugins->Control()->RumbleCommand != NULL)
|
if (g_Plugins->Control()->RumbleCommand != nullptr)
|
||||||
{
|
{
|
||||||
g_Plugins->Control()->RumbleCommand(Control, *(int *)data);
|
g_Plugins->Control()->RumbleCommand(Control, *(int *)data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void CSram::DmaToSram(uint8_t * Source, int32_t StartOffset, uint32_t len)
|
||||||
// Fix Dezaemon 3D saves
|
// Fix Dezaemon 3D saves
|
||||||
StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF);
|
StartOffset = ((StartOffset >> 3) & 0xFFFF8000) | (StartOffset & 0x7FFF);
|
||||||
|
|
||||||
if (((StartOffset & 3) == 0) && ((((uint32_t)Source) & 3) == 0) && NULL != NULL)
|
if (((StartOffset & 3) == 0) && ((((uint32_t)Source) & 3) == 0) && nullptr != nullptr)
|
||||||
{
|
{
|
||||||
m_File.Seek(StartOffset, CFile::begin);
|
m_File.Seek(StartOffset, CFile::begin);
|
||||||
m_File.Write(Source, len);
|
m_File.Write(Source, len);
|
||||||
|
|
|
@ -18,7 +18,7 @@ uint16_t gb_cart_address(unsigned int bank, uint16_t address)
|
||||||
void Transferpak::Init()
|
void Transferpak::Init()
|
||||||
{
|
{
|
||||||
//Quick check to ensure we dont have a ROM already
|
//Quick check to ensure we dont have a ROM already
|
||||||
if (tpak.gb_cart.rom == NULL)
|
if (tpak.gb_cart.rom == nullptr)
|
||||||
{
|
{
|
||||||
memset(&tpak, 0, sizeof(tpak));
|
memset(&tpak, 0, sizeof(tpak));
|
||||||
tpak.access_mode = (!GBCart::init_gb_cart(&tpak.gb_cart, g_Settings->LoadStringVal(Game_Transferpak_ROM).c_str())) ? CART_NOT_INSERTED : CART_ACCESS_MODE_0;
|
tpak.access_mode = (!GBCart::init_gb_cart(&tpak.gb_cart, g_Settings->LoadStringVal(Game_Transferpak_ROM).c_str())) ? CART_NOT_INSERTED : CART_ACCESS_MODE_0;
|
||||||
|
@ -28,7 +28,7 @@ void Transferpak::Init()
|
||||||
|
|
||||||
void Transferpak::Release()
|
void Transferpak::Release()
|
||||||
{
|
{
|
||||||
if (tpak.gb_cart.rom != NULL)
|
if (tpak.gb_cart.rom != nullptr)
|
||||||
{
|
{
|
||||||
GBCart::release_gb_cart(&tpak.gb_cart);
|
GBCart::release_gb_cart(&tpak.gb_cart);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void Transferpak::ReadFrom(uint16_t address, uint8_t * data)
|
||||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||||
{
|
{
|
||||||
//Ensure we actually have a ROM loaded in first.
|
//Ensure we actually have a ROM loaded in first.
|
||||||
if (tpak.gb_cart.rom == NULL)
|
if (tpak.gb_cart.rom == nullptr)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void Transferpak::WriteTo(uint16_t address, uint8_t * data)
|
||||||
if ((address >= 0x8000) && (address <= 0x8FFF))
|
if ((address >= 0x8000) && (address <= 0x8FFF))
|
||||||
{
|
{
|
||||||
//Ensure we actually have a ROM loaded in first.
|
//Ensure we actually have a ROM loaded in first.
|
||||||
if (tpak.gb_cart.rom == NULL)
|
if (tpak.gb_cart.rom == nullptr)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
||||||
m_EndEmulation(false),
|
m_EndEmulation(false),
|
||||||
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
|
m_SaveUsing((SAVE_CHIP_TYPE)g_Settings->LoadDword(Game_SaveChip)),
|
||||||
m_Plugins(Plugins),
|
m_Plugins(Plugins),
|
||||||
m_SyncCPU(NULL),
|
m_SyncCPU(nullptr),
|
||||||
m_SyncPlugins(NULL),
|
m_SyncPlugins(nullptr),
|
||||||
m_MMU_VM(SavesReadOnly),
|
m_MMU_VM(SavesReadOnly),
|
||||||
//m_Cheats(m_MMU_VM),
|
//m_Cheats(m_MMU_VM),
|
||||||
m_TLB(this),
|
m_TLB(this),
|
||||||
m_Reg(this, this),
|
m_Reg(this, this),
|
||||||
m_Recomp(NULL),
|
m_Recomp(nullptr),
|
||||||
m_InReset(false),
|
m_InReset(false),
|
||||||
m_NextTimer(0),
|
m_NextTimer(0),
|
||||||
m_SystemTimer(m_Reg, m_NextTimer),
|
m_SystemTimer(m_Reg, m_NextTimer),
|
||||||
|
@ -47,7 +47,7 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
||||||
m_TLBLoadAddress(0),
|
m_TLBLoadAddress(0),
|
||||||
m_TLBStoreAddress(0),
|
m_TLBStoreAddress(0),
|
||||||
m_SyncCount(0),
|
m_SyncCount(0),
|
||||||
m_thread(NULL),
|
m_thread(nullptr),
|
||||||
m_hPauseEvent(true),
|
m_hPauseEvent(true),
|
||||||
m_SyncSystem(SyncSystem),
|
m_SyncSystem(SyncSystem),
|
||||||
m_Random(randomizer_seed)
|
m_Random(randomizer_seed)
|
||||||
|
@ -94,14 +94,14 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
|
||||||
}
|
}
|
||||||
if (CpuType == CPU_SyncCores)
|
if (CpuType == CPU_SyncCores)
|
||||||
{
|
{
|
||||||
if (g_Plugins->SyncWindow() == NULL)
|
if (g_Plugins->SyncWindow() == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
g_Notify->DisplayMessage(5, "Copy Plugins");
|
g_Notify->DisplayMessage(5, "Copy Plugins");
|
||||||
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
|
||||||
m_SyncPlugins = new CPlugins(Directory_PluginSync, true);
|
m_SyncPlugins = new CPlugins(Directory_PluginSync, true);
|
||||||
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), NULL);
|
m_SyncPlugins->SetRenderWindows(g_Plugins->SyncWindow(), nullptr);
|
||||||
m_SyncCPU = new CN64System(m_SyncPlugins, randomizer_seed, true, true);
|
m_SyncCPU = new CN64System(m_SyncPlugins, randomizer_seed, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,23 +132,23 @@ CN64System::~CN64System()
|
||||||
{
|
{
|
||||||
m_SyncCPU->CpuStopped();
|
m_SyncCPU->CpuStopped();
|
||||||
delete m_SyncCPU;
|
delete m_SyncCPU;
|
||||||
m_SyncCPU = NULL;
|
m_SyncCPU = nullptr;
|
||||||
}
|
}
|
||||||
if (m_Recomp)
|
if (m_Recomp)
|
||||||
{
|
{
|
||||||
delete m_Recomp;
|
delete m_Recomp;
|
||||||
m_Recomp = NULL;
|
m_Recomp = nullptr;
|
||||||
}
|
}
|
||||||
if (m_SyncPlugins)
|
if (m_SyncPlugins)
|
||||||
{
|
{
|
||||||
delete m_SyncPlugins;
|
delete m_SyncPlugins;
|
||||||
m_SyncPlugins = NULL;
|
m_SyncPlugins = nullptr;
|
||||||
}
|
}
|
||||||
if (m_thread != NULL)
|
if (m_thread != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Deleting thread object");
|
WriteTrace(TraceN64System, TraceDebug, "Deleting thread object");
|
||||||
delete m_thread;
|
delete m_thread;
|
||||||
m_thread = NULL;
|
m_thread = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
||||||
|
|
||||||
if (action == SysEvent_LoadMachineState &&
|
if (action == SysEvent_LoadMachineState &&
|
||||||
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
||||||
g_BaseSystem != NULL &&
|
g_BaseSystem != nullptr &&
|
||||||
g_BaseSystem->LoadState())
|
g_BaseSystem->LoadState())
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy loaded save");
|
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy loaded save");
|
||||||
|
@ -167,7 +167,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
||||||
|
|
||||||
if (action == SysEvent_SaveMachineState &&
|
if (action == SysEvent_SaveMachineState &&
|
||||||
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
||||||
g_BaseSystem != NULL &&
|
g_BaseSystem != nullptr &&
|
||||||
g_BaseSystem->SaveState())
|
g_BaseSystem->SaveState())
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy saved event");
|
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy saved event");
|
||||||
|
@ -315,7 +315,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||||
|
|
||||||
//Try to load the passed N64 rom
|
//Try to load the passed N64 rom
|
||||||
if (g_Rom == NULL)
|
if (g_Rom == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global rom object");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating global rom object");
|
||||||
g_Rom = new CN64Rom();
|
g_Rom = new CN64Rom();
|
||||||
|
@ -331,7 +331,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
||||||
if (g_Rom->IsLoadedRomDDIPL())
|
if (g_Rom->IsLoadedRomDDIPL())
|
||||||
{
|
{
|
||||||
//64DD IPL
|
//64DD IPL
|
||||||
if (g_DDRom == NULL)
|
if (g_DDRom == nullptr)
|
||||||
{
|
{
|
||||||
g_DDRom = new CN64Rom();
|
g_DDRom = new CN64Rom();
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
||||||
|
|
||||||
g_System->RefreshGameSettings();
|
g_System->RefreshGameSettings();
|
||||||
|
|
||||||
if (g_Disk == NULL || !g_Rom->IsLoadedRomDDIPL())
|
if (g_Disk == nullptr || !g_Rom->IsLoadedRomDDIPL())
|
||||||
{
|
{
|
||||||
g_Settings->SaveString(Game_File, FileLoc);
|
g_Settings->SaveString(Game_File, FileLoc);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ bool CN64System::LoadFileImage(const char * FileLoc)
|
||||||
WriteTrace(TraceN64System, TraceError, "LoadN64Image failed (\"%s\")", FileLoc);
|
WriteTrace(TraceN64System, TraceError, "LoadN64Image failed (\"%s\")", FileLoc);
|
||||||
g_Notify->DisplayError(g_Rom->GetError());
|
g_Notify->DisplayError(g_Rom->GetError());
|
||||||
delete g_Rom;
|
delete g_Rom;
|
||||||
g_Rom = NULL;
|
g_Rom = nullptr;
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Done (res: false)");
|
WriteTrace(TraceN64System, TraceDebug, "Done (res: false)");
|
||||||
return false;
|
return false;
|
||||||
|
@ -381,7 +381,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||||
|
|
||||||
//Try to load the passed N64 DDrom
|
//Try to load the passed N64 DDrom
|
||||||
if (g_DDRom == NULL)
|
if (g_DDRom == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global DDrom object");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating global DDrom object");
|
||||||
g_DDRom = new CN64Rom();
|
g_DDRom = new CN64Rom();
|
||||||
|
@ -400,7 +400,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
||||||
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
|
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
|
||||||
g_Notify->DisplayError(g_DDRom->GetError());
|
g_Notify->DisplayError(g_DDRom->GetError());
|
||||||
delete g_DDRom;
|
delete g_DDRom;
|
||||||
g_DDRom = NULL;
|
g_DDRom = nullptr;
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
|
||||||
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
|
WriteTrace(TraceN64System, TraceError, "LoadN64ImageIPL failed (\"%s\")", FileLoc);
|
||||||
g_Notify->DisplayError(g_DDRom->GetError());
|
g_Notify->DisplayError(g_DDRom->GetError());
|
||||||
delete g_DDRom;
|
delete g_DDRom;
|
||||||
g_DDRom = NULL;
|
g_DDRom = nullptr;
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||||
|
|
||||||
//Try to load the passed N64 Disk
|
//Try to load the passed N64 Disk
|
||||||
if (g_Disk == NULL)
|
if (g_Disk == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating global Disk object");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating global Disk object");
|
||||||
g_Disk = new CN64Disk();
|
g_Disk = new CN64Disk();
|
||||||
|
@ -469,7 +469,7 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
|
||||||
WriteTrace(TraceN64System, TraceError, "LoadDiskImage failed (\"%s\")", FileLoc);
|
WriteTrace(TraceN64System, TraceError, "LoadDiskImage failed (\"%s\")", FileLoc);
|
||||||
g_Notify->DisplayError(g_Disk->GetError());
|
g_Notify->DisplayError(g_Disk->GetError());
|
||||||
delete g_Disk;
|
delete g_Disk;
|
||||||
g_Disk = NULL;
|
g_Disk = nullptr;
|
||||||
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -479,17 +479,17 @@ bool CN64System::LoadDiskImage(const char * FileLoc, const bool Expansion)
|
||||||
bool CN64System::RunFileImage(const char * FileLoc)
|
bool CN64System::RunFileImage(const char * FileLoc)
|
||||||
{
|
{
|
||||||
//Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously.
|
//Uninitialize g_Disk and g_DDRom to prevent exception when ending emulation of a regular ROM after playing 64DD content previously.
|
||||||
if (g_Disk != NULL)
|
if (g_Disk != nullptr)
|
||||||
{
|
{
|
||||||
g_Disk->UnallocateDiskImage();
|
g_Disk->UnallocateDiskImage();
|
||||||
delete g_Disk;
|
delete g_Disk;
|
||||||
g_Disk = NULL;
|
g_Disk = nullptr;
|
||||||
}
|
}
|
||||||
if (g_DDRom != NULL)
|
if (g_DDRom != nullptr)
|
||||||
{
|
{
|
||||||
g_DDRom->UnallocateRomImage();
|
g_DDRom->UnallocateRomImage();
|
||||||
delete g_DDRom;
|
delete g_DDRom;
|
||||||
g_DDRom = NULL;
|
g_DDRom = nullptr;
|
||||||
}
|
}
|
||||||
if (!LoadFileImage(FileLoc))
|
if (!LoadFileImage(FileLoc))
|
||||||
{
|
{
|
||||||
|
@ -553,7 +553,7 @@ bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDis
|
||||||
void CN64System::RunLoadedImage(void)
|
void CN64System::RunLoadedImage(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Start");
|
WriteTrace(TraceN64System, TraceDebug, "Start");
|
||||||
g_BaseSystem = new CN64System(g_Plugins, (uint32_t)time(NULL), false, false);
|
g_BaseSystem = new CN64System(g_Plugins, (uint32_t)time(nullptr), false, false);
|
||||||
if (g_BaseSystem)
|
if (g_BaseSystem)
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
|
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
|
||||||
|
@ -577,7 +577,7 @@ void CN64System::CloseSystem()
|
||||||
{
|
{
|
||||||
g_BaseSystem->CloseCpu();
|
g_BaseSystem->CloseCpu();
|
||||||
delete g_BaseSystem;
|
delete g_BaseSystem;
|
||||||
g_BaseSystem = NULL;
|
g_BaseSystem = nullptr;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ void CN64System::CloseSystem()
|
||||||
bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
|
bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
|
||||||
{
|
{
|
||||||
delete g_DDRom;
|
delete g_DDRom;
|
||||||
g_DDRom = NULL;
|
g_DDRom = nullptr;
|
||||||
|
|
||||||
SettingID IPLROMPathSetting;
|
SettingID IPLROMPathSetting;
|
||||||
LanguageStringID IPLROMError;
|
LanguageStringID IPLROMError;
|
||||||
|
@ -668,7 +668,7 @@ bool CN64System::EmulationStarting(CThread * thread)
|
||||||
g_BaseSystem->StartEmulation2(false);
|
g_BaseSystem->StartEmulation2(false);
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Game Done");
|
WriteTrace(TraceN64System, TraceDebug, "Game Done");
|
||||||
//PLACE TO ADD 64DD SAVING CODE
|
//PLACE TO ADD 64DD SAVING CODE
|
||||||
if (g_Disk != NULL)
|
if (g_Disk != nullptr)
|
||||||
{
|
{
|
||||||
g_Disk->SaveDiskImage();
|
g_Disk->SaveDiskImage();
|
||||||
//g_Notify->DisplayError(g_Disk->GetError());
|
//g_Notify->DisplayError(g_Disk->GetError());
|
||||||
|
@ -886,7 +886,7 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
|
||||||
m_Plugins->RomClosed();
|
m_Plugins->RomClosed();
|
||||||
m_Plugins->RomOpened();
|
m_Plugins->RomOpened();
|
||||||
}
|
}
|
||||||
if (m_SyncCPU && m_SyncCPU->m_MMU_VM.Rdram() != NULL)
|
if (m_SyncCPU && m_SyncCPU->m_MMU_VM.Rdram() != nullptr)
|
||||||
{
|
{
|
||||||
m_SyncCPU->Reset(bInitReg, ClearMenory);
|
m_SyncCPU->Reset(bInitReg, ClearMenory);
|
||||||
}
|
}
|
||||||
|
@ -934,7 +934,7 @@ bool CN64System::SetActiveSystem(bool bActive)
|
||||||
g_Plugins = m_Plugins;
|
g_Plugins = m_Plugins;
|
||||||
g_TLBLoadAddress = &m_TLBLoadAddress;
|
g_TLBLoadAddress = &m_TLBLoadAddress;
|
||||||
g_TLBStoreAddress = &m_TLBStoreAddress;
|
g_TLBStoreAddress = &m_TLBStoreAddress;
|
||||||
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : NULL;
|
g_RecompPos = m_Recomp ? m_Recomp->RecompPos() : nullptr;
|
||||||
R4300iOp::m_TestTimer = m_TestTimer;
|
R4300iOp::m_TestTimer = m_TestTimer;
|
||||||
R4300iOp::m_NextInstruction = m_NextInstruction;
|
R4300iOp::m_NextInstruction = m_NextInstruction;
|
||||||
R4300iOp::m_JumpToLocation = m_JumpToLocation;
|
R4300iOp::m_JumpToLocation = m_JumpToLocation;
|
||||||
|
@ -944,21 +944,21 @@ bool CN64System::SetActiveSystem(bool bActive)
|
||||||
{
|
{
|
||||||
if (this == g_BaseSystem)
|
if (this == g_BaseSystem)
|
||||||
{
|
{
|
||||||
g_System = NULL;
|
g_System = nullptr;
|
||||||
g_SyncSystem = NULL;
|
g_SyncSystem = nullptr;
|
||||||
g_Recompiler = NULL;
|
g_Recompiler = nullptr;
|
||||||
g_MMU = NULL;
|
g_MMU = nullptr;
|
||||||
g_TLB = NULL;
|
g_TLB = nullptr;
|
||||||
g_Reg = NULL;
|
g_Reg = nullptr;
|
||||||
g_Audio = NULL;
|
g_Audio = nullptr;
|
||||||
g_SystemTimer = NULL;
|
g_SystemTimer = nullptr;
|
||||||
g_TransVaddr = NULL;
|
g_TransVaddr = nullptr;
|
||||||
g_SystemEvents = NULL;
|
g_SystemEvents = nullptr;
|
||||||
g_NextTimer = NULL;
|
g_NextTimer = nullptr;
|
||||||
g_Plugins = m_Plugins;
|
g_Plugins = m_Plugins;
|
||||||
g_TLBLoadAddress = NULL;
|
g_TLBLoadAddress = nullptr;
|
||||||
g_TLBStoreAddress = NULL;
|
g_TLBStoreAddress = nullptr;
|
||||||
g_Random = NULL;
|
g_Random = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1737,7 +1737,7 @@ bool CN64System::SaveState()
|
||||||
{
|
{
|
||||||
ZipFile.Delete();
|
ZipFile.Delete();
|
||||||
zipFile file = zipOpen(ZipFile, 0);
|
zipFile file = zipOpen(ZipFile, 0);
|
||||||
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||||
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
|
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
|
||||||
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
||||||
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||||
|
@ -1774,7 +1774,7 @@ bool CN64System::SaveState()
|
||||||
zipWriteInFileInZip(file, m_MMU_VM.Imem(), 0x1000);
|
zipWriteInFileInZip(file, m_MMU_VM.Imem(), 0x1000);
|
||||||
zipCloseFileInZip(file);
|
zipCloseFileInZip(file);
|
||||||
|
|
||||||
zipOpenNewFileInZip(file, ExtraInfo.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
zipOpenNewFileInZip(file, ExtraInfo.GetNameExtension().c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||||
|
|
||||||
//Extra Info v2
|
//Extra Info v2
|
||||||
zipWriteInFileInZip(file, &SaveID_2, sizeof(SaveID_2));
|
zipWriteInFileInZip(file, &SaveID_2, sizeof(SaveID_2));
|
||||||
|
@ -1789,7 +1789,7 @@ bool CN64System::SaveState()
|
||||||
|
|
||||||
zipClose(file, "");
|
zipClose(file, "");
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
utimes((const char *)ZipFile, NULL);
|
utimes((const char *)ZipFile, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1860,7 +1860,7 @@ bool CN64System::SaveState()
|
||||||
}
|
}
|
||||||
m_Reg.MI_INTR_REG = MiInterReg;
|
m_Reg.MI_INTR_REG = MiInterReg;
|
||||||
g_Settings->SaveString(GameRunning_InstantSaveFile, "");
|
g_Settings->SaveString(GameRunning_InstantSaveFile, "");
|
||||||
g_Settings->SaveDword(Game_LastSaveTime, (uint32_t)time(NULL));
|
g_Settings->SaveDword(Game_LastSaveTime, (uint32_t)time(nullptr));
|
||||||
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
|
if (g_Settings->LoadDword(Setting_AutoZipInstantSave))
|
||||||
{
|
{
|
||||||
SaveFile = ZipFile;
|
SaveFile = ZipFile;
|
||||||
|
@ -1961,7 +1961,7 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
}
|
}
|
||||||
unzFile file = unzOpen(SaveFile);
|
unzFile file = unzOpen(SaveFile);
|
||||||
int port = -1;
|
int port = -1;
|
||||||
if (file != NULL)
|
if (file != nullptr)
|
||||||
{
|
{
|
||||||
port = unzGoToFirstFile(file);
|
port = unzGoToFirstFile(file);
|
||||||
}
|
}
|
||||||
|
@ -1970,7 +1970,7 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
unz_file_info info;
|
unz_file_info info;
|
||||||
char zname[132];
|
char zname[132];
|
||||||
|
|
||||||
unzGetCurrentFileInfo(file, &info, zname, 128, NULL, 0, NULL, 0);
|
unzGetCurrentFileInfo(file, &info, zname, 128, nullptr, 0, nullptr, 0);
|
||||||
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
||||||
{
|
{
|
||||||
unzClose(file);
|
unzClose(file);
|
||||||
|
@ -2383,7 +2383,7 @@ void CN64System::RefreshScreen()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen Starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen Starting");
|
||||||
g_Plugins->Gfx()->UpdateScreen();
|
g_Plugins->Gfx()->UpdateScreen();
|
||||||
if (g_Debugger != NULL && HaveDebugger())
|
if (g_Debugger != nullptr && HaveDebugger())
|
||||||
{
|
{
|
||||||
g_Debugger->FrameDrawn();
|
g_Debugger->FrameDrawn();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
CN64Disk::CN64Disk() :
|
CN64Disk::CN64Disk() :
|
||||||
m_DiskImage(NULL),
|
m_DiskImage(nullptr),
|
||||||
m_DiskImageBase(NULL),
|
m_DiskImageBase(nullptr),
|
||||||
m_DiskHeader(NULL),
|
m_DiskHeader(nullptr),
|
||||||
m_DiskHeaderBase(NULL),
|
m_DiskHeaderBase(nullptr),
|
||||||
m_ErrorMsg(EMPTY_STRING),
|
m_ErrorMsg(EMPTY_STRING),
|
||||||
m_DiskBufAddress(0),
|
m_DiskBufAddress(0),
|
||||||
m_DiskSysAddress(0),
|
m_DiskSysAddress(0),
|
||||||
|
@ -236,7 +236,7 @@ bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk");
|
||||||
std::unique_ptr<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]);
|
std::unique_ptr<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]);
|
||||||
if (ImageBase.get() == NULL)
|
if (ImageBase.get() == nullptr)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk (size: 0x%X)", DiskFileSize);
|
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk (size: 0x%X)", DiskFileSize);
|
||||||
|
@ -256,7 +256,7 @@ bool CN64Disk::AllocateDiskHeader()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge");
|
||||||
std::unique_ptr<uint8_t> HeaderBase(new uint8_t[0x40 + 0x1000]);
|
std::unique_ptr<uint8_t> HeaderBase(new uint8_t[0x40 + 0x1000]);
|
||||||
if (HeaderBase.get() == NULL)
|
if (HeaderBase.get() == nullptr)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk header forge (size: 0x40)");
|
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for disk header forge (size: 0x40)");
|
||||||
|
@ -556,17 +556,17 @@ void CN64Disk::UnallocateDiskImage()
|
||||||
{
|
{
|
||||||
ProtectMemory(m_DiskHeader, 0x40, MEM_READWRITE);
|
ProtectMemory(m_DiskHeader, 0x40, MEM_READWRITE);
|
||||||
delete[] m_DiskHeaderBase;
|
delete[] m_DiskHeaderBase;
|
||||||
m_DiskHeaderBase = NULL;
|
m_DiskHeaderBase = nullptr;
|
||||||
}
|
}
|
||||||
m_DiskHeader = NULL;
|
m_DiskHeader = nullptr;
|
||||||
|
|
||||||
if (m_DiskImageBase)
|
if (m_DiskImageBase)
|
||||||
{
|
{
|
||||||
ProtectMemory(m_DiskImage, m_DiskFileSize, MEM_READWRITE);
|
ProtectMemory(m_DiskImage, m_DiskFileSize, MEM_READWRITE);
|
||||||
delete[] m_DiskImageBase;
|
delete[] m_DiskImageBase;
|
||||||
m_DiskImageBase = NULL;
|
m_DiskImageBase = nullptr;
|
||||||
}
|
}
|
||||||
m_DiskImage = NULL;
|
m_DiskImage = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CN64Disk::CalculateCrc()
|
uint32_t CN64Disk::CalculateCrc()
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CN64Rom::CN64Rom() :
|
CN64Rom::CN64Rom() :
|
||||||
m_ROMImage(NULL),
|
m_ROMImage(nullptr),
|
||||||
m_ROMImageBase(NULL),
|
m_ROMImageBase(nullptr),
|
||||||
m_RomFileSize(0),
|
m_RomFileSize(0),
|
||||||
m_ErrorMsg(EMPTY_STRING),
|
m_ErrorMsg(EMPTY_STRING),
|
||||||
m_Country(Country_Unknown),
|
m_Country(Country_Unknown),
|
||||||
|
@ -31,7 +31,7 @@ bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
||||||
std::unique_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
std::unique_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
||||||
if (ImageBase.get() == NULL)
|
if (ImageBase.get() == nullptr)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for rom (size: 0x%X)", RomFileSize);
|
WriteTrace(TraceN64System, TraceError, "Failed to allocate memory for rom (size: 0x%X)", RomFileSize);
|
||||||
|
@ -129,7 +129,7 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
|
||||||
bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly)
|
bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
{
|
{
|
||||||
unzFile file = unzOpen(FileLoc);
|
unzFile file = unzOpen(FileLoc);
|
||||||
if (file == NULL)
|
if (file == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
|
||||||
unz_file_info info;
|
unz_file_info info;
|
||||||
char zname[260];
|
char zname[260];
|
||||||
|
|
||||||
unzGetCurrentFileInfo(file, &info, zname, sizeof(zname), NULL, 0, NULL, 0);
|
unzGetCurrentFileInfo(file, &info, zname, sizeof(zname), nullptr, 0, nullptr, 0);
|
||||||
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
||||||
{
|
{
|
||||||
SetError(MSG_FAIL_ZIP);
|
SetError(MSG_FAIL_ZIP);
|
||||||
|
@ -268,7 +268,7 @@ CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
|
||||||
{
|
{
|
||||||
crc += *(uint32_t *)(RomData + count);
|
crc += *(uint32_t *)(RomData + count);
|
||||||
}
|
}
|
||||||
if (CRC != NULL) { *CRC = crc; }
|
if (CRC != nullptr) { *CRC = crc; }
|
||||||
|
|
||||||
switch (crc)
|
switch (crc)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ void CN64Rom::CalculateCicChip()
|
||||||
{
|
{
|
||||||
uint64_t CRC = 0;
|
uint64_t CRC = 0;
|
||||||
|
|
||||||
if (m_ROMImage == NULL)
|
if (m_ROMImage == nullptr)
|
||||||
{
|
{
|
||||||
m_CicChip = CIC_UNKNOWN;
|
m_CicChip = CIC_UNKNOWN;
|
||||||
return;
|
return;
|
||||||
|
@ -503,13 +503,13 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
bool Loaded7zFile = false;
|
bool Loaded7zFile = false;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (strstr(FileLoc, "?") != NULL || _stricmp(ext.c_str(), "7z") == 0)
|
if (strstr(FileLoc, "?") != nullptr || _stricmp(ext.c_str(), "7z") == 0)
|
||||||
{
|
{
|
||||||
stdstr FullPath = FileLoc;
|
stdstr FullPath = FileLoc;
|
||||||
|
|
||||||
//this should be a 7zip file
|
//this should be a 7zip file
|
||||||
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
||||||
if (SubFile != NULL)
|
if (SubFile != nullptr)
|
||||||
{
|
{
|
||||||
*SubFile = '\0';
|
*SubFile = '\0';
|
||||||
SubFile += 1;
|
SubFile += 1;
|
||||||
|
@ -532,7 +532,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
|
|
||||||
stdstr ZipFileName;
|
stdstr ZipFileName;
|
||||||
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
|
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
|
||||||
if (SubFile != NULL)
|
if (SubFile != nullptr)
|
||||||
{
|
{
|
||||||
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
|
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
|
||||||
{
|
{
|
||||||
|
@ -699,13 +699,13 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
stdstr ext = CPath(FileLoc).GetExtension();
|
stdstr ext = CPath(FileLoc).GetExtension();
|
||||||
bool Loaded7zFile = false;
|
bool Loaded7zFile = false;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (strstr(FileLoc, "?") != NULL || _stricmp(ext.c_str(), "7z") == 0)
|
if (strstr(FileLoc, "?") != nullptr || _stricmp(ext.c_str(), "7z") == 0)
|
||||||
{
|
{
|
||||||
stdstr FullPath = FileLoc;
|
stdstr FullPath = FileLoc;
|
||||||
|
|
||||||
//this should be a 7zip file
|
//this should be a 7zip file
|
||||||
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
char * SubFile = strstr(const_cast<char*>(FullPath.c_str()), "?");
|
||||||
if (SubFile != NULL)
|
if (SubFile != nullptr)
|
||||||
{
|
{
|
||||||
*SubFile = '\0';
|
*SubFile = '\0';
|
||||||
SubFile += 1;
|
SubFile += 1;
|
||||||
|
@ -728,7 +728,7 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
|
||||||
|
|
||||||
stdstr ZipFileName;
|
stdstr ZipFileName;
|
||||||
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
|
ZipFileName.FromUTF16(ZipFile.FileNameIndex(i).c_str());
|
||||||
if (SubFile != NULL)
|
if (SubFile != nullptr)
|
||||||
{
|
{
|
||||||
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
|
if (_stricmp(ZipFileName.c_str(), SubFile) != 0)
|
||||||
{
|
{
|
||||||
|
@ -908,7 +908,7 @@ void CN64Rom::UnallocateRomImage()
|
||||||
{
|
{
|
||||||
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READWRITE);
|
ProtectMemory(m_ROMImage, m_RomFileSize, MEM_READWRITE);
|
||||||
delete[] m_ROMImageBase;
|
delete[] m_ROMImageBase;
|
||||||
m_ROMImageBase = NULL;
|
m_ROMImageBase = nullptr;
|
||||||
}
|
}
|
||||||
m_ROMImage = NULL;
|
m_ROMImage = nullptr;
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
//Get a message id for the reason that you failed to load the rom
|
//Get a message id for the reason that you failed to load the rom
|
||||||
LanguageStringID GetError() const { return m_ErrorMsg; }
|
LanguageStringID GetError() const { return m_ErrorMsg; }
|
||||||
static CICChip GetCicChipID(uint8_t * RomData, uint64_t * CRC = NULL);
|
static CICChip GetCicChipID(uint8_t * RomData, uint64_t * CRC = nullptr);
|
||||||
static void CleanRomName(char * RomName, bool byteswap = true);
|
static void CleanRomName(char * RomName, bool byteswap = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -318,7 +318,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
|
||||||
PreOpCheck(Arm_Unknown, true, __FILE__, __LINE__);
|
PreOpCheck(Arm_Unknown, true, __FILE__, __LINE__);
|
||||||
if ((value & 0xFF00) == 0 && Reg <= 7)
|
if ((value & 0xFF00) == 0 && Reg <= 7)
|
||||||
{
|
{
|
||||||
CPU_Message(" mov%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "s", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
CPU_Message(" mov%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "s", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
||||||
ArmThumbOpcode op = { 0 };
|
ArmThumbOpcode op = { 0 };
|
||||||
op.Imm8.imm8 = value;
|
op.Imm8.imm8 = value;
|
||||||
op.Imm8.rdn = Reg;
|
op.Imm8.rdn = Reg;
|
||||||
|
@ -327,7 +327,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
|
||||||
}
|
}
|
||||||
else if (CanThumbCompressConst(value))
|
else if (CanThumbCompressConst(value))
|
||||||
{
|
{
|
||||||
CPU_Message(" mov%s.w\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
CPU_Message(" mov%s.w\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
||||||
uint16_t CompressedValue = ThumbCompressConst(value);
|
uint16_t CompressedValue = ThumbCompressConst(value);
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm8_3_1.rn = 0xF;
|
op.imm8_3_1.rn = 0xF;
|
||||||
|
@ -344,7 +344,7 @@ void CArmOps::MoveConstToArmReg(ArmReg Reg, uint16_t value, const char * comment
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPU_Message(" movw%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
CPU_Message(" movw%s\t%s, #0x%X\t; %s", m_InItBlock ? ArmCurrentItCondition() : "", ArmRegName(Reg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
||||||
|
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm16.opcode = ArmMOV_IMM16;
|
op.imm16.opcode = ArmMOV_IMM16;
|
||||||
|
@ -368,7 +368,7 @@ void CArmOps::MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char *
|
||||||
{
|
{
|
||||||
PreOpCheck(DestReg, false, __FILE__, __LINE__);
|
PreOpCheck(DestReg, false, __FILE__, __LINE__);
|
||||||
|
|
||||||
CPU_Message(" movt\t%s, %s", ArmRegName(DestReg), comment != NULL ? stdstr_f("#0x%X\t; %s", (uint32_t)Const, comment).c_str() : stdstr_f("#%d\t; 0x%X", (uint32_t)Const, (uint32_t)Const).c_str());
|
CPU_Message(" movt\t%s, %s", ArmRegName(DestReg), comment != nullptr ? stdstr_f("#0x%X\t; %s", (uint32_t)Const, comment).c_str() : stdstr_f("#%d\t; 0x%X", (uint32_t)Const, (uint32_t)Const).c_str());
|
||||||
|
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm16.opcode = ArmMOV_IMM16;
|
op.imm16.opcode = ArmMOV_IMM16;
|
||||||
|
@ -559,7 +559,7 @@ void CArmOps::LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CPU_Message(" ldr.w\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
|
CPU_Message(" ldr.w\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm12.rt = DestReg;
|
op.imm12.rt = DestReg;
|
||||||
op.imm12.rn = RegPointer;
|
op.imm12.rn = RegPointer;
|
||||||
|
@ -569,7 +569,7 @@ void CArmOps::LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPU_Message(" ldr\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
|
CPU_Message(" ldr\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
|
||||||
ArmThumbOpcode op = { 0 };
|
ArmThumbOpcode op = { 0 };
|
||||||
op.Imm5.rt = DestReg;
|
op.Imm5.rt = DestReg;
|
||||||
op.Imm5.rn = RegPointer;
|
op.Imm5.rn = RegPointer;
|
||||||
|
@ -663,7 +663,7 @@ void CArmOps::MoveConstToArmReg(ArmReg DestReg, uint32_t value, const char * com
|
||||||
{
|
{
|
||||||
PreOpCheck(DestReg, false, __FILE__, __LINE__);
|
PreOpCheck(DestReg, false, __FILE__, __LINE__);
|
||||||
|
|
||||||
CPU_Message(" mov.w\t%s, #0x%X\t; %s", ArmRegName(DestReg), (uint32_t)value, comment != NULL ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
CPU_Message(" mov.w\t%s, #0x%X\t; %s", ArmRegName(DestReg), (uint32_t)value, comment != nullptr ? comment : stdstr_f("0x%X", (uint32_t)value).c_str());
|
||||||
uint16_t CompressedValue = ThumbCompressConst(value);
|
uint16_t CompressedValue = ThumbCompressConst(value);
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm8_3_1.rn = 0xF;
|
op.imm8_3_1.rn = 0xF;
|
||||||
|
@ -684,7 +684,7 @@ void CArmOps::MoveConstToArmReg(ArmReg DestReg, uint32_t value, const char * com
|
||||||
uint16_t TopValue = (uint16_t)((value >> 16) & 0xFFFF);
|
uint16_t TopValue = (uint16_t)((value >> 16) & 0xFFFF);
|
||||||
if (TopValue != 0)
|
if (TopValue != 0)
|
||||||
{
|
{
|
||||||
MoveConstToArmRegTop(DestReg, TopValue, comment != NULL ? "" : NULL);
|
MoveConstToArmRegTop(DestReg, TopValue, comment != nullptr ? "" : nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1138,7 +1138,7 @@ void CArmOps::StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint
|
||||||
{
|
{
|
||||||
if ((Offset & (~0xFFF)) != 0) { g_Notify->BreakPoint(__FILE__, __LINE__); return; }
|
if ((Offset & (~0xFFF)) != 0) { g_Notify->BreakPoint(__FILE__, __LINE__); return; }
|
||||||
|
|
||||||
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
|
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
|
||||||
Arm32Opcode op = { 0 };
|
Arm32Opcode op = { 0 };
|
||||||
op.imm12.rt = DestReg;
|
op.imm12.rt = DestReg;
|
||||||
op.imm12.rn = RegPointer;
|
op.imm12.rn = RegPointer;
|
||||||
|
@ -1148,7 +1148,7 @@ void CArmOps::StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != NULL ? "\t; " : "", comment != NULL ? comment : "");
|
CPU_Message(" str\t%s, [%s, #%d]%s%s", ArmRegName(DestReg), ArmRegName(RegPointer), (uint32_t)Offset, comment != nullptr ? "\t; " : "", comment != nullptr ? comment : "");
|
||||||
ArmThumbOpcode op = { 0 };
|
ArmThumbOpcode op = { 0 };
|
||||||
op.Imm5.rt = DestReg;
|
op.Imm5.rt = DestReg;
|
||||||
op.Imm5.rn = RegPointer;
|
op.Imm5.rn = RegPointer;
|
||||||
|
@ -1478,7 +1478,7 @@ void CArmOps::SetJump8(uint8_t * Loc, uint8_t * JumpLoc)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Loc == NULL || JumpLoc == NULL)
|
if (Loc == nullptr || JumpLoc == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
|
@ -1516,7 +1516,7 @@ void CArmOps::SetJump20(uint32_t * Loc, uint32_t * JumpLoc)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Loc == NULL || JumpLoc == NULL)
|
if (Loc == nullptr || JumpLoc == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -164,15 +164,15 @@ protected:
|
||||||
static void IfBlock(ArmItMask mask, ArmCompareType CompareType);
|
static void IfBlock(ArmItMask mask, ArmCompareType CompareType);
|
||||||
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, uint16_t offset);
|
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, uint16_t offset);
|
||||||
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
static void LoadArmRegPointerByteToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
||||||
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = NULL);
|
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = nullptr);
|
||||||
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
static void LoadArmRegPointerToArmReg(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
||||||
static void LoadArmRegPointerToFloatReg(ArmReg RegPointer, ArmFpuSingle Reg, uint8_t Offset);
|
static void LoadArmRegPointerToFloatReg(ArmReg RegPointer, ArmFpuSingle Reg, uint8_t Offset);
|
||||||
static void LoadFloatingPointControlReg(ArmReg DestReg);
|
static void LoadFloatingPointControlReg(ArmReg DestReg);
|
||||||
static void MoveArmRegArmReg(ArmReg DestReg, ArmReg SourceReg);
|
static void MoveArmRegArmReg(ArmReg DestReg, ArmReg SourceReg);
|
||||||
static void MoveArmRegToVariable(ArmReg Reg, void * Variable, const char * VariableName);
|
static void MoveArmRegToVariable(ArmReg Reg, void * Variable, const char * VariableName);
|
||||||
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
|
static void MoveConstToArmReg(ArmReg DestReg, uint16_t Const, const char * comment = nullptr);
|
||||||
static void MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char * comment = NULL);
|
static void MoveConstToArmRegTop(ArmReg DestReg, uint16_t Const, const char * comment = nullptr);
|
||||||
static void MoveConstToArmReg(ArmReg DestReg, uint32_t Const, const char * comment = NULL);
|
static void MoveConstToArmReg(ArmReg DestReg, uint32_t Const, const char * comment = nullptr);
|
||||||
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void MoveFloatRegToVariable(ArmFpuSingle reg, void * Variable, const char * VariableName);
|
static void MoveFloatRegToVariable(ArmFpuSingle reg, void * Variable, const char * VariableName);
|
||||||
static void MoveVariableToArmReg(void * Variable, const char * VariableName, ArmReg reg);
|
static void MoveVariableToArmReg(void * Variable, const char * VariableName, ArmReg reg);
|
||||||
|
@ -187,7 +187,7 @@ protected:
|
||||||
static void ShiftRightUnsignImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
|
static void ShiftRightUnsignImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
|
||||||
static void ShiftLeftImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
|
static void ShiftLeftImmed(ArmReg DestReg, ArmReg SourceReg, uint32_t shift);
|
||||||
static void SignExtendByte(ArmReg Reg);
|
static void SignExtendByte(ArmReg Reg);
|
||||||
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = NULL);
|
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, uint8_t Offset, const char * comment = nullptr);
|
||||||
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
static void StoreArmRegToArmRegPointer(ArmReg DestReg, ArmReg RegPointer, ArmReg RegPointer2, uint8_t shift);
|
||||||
static void StoreFloatingPointControlReg(ArmReg SourceReg);
|
static void StoreFloatingPointControlReg(ArmReg SourceReg);
|
||||||
static void StoreFloatRegToArmRegPointer(ArmFpuSingle Reg, ArmReg RegPointer, uint8_t Offset);
|
static void StoreFloatRegToArmRegPointer(ArmFpuSingle Reg, ArmReg RegPointer, uint8_t Offset);
|
||||||
|
|
|
@ -97,8 +97,8 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
|
||||||
|
|
||||||
void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
||||||
{
|
{
|
||||||
void *FunctAddress = NULL;
|
void *FunctAddress = nullptr;
|
||||||
const char *FunctName = NULL;
|
const char *FunctName = nullptr;
|
||||||
switch (CompareType)
|
switch (CompareType)
|
||||||
{
|
{
|
||||||
case CompareTypeTEQ:
|
case CompareTypeTEQ:
|
||||||
|
@ -153,7 +153,7 @@ void CArmRecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FunctName != NULL && FunctAddress != NULL)
|
if (FunctName != nullptr && FunctAddress != nullptr)
|
||||||
{
|
{
|
||||||
if (m_Opcode.rs != 0) { WriteBack_GPR(m_Opcode.rs, false); }
|
if (m_Opcode.rs != 0) { WriteBack_GPR(m_Opcode.rs, false); }
|
||||||
if (m_Opcode.rt != 0) { WriteBack_GPR(m_Opcode.rt, false); }
|
if (m_Opcode.rt != 0) { WriteBack_GPR(m_Opcode.rt, false); }
|
||||||
|
@ -234,7 +234,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
|
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -242,12 +242,12 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
|
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Jump.DoneDelaySlot = false;
|
m_Section->m_Jump.DoneDelaySlot = false;
|
||||||
m_Section->m_Cont.JumpPC = m_CompilePC;
|
m_Section->m_Cont.JumpPC = m_CompilePC;
|
||||||
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
|
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,8 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
|
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
|
||||||
}
|
}
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.DoneDelaySlot = false;
|
m_Section->m_Cont.DoneDelaySlot = false;
|
||||||
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
|
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
|
||||||
{
|
{
|
||||||
|
@ -282,8 +282,8 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
if ((m_CompilePC & 0xFFC) != 0xFFC)
|
if ((m_CompilePC & 0xFFC) != 0xFFC)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != NULL ? "Continue" : "ContinueExitBlock";
|
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != nullptr ? "Continue" : "ContinueExitBlock";
|
||||||
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != NULL ? "Jump" : "JumpExitBlock";
|
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != nullptr ? "Jump" : "JumpExitBlock";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -296,14 +296,14 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
|
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("");
|
CPU_Message("");
|
||||||
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
|
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
}
|
}
|
||||||
else if (m_Section->m_Cont.LinkLocation != NULL)
|
else if (m_Section->m_Cont.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("");
|
CPU_Message("");
|
||||||
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
|
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
|
||||||
|
@ -313,10 +313,10 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
||||||
{
|
{
|
||||||
uint8_t * DelayLinkLocation = NULL;
|
uint8_t * DelayLinkLocation = nullptr;
|
||||||
if (m_Section->m_Jump.FallThrough)
|
if (m_Section->m_Jump.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -324,16 +324,16 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
else if (m_Section->m_Cont.FallThrough)
|
else if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
|
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
DelayLinkLocation = *g_RecompPos;
|
DelayLinkLocation = *g_RecompPos;
|
||||||
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
|
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
|
||||||
|
|
||||||
|
@ -342,9 +342,9 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
||||||
}
|
}
|
||||||
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
|
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
DelayLinkLocation = *g_RecompPos;
|
DelayLinkLocation = *g_RecompPos;
|
||||||
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
|
BranchLabel8(ArmBranch_Always, "DoDelaySlot");
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
FallInfo->RegSet = m_RegWorkingSet;
|
FallInfo->RegSet = m_RegWorkingSet;
|
||||||
if (FallInfo == &m_Section->m_Jump)
|
if (FallInfo == &m_Section->m_Jump)
|
||||||
{
|
{
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
BranchLabel20(ArmBranch_Always, FallInfo->BranchLabel.c_str());
|
BranchLabel20(ArmBranch_Always, FallInfo->BranchLabel.c_str());
|
||||||
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||||
|
|
||||||
if (JumpInfo->LinkLocation != NULL)
|
if (JumpInfo->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
|
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
|
||||||
LinkJump(*JumpInfo);
|
LinkJump(*JumpInfo);
|
||||||
|
@ -443,12 +443,12 @@ void CArmRecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Cont.FallThrough = true;
|
m_Section->m_Cont.FallThrough = true;
|
||||||
m_Section->m_Cont.RegSet = m_RegWorkingSet;
|
m_Section->m_Cont.RegSet = m_RegWorkingSet;
|
||||||
if (m_Section->m_ContinueSection == NULL && m_Section->m_JumpSection != NULL)
|
if (m_Section->m_ContinueSection == nullptr && m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_ContinueSection = m_Section->m_JumpSection;
|
m_Section->m_ContinueSection = m_Section->m_JumpSection;
|
||||||
m_Section->m_JumpSection = NULL;
|
m_Section->m_JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -520,11 +520,11 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
if (Link)
|
if (Link)
|
||||||
{
|
{
|
||||||
|
@ -544,13 +544,13 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.FallThrough)
|
if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.FallThrough)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.FallThrough)
|
||||||
{
|
{
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.FallThrough)
|
if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ void CArmRecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
|
|
||||||
void CArmRecompilerOps::BNE_Compare()
|
void CArmRecompilerOps::BNE_Compare()
|
||||||
{
|
{
|
||||||
uint8_t * Jump = NULL;
|
uint8_t * Jump = nullptr;
|
||||||
|
|
||||||
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
||||||
{
|
{
|
||||||
|
@ -945,7 +945,7 @@ void CArmRecompilerOps::BNE_Compare()
|
||||||
|
|
||||||
void CArmRecompilerOps::BEQ_Compare()
|
void CArmRecompilerOps::BEQ_Compare()
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
||||||
{
|
{
|
||||||
|
@ -1311,7 +1311,7 @@ void CArmRecompilerOps::BGTZ_Compare()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsMapped(m_Opcode.rs))
|
if (IsMapped(m_Opcode.rs))
|
||||||
{
|
{
|
||||||
|
@ -1446,7 +1446,7 @@ void CArmRecompilerOps::BLEZ_Compare()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
ArmReg TempRegRs = Arm_Any;
|
ArmReg TempRegRs = Arm_Any;
|
||||||
if (IsMapped(m_Opcode.rs))
|
if (IsMapped(m_Opcode.rs))
|
||||||
|
@ -1516,7 +1516,7 @@ void CArmRecompilerOps::BLEZ_Compare()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (!g_System->b32BitCore())
|
if (!g_System->b32BitCore())
|
||||||
{
|
{
|
||||||
|
@ -1843,7 +1843,7 @@ void CArmRecompilerOps::J()
|
||||||
|
|
||||||
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
|
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -1852,8 +1852,8 @@ void CArmRecompilerOps::J()
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
||||||
|
@ -1889,7 +1889,7 @@ void CArmRecompilerOps::JAL()
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -1898,8 +1898,8 @@ void CArmRecompilerOps::JAL()
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
||||||
|
@ -2894,11 +2894,11 @@ void CArmRecompilerOps::SPECIAL_JR()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
||||||
{
|
{
|
||||||
|
@ -3006,11 +3006,11 @@ void CArmRecompilerOps::SPECIAL_JALR()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
|
@ -5471,11 +5471,11 @@ void CArmRecompilerOps::SetRegWorkingSet(const CRegInfo & RegInfo)
|
||||||
|
|
||||||
bool CArmRecompilerOps::InheritParentInfo()
|
bool CArmRecompilerOps::InheritParentInfo()
|
||||||
{
|
{
|
||||||
if (m_Section->m_CompiledLocation == NULL)
|
if (m_Section->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_CompiledLocation = *g_RecompPos;
|
m_Section->m_CompiledLocation = *g_RecompPos;
|
||||||
m_Section->DisplaySectionInformation();
|
m_Section->DisplaySectionInformation();
|
||||||
m_Section->m_CompiledLocation = NULL;
|
m_Section->m_CompiledLocation = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5491,7 +5491,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
if (m_Section->m_ParentSection.size() == 1)
|
if (m_Section->m_ParentSection.size() == 1)
|
||||||
{
|
{
|
||||||
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
|
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
|
||||||
if (Parent->m_CompiledLocation == NULL)
|
if (Parent->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -5511,7 +5511,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
BLOCK_PARENT BlockParent;
|
BLOCK_PARENT BlockParent;
|
||||||
|
|
||||||
if (Parent->m_CompiledLocation == NULL) { continue; }
|
if (Parent->m_CompiledLocation == nullptr) { continue; }
|
||||||
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
||||||
{
|
{
|
||||||
BlockParent.Parent = Parent;
|
BlockParent.Parent = Parent;
|
||||||
|
@ -5541,7 +5541,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
BLOCK_PARENT BlockParent;
|
BLOCK_PARENT BlockParent;
|
||||||
|
|
||||||
if (Parent->m_CompiledLocation != NULL) { continue; }
|
if (Parent->m_CompiledLocation != nullptr) { continue; }
|
||||||
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
||||||
{
|
{
|
||||||
BlockParent.Parent = Parent;
|
BlockParent.Parent = Parent;
|
||||||
|
@ -5624,7 +5624,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
|
|
||||||
if (i == (size_t)FirstParent) { continue; }
|
if (i == (size_t)FirstParent) { continue; }
|
||||||
Parent = ParentList[i].Parent;
|
Parent = ParentList[i].Parent;
|
||||||
if (Parent->m_CompiledLocation == NULL)
|
if (Parent->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5837,20 +5837,20 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
||||||
BranchLabel20(ArmBranch_Always, Label.c_str());
|
BranchLabel20(ArmBranch_Always, Label.c_str());
|
||||||
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||||
JumpInfo->LinkLocation2 = NULL;
|
JumpInfo->LinkLocation2 = nullptr;
|
||||||
|
|
||||||
CurrentParent = i;
|
CurrentParent = i;
|
||||||
Parent = ParentList[CurrentParent].Parent;
|
Parent = ParentList[CurrentParent].Parent;
|
||||||
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
||||||
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
|
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
|
||||||
if (JumpInfo->LinkLocation != NULL)
|
if (JumpInfo->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
SetJump20(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
|
SetJump20(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo->LinkLocation = NULL;
|
JumpInfo->LinkLocation = nullptr;
|
||||||
if (JumpInfo->LinkLocation2 != NULL)
|
if (JumpInfo->LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump20(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
|
SetJump20(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo->LinkLocation2 = NULL;
|
JumpInfo->LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5883,7 +5883,7 @@ bool CArmRecompilerOps::InheritParentInfo()
|
||||||
|
|
||||||
void CArmRecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
|
void CArmRecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
|
||||||
{
|
{
|
||||||
if (JumpInfo.LinkLocation != NULL)
|
if (JumpInfo.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
if (SectionID != -1)
|
if (SectionID != -1)
|
||||||
{
|
{
|
||||||
|
@ -5897,11 +5897,11 @@ void CArmRecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetJump20(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
|
SetJump20(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo.LinkLocation = NULL;
|
JumpInfo.LinkLocation = nullptr;
|
||||||
if (JumpInfo.LinkLocation2 != NULL)
|
if (JumpInfo.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump20(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
|
SetJump20(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo.LinkLocation2 = NULL;
|
JumpInfo.LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6315,7 +6315,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
||||||
switch (PAddr)
|
switch (PAddr)
|
||||||
{
|
{
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
|
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
||||||
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
|
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
|
||||||
|
@ -6340,7 +6340,7 @@ void CArmRecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
||||||
break;
|
break;
|
||||||
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
|
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
|
||||||
case 0x04400008:
|
case 0x04400008:
|
||||||
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
|
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
|
||||||
{
|
{
|
||||||
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
||||||
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
|
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
|
||||||
|
@ -6743,7 +6743,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
switch (PAddr) {
|
switch (PAddr) {
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
|
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
||||||
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
|
MoveVariableToArmReg(&g_Reg->VI_STATUS_REG, "VI_STATUS_REG", TempReg);
|
||||||
|
@ -6767,7 +6767,7 @@ void CArmRecompilerOps::SW_Register(ArmReg Reg, uint32_t VAddr)
|
||||||
AndConstToVariable(&g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG", 0xFFFFFF);
|
AndConstToVariable(&g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG", 0xFFFFFF);
|
||||||
break;
|
break;
|
||||||
case 0x04400008:
|
case 0x04400008:
|
||||||
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
|
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
|
||||||
{
|
{
|
||||||
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
ArmReg TempReg = Map_TempReg(Arm_Any, -1, false);
|
||||||
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
|
MoveVariableToArmReg(&g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG", TempReg);
|
||||||
|
@ -7223,7 +7223,7 @@ void CArmRecompilerOps::LW_KnownAddress(ArmReg Reg, uint32_t VAddr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_Plugins->Audio()->AiReadLength != NULL)
|
if (g_Plugins->Audio()->AiReadLength != nullptr)
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.BeforeCallDirect();
|
m_RegWorkingSet.BeforeCallDirect();
|
||||||
CallFunction((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");
|
CallFunction((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");
|
||||||
|
|
|
@ -21,8 +21,8 @@ m_VAddrEnter(VAddrEnter),
|
||||||
m_VAddrFirst(VAddrEnter),
|
m_VAddrFirst(VAddrEnter),
|
||||||
m_VAddrLast(VAddrEnter),
|
m_VAddrLast(VAddrEnter),
|
||||||
m_CompiledLocation(CompiledLocation),
|
m_CompiledLocation(CompiledLocation),
|
||||||
m_EnterSection(NULL),
|
m_EnterSection(nullptr),
|
||||||
m_RecompilerOps(NULL),
|
m_RecompilerOps(nullptr),
|
||||||
m_Test(1)
|
m_Test(1)
|
||||||
{
|
{
|
||||||
#if defined(__arm__) || defined(_M_ARM)
|
#if defined(__arm__) || defined(_M_ARM)
|
||||||
|
@ -37,26 +37,26 @@ m_Test(1)
|
||||||
#elif defined(__arm__) || defined(_M_ARM)
|
#elif defined(__arm__) || defined(_M_ARM)
|
||||||
m_RecompilerOps = new CArmRecompilerOps;
|
m_RecompilerOps = new CArmRecompilerOps;
|
||||||
#endif
|
#endif
|
||||||
if (m_RecompilerOps == NULL)
|
if (m_RecompilerOps == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CCodeSection * baseSection = new CCodeSection(this, VAddrEnter, 0, false);
|
CCodeSection * baseSection = new CCodeSection(this, VAddrEnter, 0, false);
|
||||||
if (baseSection == NULL)
|
if (baseSection == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Sections.push_back(baseSection);
|
m_Sections.push_back(baseSection);
|
||||||
baseSection->AddParent(NULL);
|
baseSection->AddParent(nullptr);
|
||||||
baseSection->m_CompiledLocation = (uint8_t *)-1;
|
baseSection->m_CompiledLocation = (uint8_t *)-1;
|
||||||
baseSection->m_Cont.JumpPC = VAddrEnter;
|
baseSection->m_Cont.JumpPC = VAddrEnter;
|
||||||
baseSection->m_Cont.FallThrough = true;
|
baseSection->m_Cont.FallThrough = true;
|
||||||
baseSection->m_Cont.RegSet = baseSection->m_RegEnter;
|
baseSection->m_Cont.RegSet = baseSection->m_RegEnter;
|
||||||
|
|
||||||
m_EnterSection = new CCodeSection(this, VAddrEnter, 1, true);
|
m_EnterSection = new CCodeSection(this, VAddrEnter, 1, true);
|
||||||
if (m_EnterSection == NULL)
|
if (m_EnterSection == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -89,18 +89,18 @@ CCodeBlock::~CCodeBlock()
|
||||||
}
|
}
|
||||||
m_Sections.clear();
|
m_Sections.clear();
|
||||||
|
|
||||||
if (m_RecompilerOps != NULL)
|
if (m_RecompilerOps != nullptr)
|
||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(_M_IX86)
|
#if defined(__i386__) || defined(_M_IX86)
|
||||||
delete (CX86RecompilerOps *)m_RecompilerOps;
|
delete (CX86RecompilerOps *)m_RecompilerOps;
|
||||||
#endif
|
#endif
|
||||||
m_RecompilerOps = NULL;
|
m_RecompilerOps = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC)
|
bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC)
|
||||||
{
|
{
|
||||||
if (Section != NULL)
|
if (Section != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
||||||
|
|
||||||
if (LinkAllowed)
|
if (LinkAllowed)
|
||||||
{
|
{
|
||||||
if (Section != NULL)
|
if (Section != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -129,10 +129,10 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Section == NULL)
|
if (Section == nullptr)
|
||||||
{
|
{
|
||||||
Section = new CCodeSection(this, TargetPC, m_Sections.size(), LinkAllowed);
|
Section = new CCodeSection(this, TargetPC, m_Sections.size(), LinkAllowed);
|
||||||
if (Section == NULL)
|
if (Section == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
|
@ -145,7 +145,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
||||||
Section->AddParent(CurrentSection);
|
Section->AddParent(CurrentSection);
|
||||||
if (TargetPC <= CurrentPC && TargetPC != m_VAddrEnter)
|
if (TargetPC <= CurrentPC && TargetPC != m_VAddrEnter)
|
||||||
{
|
{
|
||||||
CCodeSection * SplitSection = NULL;
|
CCodeSection * SplitSection = nullptr;
|
||||||
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
||||||
{
|
{
|
||||||
if (itr->first >= TargetPC)
|
if (itr->first >= TargetPC)
|
||||||
|
@ -154,7 +154,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
||||||
}
|
}
|
||||||
SplitSection = itr->second;
|
SplitSection = itr->second;
|
||||||
}
|
}
|
||||||
if (SplitSection == NULL)
|
if (SplitSection == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
||||||
BaseSection->AddParent(SplitSection);
|
BaseSection->AddParent(SplitSection);
|
||||||
|
|
||||||
SplitSection->m_EndPC = TargetPC - 4;
|
SplitSection->m_EndPC = TargetPC - 4;
|
||||||
SplitSection->m_JumpSection = NULL;
|
SplitSection->m_JumpSection = nullptr;
|
||||||
SplitSection->m_ContinueSection = BaseSection;
|
SplitSection->m_ContinueSection = BaseSection;
|
||||||
SplitSection->SetContinueAddress(TargetPC - 4, TargetPC);
|
SplitSection->SetContinueAddress(TargetPC - 4, TargetPC);
|
||||||
SplitSection->SetJumpAddress((uint32_t)-1, (uint32_t)-1, false);
|
SplitSection->SetJumpAddress((uint32_t)-1, (uint32_t)-1, false);
|
||||||
|
@ -204,12 +204,12 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
SectionMap::const_iterator itr = m_SectionMap.find(TestPC);
|
SectionMap::const_iterator itr = m_SectionMap.find(TestPC);
|
||||||
if (itr != m_SectionMap.end() && CurrentSection != itr->second)
|
if (itr != m_SectionMap.end() && CurrentSection != itr->second)
|
||||||
{
|
{
|
||||||
if (CurrentSection->m_ContinueSection != NULL &&
|
if (CurrentSection->m_ContinueSection != nullptr &&
|
||||||
CurrentSection->m_ContinueSection != itr->second)
|
CurrentSection->m_ContinueSection != itr->second)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (CurrentSection->m_ContinueSection == NULL)
|
if (CurrentSection->m_ContinueSection == nullptr)
|
||||||
{
|
{
|
||||||
SetSection(CurrentSection->m_ContinueSection, CurrentSection, TestPC, true, TestPC);
|
SetSection(CurrentSection->m_ContinueSection, CurrentSection, TestPC, true, TestPC);
|
||||||
CurrentSection->SetContinueAddress(TestPC - 4, TestPC);
|
CurrentSection->SetContinueAddress(TestPC - 4, TestPC);
|
||||||
|
@ -220,8 +220,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
CPU_Message("Section %d", CurrentSection->m_SectionID);
|
CPU_Message("Section %d", CurrentSection->m_SectionID);
|
||||||
if (EnterSection != m_EnterSection)
|
if (EnterSection != m_EnterSection)
|
||||||
{
|
{
|
||||||
if (CurrentSection->m_JumpSection != NULL ||
|
if (CurrentSection->m_JumpSection != nullptr ||
|
||||||
CurrentSection->m_ContinueSection != NULL ||
|
CurrentSection->m_ContinueSection != nullptr ||
|
||||||
CurrentSection->m_EndSection)
|
CurrentSection->m_EndSection)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -335,11 +335,11 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
TestPC += IncludeDelaySlot ? 8 : 4;
|
TestPC += IncludeDelaySlot ? 8 : 4;
|
||||||
|
|
||||||
//Find the next section
|
//Find the next section
|
||||||
CCodeSection * NewSection = NULL;
|
CCodeSection * NewSection = nullptr;
|
||||||
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
for (SectionMap::const_iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
||||||
{
|
{
|
||||||
if (CurrentSection->m_JumpSection != NULL ||
|
if (CurrentSection->m_JumpSection != nullptr ||
|
||||||
CurrentSection->m_ContinueSection != NULL ||
|
CurrentSection->m_ContinueSection != nullptr ||
|
||||||
CurrentSection->m_EndSection)
|
CurrentSection->m_EndSection)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -347,7 +347,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
NewSection = itr->second;
|
NewSection = itr->second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (NewSection == NULL)
|
if (NewSection == nullptr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -356,8 +356,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
CurrentSection = NewSection;
|
CurrentSection = NewSection;
|
||||||
if (CurrentSection->m_JumpSection != NULL ||
|
if (CurrentSection->m_JumpSection != nullptr ||
|
||||||
CurrentSection->m_ContinueSection != NULL ||
|
CurrentSection->m_ContinueSection != nullptr ||
|
||||||
CurrentSection->m_EndSection)
|
CurrentSection->m_EndSection)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -370,8 +370,8 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
||||||
for (SectionMap::iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
for (SectionMap::iterator itr = m_SectionMap.begin(); itr != m_SectionMap.end(); itr++)
|
||||||
{
|
{
|
||||||
CCodeSection * Section = itr->second;
|
CCodeSection * Section = itr->second;
|
||||||
if (Section->m_JumpSection != NULL ||
|
if (Section->m_JumpSection != nullptr ||
|
||||||
Section->m_ContinueSection != NULL ||
|
Section->m_ContinueSection != nullptr ||
|
||||||
Section->m_EndSection)
|
Section->m_EndSection)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -754,11 +754,11 @@ bool CCodeBlock::Compile()
|
||||||
m_RecompilerOps->EnterCodeBlock();
|
m_RecompilerOps->EnterCodeBlock();
|
||||||
if (g_System->bLinkBlocks())
|
if (g_System->bLinkBlocks())
|
||||||
{
|
{
|
||||||
while (m_EnterSection !=NULL && m_EnterSection->GenerateNativeCode(NextTest()));
|
while (m_EnterSection !=nullptr && m_EnterSection->GenerateNativeCode(NextTest()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_EnterSection == NULL || !m_EnterSection->GenerateNativeCode(NextTest()))
|
if (m_EnterSection == nullptr || !m_EnterSection->GenerateNativeCode(NextTest()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,13 +149,13 @@ CCodeSection::CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID
|
||||||
m_SectionID(ID),
|
m_SectionID(ID),
|
||||||
m_EnterPC(EnterPC),
|
m_EnterPC(EnterPC),
|
||||||
m_EndPC((uint32_t)-1),
|
m_EndPC((uint32_t)-1),
|
||||||
m_ContinueSection(NULL),
|
m_ContinueSection(nullptr),
|
||||||
m_JumpSection(NULL),
|
m_JumpSection(nullptr),
|
||||||
m_EndSection(false),
|
m_EndSection(false),
|
||||||
m_LinkAllowed(LinkAllowed),
|
m_LinkAllowed(LinkAllowed),
|
||||||
m_Test(0),
|
m_Test(0),
|
||||||
m_Test2(0),
|
m_Test2(0),
|
||||||
m_CompiledLocation(NULL),
|
m_CompiledLocation(nullptr),
|
||||||
m_InLoop(false),
|
m_InLoop(false),
|
||||||
m_DelaySlot(false),
|
m_DelaySlot(false),
|
||||||
m_RecompilerOps(CodeBlock->RecompilerOps())
|
m_RecompilerOps(CodeBlock->RecompilerOps())
|
||||||
|
@ -176,7 +176,7 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (JumpInfo[i]->LinkLocation == NULL &&
|
if (JumpInfo[i]->LinkLocation == nullptr &&
|
||||||
JumpInfo[i]->FallThrough == false)
|
JumpInfo[i]->FallThrough == false)
|
||||||
{
|
{
|
||||||
JumpInfo[i]->TargetPC = (uint32_t)-1;
|
JumpInfo[i]->TargetPC = (uint32_t)-1;
|
||||||
|
@ -188,46 +188,46 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
//Handle Fall througth
|
//Handle Fall througth
|
||||||
uint8_t * Jump = NULL;
|
uint8_t * Jump = nullptr;
|
||||||
for (i = 0; i < 2; i ++)
|
for (i = 0; i < 2; i ++)
|
||||||
{
|
{
|
||||||
if (!JumpInfo[i]->FallThrough) { continue; }
|
if (!JumpInfo[i]->FallThrough) { continue; }
|
||||||
JumpInfo[i]->FallThrough = false;
|
JumpInfo[i]->FallThrough = false;
|
||||||
if (JumpInfo[i]->LinkLocation != NULL)
|
if (JumpInfo[i]->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
|
||||||
JumpInfo[i]->LinkLocation = NULL;
|
JumpInfo[i]->LinkLocation = nullptr;
|
||||||
if (JumpInfo[i]->LinkLocation2 != NULL)
|
if (JumpInfo[i]->LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
|
||||||
JumpInfo[i]->LinkLocation2 = NULL;
|
JumpInfo[i]->LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
|
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
|
||||||
if (JumpInfo[(i + 1) & 1]->LinkLocation == NULL) { break; }
|
if (JumpInfo[(i + 1) & 1]->LinkLocation == nullptr) { break; }
|
||||||
JmpLabel8("FinishBlock",0);
|
JmpLabel8("FinishBlock",0);
|
||||||
Jump = *g_RecompPos - 1;
|
Jump = *g_RecompPos - 1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 2; i ++)
|
for (i = 0; i < 2; i ++)
|
||||||
{
|
{
|
||||||
if (JumpInfo[i]->LinkLocation == NULL) { continue; }
|
if (JumpInfo[i]->LinkLocation == nullptr) { continue; }
|
||||||
JumpInfo[i]->FallThrough = false;
|
JumpInfo[i]->FallThrough = false;
|
||||||
if (JumpInfo[i]->LinkLocation != NULL)
|
if (JumpInfo[i]->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo[i]->LinkLocation,(uint32_t *)*g_RecompPos);
|
||||||
JumpInfo[i]->LinkLocation = NULL;
|
JumpInfo[i]->LinkLocation = nullptr;
|
||||||
if (JumpInfo[i]->LinkLocation2 != NULL)
|
if (JumpInfo[i]->LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo[i]->LinkLocation2,(uint32_t *)*g_RecompPos);
|
||||||
JumpInfo[i]->LinkLocation2 = NULL;
|
JumpInfo[i]->LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
|
PushImm32(stdstr_f("0x%08X",JumpInfo[i]->TargetPC).c_str(),JumpInfo[i]->TargetPC);
|
||||||
if (JumpInfo[(i + 1) & 1]->LinkLocation == NULL) { break; }
|
if (JumpInfo[(i + 1) & 1]->LinkLocation == nullptr) { break; }
|
||||||
JmpLabel8("FinishBlock",0);
|
JmpLabel8("FinishBlock",0);
|
||||||
Jump = *g_RecompPos - 1;
|
Jump = *g_RecompPos - 1;
|
||||||
}
|
}
|
||||||
if (Jump != NULL)
|
if (Jump != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message(" $FinishBlock:");
|
CPU_Message(" $FinishBlock:");
|
||||||
SetJump8(Jump,*g_RecompPos);
|
SetJump8(Jump,*g_RecompPos);
|
||||||
|
@ -261,25 +261,25 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
m_RecompilerOps->CompileInPermLoop(m_Jump.RegSet, m_RecompilerOps->GetCurrentPC());
|
m_RecompilerOps->CompileInPermLoop(m_Jump.RegSet, m_RecompilerOps->GetCurrentPC());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TargetSection[0] != TargetSection[1] || TargetSection[0] == NULL)
|
if (TargetSection[0] != TargetSection[1] || TargetSection[0] == nullptr)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (JumpInfo[i]->LinkLocation == NULL && JumpInfo[i]->FallThrough == false)
|
if (JumpInfo[i]->LinkLocation == nullptr && JumpInfo[i]->FallThrough == false)
|
||||||
{
|
{
|
||||||
if (TargetSection[i])
|
if (TargetSection[i])
|
||||||
{
|
{
|
||||||
TargetSection[i]->UnlinkParent(this, i == 0);
|
TargetSection[i]->UnlinkParent(this, i == 0);
|
||||||
TargetSection[i] = NULL;
|
TargetSection[i] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TargetSection[i] == NULL && JumpInfo[i]->FallThrough)
|
else if (TargetSection[i] == nullptr && JumpInfo[i]->FallThrough)
|
||||||
{
|
{
|
||||||
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
||||||
m_RecompilerOps->CompileExit(JumpInfo[i]->JumpPC, JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet, JumpInfo[i]->ExitReason);
|
m_RecompilerOps->CompileExit(JumpInfo[i]->JumpPC, JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet, JumpInfo[i]->ExitReason);
|
||||||
JumpInfo[i]->FallThrough = false;
|
JumpInfo[i]->FallThrough = false;
|
||||||
}
|
}
|
||||||
else if (TargetSection[i] != NULL && JumpInfo[i] != NULL)
|
else if (TargetSection[i] != nullptr && JumpInfo[i] != nullptr)
|
||||||
{
|
{
|
||||||
if (!JumpInfo[i]->FallThrough) { continue; }
|
if (!JumpInfo[i]->FallThrough) { continue; }
|
||||||
if (JumpInfo[i]->TargetPC == TargetSection[i]->m_EnterPC) { continue; }
|
if (JumpInfo[i]->TargetPC == TargetSection[i]->m_EnterPC) { continue; }
|
||||||
|
@ -291,9 +291,9 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Cont.LinkLocation == NULL && m_Cont.FallThrough == false) { m_ContinueSection = NULL; }
|
if (m_Cont.LinkLocation == nullptr && m_Cont.FallThrough == false) { m_ContinueSection = nullptr; }
|
||||||
if (m_Jump.LinkLocation == NULL && m_Jump.FallThrough == false) { m_JumpSection = NULL; }
|
if (m_Jump.LinkLocation == nullptr && m_Jump.FallThrough == false) { m_JumpSection = nullptr; }
|
||||||
if (m_JumpSection == NULL && m_ContinueSection == NULL)
|
if (m_JumpSection == nullptr && m_ContinueSection == nullptr)
|
||||||
{
|
{
|
||||||
//FreeSection(TargetSection[0],Section);
|
//FreeSection(TargetSection[0],Section);
|
||||||
}
|
}
|
||||||
|
@ -303,10 +303,10 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
TargetSection[1] = m_JumpSection;
|
TargetSection[1] = m_JumpSection;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (TargetSection[i] == NULL) { continue; }
|
if (TargetSection[i] == nullptr) { continue; }
|
||||||
if (!JumpInfo[i]->FallThrough) { continue; }
|
if (!JumpInfo[i]->FallThrough) { continue; }
|
||||||
|
|
||||||
if (TargetSection[i]->m_CompiledLocation != NULL)
|
if (TargetSection[i]->m_CompiledLocation != nullptr)
|
||||||
{
|
{
|
||||||
JumpInfo[i]->FallThrough = false;
|
JumpInfo[i]->FallThrough = false;
|
||||||
m_RecompilerOps->LinkJump(*JumpInfo[i], TargetSection[i]->m_SectionID);
|
m_RecompilerOps->LinkJump(*JumpInfo[i], TargetSection[i]->m_SectionID);
|
||||||
|
@ -338,13 +338,13 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (TargetSection[i] == NULL) { continue; }
|
if (TargetSection[i] == nullptr) { continue; }
|
||||||
if (TargetSection[i]->m_ParentSection.empty()) { continue; }
|
if (TargetSection[i]->m_ParentSection.empty()) { continue; }
|
||||||
for (SECTION_LIST::iterator iter = TargetSection[i]->m_ParentSection.begin(); iter != TargetSection[i]->m_ParentSection.end(); iter++)
|
for (SECTION_LIST::iterator iter = TargetSection[i]->m_ParentSection.begin(); iter != TargetSection[i]->m_ParentSection.end(); iter++)
|
||||||
{
|
{
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
|
|
||||||
if (Parent->m_CompiledLocation != NULL) { continue; }
|
if (Parent->m_CompiledLocation != nullptr) { continue; }
|
||||||
if (Parent->m_InLoop) { continue; }
|
if (Parent->m_InLoop) { continue; }
|
||||||
if (JumpInfo[i]->PermLoop)
|
if (JumpInfo[i]->PermLoop)
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (JumpInfo[i]->FallThrough && (TargetSection[i] == NULL || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
|
if (JumpInfo[i]->FallThrough && (TargetSection[i] == nullptr || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
|
||||||
{
|
{
|
||||||
JumpInfo[i]->FallThrough = false;
|
JumpInfo[i]->FallThrough = false;
|
||||||
m_RecompilerOps->JumpToUnknown(JumpInfo[i]);
|
m_RecompilerOps->JumpToUnknown(JumpInfo[i]);
|
||||||
|
@ -386,8 +386,8 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
//CPU_Message("Section %d",m_SectionID);
|
//CPU_Message("Section %d",m_SectionID);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (JumpInfo[i]->LinkLocation == NULL) { continue; }
|
if (JumpInfo[i]->LinkLocation == nullptr) { continue; }
|
||||||
if (TargetSection[i] == NULL)
|
if (TargetSection[i] == nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("ExitBlock (from %d):", m_SectionID);
|
CPU_Message("ExitBlock (from %d):", m_SectionID);
|
||||||
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
||||||
|
@ -398,7 +398,7 @@ void CCodeSection::GenerateSectionLinkage()
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (TargetSection[i]->m_CompiledLocation == NULL)
|
if (TargetSection[i]->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest());
|
TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest());
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ bool CCodeSection::ParentContinue()
|
||||||
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
|
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
|
||||||
{
|
{
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
if (Parent->m_CompiledLocation != NULL) { continue; }
|
if (Parent->m_CompiledLocation != nullptr) { continue; }
|
||||||
if (IsAllParentLoops(Parent, true, m_BlockInfo->NextTest())) { continue; }
|
if (IsAllParentLoops(Parent, true, m_BlockInfo->NextTest())) { continue; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -475,15 +475,15 @@ bool CCodeSection::ParentContinue()
|
||||||
|
|
||||||
bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
||||||
{
|
{
|
||||||
if (m_CompiledLocation != NULL)
|
if (m_CompiledLocation != nullptr)
|
||||||
{
|
{
|
||||||
if (m_Test == Test)
|
if (m_Test == Test)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_Test = Test;
|
m_Test = Test;
|
||||||
if (m_ContinueSection != NULL && m_ContinueSection->GenerateNativeCode(Test)) { return true; }
|
if (m_ContinueSection != nullptr && m_ContinueSection->GenerateNativeCode(Test)) { return true; }
|
||||||
if (m_JumpSection != NULL && m_JumpSection->GenerateNativeCode(Test)) { return true; }
|
if (m_JumpSection != nullptr && m_JumpSection->GenerateNativeCode(Test)) { return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
||||||
|
|
||||||
void CCodeSection::AddParent(CCodeSection * Parent)
|
void CCodeSection::AddParent(CCodeSection * Parent)
|
||||||
{
|
{
|
||||||
if (Parent == NULL)
|
if (Parent == nullptr)
|
||||||
{
|
{
|
||||||
m_RecompilerOps->SetRegWorkingSet(m_RegEnter);
|
m_RecompilerOps->SetRegWorkingSet(m_RegEnter);
|
||||||
return;
|
return;
|
||||||
|
@ -981,11 +981,11 @@ void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID)
|
||||||
if (m_Test != Test)
|
if (m_Test != Test)
|
||||||
{
|
{
|
||||||
m_Test = Test;
|
m_Test = Test;
|
||||||
if (m_ContinueSection != NULL)
|
if (m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_ContinueSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_ContinueSection->m_SectionID);
|
m_ContinueSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
if (m_JumpSection != NULL)
|
if (m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_JumpSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_JumpSection->m_SectionID);
|
m_JumpSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -1019,15 +1019,15 @@ CCodeSection * CCodeSection::ExistingSection(uint32_t Addr, uint32_t Test)
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (m_Test == Test) { return NULL; }
|
if (m_Test == Test) { return nullptr; }
|
||||||
m_Test = Test;
|
m_Test = Test;
|
||||||
|
|
||||||
CCodeSection * Section = m_JumpSection ? m_JumpSection->ExistingSection(Addr, Test) : NULL;
|
CCodeSection * Section = m_JumpSection ? m_JumpSection->ExistingSection(Addr, Test) : nullptr;
|
||||||
if (Section != NULL) { return Section; }
|
if (Section != nullptr) { return Section; }
|
||||||
Section = m_ContinueSection ? m_ContinueSection->ExistingSection(Addr, Test) : NULL;
|
Section = m_ContinueSection ? m_ContinueSection->ExistingSection(Addr, Test) : nullptr;
|
||||||
if (Section != NULL) { return Section; }
|
if (Section != nullptr) { return Section; }
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
|
bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
|
||||||
|
@ -1071,12 +1071,12 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||||
|
|
||||||
if (ContinueSection && Parent->m_ContinueSection == this)
|
if (ContinueSection && Parent->m_ContinueSection == this)
|
||||||
{
|
{
|
||||||
Parent->m_ContinueSection = NULL;
|
Parent->m_ContinueSection = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ContinueSection && Parent->m_JumpSection == this)
|
if (!ContinueSection && Parent->m_JumpSection == this)
|
||||||
{
|
{
|
||||||
Parent->m_JumpSection = NULL;
|
Parent->m_JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bRemove = false;
|
bool bRemove = false;
|
||||||
|
@ -1093,7 +1093,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
CodeSection->m_ContinueSection = NULL;
|
CodeSection->m_ContinueSection = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CodeSection->m_JumpSection == this)
|
if (CodeSection->m_JumpSection == this)
|
||||||
|
@ -1102,7 +1102,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
CodeSection->m_JumpSection = NULL;
|
CodeSection->m_JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bRemove = true;
|
bRemove = true;
|
||||||
|
@ -1114,11 +1114,11 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||||
}
|
}
|
||||||
if (bRemove)
|
if (bRemove)
|
||||||
{
|
{
|
||||||
if (m_JumpSection != NULL)
|
if (m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_JumpSection->UnlinkParent(this, false);
|
m_JumpSection->UnlinkParent(this, false);
|
||||||
}
|
}
|
||||||
if (m_ContinueSection != NULL)
|
if (m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_ContinueSection->UnlinkParent(this, true);
|
m_ContinueSection->UnlinkParent(this, true);
|
||||||
}
|
}
|
||||||
|
@ -1127,7 +1127,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||||
|
|
||||||
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
||||||
{
|
{
|
||||||
if (IgnoreIfCompiled && Parent->m_CompiledLocation != NULL) { return true; }
|
if (IgnoreIfCompiled && Parent->m_CompiledLocation != nullptr) { return true; }
|
||||||
if (!m_InLoop) { return false; }
|
if (!m_InLoop) { return false; }
|
||||||
if (!Parent->m_InLoop) { return false; }
|
if (!Parent->m_InLoop) { return false; }
|
||||||
if (Parent->m_ParentSection.empty()) { return false; }
|
if (Parent->m_ParentSection.empty()) { return false; }
|
||||||
|
@ -1153,8 +1153,8 @@ bool CCodeSection::DisplaySectionInformation(uint32_t ID, uint32_t Test)
|
||||||
m_Test = Test;
|
m_Test = Test;
|
||||||
if (m_SectionID != ID)
|
if (m_SectionID != ID)
|
||||||
{
|
{
|
||||||
if (m_ContinueSection != NULL && m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; }
|
if (m_ContinueSection != nullptr && m_ContinueSection->DisplaySectionInformation(ID, Test)) { return true; }
|
||||||
if (m_JumpSection != NULL && m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; }
|
if (m_JumpSection != nullptr && m_JumpSection->DisplaySectionInformation(ID, Test)) { return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DisplaySectionInformation();
|
DisplaySectionInformation();
|
||||||
|
@ -1194,7 +1194,7 @@ void CCodeSection::DisplaySectionInformation()
|
||||||
{
|
{
|
||||||
CPU_Message("Jump Address: 0x%08X", m_Jump.JumpPC);
|
CPU_Message("Jump Address: 0x%08X", m_Jump.JumpPC);
|
||||||
CPU_Message("Jump Target Address: 0x%08X", m_Jump.TargetPC);
|
CPU_Message("Jump Target Address: 0x%08X", m_Jump.TargetPC);
|
||||||
if (m_JumpSection != NULL)
|
if (m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("Jump Section: %d", m_JumpSection->m_SectionID);
|
CPU_Message("Jump Section: %d", m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1204,7 @@ void CCodeSection::DisplaySectionInformation()
|
||||||
}
|
}
|
||||||
CPU_Message("Continue Address: 0x%08X", m_Cont.JumpPC);
|
CPU_Message("Continue Address: 0x%08X", m_Cont.JumpPC);
|
||||||
CPU_Message("Continue Target Address: 0x%08X", m_Cont.TargetPC);
|
CPU_Message("Continue Target Address: 0x%08X", m_Cont.TargetPC);
|
||||||
if (m_ContinueSection != NULL) {
|
if (m_ContinueSection != nullptr) {
|
||||||
CPU_Message("Continue Section: %d", m_ContinueSection->m_SectionID);
|
CPU_Message("Continue Section: %d", m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,7 +8,7 @@ CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
|
||||||
m_Hash(CodeBlock.Hash()),
|
m_Hash(CodeBlock.Hash()),
|
||||||
m_Function((Func)CodeBlock.CompiledLocation()),
|
m_Function((Func)CodeBlock.CompiledLocation()),
|
||||||
m_FunctionEnd(CodeBlock.CompiledLocationEnd()),
|
m_FunctionEnd(CodeBlock.CompiledLocationEnd()),
|
||||||
m_Next(NULL)
|
m_Next(nullptr)
|
||||||
{
|
{
|
||||||
m_MemContents[0] = CodeBlock.MemContents(0);
|
m_MemContents[0] = CodeBlock.MemContents(0);
|
||||||
m_MemContents[1] = CodeBlock.MemContents(1);
|
m_MemContents[1] = CodeBlock.MemContents(1);
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
|
|
||||||
CFunctionMap::CFunctionMap() :
|
CFunctionMap::CFunctionMap() :
|
||||||
m_JumpTable(NULL),
|
m_JumpTable(nullptr),
|
||||||
m_FunctionTable(NULL)
|
m_FunctionTable(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ CFunctionMap::~CFunctionMap()
|
||||||
bool CFunctionMap::AllocateMemory()
|
bool CFunctionMap::AllocateMemory()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "start");
|
WriteTrace(TraceRecompiler, TraceDebug, "start");
|
||||||
if (LookUpMode() == FuncFind_VirtualLookup && m_FunctionTable == NULL)
|
if (LookUpMode() == FuncFind_VirtualLookup && m_FunctionTable == nullptr)
|
||||||
{
|
{
|
||||||
m_FunctionTable = new PCCompiledFunc_TABLE[0x100000];
|
m_FunctionTable = new PCCompiledFunc_TABLE[0x100000];
|
||||||
if (m_FunctionTable == NULL)
|
if (m_FunctionTable == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate function table");
|
WriteTrace(TraceRecompiler, TraceError, "failed to allocate function table");
|
||||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -28,10 +28,10 @@ bool CFunctionMap::AllocateMemory()
|
||||||
}
|
}
|
||||||
memset(m_FunctionTable, 0, 0x100000 * sizeof(PCCompiledFunc_TABLE));
|
memset(m_FunctionTable, 0, 0x100000 * sizeof(PCCompiledFunc_TABLE));
|
||||||
}
|
}
|
||||||
if (LookUpMode() == FuncFind_PhysicalLookup && m_JumpTable == NULL)
|
if (LookUpMode() == FuncFind_PhysicalLookup && m_JumpTable == nullptr)
|
||||||
{
|
{
|
||||||
m_JumpTable = new PCCompiledFunc[RdramSize() >> 2];
|
m_JumpTable = new PCCompiledFunc[RdramSize() >> 2];
|
||||||
if (m_JumpTable == NULL)
|
if (m_JumpTable == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate jump table");
|
WriteTrace(TraceRecompiler, TraceError, "failed to allocate jump table");
|
||||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -49,18 +49,18 @@ void CFunctionMap::CleanBuffers()
|
||||||
{
|
{
|
||||||
for (int i = 0, n = 0x100000; i < n; i++)
|
for (int i = 0, n = 0x100000; i < n; i++)
|
||||||
{
|
{
|
||||||
if (m_FunctionTable[i] != NULL)
|
if (m_FunctionTable[i] != nullptr)
|
||||||
{
|
{
|
||||||
delete m_FunctionTable[i];
|
delete m_FunctionTable[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] m_FunctionTable;
|
delete[] m_FunctionTable;
|
||||||
m_FunctionTable = NULL;
|
m_FunctionTable = nullptr;
|
||||||
}
|
}
|
||||||
if (m_JumpTable)
|
if (m_JumpTable)
|
||||||
{
|
{
|
||||||
delete[] m_JumpTable;
|
delete[] m_JumpTable;
|
||||||
m_JumpTable = NULL;
|
m_JumpTable = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ bool LoopAnalysis::SetupEnterSection(CCodeSection * Section, bool & bChanged, bo
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
|
|
||||||
CPU_Message("%s: Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
CPU_Message("%s: Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||||
if (Parent->m_Test != m_Test && (m_EnterSection != Section || Parent->m_CompiledLocation == NULL) && Parent->m_InLoop)
|
if (Parent->m_Test != m_Test && (m_EnterSection != Section || Parent->m_CompiledLocation == nullptr) && Parent->m_InLoop)
|
||||||
{
|
{
|
||||||
CPU_Message("%s: Ignore Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
CPU_Message("%s: Ignore Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||||
bSkipedSection = true;
|
bSkipedSection = true;
|
||||||
|
@ -140,7 +140,7 @@ bool LoopAnalysis::SetupEnterSection(CCodeSection * Section, bool & bChanged, bo
|
||||||
|
|
||||||
bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
{
|
{
|
||||||
if (Section == NULL) { return true; }
|
if (Section == nullptr) { return true; }
|
||||||
if (!Section->m_InLoop) { return true; }
|
if (!Section->m_InLoop) { return true; }
|
||||||
|
|
||||||
CPU_Message("%s: Section %d Block PC: 0x%X", __FUNCTION__, Section->m_SectionID, m_BlockInfo->VAddrEnter());
|
CPU_Message("%s: Section %d Block PC: 0x%X", __FUNCTION__, Section->m_SectionID, m_BlockInfo->VAddrEnter());
|
||||||
|
@ -253,13 +253,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
|
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
|
||||||
Section->m_JumpSection != NULL &&
|
Section->m_JumpSection != nullptr &&
|
||||||
Section->m_Jump.TargetPC != (uint32_t)-1)
|
Section->m_Jump.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -278,13 +278,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = LIKELY_DELAY_SLOT;
|
m_NextInstruction = LIKELY_DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Section->m_Jump.TargetPC != m_PC + 4 &&
|
if (Section->m_Jump.TargetPC != m_PC + 4 &&
|
||||||
Section->m_JumpSection != NULL &&
|
Section->m_JumpSection != nullptr &&
|
||||||
Section->m_Jump.TargetPC != (uint32_t)-1)
|
Section->m_Jump.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -410,7 +410,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
if (m_Command.rs != 0 || m_Command.rt != 0)
|
if (m_Command.rs != 0 || m_Command.rt != 0)
|
||||||
{
|
{
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -445,13 +445,13 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
|
if (Section->m_Jump.TargetPC != m_PC + ((int16_t)m_Command.offset << 2) + 4 &&
|
||||||
Section->m_JumpSection != NULL &&
|
Section->m_JumpSection != nullptr &&
|
||||||
Section->m_Jump.TargetPC != (uint32_t)-1)
|
Section->m_Jump.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -572,7 +572,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = LIKELY_DELAY_SLOT;
|
m_NextInstruction = LIKELY_DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -597,7 +597,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -639,7 +639,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
||||||
m_NextInstruction = LIKELY_DELAY_SLOT;
|
m_NextInstruction = LIKELY_DELAY_SLOT;
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
if (Section->m_Cont.TargetPC != m_PC + 8 &&
|
||||||
Section->m_ContinueSection != NULL &&
|
Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -953,12 +953,12 @@ void LoopAnalysis::SPECIAL_JALR()
|
||||||
void LoopAnalysis::SPECIAL_SYSCALL(CCodeSection * Section)
|
void LoopAnalysis::SPECIAL_SYSCALL(CCodeSection * Section)
|
||||||
{
|
{
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_ContinueSection != NULL &&
|
if (Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Section->m_JumpSection != NULL &&
|
if (Section->m_JumpSection != nullptr &&
|
||||||
Section->m_Jump.TargetPC != (uint32_t)-1)
|
Section->m_Jump.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
@ -973,12 +973,12 @@ void LoopAnalysis::SPECIAL_SYSCALL(CCodeSection * Section)
|
||||||
void LoopAnalysis::SPECIAL_BREAK(CCodeSection * Section)
|
void LoopAnalysis::SPECIAL_BREAK(CCodeSection * Section)
|
||||||
{
|
{
|
||||||
#ifdef CHECKED_BUILD
|
#ifdef CHECKED_BUILD
|
||||||
if (Section->m_ContinueSection != NULL &&
|
if (Section->m_ContinueSection != nullptr &&
|
||||||
Section->m_Cont.TargetPC != (uint32_t)-1)
|
Section->m_Cont.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Section->m_JumpSection != NULL &&
|
if (Section->m_JumpSection != nullptr &&
|
||||||
Section->m_Jump.TargetPC != (uint32_t)-1)
|
Section->m_Jump.TargetPC != (uint32_t)-1)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
|
|
@ -120,22 +120,22 @@ void CRecompiler::RecompilerMain_VirtualTable()
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = table[TableEntry];
|
CCompiledFunc * info = table[TableEntry];
|
||||||
if (info != NULL)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
(info->Function())();
|
(info->Function())();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CCompiledFunc * info = CompileCode();
|
CCompiledFunc * info = CompileCode();
|
||||||
if (info == NULL || m_EndEmulation)
|
if (info == nullptr || m_EndEmulation)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table == NULL)
|
if (table == nullptr)
|
||||||
{
|
{
|
||||||
table = new PCCompiledFunc[(0x1000 >> 2)];
|
table = new PCCompiledFunc[(0x1000 >> 2)];
|
||||||
if (table == NULL)
|
if (table == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate PCCompiledFunc");
|
WriteTrace(TraceRecompiler, TraceError, "failed to allocate PCCompiledFunc");
|
||||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -165,7 +165,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
{
|
{
|
||||||
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
||||||
//Find Block on hash table
|
//Find Block on hash table
|
||||||
if (Info == NULL)
|
if (Info == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
|
@ -184,7 +184,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
//Find Block on hash table
|
//Find Block on hash table
|
||||||
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
||||||
|
|
||||||
if (Info == NULL || EndEmulation())
|
if (Info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
|
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
|
||||||
NextInstruction = DELAY_SLOT;
|
NextInstruction = DELAY_SLOT;
|
||||||
Info = NULL;
|
Info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_asm {
|
_asm {
|
||||||
|
@ -209,13 +209,13 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = table[(PROGRAM_COUNTER & 0xFFF) >> 2];
|
CCompiledFunc * info = table[(PROGRAM_COUNTER & 0xFFF) >> 2];
|
||||||
if (info != NULL)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
if ((*info->MemLocation[0] != info->MemContents[0]) ||
|
if ((*info->MemLocation[0] != info->MemContents[0]) ||
|
||||||
(*info->MemLocation[1] != info->MemContents[1]))
|
(*info->MemLocation[1] != info->MemContents[1]))
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((info->VStartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
ClearRecompCode_Virt((info->VStartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const uint8_t * Block = info->FunctionAddr();
|
const uint8_t * Block = info->FunctionAddr();
|
||||||
|
@ -242,7 +242,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
#endif
|
#endif
|
||||||
CCompiledFunc * info = CompileCode();
|
CCompiledFunc * info = CompileCode();
|
||||||
|
|
||||||
if (info == NULL || EndEmulation())
|
if (info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -265,11 +265,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
||||||
|
|
||||||
//Find Block on hash table
|
//Find Block on hash table
|
||||||
if (Info == NULL)
|
if (Info == nullptr)
|
||||||
{
|
{
|
||||||
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
||||||
|
|
||||||
if (Info == NULL || EndEmulation())
|
if (Info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
|
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x2000, Remove_ValidateFunc);
|
||||||
NextInstruction = DELAY_SLOT;
|
NextInstruction = DELAY_SLOT;
|
||||||
Info = NULL;
|
Info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,11 +297,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
CCompiledFunc * Info = m_Functions.FindFunction(PROGRAM_COUNTER);
|
CCompiledFunc * Info = m_Functions.FindFunction(PROGRAM_COUNTER);
|
||||||
|
|
||||||
//Find Block on hash table
|
//Find Block on hash table
|
||||||
if (Info == NULL)
|
if (Info == nullptr)
|
||||||
{
|
{
|
||||||
Info = CompileCode();
|
Info = CompileCode();
|
||||||
|
|
||||||
if (Info == NULL || EndEmulation())
|
if (Info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ void CRecompiler::RecompilerMain_VirtualTable_validate()
|
||||||
(*Info->MemLocation[1] != Info->MemContents[1]))
|
(*Info->MemLocation[1] != Info->MemContents[1]))
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
ClearRecompCode_Virt((Info->StartPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
||||||
Info = NULL;
|
Info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,10 +334,10 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
if (PhysicalAddr < g_System->RdramSize())
|
if (PhysicalAddr < g_System->RdramSize())
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
||||||
if (info == NULL)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
info = CompileCode();
|
info = CompileCode();
|
||||||
if (info == NULL || m_EndEmulation)
|
if (info == nullptr || m_EndEmulation)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -395,11 +395,11 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
CCompiledFunc * Info = m_FunctionsDelaySlot.FindFunction(PROGRAM_COUNTER);
|
||||||
|
|
||||||
//Find Block on hash table
|
//Find Block on hash table
|
||||||
if (Info == NULL)
|
if (Info == nullptr)
|
||||||
{
|
{
|
||||||
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
Info = CompileDelaySlot(PROGRAM_COUNTER);
|
||||||
|
|
||||||
if (Info == NULL || EndEmulation())
|
if (Info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x2000,Remove_ValidateFunc);
|
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x2000,Remove_ValidateFunc);
|
||||||
NextInstruction = DELAY_SLOT;
|
NextInstruction = DELAY_SLOT;
|
||||||
Info = NULL;
|
Info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -464,11 +464,11 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Info == NULL)
|
if (Info == nullptr)
|
||||||
{
|
{
|
||||||
Info = CompileCode();
|
Info = CompileCode();
|
||||||
|
|
||||||
if (Info == NULL || EndEmulation())
|
if (Info == nullptr || EndEmulation())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
(*Info->MemLocation[1] != Info->MemContents[1]))
|
(*Info->MemLocation[1] != Info->MemContents[1]))
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x3000,Remove_ValidateFunc);
|
ClearRecompCode_Virt((Info->VStartPC() - 0x1000) & ~0xFFF,0x3000,Remove_ValidateFunc);
|
||||||
Info = NULL;
|
Info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,10 +538,10 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
||||||
|
|
||||||
if (info == NULL)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
info = CompileCode();
|
info = CompileCode();
|
||||||
if (info == NULL || m_EndEmulation)
|
if (info == nullptr || m_EndEmulation)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -580,10 +580,10 @@ void CRecompiler::RecompilerMain_Lookup_validate()
|
||||||
if (PhysicalAddr < g_System->RdramSize())
|
if (PhysicalAddr < g_System->RdramSize())
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
||||||
if (info == NULL)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
info = CompileCode();
|
info = CompileCode();
|
||||||
if (info == NULL || m_EndEmulation)
|
if (info == nullptr || m_EndEmulation)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
|
||||||
*(info->MemLocation(1)) != info->MemContents(1))
|
*(info->MemLocation(1)) != info->MemContents(1))
|
||||||
{
|
{
|
||||||
ClearRecompCode_Virt((info->EnterPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
ClearRecompCode_Virt((info->EnterPC() - 0x1000) & ~0xFFF, 0x3000, Remove_ValidateFunc);
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,10 +648,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
|
||||||
{
|
{
|
||||||
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
CCompiledFunc * info = JumpTable()[PhysicalAddr >> 2];
|
||||||
|
|
||||||
if (info == NULL)
|
if (info == nullptr)
|
||||||
{
|
{
|
||||||
info = CompileCode();
|
info = CompileCode();
|
||||||
if (info == NULL || m_EndEmulation)
|
if (info == nullptr || m_EndEmulation)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -675,10 +675,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
|
||||||
ClearRecompCode_Phys(0, 0x2000, Remove_ValidateFunc);
|
ClearRecompCode_Phys(0, 0x2000, Remove_ValidateFunc);
|
||||||
}
|
}
|
||||||
info = JumpTable()[PhysicalAddr >> 2];
|
info = JumpTable()[PhysicalAddr >> 2];
|
||||||
if (info != NULL)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -754,7 +754,7 @@ void CRecompiler::ResetRecompCode(bool bAllocate)
|
||||||
for (CCompiledFuncList::iterator iter = m_Functions.begin(); iter != m_Functions.end(); iter++)
|
for (CCompiledFuncList::iterator iter = m_Functions.begin(); iter != m_Functions.end(); iter++)
|
||||||
{
|
{
|
||||||
CCompiledFunc * Func = iter->second;
|
CCompiledFunc * Func = iter->second;
|
||||||
while (Func != NULL)
|
while (Func != nullptr)
|
||||||
{
|
{
|
||||||
CCompiledFunc * CurrentFunc = Func;
|
CCompiledFunc * CurrentFunc = Func;
|
||||||
Func = Func->Next();
|
Func = Func->Next();
|
||||||
|
@ -808,15 +808,15 @@ void CRecompiler::RecompilerMain_ChangeMemory()
|
||||||
{
|
{
|
||||||
uint32_t Index = (Value & 0xFFFF);
|
uint32_t Index = (Value & 0xFFFF);
|
||||||
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
|
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
|
||||||
if (OrigMem[Index].PAddr != Addr) { Block = NULL; }
|
if (OrigMem[Index].PAddr != Addr) { Block = nullptr; }
|
||||||
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = NULL; }
|
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = nullptr; }
|
||||||
if (Index >= TargetIndex) { Block = NULL; }
|
if (Index >= TargetIndex) { Block = nullptr; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Block = NULL;
|
Block = nullptr;
|
||||||
}
|
}
|
||||||
if (Block == NULL)
|
if (Block == nullptr)
|
||||||
{
|
{
|
||||||
uint32_t MemValue;
|
uint32_t MemValue;
|
||||||
|
|
||||||
|
@ -852,13 +852,13 @@ void CRecompiler::RecompilerMain_ChangeMemory()
|
||||||
{
|
{
|
||||||
uint32_t Index = (Value & 0xFFFF);
|
uint32_t Index = (Value & 0xFFFF);
|
||||||
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
|
Block = (uint8_t *)OrigMem[Index].CompiledLocation;
|
||||||
if (OrigMem[Index].PAddr != Addr) { Block = NULL; }
|
if (OrigMem[Index].PAddr != Addr) { Block = nullptr; }
|
||||||
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = NULL; }
|
if (OrigMem[Index].VAddr != PROGRAM_COUNTER) { Block = nullptr; }
|
||||||
if (Index >= TargetIndex) { Block = NULL; }
|
if (Index >= TargetIndex) { Block = nullptr; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Block = NULL;
|
Block = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -867,7 +867,7 @@ void CRecompiler::RecompilerMain_ChangeMemory()
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Block == NULL)
|
if (Block == nullptr)
|
||||||
{
|
{
|
||||||
uint32_t MemValue;
|
uint32_t MemValue;
|
||||||
|
|
||||||
|
@ -943,14 +943,14 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, pAddr))
|
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, pAddr))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
|
WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCompiledFuncList::iterator iter = m_Functions.find(PROGRAM_COUNTER);
|
CCompiledFuncList::iterator iter = m_Functions.find(PROGRAM_COUNTER);
|
||||||
if (iter != m_Functions.end())
|
if (iter != m_Functions.end())
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceInfo, "exisiting functions for address (Program Counter: %X pAddr: %X)", PROGRAM_COUNTER, pAddr);
|
WriteTrace(TraceRecompiler, TraceInfo, "exisiting functions for address (Program Counter: %X pAddr: %X)", PROGRAM_COUNTER, pAddr);
|
||||||
for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next())
|
for (CCompiledFunc * Func = iter->second; Func != nullptr; Func = Func->Next())
|
||||||
{
|
{
|
||||||
uint32_t PAddr;
|
uint32_t PAddr;
|
||||||
if (m_MMU.TranslateVaddr(Func->MinPC(), PAddr))
|
if (m_MMU.TranslateVaddr(Func->MinPC(), PAddr))
|
||||||
|
@ -974,7 +974,7 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
CCodeBlock CodeBlock(PROGRAM_COUNTER, *g_RecompPos);
|
CCodeBlock CodeBlock(PROGRAM_COUNTER, *g_RecompPos);
|
||||||
if (!CodeBlock.Compile())
|
if (!CodeBlock.Compile())
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bShowRecompMemSize())
|
if (bShowRecompMemSize())
|
||||||
|
@ -1081,7 +1081,7 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "Delete Table (%X): Index = %d", table, AddressIndex);
|
WriteTrace(TraceRecompiler, TraceError, "Delete Table (%X): Index = %d", table, AddressIndex);
|
||||||
delete table;
|
delete table;
|
||||||
table = NULL;
|
table = nullptr;
|
||||||
m_MMU.UnProtectMemory(Address, Address + length);
|
m_MMU.UnProtectMemory(Address, Address + length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
static CLog * g_CPULogFile = NULL;
|
static CLog * g_CPULogFile = nullptr;
|
||||||
|
|
||||||
void Recompiler_Log_Message(const char * strFormat, ...)
|
void Recompiler_Log_Message(const char * strFormat, ...)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ void Recompiler_Log_Message(const char * strFormat, ...)
|
||||||
va_start(args, strFormat);
|
va_start(args, strFormat);
|
||||||
size_t nlen = _vscprintf(strFormat, args) + 1;
|
size_t nlen = _vscprintf(strFormat, args) + 1;
|
||||||
char * buffer = (char *)alloca((nlen + 3) * sizeof(char));
|
char * buffer = (char *)alloca((nlen + 3) * sizeof(char));
|
||||||
if (buffer != NULL)
|
if (buffer != nullptr)
|
||||||
{
|
{
|
||||||
if (nlen > 0)
|
if (nlen > 0)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ void Recompiler_Log_Message(const char * strFormat, ...)
|
||||||
void Start_Recompiler_Log (void)
|
void Start_Recompiler_Log (void)
|
||||||
{
|
{
|
||||||
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "CPUoutput.log");
|
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "CPUoutput.log");
|
||||||
if (g_CPULogFile != NULL)
|
if (g_CPULogFile != nullptr)
|
||||||
{
|
{
|
||||||
Stop_Recompiler_Log();
|
Stop_Recompiler_Log();
|
||||||
}
|
}
|
||||||
|
@ -49,23 +49,23 @@ void Start_Recompiler_Log (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete g_CPULogFile;
|
delete g_CPULogFile;
|
||||||
g_CPULogFile = NULL;
|
g_CPULogFile = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop_Recompiler_Log (void)
|
void Stop_Recompiler_Log (void)
|
||||||
{
|
{
|
||||||
if (g_CPULogFile != NULL)
|
if (g_CPULogFile != nullptr)
|
||||||
{
|
{
|
||||||
delete g_CPULogFile;
|
delete g_CPULogFile;
|
||||||
g_CPULogFile = NULL;
|
g_CPULogFile = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush_Recompiler_Log(void)
|
void Flush_Recompiler_Log(void)
|
||||||
{
|
{
|
||||||
if (g_CPULogFile != NULL)
|
if (g_CPULogFile != nullptr)
|
||||||
{
|
{
|
||||||
g_CPULogFile->Flush();
|
g_CPULogFile->Flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include <Common/MemoryManagement.h>
|
#include <Common/MemoryManagement.h>
|
||||||
|
|
||||||
CRecompMemory::CRecompMemory() :
|
CRecompMemory::CRecompMemory() :
|
||||||
m_RecompCode(NULL),
|
m_RecompCode(nullptr),
|
||||||
m_RecompSize(0)
|
m_RecompSize(0)
|
||||||
{
|
{
|
||||||
m_RecompPos = NULL;
|
m_RecompPos = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRecompMemory::~CRecompMemory()
|
CRecompMemory::~CRecompMemory()
|
||||||
|
@ -16,9 +16,9 @@ CRecompMemory::~CRecompMemory()
|
||||||
if (m_RecompCode)
|
if (m_RecompCode)
|
||||||
{
|
{
|
||||||
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
||||||
m_RecompCode = NULL;
|
m_RecompCode = nullptr;
|
||||||
}
|
}
|
||||||
m_RecompPos = NULL;
|
m_RecompPos = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRecompMemory::AllocateMemory()
|
bool CRecompMemory::AllocateMemory()
|
||||||
|
@ -26,7 +26,7 @@ bool CRecompMemory::AllocateMemory()
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Start");
|
WriteTrace(TraceRecompiler, TraceDebug, "Start");
|
||||||
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "RecompCodeBase = %X", RecompCodeBase);
|
WriteTrace(TraceRecompiler, TraceDebug, "RecompCodeBase = %X", RecompCodeBase);
|
||||||
if (RecompCodeBase == NULL)
|
if (RecompCodeBase == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
||||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -34,7 +34,7 @@ bool CRecompMemory::AllocateMemory()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||||
if (m_RecompCode == NULL)
|
if (m_RecompCode == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
||||||
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
||||||
|
@ -61,7 +61,7 @@ void CRecompMemory::CheckRecompMem()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||||
if (MemAddr == NULL)
|
if (MemAddr == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
||||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
|
|
@ -7,8 +7,8 @@ CJumpInfo::CJumpInfo()
|
||||||
TargetPC = (uint32_t)-1;
|
TargetPC = (uint32_t)-1;
|
||||||
JumpPC = (uint32_t)-1;
|
JumpPC = (uint32_t)-1;
|
||||||
BranchLabel = "";
|
BranchLabel = "";
|
||||||
LinkLocation = NULL;
|
LinkLocation = nullptr;
|
||||||
LinkLocation2 = NULL;
|
LinkLocation2 = nullptr;
|
||||||
FallThrough = false;
|
FallThrough = false;
|
||||||
PermLoop = false;
|
PermLoop = false;
|
||||||
DoneDelaySlot = false;
|
DoneDelaySlot = false;
|
||||||
|
@ -19,7 +19,7 @@ CJumpInfo::CJumpInfo()
|
||||||
|
|
||||||
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
||||||
{
|
{
|
||||||
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
|
if (IgnoreIfCompiled && Parent->CompiledLocation != nullptr) { return true; }
|
||||||
if (!InLoop) { return false; }
|
if (!InLoop) { return false; }
|
||||||
if (!Parent->InLoop) { return false; }
|
if (!Parent->InLoop) { return false; }
|
||||||
if (Parent->ParentSection.empty()) { return false; }
|
if (Parent->ParentSection.empty()) { return false; }
|
||||||
|
@ -59,7 +59,7 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
|
||||||
// }
|
// }
|
||||||
if (ContinueSection && Parent->ContinueSection == this)
|
if (ContinueSection && Parent->ContinueSection == this)
|
||||||
{
|
{
|
||||||
Parent->ContinueSection = NULL;
|
Parent->ContinueSection = nullptr;
|
||||||
}
|
}
|
||||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||||
// {
|
// {
|
||||||
|
@ -70,7 +70,7 @@ void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool C
|
||||||
// }
|
// }
|
||||||
if (!ContinueSection && Parent->JumpSection == this)
|
if (!ContinueSection && Parent->JumpSection == this)
|
||||||
{
|
{
|
||||||
Parent->JumpSection = NULL;
|
Parent->JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
if (AllowDelete)
|
if (AllowDelete)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ CCodeSection::~CCodeSection()
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
ContinueSection = NULL;
|
ContinueSection = nullptr;
|
||||||
}
|
}
|
||||||
if (JumpSection)
|
if (JumpSection)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ CCodeSection::~CCodeSection()
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
JumpSection = NULL;
|
JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <Project64-core/Debugger.h>
|
#include <Project64-core/Debugger.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
CCodeSection * CX86RecompilerOps::m_Section = NULL;
|
CCodeSection * CX86RecompilerOps::m_Section = nullptr;
|
||||||
CRegInfo CX86RecompilerOps::m_RegWorkingSet;
|
CRegInfo CX86RecompilerOps::m_RegWorkingSet;
|
||||||
STEP_TYPE CX86RecompilerOps::m_NextInstruction;
|
STEP_TYPE CX86RecompilerOps::m_NextInstruction;
|
||||||
uint32_t CX86RecompilerOps::m_CompilePC;
|
uint32_t CX86RecompilerOps::m_CompilePC;
|
||||||
|
@ -355,8 +355,8 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
|
||||||
/*************************** Trap functions *************************/
|
/*************************** Trap functions *************************/
|
||||||
void CX86RecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
void CX86RecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
||||||
{
|
{
|
||||||
void *FunctAddress = NULL;
|
void *FunctAddress = nullptr;
|
||||||
const char *FunctName = NULL;
|
const char *FunctName = nullptr;
|
||||||
switch (CompareType)
|
switch (CompareType)
|
||||||
{
|
{
|
||||||
case CompareTypeTEQ:
|
case CompareTypeTEQ:
|
||||||
|
@ -411,7 +411,7 @@ void CX86RecompilerOps::Compile_TrapCompare(TRAP_COMPARE CompareType)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FunctName != NULL && FunctAddress != NULL)
|
if (FunctName != nullptr && FunctAddress != nullptr)
|
||||||
{
|
{
|
||||||
if (IsMapped(m_Opcode.rs)) {
|
if (IsMapped(m_Opcode.rs)) {
|
||||||
UnMap_GPR(m_Opcode.rs, true);
|
UnMap_GPR(m_Opcode.rs, true);
|
||||||
|
@ -500,7 +500,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
|
m_Section->m_Jump.TargetPC = m_CompilePC + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -508,12 +508,12 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
|
m_Section->m_Jump.BranchLabel.Format("Exit_%X_jump_%X", m_Section->m_EnterPC, m_Section->m_Jump.TargetPC);
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Jump.DoneDelaySlot = false;
|
m_Section->m_Jump.DoneDelaySlot = false;
|
||||||
m_Section->m_Cont.JumpPC = m_CompilePC;
|
m_Section->m_Cont.JumpPC = m_CompilePC;
|
||||||
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
|
m_Section->m_Cont.TargetPC = m_CompilePC + 8;
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -521,8 +521,8 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
|
m_Section->m_Cont.BranchLabel.Format("Exit_%X_continue_%X", m_Section->m_EnterPC, m_Section->m_Cont.TargetPC);
|
||||||
}
|
}
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.DoneDelaySlot = false;
|
m_Section->m_Cont.DoneDelaySlot = false;
|
||||||
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
|
if (m_Section->m_Jump.TargetPC < m_Section->m_Cont.TargetPC)
|
||||||
{
|
{
|
||||||
|
@ -545,8 +545,8 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
{
|
{
|
||||||
if ((m_CompilePC & 0xFFC) != 0xFFC)
|
if ((m_CompilePC & 0xFFC) != 0xFFC)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != NULL ? "Continue" : "ExitBlock";
|
m_Section->m_Cont.BranchLabel = m_Section->m_ContinueSection != nullptr ? "Continue" : "ExitBlock";
|
||||||
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != NULL ? "Jump" : "ExitBlock";
|
m_Section->m_Jump.BranchLabel = m_Section->m_JumpSection != nullptr ? "Jump" : "ExitBlock";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -559,14 +559,14 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
|
if (!m_Section->m_Jump.FallThrough && !m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("");
|
CPU_Message("");
|
||||||
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
|
CPU_Message(" %s:", m_Section->m_Jump.BranchLabel.c_str());
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
}
|
}
|
||||||
else if (m_Section->m_Cont.LinkLocation != NULL)
|
else if (m_Section->m_Cont.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("");
|
CPU_Message("");
|
||||||
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
|
CPU_Message(" %s:", m_Section->m_Cont.BranchLabel.c_str());
|
||||||
|
@ -576,10 +576,10 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
if ((m_CompilePC & 0xFFC) == 0xFFC)
|
||||||
{
|
{
|
||||||
uint8_t * DelayLinkLocation = NULL;
|
uint8_t * DelayLinkLocation = nullptr;
|
||||||
if (m_Section->m_Jump.FallThrough)
|
if (m_Section->m_Jump.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -587,17 +587,17 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
else if (m_Section->m_Cont.FallThrough)
|
else if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
|
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
MoveConstToVariable(m_Section->m_Cont.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.LinkLocation2 != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
JmpLabel8("DoDelaySlot", 0);
|
JmpLabel8("DoDelaySlot", 0);
|
||||||
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
|
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
|
||||||
|
|
||||||
CPU_Message(" ");
|
CPU_Message(" ");
|
||||||
|
@ -605,10 +605,10 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
MoveConstToVariable(m_Section->m_Jump.TargetPC, &R4300iOp::m_JumpToLocation, "R4300iOp::m_JumpToLocation");
|
||||||
}
|
}
|
||||||
if (m_Section->m_Cont.LinkLocation != NULL || m_Section->m_Cont.LinkLocation2 != NULL)
|
if (m_Section->m_Cont.LinkLocation != nullptr || m_Section->m_Cont.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
JmpLabel8("DoDelaySlot", 0);
|
JmpLabel8("DoDelaySlot", 0);
|
||||||
if (DelayLinkLocation != NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
if (DelayLinkLocation != nullptr) { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
|
DelayLinkLocation = (uint8_t *)(*g_RecompPos - 1);
|
||||||
|
|
||||||
CPU_Message(" ");
|
CPU_Message(" ");
|
||||||
|
@ -643,7 +643,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
FallInfo->RegSet = m_RegWorkingSet;
|
FallInfo->RegSet = m_RegWorkingSet;
|
||||||
if (FallInfo == &m_Section->m_Jump)
|
if (FallInfo == &m_Section->m_Jump)
|
||||||
{
|
{
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", m_Section->m_JumpSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
JmpLabel32(FallInfo->BranchLabel.c_str(), 0);
|
JmpLabel32(FallInfo->BranchLabel.c_str(), 0);
|
||||||
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
FallInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||||
|
|
||||||
if (JumpInfo->LinkLocation != NULL)
|
if (JumpInfo->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
|
CPU_Message(" %s:", JumpInfo->BranchLabel.c_str());
|
||||||
LinkJump(*JumpInfo);
|
LinkJump(*JumpInfo);
|
||||||
|
@ -705,12 +705,12 @@ void CX86RecompilerOps::Compile_Branch(BRANCH_COMPARE CompareType, BRANCH_TYPE B
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Cont.FallThrough = true;
|
m_Section->m_Cont.FallThrough = true;
|
||||||
m_Section->m_Cont.RegSet = m_RegWorkingSet;
|
m_Section->m_Cont.RegSet = m_RegWorkingSet;
|
||||||
if (m_Section->m_ContinueSection == NULL && m_Section->m_JumpSection != NULL)
|
if (m_Section->m_ContinueSection == nullptr && m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_ContinueSection = m_Section->m_JumpSection;
|
m_Section->m_ContinueSection = m_Section->m_JumpSection;
|
||||||
m_Section->m_JumpSection = NULL;
|
m_Section->m_JumpSection = nullptr;
|
||||||
}
|
}
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", m_Section->m_ContinueSection->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -763,7 +763,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_ContinueSection != NULL)
|
if (m_Section->m_ContinueSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
|
m_Section->m_Cont.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_ContinueSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -782,11 +782,11 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
if (Link)
|
if (Link)
|
||||||
{
|
{
|
||||||
|
@ -803,13 +803,13 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.FallThrough)
|
if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL || m_Section->m_Jump.FallThrough)
|
if (m_Section->m_Jump.LinkLocation != nullptr || m_Section->m_Jump.FallThrough)
|
||||||
{
|
{
|
||||||
LinkJump(m_Section->m_Jump);
|
LinkJump(m_Section->m_Jump);
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkJump(m_Section->m_Cont);
|
LinkJump(m_Section->m_Cont);
|
||||||
CompileExit(m_CompilePC, m_CompilePC + 8, m_Section->m_Cont.RegSet, CExitInfo::Normal, true, NULL);
|
CompileExit(m_CompilePC, m_CompilePC + 8, m_Section->m_Cont.RegSet, CExitInfo::Normal, true, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -842,7 +842,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
{
|
{
|
||||||
if (m_Section->m_Cont.FallThrough)
|
if (m_Section->m_Cont.FallThrough)
|
||||||
{
|
{
|
||||||
if (m_Section->m_Jump.LinkLocation != NULL)
|
if (m_Section->m_Jump.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ void CX86RecompilerOps::Compile_BranchLikely(BRANCH_COMPARE CompareType, bool Li
|
||||||
|
|
||||||
void CX86RecompilerOps::BNE_Compare()
|
void CX86RecompilerOps::BNE_Compare()
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
||||||
{
|
{
|
||||||
|
@ -1191,7 +1191,7 @@ void CX86RecompilerOps::BNE_Compare()
|
||||||
|
|
||||||
void CX86RecompilerOps::BEQ_Compare()
|
void CX86RecompilerOps::BEQ_Compare()
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
if (IsKnown(m_Opcode.rs) && IsKnown(m_Opcode.rt))
|
||||||
{
|
{
|
||||||
|
@ -1576,7 +1576,7 @@ void CX86RecompilerOps::BGTZ_Compare()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsMapped(m_Opcode.rs))
|
if (IsMapped(m_Opcode.rs))
|
||||||
{
|
{
|
||||||
|
@ -1709,7 +1709,7 @@ void CX86RecompilerOps::BLEZ_Compare()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (IsMapped(m_Opcode.rs))
|
if (IsMapped(m_Opcode.rs))
|
||||||
{
|
{
|
||||||
|
@ -1773,7 +1773,7 @@ void CX86RecompilerOps::BLEZ_Compare()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8_t *Jump = NULL;
|
uint8_t *Jump = nullptr;
|
||||||
|
|
||||||
if (!g_System->b32BitCore())
|
if (!g_System->b32BitCore())
|
||||||
{
|
{
|
||||||
|
@ -2141,7 +2141,7 @@ void CX86RecompilerOps::J()
|
||||||
|
|
||||||
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
|
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);;
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -2150,8 +2150,8 @@ void CX86RecompilerOps::J()
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
||||||
|
@ -2182,7 +2182,7 @@ void CX86RecompilerOps::JAL()
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
m_Section->m_Jump.TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
|
||||||
m_Section->m_Jump.JumpPC = m_CompilePC;
|
m_Section->m_Jump.JumpPC = m_CompilePC;
|
||||||
if (m_Section->m_JumpSection != NULL)
|
if (m_Section->m_JumpSection != nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
m_Section->m_Jump.BranchLabel.Format("Section_%d", ((CCodeSection *)m_Section->m_JumpSection)->m_SectionID);
|
||||||
}
|
}
|
||||||
|
@ -2191,8 +2191,8 @@ void CX86RecompilerOps::JAL()
|
||||||
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
m_Section->m_Jump.BranchLabel = "ExitBlock";
|
||||||
}
|
}
|
||||||
m_Section->m_Jump.FallThrough = true;
|
m_Section->m_Jump.FallThrough = true;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
else if (m_NextInstruction == DELAY_SLOT_DONE)
|
||||||
|
@ -2216,7 +2216,7 @@ void CX86RecompilerOps::JAL()
|
||||||
bool bCheck = TargetPC <= m_CompilePC;
|
bool bCheck = TargetPC <= m_CompilePC;
|
||||||
UpdateCounters(m_RegWorkingSet, bCheck, true);
|
UpdateCounters(m_RegWorkingSet, bCheck, true);
|
||||||
|
|
||||||
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, bCheck ? CExitInfo::Normal : CExitInfo::Normal_NoSysCheck, true, NULL);
|
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, bCheck ? CExitInfo::Normal : CExitInfo::Normal_NoSysCheck, true, nullptr);
|
||||||
}
|
}
|
||||||
m_NextInstruction = END_BLOCK;
|
m_NextInstruction = END_BLOCK;
|
||||||
}
|
}
|
||||||
|
@ -2349,7 +2349,7 @@ void CX86RecompilerOps::SLTIU()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t * Jump = NULL;
|
uint8_t * Jump = nullptr;
|
||||||
|
|
||||||
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
|
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
|
||||||
JneLabel8("CompareSet", 0);
|
JneLabel8("CompareSet", 0);
|
||||||
|
@ -2445,7 +2445,7 @@ void CX86RecompilerOps::SLTI()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t * Jump[2] = { NULL, NULL };
|
uint8_t * Jump[2] = { nullptr, nullptr };
|
||||||
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
|
CompConstToVariable(((int16_t)m_Opcode.immediate >> 31), &_GPR[m_Opcode.rs].W[1], CRegName::GPR_Hi[m_Opcode.rs]);
|
||||||
JeLabel8("Low Compare", 0);
|
JeLabel8("Low Compare", 0);
|
||||||
Jump[0] = *g_RecompPos - 1;
|
Jump[0] = *g_RecompPos - 1;
|
||||||
|
@ -3349,7 +3349,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_Plugins->Audio()->AiReadLength != NULL)
|
if (g_Plugins->Audio()->AiReadLength != nullptr)
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.BeforeCallDirect();
|
m_RegWorkingSet.BeforeCallDirect();
|
||||||
Call_Direct((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");
|
Call_Direct((void *)g_Plugins->Audio()->AiReadLength, "AiReadLength");
|
||||||
|
@ -3495,7 +3495,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
|
||||||
sprintf(VarName, "RDRAM + %X", PAddr);
|
sprintf(VarName, "RDRAM + %X", PAddr);
|
||||||
MoveVariableToX86reg(PAddr + g_MMU->Rdram(), VarName, Reg);
|
MoveVariableToX86reg(PAddr + g_MMU->Rdram(), VarName, Reg);
|
||||||
}
|
}
|
||||||
else if (g_DDRom != NULL && ((PAddr & 0xFF000000) == 0x06000000 && (PAddr - 0x06000000) < g_DDRom->GetRomSize()))
|
else if (g_DDRom != nullptr && ((PAddr & 0xFF000000) == 0x06000000 && (PAddr - 0x06000000) < g_DDRom->GetRomSize()))
|
||||||
{
|
{
|
||||||
// read from ddrom
|
// read from ddrom
|
||||||
sprintf(VarName, "RDRAM + %X", PAddr);
|
sprintf(VarName, "RDRAM + %X", PAddr);
|
||||||
|
@ -4137,7 +4137,7 @@ void CX86RecompilerOps::SW(bool bCheckLLbit)
|
||||||
ShiftRightUnsignImmed(TempReg2, 12);
|
ShiftRightUnsignImmed(TempReg2, 12);
|
||||||
MoveVariableDispToX86Reg(g_MMU->m_TLB_WriteMap, "MMU->TLB_WriteMap", TempReg2, TempReg2, 4);
|
MoveVariableDispToX86Reg(g_MMU->m_TLB_WriteMap, "MMU->TLB_WriteMap", TempReg2, TempReg2, 4);
|
||||||
CompileWriteTLBMiss(TempReg1, TempReg2);
|
CompileWriteTLBMiss(TempReg1, TempReg2);
|
||||||
uint8_t * Jump = NULL;
|
uint8_t * Jump = nullptr;
|
||||||
if (bCheckLLbit)
|
if (bCheckLLbit)
|
||||||
{
|
{
|
||||||
CompConstToVariable(1, _LLBit, "_LLBit");
|
CompConstToVariable(1, _LLBit, "_LLBit");
|
||||||
|
@ -5161,11 +5161,11 @@ void CX86RecompilerOps::SPECIAL_JR()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
||||||
{
|
{
|
||||||
|
@ -5188,7 +5188,7 @@ void CX86RecompilerOps::SPECIAL_JR()
|
||||||
{
|
{
|
||||||
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
||||||
{
|
{
|
||||||
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
|
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5205,7 +5205,7 @@ void CX86RecompilerOps::SPECIAL_JR()
|
||||||
{
|
{
|
||||||
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
|
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
|
||||||
}
|
}
|
||||||
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
|
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
|
||||||
if (m_Section->m_JumpSection)
|
if (m_Section->m_JumpSection)
|
||||||
{
|
{
|
||||||
m_Section->GenerateSectionLinkage();
|
m_Section->GenerateSectionLinkage();
|
||||||
|
@ -5258,11 +5258,11 @@ void CX86RecompilerOps::SPECIAL_JALR()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Section->m_Jump.FallThrough = false;
|
m_Section->m_Jump.FallThrough = false;
|
||||||
m_Section->m_Jump.LinkLocation = NULL;
|
m_Section->m_Jump.LinkLocation = nullptr;
|
||||||
m_Section->m_Jump.LinkLocation2 = NULL;
|
m_Section->m_Jump.LinkLocation2 = nullptr;
|
||||||
m_Section->m_Cont.FallThrough = false;
|
m_Section->m_Cont.FallThrough = false;
|
||||||
m_Section->m_Cont.LinkLocation = NULL;
|
m_Section->m_Cont.LinkLocation = nullptr;
|
||||||
m_Section->m_Cont.LinkLocation2 = NULL;
|
m_Section->m_Cont.LinkLocation2 = nullptr;
|
||||||
|
|
||||||
m_NextInstruction = DO_DELAY_SLOT;
|
m_NextInstruction = DO_DELAY_SLOT;
|
||||||
}
|
}
|
||||||
|
@ -5270,7 +5270,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
|
||||||
{
|
{
|
||||||
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
if (DelaySlotEffectsCompare(m_CompilePC, m_Opcode.rs, 0))
|
||||||
{
|
{
|
||||||
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
|
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5287,7 +5287,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
|
||||||
{
|
{
|
||||||
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
|
MoveX86regToVariable(Map_TempReg(x86_Any, m_Opcode.rs, false), _PROGRAM_COUNTER, "PROGRAM_COUNTER");
|
||||||
}
|
}
|
||||||
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
|
CompileExit((uint32_t)-1, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
|
||||||
if (m_Section->m_JumpSection)
|
if (m_Section->m_JumpSection)
|
||||||
{
|
{
|
||||||
m_Section->GenerateSectionLinkage();
|
m_Section->GenerateSectionLinkage();
|
||||||
|
@ -5303,7 +5303,7 @@ void CX86RecompilerOps::SPECIAL_JALR()
|
||||||
|
|
||||||
void CX86RecompilerOps::SPECIAL_SYSCALL()
|
void CX86RecompilerOps::SPECIAL_SYSCALL()
|
||||||
{
|
{
|
||||||
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::DoSysCall, true, NULL);
|
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::DoSysCall, true, nullptr);
|
||||||
m_NextInstruction = END_BLOCK;
|
m_NextInstruction = END_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5681,7 +5681,7 @@ void CX86RecompilerOps::SPECIAL_DIVU()
|
||||||
MoveConstToVariable(0, &_RegHI->UW[1], "_RegHI->UW[1]");
|
MoveConstToVariable(0, &_RegHI->UW[1], "_RegHI->UW[1]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Jump[1] = NULL;
|
Jump[1] = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5731,7 +5731,7 @@ void CX86RecompilerOps::SPECIAL_DIVU()
|
||||||
MoveX86regToVariable(x86_EAX, &_RegLO->UW[1], "_RegLO->UW[1]");
|
MoveX86regToVariable(x86_EAX, &_RegLO->UW[1], "_RegLO->UW[1]");
|
||||||
MoveX86regToVariable(x86_EDX, &_RegHI->UW[1], "_RegHI->UW[1]");
|
MoveX86regToVariable(x86_EDX, &_RegHI->UW[1], "_RegHI->UW[1]");
|
||||||
|
|
||||||
if (Jump[1] != NULL)
|
if (Jump[1] != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message("");
|
CPU_Message("");
|
||||||
CPU_Message(" EndDivu:");
|
CPU_Message(" EndDivu:");
|
||||||
|
@ -7018,7 +7018,7 @@ void CX86RecompilerOps::SPECIAL_SLT()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump[2] = { NULL, NULL };
|
uint8_t *Jump[2] = { nullptr, nullptr };
|
||||||
|
|
||||||
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
|
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
|
||||||
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
|
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
|
||||||
|
@ -7195,7 +7195,7 @@ void CX86RecompilerOps::SPECIAL_SLTU()
|
||||||
{
|
{
|
||||||
uint32_t KnownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rt : m_Opcode.rs;
|
uint32_t KnownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rt : m_Opcode.rs;
|
||||||
uint32_t UnknownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rs : m_Opcode.rt;
|
uint32_t UnknownReg = IsKnown(m_Opcode.rt) ? m_Opcode.rs : m_Opcode.rt;
|
||||||
uint8_t *Jump[2] = { NULL, NULL };
|
uint8_t *Jump[2] = { nullptr, nullptr };
|
||||||
|
|
||||||
ProtectGPR(KnownReg);
|
ProtectGPR(KnownReg);
|
||||||
if (g_System->b32BitCore())
|
if (g_System->b32BitCore())
|
||||||
|
@ -7298,7 +7298,7 @@ void CX86RecompilerOps::SPECIAL_SLTU()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint8_t *Jump[2] = { NULL, NULL };
|
uint8_t *Jump[2] = { nullptr, nullptr };
|
||||||
|
|
||||||
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
|
x86Reg Reg = Map_TempReg(x86_Any, m_Opcode.rs, true);
|
||||||
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
|
CompX86regToVariable(Reg, &_GPR[m_Opcode.rt].W[1], CRegName::GPR_Hi[m_Opcode.rt]);
|
||||||
|
@ -8171,7 +8171,7 @@ void CX86RecompilerOps::COP0_CO_ERET(void)
|
||||||
Call_Direct((void *)x86_compiler_COP0_CO_ERET, "x86_compiler_COP0_CO_ERET");
|
Call_Direct((void *)x86_compiler_COP0_CO_ERET, "x86_compiler_COP0_CO_ERET");
|
||||||
|
|
||||||
UpdateCounters(m_RegWorkingSet, true, true);
|
UpdateCounters(m_RegWorkingSet, true, true);
|
||||||
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, NULL);
|
CompileExit(m_CompilePC, (uint32_t)-1, m_RegWorkingSet, CExitInfo::Normal, true, nullptr);
|
||||||
m_NextInstruction = END_BLOCK;
|
m_NextInstruction = END_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9259,7 +9259,7 @@ void CX86RecompilerOps::CompileExitCode()
|
||||||
CPU_Message(" $Exit_%d", ExitIter->ID);
|
CPU_Message(" $Exit_%d", ExitIter->ID);
|
||||||
SetJump32(ExitIter->JumpLoc, (uint32_t *)*g_RecompPos);
|
SetJump32(ExitIter->JumpLoc, (uint32_t *)*g_RecompPos);
|
||||||
m_NextInstruction = ExitIter->NextInstruction;
|
m_NextInstruction = ExitIter->NextInstruction;
|
||||||
CompileExit((uint32_t)-1, ExitIter->TargetPC, ExitIter->ExitRegSet, ExitIter->reason, true, NULL);
|
CompileExit((uint32_t)-1, ExitIter->TargetPC, ExitIter->ExitRegSet, ExitIter->reason, true, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9552,11 +9552,11 @@ void CX86RecompilerOps::SetRegWorkingSet(const CRegInfo & RegInfo)
|
||||||
|
|
||||||
bool CX86RecompilerOps::InheritParentInfo()
|
bool CX86RecompilerOps::InheritParentInfo()
|
||||||
{
|
{
|
||||||
if (m_Section->m_CompiledLocation == NULL)
|
if (m_Section->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
m_Section->m_CompiledLocation = *g_RecompPos;
|
m_Section->m_CompiledLocation = *g_RecompPos;
|
||||||
m_Section->DisplaySectionInformation();
|
m_Section->DisplaySectionInformation();
|
||||||
m_Section->m_CompiledLocation = NULL;
|
m_Section->m_CompiledLocation = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9572,7 +9572,7 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
if (m_Section->m_ParentSection.size() == 1)
|
if (m_Section->m_ParentSection.size() == 1)
|
||||||
{
|
{
|
||||||
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
|
CCodeSection * Parent = *(m_Section->m_ParentSection.begin());
|
||||||
if (Parent->m_CompiledLocation == NULL)
|
if (Parent->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -9592,7 +9592,7 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
BLOCK_PARENT BlockParent;
|
BLOCK_PARENT BlockParent;
|
||||||
|
|
||||||
if (Parent->m_CompiledLocation == NULL) { continue; }
|
if (Parent->m_CompiledLocation == nullptr) { continue; }
|
||||||
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
||||||
{
|
{
|
||||||
BlockParent.Parent = Parent;
|
BlockParent.Parent = Parent;
|
||||||
|
@ -9622,7 +9622,7 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
CCodeSection * Parent = *iter;
|
CCodeSection * Parent = *iter;
|
||||||
BLOCK_PARENT BlockParent;
|
BLOCK_PARENT BlockParent;
|
||||||
|
|
||||||
if (Parent->m_CompiledLocation != NULL) { continue; }
|
if (Parent->m_CompiledLocation != nullptr) { continue; }
|
||||||
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
if (Parent->m_JumpSection != Parent->m_ContinueSection)
|
||||||
{
|
{
|
||||||
BlockParent.Parent = Parent;
|
BlockParent.Parent = Parent;
|
||||||
|
@ -9708,7 +9708,7 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
|
|
||||||
if (i == (size_t)FirstParent) { continue; }
|
if (i == (size_t)FirstParent) { continue; }
|
||||||
Parent = ParentList[i].Parent;
|
Parent = ParentList[i].Parent;
|
||||||
if (Parent->m_CompiledLocation == NULL)
|
if (Parent->m_CompiledLocation == nullptr)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -9915,20 +9915,20 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
||||||
JmpLabel32(Label.c_str(), 0);
|
JmpLabel32(Label.c_str(), 0);
|
||||||
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
JumpInfo->LinkLocation = (uint32_t *)(*g_RecompPos - 4);
|
||||||
JumpInfo->LinkLocation2 = NULL;
|
JumpInfo->LinkLocation2 = nullptr;
|
||||||
|
|
||||||
CurrentParent = i;
|
CurrentParent = i;
|
||||||
Parent = ParentList[CurrentParent].Parent;
|
Parent = ParentList[CurrentParent].Parent;
|
||||||
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
JumpInfo = ParentList[CurrentParent].JumpInfo;
|
||||||
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
|
CPU_Message(" Section_%d (from %d):", m_Section->m_SectionID, Parent->m_SectionID);
|
||||||
if (JumpInfo->LinkLocation != NULL)
|
if (JumpInfo->LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo->LinkLocation, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo->LinkLocation = NULL;
|
JumpInfo->LinkLocation = nullptr;
|
||||||
if (JumpInfo->LinkLocation2 != NULL)
|
if (JumpInfo->LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo->LinkLocation2, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo->LinkLocation2 = NULL;
|
JumpInfo->LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9961,7 +9961,7 @@ bool CX86RecompilerOps::InheritParentInfo()
|
||||||
|
|
||||||
void CX86RecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
|
void CX86RecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint32_t FromSectionID)
|
||||||
{
|
{
|
||||||
if (JumpInfo.LinkLocation != NULL)
|
if (JumpInfo.LinkLocation != nullptr)
|
||||||
{
|
{
|
||||||
if (SectionID != -1)
|
if (SectionID != -1)
|
||||||
{
|
{
|
||||||
|
@ -9975,11 +9975,11 @@ void CX86RecompilerOps::LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID, uint3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetJump32(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo.LinkLocation, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo.LinkLocation = NULL;
|
JumpInfo.LinkLocation = nullptr;
|
||||||
if (JumpInfo.LinkLocation2 != NULL)
|
if (JumpInfo.LinkLocation2 != nullptr)
|
||||||
{
|
{
|
||||||
SetJump32(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
|
SetJump32(JumpInfo.LinkLocation2, (uint32_t *)*g_RecompPos);
|
||||||
JumpInfo.LinkLocation2 = NULL;
|
JumpInfo.LinkLocation2 = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10231,7 +10231,7 @@ void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
|
||||||
|
|
||||||
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason)
|
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason)
|
||||||
{
|
{
|
||||||
CompileExit(JumpPC, TargetPC, ExitRegSet, reason, true, NULL);
|
CompileExit(JumpPC, TargetPC, ExitRegSet, reason, true, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value))
|
void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value))
|
||||||
|
@ -10240,7 +10240,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
||||||
{
|
{
|
||||||
char String[100];
|
char String[100];
|
||||||
sprintf(String, "Exit_%d", m_ExitInfo.size());
|
sprintf(String, "Exit_%d", m_ExitInfo.size());
|
||||||
if (x86Jmp == NULL)
|
if (x86Jmp == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
|
@ -10314,7 +10314,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
||||||
// uint32_t pAddr = TargetPC & 0x1FFFFFFF;
|
// uint32_t pAddr = TargetPC & 0x1FFFFFFF;
|
||||||
//
|
//
|
||||||
// MoveVariableToX86reg((uint8_t *)RDRAM + pAddr,"RDRAM + pAddr",x86_EAX);
|
// MoveVariableToX86reg((uint8_t *)RDRAM + pAddr,"RDRAM + pAddr",x86_EAX);
|
||||||
// Jump2 = NULL;
|
// Jump2 = nullptr;
|
||||||
// } else {
|
// } else {
|
||||||
// MoveConstToX86reg((TargetPC >> 12),x86_ECX);
|
// MoveConstToX86reg((TargetPC >> 12),x86_ECX);
|
||||||
// MoveConstToX86reg(TargetPC,x86_EBX);
|
// MoveConstToX86reg(TargetPC,x86_EBX);
|
||||||
|
@ -10336,7 +10336,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
||||||
// JmpDirectReg(x86_ECX);
|
// JmpDirectReg(x86_ECX);
|
||||||
// CPU_Message(" NoCode:");
|
// CPU_Message(" NoCode:");
|
||||||
// *((uint8_t *)(Jump))=(uint8_t)(*g_RecompPos - Jump - 1);
|
// *((uint8_t *)(Jump))=(uint8_t)(*g_RecompPos - Jump - 1);
|
||||||
// if (Jump2 != NULL) {
|
// if (Jump2 != nullptr) {
|
||||||
// CPU_Message(" NoTlbEntry:");
|
// CPU_Message(" NoTlbEntry:");
|
||||||
// *((uint8_t *)(Jump2))=(uint8_t)(*g_RecompPos - Jump2 - 1);
|
// *((uint8_t *)(Jump2))=(uint8_t)(*g_RecompPos - Jump2 - 1);
|
||||||
// }
|
// }
|
||||||
|
@ -10356,7 +10356,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
||||||
}
|
}
|
||||||
else if (LookUpMode() == FuncFind_PhysicalLookup)
|
else if (LookUpMode() == FuncFind_PhysicalLookup)
|
||||||
{
|
{
|
||||||
uint8_t * Jump2 = NULL;
|
uint8_t * Jump2 = nullptr;
|
||||||
if (TargetPC >= 0x80000000 && TargetPC < 0x90000000)
|
if (TargetPC >= 0x80000000 && TargetPC < 0x90000000)
|
||||||
{
|
{
|
||||||
uint32_t pAddr = TargetPC & 0x1FFFFFFF;
|
uint32_t pAddr = TargetPC & 0x1FFFFFFF;
|
||||||
|
@ -10384,7 +10384,7 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
|
||||||
JmpDirectReg(x86_EAX);
|
JmpDirectReg(x86_EAX);
|
||||||
CPU_Message(" NullPointer:");
|
CPU_Message(" NullPointer:");
|
||||||
*((uint8_t *)(Jump)) = (uint8_t)(*g_RecompPos - Jump - 1);
|
*((uint8_t *)(Jump)) = (uint8_t)(*g_RecompPos - Jump - 1);
|
||||||
if (Jump2 != NULL)
|
if (Jump2 != nullptr)
|
||||||
{
|
{
|
||||||
CPU_Message(" NoTlbEntry:");
|
CPU_Message(" NoTlbEntry:");
|
||||||
*((uint8_t *)(Jump2)) = (uint8_t)(*g_RecompPos - Jump2 - 1);
|
*((uint8_t *)(Jump2)) = (uint8_t)(*g_RecompPos - Jump2 - 1);
|
||||||
|
@ -11014,7 +11014,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
||||||
switch (PAddr)
|
switch (PAddr)
|
||||||
{
|
{
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
|
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
CompConstToVariable(Value, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
|
CompConstToVariable(Value, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
|
||||||
JeLabel8("Continue", 0);
|
JeLabel8("Continue", 0);
|
||||||
|
@ -11030,7 +11030,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
||||||
break;
|
break;
|
||||||
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
|
case 0x04400004: MoveConstToVariable((Value & 0xFFFFFF), &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG"); break;
|
||||||
case 0x04400008:
|
case 0x04400008:
|
||||||
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
|
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
|
||||||
{
|
{
|
||||||
CompConstToVariable(Value, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
|
CompConstToVariable(Value, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
|
||||||
JeLabel8("Continue", 0);
|
JeLabel8("Continue", 0);
|
||||||
|
@ -11473,7 +11473,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
switch (PAddr) {
|
switch (PAddr) {
|
||||||
case 0x04400000:
|
case 0x04400000:
|
||||||
if (g_Plugins->Gfx()->ViStatusChanged != NULL)
|
if (g_Plugins->Gfx()->ViStatusChanged != nullptr)
|
||||||
{
|
{
|
||||||
uint8_t * Jump;
|
uint8_t * Jump;
|
||||||
CompX86regToVariable(Reg, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
|
CompX86regToVariable(Reg, &g_Reg->VI_STATUS_REG, "VI_STATUS_REG");
|
||||||
|
@ -11493,7 +11493,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
|
||||||
AndConstToVariable(0xFFFFFF, &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG");
|
AndConstToVariable(0xFFFFFF, &g_Reg->VI_ORIGIN_REG, "VI_ORIGIN_REG");
|
||||||
break;
|
break;
|
||||||
case 0x04400008:
|
case 0x04400008:
|
||||||
if (g_Plugins->Gfx()->ViWidthChanged != NULL)
|
if (g_Plugins->Gfx()->ViWidthChanged != nullptr)
|
||||||
{
|
{
|
||||||
uint8_t * Jump;
|
uint8_t * Jump;
|
||||||
CompX86regToVariable(Reg, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
|
CompX86regToVariable(Reg, &g_Reg->VI_WIDTH_REG, "VI_WIDTH_REG");
|
||||||
|
|
|
@ -4261,7 +4261,7 @@ void CX86Ops::SetJump32(uint32_t * Loc, uint32_t * JumpLoc)
|
||||||
|
|
||||||
void CX86Ops::SetJump8(uint8_t * Loc, uint8_t * JumpLoc)
|
void CX86Ops::SetJump8(uint8_t * Loc, uint8_t * JumpLoc)
|
||||||
{
|
{
|
||||||
if (Loc == NULL || JumpLoc == NULL)
|
if (Loc == nullptr || JumpLoc == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
|
@ -4289,7 +4289,7 @@ void * CX86Ops::GetAddressOf(int value, ...)
|
||||||
void CX86Ops::AddCode8(uint8_t value)
|
void CX86Ops::AddCode8(uint8_t value)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (g_RecompPos == NULL)
|
if (g_RecompPos == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
@ -4301,7 +4301,7 @@ void CX86Ops::AddCode8(uint8_t value)
|
||||||
void CX86Ops::AddCode16(uint16_t value)
|
void CX86Ops::AddCode16(uint16_t value)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (g_RecompPos == NULL)
|
if (g_RecompPos == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
@ -4313,7 +4313,7 @@ void CX86Ops::AddCode16(uint16_t value)
|
||||||
void CX86Ops::AddCode32(uint32_t value)
|
void CX86Ops::AddCode32(uint32_t value)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (g_RecompPos == NULL)
|
if (g_RecompPos == nullptr)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
|
||||||
if (CurrentTimeValue - LastTime >= 1000000)
|
if (CurrentTimeValue - LastTime >= 1000000)
|
||||||
{
|
{
|
||||||
/* Output FPS */
|
/* Output FPS */
|
||||||
if (FrameRate != NULL) { *FrameRate = m_Frames; }
|
if (FrameRate != nullptr) { *FrameRate = m_Frames; }
|
||||||
m_Frames = 0;
|
m_Frames = 0;
|
||||||
m_LastTime = CurrentTime;
|
m_LastTime = CurrentTime;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SystemGlobals.h"
|
#include "SystemGlobals.h"
|
||||||
|
|
||||||
CN64System * g_System = NULL;
|
CN64System * g_System = nullptr;
|
||||||
CN64System * g_BaseSystem = NULL;
|
CN64System * g_BaseSystem = nullptr;
|
||||||
CN64System * g_SyncSystem = NULL;
|
CN64System * g_SyncSystem = nullptr;
|
||||||
CRecompiler * g_Recompiler = NULL;
|
CRecompiler * g_Recompiler = nullptr;
|
||||||
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
|
CMipsMemoryVM * g_MMU = nullptr; //Memory of the n64
|
||||||
CTLB * g_TLB = NULL; //TLB Unit
|
CTLB * g_TLB = nullptr; //TLB Unit
|
||||||
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
CRegisters * g_Reg = nullptr; //Current Register Set attacted to the g_MMU
|
||||||
CNotification * g_Notify = NULL;
|
CNotification * g_Notify = nullptr;
|
||||||
CPlugins * g_Plugins = NULL;
|
CPlugins * g_Plugins = nullptr;
|
||||||
CN64Rom * g_Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
CN64Rom * g_Rom = nullptr; //The current rom that this system is executing.. it can only execute one file at the time
|
||||||
CN64Rom * g_DDRom = NULL; //64DD IPL ROM
|
CN64Rom * g_DDRom = nullptr; //64DD IPL ROM
|
||||||
CN64Disk * g_Disk = NULL; //64DD DISK
|
CN64Disk * g_Disk = nullptr; //64DD DISK
|
||||||
CAudio * g_Audio = NULL;
|
CAudio * g_Audio = nullptr;
|
||||||
CSystemTimer * g_SystemTimer = NULL;
|
CSystemTimer * g_SystemTimer = nullptr;
|
||||||
CTransVaddr * g_TransVaddr = NULL;
|
CTransVaddr * g_TransVaddr = nullptr;
|
||||||
CSystemEvents * g_SystemEvents = NULL;
|
CSystemEvents * g_SystemEvents = nullptr;
|
||||||
uint32_t * g_TLBLoadAddress = NULL;
|
uint32_t * g_TLBLoadAddress = nullptr;
|
||||||
uint32_t * g_TLBStoreAddress = NULL;
|
uint32_t * g_TLBStoreAddress = nullptr;
|
||||||
CDebugger * g_Debugger = NULL;
|
CDebugger * g_Debugger = nullptr;
|
||||||
uint8_t ** g_RecompPos = NULL;
|
uint8_t ** g_RecompPos = nullptr;
|
||||||
CMempak * g_Mempak = NULL;
|
CMempak * g_Mempak = nullptr;
|
||||||
CRandom * g_Random = NULL;
|
CRandom * g_Random = nullptr;
|
||||||
CEnhancements * g_Enhancements = NULL;
|
CEnhancements * g_Enhancements = nullptr;
|
||||||
|
|
||||||
int * g_NextTimer;
|
int * g_NextTimer;
|
|
@ -11,18 +11,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CAudioPlugin::CAudioPlugin() :
|
CAudioPlugin::CAudioPlugin() :
|
||||||
AiLenChanged(NULL),
|
AiLenChanged(nullptr),
|
||||||
AiReadLength(NULL),
|
AiReadLength(nullptr),
|
||||||
ProcessAList(NULL),
|
ProcessAList(nullptr),
|
||||||
m_hAudioThread(NULL),
|
m_hAudioThread(nullptr),
|
||||||
AiUpdate(NULL),
|
AiUpdate(nullptr),
|
||||||
AiDacrateChanged(NULL)
|
AiDacrateChanged(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioPlugin::~CAudioPlugin()
|
CAudioPlugin::~CAudioPlugin()
|
||||||
{
|
{
|
||||||
Close(NULL);
|
Close(nullptr);
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,15 +40,15 @@ bool CAudioPlugin::LoadFunctions(void)
|
||||||
LoadFunction(ProcessAList);
|
LoadFunction(ProcessAList);
|
||||||
|
|
||||||
// Make sure dll has all needed functions
|
// Make sure dll has all needed functions
|
||||||
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
|
if (AiDacrateChanged == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
|
if (AiLenChanged == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
|
if (AiReadLength == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
|
if (InitiateAudio == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessAList == nullptr) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -86,23 +86,23 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||||
LoadFunction(InitiateAudio);
|
LoadFunction(InitiateAudio);
|
||||||
if (InitiateAudio == NULL) { return false; }
|
if (InitiateAudio == nullptr) { return false; }
|
||||||
|
|
||||||
AUDIO_INFO Info = { 0 };
|
AUDIO_INFO Info = { 0 };
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
|
Info.hwnd = Window ? Window->GetWindowHandle() : nullptr;
|
||||||
Info.hinst = Window ? Window->GetModuleInstance() : NULL;
|
Info.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
||||||
#else
|
#else
|
||||||
Info.hwnd = NULL;
|
Info.hwnd = nullptr;
|
||||||
Info.hinst = NULL;
|
Info.hinst = nullptr;
|
||||||
#endif
|
#endif
|
||||||
Info.MemoryBswaped = true;
|
Info.MemoryBswaped = true;
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. just needed to we can config the DLL.
|
// parameters here.. just needed to we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == nullptr)
|
||||||
{
|
{
|
||||||
static uint8_t Buffer[100];
|
static uint8_t Buffer[100];
|
||||||
static uint32_t Value = 0;
|
static uint32_t Value = 0;
|
||||||
|
@ -125,7 +125,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
CRegisters & Reg = System->m_Reg;
|
CRegisters & Reg = System->m_Reg;
|
||||||
|
|
||||||
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
|
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
|
||||||
Info.HEADER = g_Disk->GetDiskHeader();
|
Info.HEADER = g_Disk->GetDiskHeader();
|
||||||
else
|
else
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
|
@ -144,7 +144,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
m_Initialized = InitiateAudio(Info) != 0;
|
m_Initialized = InitiateAudio(Info) != 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (System != NULL)
|
if (System != nullptr)
|
||||||
{
|
{
|
||||||
if (AiUpdate)
|
if (AiUpdate)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
TerminateThread(m_hAudioThread, 0);
|
TerminateThread(m_hAudioThread, 0);
|
||||||
}
|
}
|
||||||
DWORD ThreadID;
|
DWORD ThreadID;
|
||||||
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
m_hAudioThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System->m_Reg.AI_DACRATE_REG != 0)
|
if (System->m_Reg.AI_DACRATE_REG != 0)
|
||||||
|
@ -173,14 +173,14 @@ void CAudioPlugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||||
TerminateThread(m_hAudioThread, 0);
|
TerminateThread(m_hAudioThread, 0);
|
||||||
m_hAudioThread = NULL;
|
m_hAudioThread = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
AiDacrateChanged = NULL;
|
AiDacrateChanged = nullptr;
|
||||||
AiLenChanged = NULL;
|
AiLenChanged = nullptr;
|
||||||
AiReadLength = NULL;
|
AiReadLength = nullptr;
|
||||||
AiUpdate = NULL;
|
AiUpdate = nullptr;
|
||||||
ProcessAList = NULL;
|
ProcessAList = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
#include "ControllerPlugin.h"
|
#include "ControllerPlugin.h"
|
||||||
|
|
||||||
CControl_Plugin::CControl_Plugin(void) :
|
CControl_Plugin::CControl_Plugin(void) :
|
||||||
WM_KeyDown(NULL),
|
WM_KeyDown(nullptr),
|
||||||
WM_KeyUp(NULL),
|
WM_KeyUp(nullptr),
|
||||||
RumbleCommand(NULL),
|
RumbleCommand(nullptr),
|
||||||
GetKeys(NULL),
|
GetKeys(nullptr),
|
||||||
ReadController(NULL),
|
ReadController(nullptr),
|
||||||
ControllerCommand(NULL),
|
ControllerCommand(nullptr),
|
||||||
m_AllocatedControllers(false)
|
m_AllocatedControllers(false)
|
||||||
{
|
{
|
||||||
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
||||||
|
@ -19,7 +19,7 @@ CControl_Plugin::CControl_Plugin(void) :
|
||||||
|
|
||||||
CControl_Plugin::~CControl_Plugin()
|
CControl_Plugin::~CControl_Plugin()
|
||||||
{
|
{
|
||||||
Close(NULL);
|
Close(nullptr);
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ bool CControl_Plugin::LoadFunctions(void)
|
||||||
LoadFunction(RumbleCommand);
|
LoadFunction(RumbleCommand);
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
|
if (InitiateControllers == nullptr) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate our own controller
|
// Allocate our own controller
|
||||||
|
@ -69,11 +69,11 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_0);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_0);
|
||||||
if (InitiateControllers_1_0 == NULL) { return false; }
|
if (InitiateControllers_1_0 == nullptr) { return false; }
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
||||||
#else
|
#else
|
||||||
InitiateControllers_1_0(NULL, m_PluginControllers);
|
InitiateControllers_1_0(nullptr, m_PluginControllers);
|
||||||
#endif
|
#endif
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -81,13 +81,13 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
CONTROL_INFO ControlInfo;
|
CONTROL_INFO ControlInfo;
|
||||||
ControlInfo.Controls = m_PluginControllers;
|
ControlInfo.Controls = m_PluginControllers;
|
||||||
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress());
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
|
ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
||||||
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
|
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : nullptr;
|
||||||
#else
|
#else
|
||||||
ControlInfo.hinst = NULL;
|
ControlInfo.hinst = nullptr;
|
||||||
ControlInfo.hMainWindow = NULL;
|
ControlInfo.hMainWindow = nullptr;
|
||||||
#endif
|
#endif
|
||||||
ControlInfo.MemoryBswaped = true;
|
ControlInfo.MemoryBswaped = true;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_1);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_1);
|
||||||
if (InitiateControllers_1_1 == NULL) { return false; }
|
if (InitiateControllers_1_1 == nullptr) { return false; }
|
||||||
|
|
||||||
InitiateControllers_1_1(ControlInfo);
|
InitiateControllers_1_1(ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
@ -106,7 +106,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_2);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_2);
|
||||||
if (InitiateControllers_1_2 == NULL) { return false; }
|
if (InitiateControllers_1_2 == nullptr) { return false; }
|
||||||
|
|
||||||
InitiateControllers_1_2(&ControlInfo);
|
InitiateControllers_1_2(&ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
@ -122,16 +122,16 @@ void CControl_Plugin::UnloadPluginDetails(void)
|
||||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||||
{
|
{
|
||||||
delete m_Controllers[count];
|
delete m_Controllers[count];
|
||||||
m_Controllers[count] = NULL;
|
m_Controllers[count] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_AllocatedControllers = false;
|
m_AllocatedControllers = false;
|
||||||
ControllerCommand = NULL;
|
ControllerCommand = nullptr;
|
||||||
GetKeys = NULL;
|
GetKeys = nullptr;
|
||||||
ReadController = NULL;
|
ReadController = nullptr;
|
||||||
WM_KeyDown = NULL;
|
WM_KeyDown = nullptr;
|
||||||
WM_KeyUp = NULL;
|
WM_KeyUp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::UpdateKeys(void)
|
void CControl_Plugin::UpdateKeys(void)
|
||||||
|
@ -149,7 +149,7 @@ void CControl_Plugin::UpdateKeys(void)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ReadController) { ReadController(-1, NULL); }
|
if (ReadController) { ReadController(-1, nullptr); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||||
|
@ -159,7 +159,7 @@ void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||||
{
|
{
|
||||||
delete m_Controllers[count];
|
delete m_Controllers[count];
|
||||||
m_Controllers[count] = NULL;
|
m_Controllers[count] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_AllocatedControllers = false;
|
m_AllocatedControllers = false;
|
||||||
|
|
|
@ -8,22 +8,22 @@
|
||||||
#include "GFXPlugin.h"
|
#include "GFXPlugin.h"
|
||||||
|
|
||||||
CGfxPlugin::CGfxPlugin() :
|
CGfxPlugin::CGfxPlugin() :
|
||||||
CaptureScreen(NULL),
|
CaptureScreen(nullptr),
|
||||||
ChangeWindow(NULL),
|
ChangeWindow(nullptr),
|
||||||
DrawScreen(NULL),
|
DrawScreen(nullptr),
|
||||||
DrawStatus(NULL),
|
DrawStatus(nullptr),
|
||||||
MoveScreen(NULL),
|
MoveScreen(nullptr),
|
||||||
ProcessDList(NULL),
|
ProcessDList(nullptr),
|
||||||
ProcessRDPList(NULL),
|
ProcessRDPList(nullptr),
|
||||||
ShowCFB(NULL),
|
ShowCFB(nullptr),
|
||||||
UpdateScreen(NULL),
|
UpdateScreen(nullptr),
|
||||||
ViStatusChanged(NULL),
|
ViStatusChanged(nullptr),
|
||||||
ViWidthChanged(NULL),
|
ViWidthChanged(nullptr),
|
||||||
SoftReset(NULL),
|
SoftReset(nullptr),
|
||||||
GetRomBrowserMenu(NULL),
|
GetRomBrowserMenu(nullptr),
|
||||||
OnRomBrowserMenuItem(NULL),
|
OnRomBrowserMenuItem(nullptr),
|
||||||
GetDebugInfo(NULL),
|
GetDebugInfo(nullptr),
|
||||||
InitiateDebugger(NULL)
|
InitiateDebugger(nullptr)
|
||||||
{
|
{
|
||||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ InitiateDebugger(NULL)
|
||||||
CGfxPlugin::~CGfxPlugin()
|
CGfxPlugin::~CGfxPlugin()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Start");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Start");
|
||||||
Close(NULL);
|
Close(nullptr);
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
@ -62,15 +62,15 @@ bool CGfxPlugin::LoadFunctions(void)
|
||||||
LoadFunction(OnRomBrowserMenuItem);
|
LoadFunction(OnRomBrowserMenuItem);
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
|
if (ChangeWindow == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
|
if (DrawScreen == nullptr) { DrawScreen = DummyDrawScreen; }
|
||||||
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
|
if (InitiateGFX == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
|
if (MoveScreen == nullptr) { MoveScreen = DummyMoveScreen; }
|
||||||
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessDList == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
|
if (UpdateScreen == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
|
if (ViStatusChanged == nullptr) { ViStatusChanged = DummyViStatusChanged; }
|
||||||
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
|
if (ViWidthChanged == nullptr) { ViWidthChanged = DummyViWidthChanged; }
|
||||||
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
|
if (SoftReset == nullptr) { SoftReset = DummySoftReset; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0103)
|
if (m_PluginInfo.Version >= 0x0103)
|
||||||
{
|
{
|
||||||
|
@ -80,17 +80,17 @@ bool CGfxPlugin::LoadFunctions(void)
|
||||||
LoadFunction(GetDebugInfo);
|
LoadFunction(GetDebugInfo);
|
||||||
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
||||||
|
|
||||||
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessRDPList == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
|
if (CaptureScreen == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
|
if (ShowCFB == nullptr) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0104)
|
if (m_PluginInfo.Version >= 0x0104)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetDebugInfo != NULL)
|
if (GetDebugInfo != nullptr)
|
||||||
{
|
{
|
||||||
GetDebugInfo(&m_GFXDebug);
|
GetDebugInfo(&m_GFXDebug);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void * hWnd; /* Render window */
|
void * hWnd; /* Render window */
|
||||||
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
|
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
|
||||||
|
|
||||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||||
// bswap on a dword (32 bits) boundry
|
// bswap on a dword (32 bits) boundry
|
||||||
|
@ -162,7 +162,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
||||||
_LoadFunction("InitiateGFX", InitiateGFX);
|
_LoadFunction("InitiateGFX", InitiateGFX);
|
||||||
if (InitiateGFX == NULL)
|
if (InitiateGFX == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Failed to find InitiateGFX");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Failed to find InitiateGFX");
|
||||||
return false;
|
return false;
|
||||||
|
@ -174,10 +174,10 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
#if defined(ANDROID) || defined(__ANDROID__)
|
#if defined(ANDROID) || defined(__ANDROID__)
|
||||||
Info.SwapBuffers = SwapBuffers;
|
Info.SwapBuffers = SwapBuffers;
|
||||||
#endif
|
#endif
|
||||||
Info.hWnd = NULL;
|
Info.hWnd = nullptr;
|
||||||
Info.hStatusBar = NULL;
|
Info.hStatusBar = nullptr;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (Window != NULL)
|
if (Window != nullptr)
|
||||||
{
|
{
|
||||||
Info.hWnd = Window->GetWindowHandle();
|
Info.hWnd = Window->GetWindowHandle();
|
||||||
Info.hStatusBar = Window->GetStatusBar();
|
Info.hStatusBar = Window->GetStatusBar();
|
||||||
|
@ -188,7 +188,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. it's just needed so we can config the DLL.
|
// parameters here.. it's just needed so we can config the DLL.
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "System = %X", System);
|
WriteTrace(TraceGFXPlugin, TraceDebug, "System = %X", System);
|
||||||
if (System == NULL)
|
if (System == nullptr)
|
||||||
{
|
{
|
||||||
static uint8_t Buffer[100];
|
static uint8_t Buffer[100];
|
||||||
static uint32_t Value = 0;
|
static uint32_t Value = 0;
|
||||||
|
@ -219,7 +219,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
CRegisters & Reg = System->m_Reg;
|
CRegisters & Reg = System->m_Reg;
|
||||||
|
|
||||||
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
|
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
|
||||||
Info.HEADER = g_Disk->GetDiskHeader();
|
Info.HEADER = g_Disk->GetDiskHeader();
|
||||||
else
|
else
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
|
@ -261,30 +261,30 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
void CGfxPlugin::UnloadPluginDetails(void)
|
void CGfxPlugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "start");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "start");
|
||||||
if (m_LibHandle != NULL)
|
if (m_LibHandle != nullptr)
|
||||||
{
|
{
|
||||||
pjutil::DynLibClose(m_LibHandle);
|
pjutil::DynLibClose(m_LibHandle);
|
||||||
m_LibHandle = NULL;
|
m_LibHandle = nullptr;
|
||||||
}
|
}
|
||||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||||
|
|
||||||
// CaptureScreen = NULL;
|
// CaptureScreen = nullptr;
|
||||||
ChangeWindow = NULL;
|
ChangeWindow = nullptr;
|
||||||
GetDebugInfo = NULL;
|
GetDebugInfo = nullptr;
|
||||||
DrawScreen = NULL;
|
DrawScreen = nullptr;
|
||||||
DrawStatus = NULL;
|
DrawStatus = nullptr;
|
||||||
// FrameBufferRead = NULL;
|
// FrameBufferRead = nullptr;
|
||||||
// FrameBufferWrite = NULL;
|
// FrameBufferWrite = nullptr;
|
||||||
InitiateDebugger = NULL;
|
InitiateDebugger = nullptr;
|
||||||
MoveScreen = NULL;
|
MoveScreen = nullptr;
|
||||||
ProcessDList = NULL;
|
ProcessDList = nullptr;
|
||||||
ProcessRDPList = NULL;
|
ProcessRDPList = nullptr;
|
||||||
ShowCFB = NULL;
|
ShowCFB = nullptr;
|
||||||
UpdateScreen = NULL;
|
UpdateScreen = nullptr;
|
||||||
ViStatusChanged = NULL;
|
ViStatusChanged = nullptr;
|
||||||
ViWidthChanged = NULL;
|
ViWidthChanged = nullptr;
|
||||||
GetRomBrowserMenu = NULL;
|
GetRomBrowserMenu = nullptr;
|
||||||
OnRomBrowserMenuItem = NULL;
|
OnRomBrowserMenuItem = nullptr;
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,9 +299,9 @@ void CGfxPlugin::ProcessMenuItem(int32_t id)
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
void CGfxPlugin::SwapBuffers(void)
|
void CGfxPlugin::SwapBuffers(void)
|
||||||
{
|
{
|
||||||
RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : NULL;
|
RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : nullptr;
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Start (render: %p)",render);
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Start (render: %p)",render);
|
||||||
if (render != NULL)
|
if (render != nullptr)
|
||||||
{
|
{
|
||||||
render->SwapWindow();
|
render->SwapWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CPlugin::CPlugin() :
|
CPlugin::CPlugin() :
|
||||||
DllAbout(NULL),
|
DllAbout(nullptr),
|
||||||
DllConfig(NULL),
|
DllConfig(nullptr),
|
||||||
CloseDLL(NULL),
|
CloseDLL(nullptr),
|
||||||
RomOpen(NULL),
|
RomOpen(nullptr),
|
||||||
RomClosed(NULL),
|
RomClosed(nullptr),
|
||||||
PluginOpened(NULL),
|
PluginOpened(nullptr),
|
||||||
SetSettingInfo(NULL),
|
SetSettingInfo(nullptr),
|
||||||
SetSettingInfo2(NULL),
|
SetSettingInfo2(nullptr),
|
||||||
SetSettingInfo3(NULL),
|
SetSettingInfo3(nullptr),
|
||||||
m_LibHandle(NULL),
|
m_LibHandle(nullptr),
|
||||||
m_Initialized(false),
|
m_Initialized(false),
|
||||||
m_RomOpen(false)
|
m_RomOpen(false)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ bool CPlugin::Load(const char * FileName)
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Loading: %s", FileName);
|
WriteTrace(PluginTraceType(), TraceDebug, "Loading: %s", FileName);
|
||||||
|
|
||||||
// Already loaded, so unload first.
|
// Already loaded, so unload first.
|
||||||
if (m_LibHandle != NULL)
|
if (m_LibHandle != nullptr)
|
||||||
{
|
{
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ bool CPlugin::Load(const char * FileName)
|
||||||
m_LibHandle = pjutil::DynLibOpen(FileName, HaveDebugger());
|
m_LibHandle = pjutil::DynLibOpen(FileName, HaveDebugger());
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Loaded: %s LibHandle: %X", FileName, m_LibHandle);
|
WriteTrace(PluginTraceType(), TraceDebug, "Loaded: %s LibHandle: %X", FileName, m_LibHandle);
|
||||||
|
|
||||||
if (m_LibHandle == NULL)
|
if (m_LibHandle == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ bool CPlugin::Load(const char * FileName)
|
||||||
// Get DLL information
|
// Get DLL information
|
||||||
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
||||||
LoadFunction(GetDllInfo);
|
LoadFunction(GetDllInfo);
|
||||||
if (GetDllInfo == NULL) { return false; }
|
if (GetDllInfo == nullptr) { return false; }
|
||||||
|
|
||||||
GetDllInfo(&m_PluginInfo);
|
GetDllInfo(&m_PluginInfo);
|
||||||
if (!ValidPluginVersion(m_PluginInfo)) { return false; }
|
if (!ValidPluginVersion(m_PluginInfo)) { return false; }
|
||||||
|
@ -120,12 +120,12 @@ bool CPlugin::Load(const char * FileName)
|
||||||
info.GetSettingSz = (const char * (*)(void *, int, char *, int))&CSettings::GetSettingSz;
|
info.GetSettingSz = (const char * (*)(void *, int, char *, int))&CSettings::GetSettingSz;
|
||||||
info.SetSetting = (void(*)(void *, int, uint32_t))&CSettings::SetSetting;
|
info.SetSetting = (void(*)(void *, int, uint32_t))&CSettings::SetSetting;
|
||||||
info.SetSettingSz = (void(*)(void *, int, const char *))&CSettings::SetSettingSz;
|
info.SetSettingSz = (void(*)(void *, int, const char *))&CSettings::SetSettingSz;
|
||||||
info.UseUnregisteredSetting = NULL;
|
info.UseUnregisteredSetting = nullptr;
|
||||||
|
|
||||||
SetSettingInfo(&info);
|
SetSettingInfo(&info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RomClosed == NULL)
|
if (RomClosed == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
|
||||||
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
||||||
if (Render != NULL)
|
if (Render != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadInit");
|
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadInit");
|
||||||
Render->GfxThreadInit();
|
Render->GfxThreadInit();
|
||||||
|
@ -169,7 +169,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
|
||||||
Render = Render; // used just for andoid
|
Render = Render; // used just for andoid
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (RomOpen != NULL)
|
if (RomOpen != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Before Rom Open");
|
WriteTrace(PluginTraceType(), TraceDebug, "Before Rom Open");
|
||||||
RomOpen();
|
RomOpen();
|
||||||
|
@ -190,7 +190,7 @@ void CPlugin::RomClose(RenderWindow * Render)
|
||||||
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
||||||
if (Render != NULL)
|
if (Render != nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadDone");
|
WriteTrace(PluginTraceType(), TraceDebug, "Calling GfxThreadDone");
|
||||||
Render->GfxThreadDone();
|
Render->GfxThreadDone();
|
||||||
|
@ -221,7 +221,7 @@ void CPlugin::Close(RenderWindow * Render)
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
|
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
|
||||||
RomClose(Render);
|
RomClose(Render);
|
||||||
m_Initialized = false;
|
m_Initialized = false;
|
||||||
if (CloseDLL != NULL)
|
if (CloseDLL != nullptr)
|
||||||
{
|
{
|
||||||
CloseDLL();
|
CloseDLL();
|
||||||
}
|
}
|
||||||
|
@ -232,25 +232,25 @@ void CPlugin::UnloadPlugin()
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
|
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
|
||||||
memset(&m_PluginInfo, 0, sizeof(m_PluginInfo));
|
memset(&m_PluginInfo, 0, sizeof(m_PluginInfo));
|
||||||
if (m_LibHandle != NULL)
|
if (m_LibHandle != nullptr)
|
||||||
{
|
{
|
||||||
UnloadPluginDetails();
|
UnloadPluginDetails();
|
||||||
}
|
}
|
||||||
if (m_LibHandle != NULL)
|
if (m_LibHandle != nullptr)
|
||||||
{
|
{
|
||||||
pjutil::DynLibClose(m_LibHandle);
|
pjutil::DynLibClose(m_LibHandle);
|
||||||
m_LibHandle = NULL;
|
m_LibHandle = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DllAbout = NULL;
|
DllAbout = nullptr;
|
||||||
CloseDLL = NULL;
|
CloseDLL = nullptr;
|
||||||
RomOpen = NULL;
|
RomOpen = nullptr;
|
||||||
RomClosed = NULL;
|
RomClosed = nullptr;
|
||||||
PluginOpened = NULL;
|
PluginOpened = nullptr;
|
||||||
DllConfig = NULL;
|
DllConfig = nullptr;
|
||||||
SetSettingInfo = NULL;
|
SetSettingInfo = nullptr;
|
||||||
SetSettingInfo2 = NULL;
|
SetSettingInfo2 = nullptr;
|
||||||
SetSettingInfo3 = NULL;
|
SetSettingInfo3 = nullptr;
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Done", PluginType());
|
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Done", PluginType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
|
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
|
||||||
m_MainWindow(NULL),
|
m_MainWindow(nullptr),
|
||||||
m_SyncWindow(NULL),
|
m_SyncWindow(nullptr),
|
||||||
m_PluginDirSetting(PluginDirSetting),
|
m_PluginDirSetting(PluginDirSetting),
|
||||||
m_PluginDir(g_Settings->LoadStringVal(PluginDirSetting)),
|
m_PluginDir(g_Settings->LoadStringVal(PluginDirSetting)),
|
||||||
m_Gfx(NULL),
|
m_Gfx(nullptr),
|
||||||
m_Audio(NULL),
|
m_Audio(nullptr),
|
||||||
m_RSP(NULL),
|
m_RSP(nullptr),
|
||||||
m_Control(NULL),
|
m_Control(nullptr),
|
||||||
m_initilized(false),
|
m_initilized(false),
|
||||||
m_SyncPlugins(SyncPlugins)
|
m_SyncPlugins(SyncPlugins)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_this->Reset(NULL);
|
_this->Reset(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||||
|
@ -104,7 +104,7 @@ void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
template <typename plugin_type>
|
template <typename plugin_type>
|
||||||
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type, bool IsCopy)
|
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type, bool IsCopy)
|
||||||
{
|
{
|
||||||
if (plugin != NULL)
|
if (plugin != nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID,
|
||||||
{
|
{
|
||||||
WriteTrace(TraceLevel, TraceError, "Failed to load %s", (const char *)PluginFileName);
|
WriteTrace(TraceLevel, TraceError, "Failed to load %s", (const char *)PluginFileName);
|
||||||
delete plugin;
|
delete plugin;
|
||||||
plugin = NULL;
|
plugin = nullptr;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ void CPlugins::CreatePlugins(void)
|
||||||
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
|
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
|
||||||
|
|
||||||
//Enable debugger
|
//Enable debugger
|
||||||
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
if (m_RSP != nullptr && m_RSP->EnableDebugging)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
||||||
m_RSP->EnableDebugging(HaveDebugger());
|
m_RSP->EnableDebugging(HaveDebugger());
|
||||||
|
@ -178,7 +178,7 @@ void CPlugins::GameReset(void)
|
||||||
|
|
||||||
void CPlugins::DestroyGfxPlugin(void)
|
void CPlugins::DestroyGfxPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Gfx == NULL)
|
if (m_Gfx == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -187,15 +187,15 @@ void CPlugins::DestroyGfxPlugin(void)
|
||||||
WriteTrace(TraceGFXPlugin, TraceInfo, "deleting");
|
WriteTrace(TraceGFXPlugin, TraceInfo, "deleting");
|
||||||
delete m_Gfx;
|
delete m_Gfx;
|
||||||
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted");
|
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted");
|
||||||
m_Gfx = NULL;
|
m_Gfx = nullptr;
|
||||||
// g_Settings->UnknownSetting_GFX = NULL;
|
// g_Settings->UnknownSetting_GFX = nullptr;
|
||||||
DestroyRspPlugin();
|
DestroyRspPlugin();
|
||||||
WriteTrace(TraceGFXPlugin, TraceInfo, "Done");
|
WriteTrace(TraceGFXPlugin, TraceInfo, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyAudioPlugin(void)
|
void CPlugins::DestroyAudioPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Audio == NULL)
|
if (m_Audio == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -204,16 +204,16 @@ void CPlugins::DestroyAudioPlugin(void)
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
||||||
delete m_Audio;
|
delete m_Audio;
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
||||||
m_Audio = NULL;
|
m_Audio = nullptr;
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
||||||
// g_Settings->UnknownSetting_AUDIO = NULL;
|
// g_Settings->UnknownSetting_AUDIO = nullptr;
|
||||||
DestroyRspPlugin();
|
DestroyRspPlugin();
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyRspPlugin(void)
|
void CPlugins::DestroyRspPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_RSP == NULL)
|
if (m_RSP == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -221,14 +221,14 @@ void CPlugins::DestroyRspPlugin(void)
|
||||||
m_RSP->Close(m_MainWindow);
|
m_RSP->Close(m_MainWindow);
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
||||||
delete m_RSP;
|
delete m_RSP;
|
||||||
m_RSP = NULL;
|
m_RSP = nullptr;
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
||||||
// g_Settings->UnknownSetting_RSP = NULL;
|
// g_Settings->UnknownSetting_RSP = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyControlPlugin(void)
|
void CPlugins::DestroyControlPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Control == NULL)
|
if (m_Control == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,9 +236,9 @@ void CPlugins::DestroyControlPlugin(void)
|
||||||
m_Control->Close(m_MainWindow);
|
m_Control->Close(m_MainWindow);
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
||||||
delete m_Control;
|
delete m_Control;
|
||||||
m_Control = NULL;
|
m_Control = nullptr;
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
||||||
// g_Settings->UnknownSetting_CTRL = NULL;
|
// g_Settings->UnknownSetting_CTRL = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
||||||
|
@ -276,10 +276,10 @@ bool CPlugins::Initiate(CN64System * System)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||||
//Check to make sure we have the plugin available to be used
|
//Check to make sure we have the plugin available to be used
|
||||||
if (m_Gfx == NULL) { return false; }
|
if (m_Gfx == nullptr) { return false; }
|
||||||
if (m_Audio == NULL) { return false; }
|
if (m_Audio == nullptr) { return false; }
|
||||||
if (m_RSP == NULL) { return false; }
|
if (m_RSP == nullptr) { return false; }
|
||||||
if (m_Control == NULL) { return false; }
|
if (m_Control == nullptr) { return false; }
|
||||||
|
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||||
|
@ -372,10 +372,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP:
|
case PLUGIN_TYPE_RSP:
|
||||||
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
|
if (m_RSP == nullptr || m_RSP->DllConfig == nullptr) { break; }
|
||||||
if (!m_RSP->Initialized())
|
if (!m_RSP->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_RSP->Initiate(this, NULL))
|
if (!m_RSP->Initiate(this, nullptr))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -383,10 +383,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
m_RSP->DllConfig(hParent);
|
m_RSP->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_GFX:
|
case PLUGIN_TYPE_GFX:
|
||||||
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
|
if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr) { break; }
|
||||||
if (!m_Gfx->Initialized())
|
if (!m_Gfx->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Gfx->Initiate(NULL, m_MainWindow))
|
if (!m_Gfx->Initiate(nullptr, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -394,10 +394,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
m_Gfx->DllConfig(hParent);
|
m_Gfx->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_AUDIO:
|
case PLUGIN_TYPE_AUDIO:
|
||||||
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
|
if (m_Audio == nullptr || m_Audio->DllConfig == nullptr) { break; }
|
||||||
if (!m_Audio->Initialized())
|
if (!m_Audio->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Audio->Initiate(NULL, m_MainWindow))
|
if (!m_Audio->Initiate(nullptr, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -409,10 +409,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_CONTROLLER:
|
case PLUGIN_TYPE_CONTROLLER:
|
||||||
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
|
if (m_Control == nullptr || m_Control->DllConfig == nullptr) { break; }
|
||||||
if (!m_Control->Initialized())
|
if (!m_Control->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Control->Initiate(NULL, m_MainWindow))
|
if (!m_Control->Initiate(nullptr, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,18 @@
|
||||||
void DummyFunc1(int a) { a += 1; }
|
void DummyFunc1(int a) { a += 1; }
|
||||||
|
|
||||||
CRSP_Plugin::CRSP_Plugin(void) :
|
CRSP_Plugin::CRSP_Plugin(void) :
|
||||||
DoRspCycles(NULL),
|
DoRspCycles(nullptr),
|
||||||
EnableDebugging(NULL),
|
EnableDebugging(nullptr),
|
||||||
m_CycleCount(0),
|
m_CycleCount(0),
|
||||||
GetDebugInfo(NULL),
|
GetDebugInfo(nullptr),
|
||||||
InitiateDebugger(NULL)
|
InitiateDebugger(nullptr)
|
||||||
{
|
{
|
||||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||||
}
|
}
|
||||||
|
|
||||||
CRSP_Plugin::~CRSP_Plugin()
|
CRSP_Plugin::~CRSP_Plugin()
|
||||||
{
|
{
|
||||||
Close(NULL);
|
Close(nullptr);
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,21 +36,21 @@ bool CRSP_Plugin::LoadFunctions(void)
|
||||||
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
||||||
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
||||||
LoadFunction(EnableDebugging);
|
LoadFunction(EnableDebugging);
|
||||||
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
|
if (EnableDebugging == nullptr) { EnableDebugging = DummyFunc1; }
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
|
if (DoRspCycles == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
|
if (InitiateRSP == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (RomClosed == NULL) { UnloadPlugin(); return false; }
|
if (RomClosed == nullptr) { UnloadPlugin(); return false; }
|
||||||
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
|
if (CloseDLL == nullptr) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get debug info if able
|
// Get debug info if able
|
||||||
if (GetDebugInfo != NULL)
|
if (GetDebugInfo != nullptr)
|
||||||
{
|
{
|
||||||
GetDebugInfo(&m_RSPDebug);
|
GetDebugInfo(&m_RSPDebug);
|
||||||
}
|
}
|
||||||
|
@ -111,17 +111,17 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
RSP_INFO_1_3 Info = { 0 };
|
RSP_INFO_1_3 Info = { 0 };
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Info.hInst = (Plugins != NULL && Plugins->MainWindow() != NULL) ? Plugins->MainWindow()->GetModuleInstance() : NULL;
|
Info.hInst = (Plugins != nullptr && Plugins->MainWindow() != nullptr) ? Plugins->MainWindow()->GetModuleInstance() : nullptr;
|
||||||
#else
|
#else
|
||||||
Info.hInst = NULL;
|
Info.hInst = nullptr;
|
||||||
#endif
|
#endif
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
Info.MemoryBswaped = (System == nullptr); // only true when the system's not yet loaded
|
||||||
|
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateRSP) (RSP_INFO_1_3 RSP_Info, uint32_t * Cycles);
|
void(CALL *InitiateRSP) (RSP_INFO_1_3 RSP_Info, uint32_t * Cycles);
|
||||||
LoadFunction(InitiateRSP);
|
LoadFunction(InitiateRSP);
|
||||||
if (InitiateRSP == NULL)
|
if (InitiateRSP == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
|
||||||
|
@ -130,7 +130,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. just needed to we can config the DLL.
|
// parameters here.. just needed to we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == nullptr)
|
||||||
{
|
{
|
||||||
static uint8_t Buffer[100];
|
static uint8_t Buffer[100];
|
||||||
static uint32_t Value = 0;
|
static uint32_t Value = 0;
|
||||||
|
@ -177,7 +177,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
CMipsMemoryVM & MMU = System->m_MMU_VM;
|
||||||
CRegisters & Reg = System->m_Reg;
|
CRegisters & Reg = System->m_Reg;
|
||||||
|
|
||||||
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != NULL)
|
if (g_Rom->IsLoadedRomDDIPL() && g_Disk != nullptr)
|
||||||
Info.HEADER = g_Disk->GetDiskHeader();
|
Info.HEADER = g_Disk->GetDiskHeader();
|
||||||
else
|
else
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
|
@ -251,17 +251,17 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
RSP_INFO_1_1 Info = { 0 };
|
RSP_INFO_1_1 Info = { 0 };
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Info.hInst = (Plugins != NULL && Plugins->MainWindow() != NULL) ? Plugins->MainWindow()->GetModuleInstance() : NULL;
|
Info.hInst = (Plugins != nullptr && Plugins->MainWindow() != nullptr) ? Plugins->MainWindow()->GetModuleInstance() : nullptr;
|
||||||
#else
|
#else
|
||||||
Info.hInst = NULL;
|
Info.hInst = nullptr;
|
||||||
#endif
|
#endif
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
Info.MemoryBswaped = (System == nullptr); // only true when the system's not yet loaded
|
||||||
|
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateRSP) (RSP_INFO_1_1 RSP_Info, uint32_t * Cycles);
|
void(CALL *InitiateRSP) (RSP_INFO_1_1 RSP_Info, uint32_t * Cycles);
|
||||||
LoadFunction(InitiateRSP);
|
LoadFunction(InitiateRSP);
|
||||||
if (InitiateRSP == NULL)
|
if (InitiateRSP == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "Failed to find InitiateRSP");
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "Done (res: false)");
|
||||||
|
@ -270,7 +270,7 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. just needed to we can config the DLL.
|
// parameters here.. just needed to we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == nullptr)
|
||||||
{
|
{
|
||||||
static uint8_t Buffer[100];
|
static uint8_t Buffer[100];
|
||||||
static uint32_t Value = 0;
|
static uint32_t Value = 0;
|
||||||
|
@ -354,10 +354,10 @@ bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
void CRSP_Plugin::UnloadPluginDetails(void)
|
void CRSP_Plugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||||
DoRspCycles = NULL;
|
DoRspCycles = nullptr;
|
||||||
EnableDebugging = NULL;
|
EnableDebugging = nullptr;
|
||||||
GetDebugInfo = NULL;
|
GetDebugInfo = nullptr;
|
||||||
InitiateDebugger = NULL;
|
InitiateDebugger = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRSP_Plugin::ProcessMenuItem(int id)
|
void CRSP_Plugin::ProcessMenuItem(int id)
|
||||||
|
|
|
@ -31,12 +31,12 @@ CRomList::CRomList() :
|
||||||
m_RefreshThread((CThread::CTHREAD_START_ROUTINE)RefreshRomListStatic),
|
m_RefreshThread((CThread::CTHREAD_START_ROUTINE)RefreshRomListStatic),
|
||||||
m_StopRefresh(false),
|
m_StopRefresh(false),
|
||||||
m_GameDir(g_Settings->LoadStringVal(RomList_GameDir).c_str()),
|
m_GameDir(g_Settings->LoadStringVal(RomList_GameDir).c_str()),
|
||||||
m_NotesIniFile(NULL),
|
m_NotesIniFile(nullptr),
|
||||||
m_ExtIniFile(NULL),
|
m_ExtIniFile(nullptr),
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_ZipIniFile(NULL),
|
m_ZipIniFile(nullptr),
|
||||||
#endif
|
#endif
|
||||||
m_RomIniFile(NULL)
|
m_RomIniFile(nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRomList, TraceVerbose, "Start");
|
WriteTrace(TraceRomList, TraceVerbose, "Start");
|
||||||
if (g_Settings)
|
if (g_Settings)
|
||||||
|
@ -63,23 +63,23 @@ CRomList::~CRomList()
|
||||||
if (m_NotesIniFile)
|
if (m_NotesIniFile)
|
||||||
{
|
{
|
||||||
delete m_NotesIniFile;
|
delete m_NotesIniFile;
|
||||||
m_NotesIniFile = NULL;
|
m_NotesIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_ExtIniFile)
|
if (m_ExtIniFile)
|
||||||
{
|
{
|
||||||
delete m_ExtIniFile;
|
delete m_ExtIniFile;
|
||||||
m_ExtIniFile = NULL;
|
m_ExtIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_RomIniFile)
|
if (m_RomIniFile)
|
||||||
{
|
{
|
||||||
delete m_RomIniFile;
|
delete m_RomIniFile;
|
||||||
m_RomIniFile = NULL;
|
m_RomIniFile = nullptr;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (m_ZipIniFile)
|
if (m_ZipIniFile)
|
||||||
{
|
{
|
||||||
delete m_ZipIniFile;
|
delete m_ZipIniFile;
|
||||||
m_ZipIniFile = NULL;
|
m_ZipIniFile = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (g_Settings)
|
if (g_Settings)
|
||||||
|
@ -277,7 +277,7 @@ void CRomList::FillRomList(strlist & FileList, const char * Directory)
|
||||||
const char backup_character = szHeader[2 * x + delimit_offset];
|
const char backup_character = szHeader[2 * x + delimit_offset];
|
||||||
|
|
||||||
szHeader[2 * x + delimit_offset] = '\0';
|
szHeader[2 * x + delimit_offset] = '\0';
|
||||||
*(uint32_t *)&RomData[x] = strtoul(&szHeader[2 * x], NULL, 16);
|
*(uint32_t *)&RomData[x] = strtoul(&szHeader[2 * x], nullptr, 16);
|
||||||
szHeader[2 * x + delimit_offset] = backup_character;
|
szHeader[2 * x + delimit_offset] = backup_character;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,13 +344,13 @@ bool CRomList::LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_
|
||||||
char zname[132];
|
char zname[132];
|
||||||
unzFile file;
|
unzFile file;
|
||||||
file = unzOpen(FileName);
|
file = unzOpen(FileName);
|
||||||
if (file == NULL) { return false; }
|
if (file == nullptr) { return false; }
|
||||||
|
|
||||||
port = unzGoToFirstFile(file);
|
port = unzGoToFirstFile(file);
|
||||||
FoundRom = false;
|
FoundRom = false;
|
||||||
while (port == UNZ_OK && FoundRom == false)
|
while (port == UNZ_OK && FoundRom == false)
|
||||||
{
|
{
|
||||||
unzGetCurrentFileInfo(file, &info, zname, 128, NULL, 0, NULL, 0);
|
unzGetCurrentFileInfo(file, &info, zname, 128, nullptr, 0, nullptr, 0);
|
||||||
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
if (unzLocateFile(file, zname, 1) != UNZ_OK)
|
||||||
{
|
{
|
||||||
unzClose(file);
|
unzClose(file);
|
||||||
|
@ -507,7 +507,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
|
||||||
|
|
||||||
if (LoadDataFromRomFile(pRomInfo->szFullFileName, RomData, sizeof(RomData), &pRomInfo->RomSize, pRomInfo->FileFormat))
|
if (LoadDataFromRomFile(pRomInfo->szFullFileName, RomData, sizeof(RomData), &pRomInfo->RomSize, pRomInfo->FileFormat))
|
||||||
{
|
{
|
||||||
if (strstr(pRomInfo->szFullFileName, "?") != NULL)
|
if (strstr(pRomInfo->szFullFileName, "?") != nullptr)
|
||||||
{
|
{
|
||||||
strcpy(pRomInfo->FileName, strstr(pRomInfo->szFullFileName, "?") + 1);
|
strcpy(pRomInfo->FileName, strstr(pRomInfo->szFullFileName, "?") + 1);
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ void CRomList::FillRomExtensionInfo(ROM_INFO * pRomInfo)
|
||||||
//Get the selected color
|
//Get the selected color
|
||||||
String.Format("%s.Sel", pRomInfo->Status);
|
String.Format("%s.Sel", pRomInfo->Status);
|
||||||
String = m_RomIniFile->GetString("Rom Status", String.c_str(), "FFFFFFFF");
|
String = m_RomIniFile->GetString("Rom Status", String.c_str(), "FFFFFFFF");
|
||||||
uint32_t selcol = strtoul(String.c_str(), NULL, 16);
|
uint32_t selcol = strtoul(String.c_str(), nullptr, 16);
|
||||||
if (selcol & 0x80000000)
|
if (selcol & 0x80000000)
|
||||||
{
|
{
|
||||||
pRomInfo->SelColor = -1;
|
pRomInfo->SelColor = -1;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
#include <Common/Trace.h>
|
#include <Common/Trace.h>
|
||||||
|
|
||||||
CSettings * g_Settings = NULL;
|
CSettings * g_Settings = nullptr;
|
||||||
|
|
||||||
CSettings::CSettings() :
|
CSettings::CSettings() :
|
||||||
m_NextAutoSettingId(0x200000)
|
m_NextAutoSettingId(0x200000)
|
||||||
|
@ -44,7 +44,7 @@ CSettings::~CSettings()
|
||||||
for (SETTING_CALLBACK::iterator cb_iter = m_Callback.begin(); cb_iter != m_Callback.end(); cb_iter++)
|
for (SETTING_CALLBACK::iterator cb_iter = m_Callback.begin(); cb_iter != m_Callback.end(); cb_iter++)
|
||||||
{
|
{
|
||||||
SETTING_CHANGED_CB * item = cb_iter->second;
|
SETTING_CHANGED_CB * item = cb_iter->second;
|
||||||
while (item != NULL)
|
while (item != nullptr)
|
||||||
{
|
{
|
||||||
SETTING_CHANGED_CB * current_item = item;
|
SETTING_CHANGED_CB * current_item = item;
|
||||||
item = item->Next;
|
item = item->Next;
|
||||||
|
@ -1252,7 +1252,7 @@ void CSettings::NotifyCallBacks(SettingID Type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SETTING_CHANGED_CB * item = Callback->second; item != NULL; item = item->Next)
|
for (SETTING_CHANGED_CB * item = Callback->second; item != nullptr; item = item->Next)
|
||||||
{
|
{
|
||||||
item->Func(item->Data);
|
item->Func(item->Data);
|
||||||
}
|
}
|
||||||
|
@ -1263,7 +1263,7 @@ void CSettings::RegisterChangeCB(SettingID Type, void * Data, SettingChangedFunc
|
||||||
SETTING_CHANGED_CB * new_item = new SETTING_CHANGED_CB;
|
SETTING_CHANGED_CB * new_item = new SETTING_CHANGED_CB;
|
||||||
new_item->Data = Data;
|
new_item->Data = Data;
|
||||||
new_item->Func = Func;
|
new_item->Func = Func;
|
||||||
new_item->Next = NULL;
|
new_item->Next = nullptr;
|
||||||
|
|
||||||
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
||||||
if (Callback != m_Callback.end())
|
if (Callback != m_Callback.end())
|
||||||
|
@ -1289,7 +1289,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
|
||||||
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
||||||
if (Callback != m_Callback.end())
|
if (Callback != m_Callback.end())
|
||||||
{
|
{
|
||||||
SETTING_CHANGED_CB * PrevItem = NULL;
|
SETTING_CHANGED_CB * PrevItem = nullptr;
|
||||||
SETTING_CHANGED_CB * item = Callback->second;
|
SETTING_CHANGED_CB * item = Callback->second;
|
||||||
|
|
||||||
while (item)
|
while (item)
|
||||||
|
@ -1297,7 +1297,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
|
||||||
if (Callback->first == Type && item->Data == Data && item->Func == Func)
|
if (Callback->first == Type && item->Data == Data && item->Func == Func)
|
||||||
{
|
{
|
||||||
bRemoved = true;
|
bRemoved = true;
|
||||||
if (PrevItem == NULL)
|
if (PrevItem == nullptr)
|
||||||
{
|
{
|
||||||
if (item->Next)
|
if (item->Next)
|
||||||
{
|
{
|
||||||
|
@ -1316,7 +1316,7 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
|
||||||
PrevItem->Next = item->Next;
|
PrevItem->Next = item->Next;
|
||||||
}
|
}
|
||||||
delete item;
|
delete item;
|
||||||
item = NULL;
|
item = nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PrevItem = item;
|
PrevItem = item;
|
||||||
|
|
|
@ -33,32 +33,32 @@ CLogSettings::CLogSettings()
|
||||||
m_RefCount += 1;
|
m_RefCount += 1;
|
||||||
if (m_RefCount == 1)
|
if (m_RefCount == 1)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(Logging_GenerateLog, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_GenerateLog, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogRDRamRegisters, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogRDRamRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogSPRegisters, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogSPRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogDPCRegisters, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogDPCRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogDPSRegisters, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogDPSRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogMIPSInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogMIPSInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogVideoInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogVideoInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogAudioInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogAudioInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPerInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPerInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogRDRAMInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogRDRAMInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogSerialInterface, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogSerialInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPRDMAOperations, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPRDMAOperations, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemLoads, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemLoads, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemLoads, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemLoads, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemStores, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPRDirectMemStores, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemStores, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogPRDMAMemStores, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogControllerPak, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogControllerPak, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogCP0changes, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogCP0changes, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogCP0reads, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogCP0reads, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogTLB, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogTLB, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogExceptions, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogExceptions, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_NoInterrupts, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_NoInterrupts, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogCache, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogCache, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogRomHeader, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogRomHeader, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Logging_LogUnknown, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Logging_LogUnknown, nullptr, RefreshSettings);
|
||||||
RefreshSettings(NULL);
|
RefreshSettings(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,31 +67,31 @@ CLogSettings::~CLogSettings()
|
||||||
m_RefCount -= 1;
|
m_RefCount -= 1;
|
||||||
if (m_RefCount == 0)
|
if (m_RefCount == 0)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Logging_GenerateLog, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_GenerateLog, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogRDRamRegisters, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogRDRamRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogSPRegisters, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogSPRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogDPCRegisters, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogDPCRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogDPSRegisters, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogDPSRegisters, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogMIPSInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogMIPSInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogVideoInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogVideoInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogAudioInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogAudioInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPerInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPerInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogRDRAMInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogRDRAMInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogSerialInterface, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogSerialInterface, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPRDMAOperations, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPRDMAOperations, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemLoads, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemLoads, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemLoads, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemLoads, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemStores, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPRDirectMemStores, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemStores, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogPRDMAMemStores, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogControllerPak, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogControllerPak, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogCP0changes, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogCP0changes, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogCP0reads, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogCP0reads, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogTLB, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogTLB, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogExceptions, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogExceptions, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_NoInterrupts, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_NoInterrupts, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogCache, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogCache, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogRomHeader, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogRomHeader, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Logging_LogUnknown, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Logging_LogUnknown, nullptr, RefreshSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,13 @@ CN64SystemSettings::CN64SystemSettings()
|
||||||
m_RefCount += 1;
|
m_RefCount += 1;
|
||||||
if (m_RefCount == 1)
|
if (m_RefCount == 1)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_BasicMode, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, nullptr, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, nullptr, RefreshSettings);
|
||||||
|
|
||||||
RefreshSettings(NULL);
|
RefreshSettings(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ CN64SystemSettings::~CN64SystemSettings()
|
||||||
m_RefCount -= 1;
|
m_RefCount -= 1;
|
||||||
if (m_RefCount == 0)
|
if (m_RefCount == 0)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, nullptr, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, nullptr, RefreshSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
|
CIniFile * CSettingTypeApplication::m_SettingsIniFile = nullptr;
|
||||||
|
|
||||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue) :
|
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue) :
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
|
@ -105,7 +105,7 @@ void CSettingTypeApplication::Flush()
|
||||||
|
|
||||||
void CSettingTypeApplication::ResetAll()
|
void CSettingTypeApplication::ResetAll()
|
||||||
{
|
{
|
||||||
if (m_SettingsIniFile == NULL)
|
if (m_SettingsIniFile == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ void CSettingTypeApplication::CleanUp()
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SetAutoFlush(true);
|
m_SettingsIniFile->SetAutoFlush(true);
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void CSettingTypeApplication::Save(uint32_t Index, bool Value)
|
||||||
((m_DefaultSetting == Default_Constant && m_DefaultValue == (uint32_t)Value) ||
|
((m_DefaultSetting == Default_Constant && m_DefaultValue == (uint32_t)Value) ||
|
||||||
(m_DefaultSetting != Default_Constant && (indexed ? g_Settings->LoadBoolIndex(m_DefaultSetting, Index) : g_Settings->LoadBool(m_DefaultSetting)) == Value)))
|
(m_DefaultSetting != Default_Constant && (indexed ? g_Settings->LoadBoolIndex(m_DefaultSetting, Index) : g_Settings->LoadBool(m_DefaultSetting)) == Value)))
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@ void CSettingTypeApplication::Save(uint32_t /*Index*/, uint32_t Value)
|
||||||
((m_DefaultSetting == Default_Constant && m_DefaultValue == Value) ||
|
((m_DefaultSetting == Default_Constant && m_DefaultValue == Value) ||
|
||||||
(m_DefaultSetting != Default_Constant && g_Settings->LoadDword(m_DefaultSetting) == Value)))
|
(m_DefaultSetting != Default_Constant && g_Settings->LoadDword(m_DefaultSetting) == Value)))
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -258,11 +258,11 @@ void CSettingTypeApplication::Save(uint32_t Index, const std::string & Value)
|
||||||
|
|
||||||
void CSettingTypeApplication::Save(uint32_t /*Index*/, const char * Value)
|
void CSettingTypeApplication::Save(uint32_t /*Index*/, const char * Value)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None && Value != NULL &&
|
if (m_DefaultSetting != Default_None && Value != nullptr &&
|
||||||
((m_DefaultSetting == Default_Constant && strcmp(m_DefaultStr,Value) == 0) ||
|
((m_DefaultSetting == Default_Constant && strcmp(m_DefaultStr,Value) == 0) ||
|
||||||
(m_DefaultSetting != Default_Constant && strcmp(g_Settings->LoadStringVal(m_DefaultSetting).c_str(),Value) == 0)))
|
(m_DefaultSetting != Default_Constant && strcmp(g_Settings->LoadStringVal(m_DefaultSetting).c_str(),Value) == 0)))
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -284,5 +284,5 @@ std::string CSettingTypeApplication::FixSectionName(const char * Section)
|
||||||
|
|
||||||
void CSettingTypeApplication::Delete(uint32_t /*Index*/)
|
void CSettingTypeApplication::Delete(uint32_t /*Index*/)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), NULL);
|
m_SettingsIniFile->SaveString(SectionName(), m_KeyNameIdex.c_str(), nullptr);
|
||||||
}
|
}
|
|
@ -91,5 +91,5 @@ void CSettingTypeApplicationIndex::Save(uint32_t Index, const char * Value)
|
||||||
void CSettingTypeApplicationIndex::Delete(uint32_t Index)
|
void CSettingTypeApplicationIndex::Delete(uint32_t Index)
|
||||||
{
|
{
|
||||||
m_KeyNameIdex = stdstr_f("%s %d", m_KeyName.c_str(), Index);
|
m_KeyNameIdex = stdstr_f("%s %d", m_KeyName.c_str(), Index);
|
||||||
CSettingTypeApplication::Save(0, (const char *)NULL);
|
CSettingTypeApplication::Save(0, (const char *)nullptr);
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
bool CSettingTypeGame::m_RdbEditor = false;
|
bool CSettingTypeGame::m_RdbEditor = false;
|
||||||
bool CSettingTypeGame::m_EraseDefaults = true;
|
bool CSettingTypeGame::m_EraseDefaults = true;
|
||||||
std::string * CSettingTypeGame::m_SectionIdent = NULL;
|
std::string * CSettingTypeGame::m_SectionIdent = nullptr;
|
||||||
|
|
||||||
CSettingTypeGame::CSettingTypeGame(const char * Name, bool DefaultValue) :
|
CSettingTypeGame::CSettingTypeGame(const char * Name, bool DefaultValue) :
|
||||||
CSettingTypeApplication("", Name, DefaultValue)
|
CSettingTypeApplication("", Name, DefaultValue)
|
||||||
|
@ -33,18 +33,18 @@ CSettingTypeGame::~CSettingTypeGame()
|
||||||
void CSettingTypeGame::Initialize(void)
|
void CSettingTypeGame::Initialize(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
||||||
UpdateSettings(NULL);
|
UpdateSettings(nullptr);
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey, NULL, UpdateSettings);
|
g_Settings->RegisterChangeCB(Game_IniKey, nullptr, UpdateSettings);
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::CleanUp(void)
|
void CSettingTypeGame::CleanUp(void)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Game_IniKey, NULL, UpdateSettings);
|
g_Settings->UnregisterChangeCB(Game_IniKey, nullptr, UpdateSettings);
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
delete m_SectionIdent;
|
delete m_SectionIdent;
|
||||||
m_SectionIdent = NULL;
|
m_SectionIdent = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void CSettingTypeGame::UpdateSettings(void * /*Data */)
|
||||||
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
||||||
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||||
|
|
||||||
if (m_SectionIdent == NULL)
|
if (m_SectionIdent == nullptr)
|
||||||
{
|
{
|
||||||
m_SectionIdent = new stdstr;
|
m_SectionIdent = new stdstr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,5 +109,5 @@ void CSettingTypeRDBCpuType::Save (uint32_t /*Index*/, const char * /*Value*/ )
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::Delete(uint32_t /*Index*/ )
|
void CSettingTypeRDBCpuType::Delete(uint32_t /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,5 +98,5 @@ void CSettingTypeRDBOnOff::Save (uint32_t /*Index*/, const char * /*Value*/ )
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::Delete(uint32_t /*Index*/ )
|
void CSettingTypeRDBOnOff::Delete(uint32_t /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,5 +87,5 @@ void CSettingTypeRDBRDRamSize::Save (uint32_t /*Index*/, const char * /*Value*/
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::Delete(uint32_t /*Index*/ )
|
void CSettingTypeRDBRDRamSize::Delete(uint32_t /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,5 +115,5 @@ void CSettingTypeRDBSaveChip::Save (uint32_t /*Index*/, const char * /*Value*/ )
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::Delete(uint32_t /*Index*/ )
|
void CSettingTypeRDBSaveChip::Delete(uint32_t /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,5 +110,5 @@ void CSettingTypeRDBYesNo::Save(uint32_t /*Index*/, const char * /*Value*/)
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::Delete(uint32_t /*Index*/)
|
void CSettingTypeRDBYesNo::Delete(uint32_t /*Index*/)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), nullptr);
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
|
|
||||||
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
|
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = nullptr;
|
||||||
CIniFile * CSettingTypeRomDatabase::m_VideoIniFile = NULL;
|
CIniFile * CSettingTypeRomDatabase::m_VideoIniFile = nullptr;
|
||||||
CIniFile * CSettingTypeRomDatabase::m_AudioIniFile = NULL;
|
CIniFile * CSettingTypeRomDatabase::m_AudioIniFile = nullptr;
|
||||||
std::string * CSettingTypeRomDatabase::m_SectionIdent = NULL;
|
std::string * CSettingTypeRomDatabase::m_SectionIdent = nullptr;
|
||||||
|
|
||||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, uint32_t DefaultValue, bool DeleteOnDefault) :
|
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, uint32_t DefaultValue, bool DeleteOnDefault) :
|
||||||
m_KeyName(StripNameSection(Name)),
|
m_KeyName(StripNameSection(Name)),
|
||||||
|
@ -62,8 +62,8 @@ void CSettingTypeRomDatabase::Initialize(void)
|
||||||
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
|
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
|
||||||
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
|
m_AudioIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_AudioRDB).c_str());
|
||||||
|
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey, NULL, GameChanged);
|
g_Settings->RegisterChangeCB(Game_IniKey, nullptr, GameChanged);
|
||||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, NULL, BaseDirChanged);
|
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, nullptr, BaseDirChanged);
|
||||||
|
|
||||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||||
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
WriteTrace(TraceAppInit, TraceDebug, "Done");
|
||||||
|
@ -71,27 +71,27 @@ void CSettingTypeRomDatabase::Initialize(void)
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::CleanUp(void)
|
void CSettingTypeRomDatabase::CleanUp(void)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, NULL, BaseDirChanged);
|
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, nullptr, BaseDirChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_IniKey, NULL, GameChanged);
|
g_Settings->UnregisterChangeCB(Game_IniKey, nullptr, GameChanged);
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_VideoIniFile)
|
if (m_VideoIniFile)
|
||||||
{
|
{
|
||||||
delete m_VideoIniFile;
|
delete m_VideoIniFile;
|
||||||
m_VideoIniFile = NULL;
|
m_VideoIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_AudioIniFile)
|
if (m_AudioIniFile)
|
||||||
{
|
{
|
||||||
delete m_AudioIniFile;
|
delete m_AudioIniFile;
|
||||||
m_AudioIniFile = NULL;
|
m_AudioIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
delete m_SectionIdent;
|
delete m_SectionIdent;
|
||||||
m_SectionIdent = NULL;
|
m_SectionIdent = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +100,17 @@ void CSettingTypeRomDatabase::BaseDirChanged(void * /*Data */)
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_VideoIniFile)
|
if (m_VideoIniFile)
|
||||||
{
|
{
|
||||||
delete m_VideoIniFile;
|
delete m_VideoIniFile;
|
||||||
m_VideoIniFile = NULL;
|
m_VideoIniFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_AudioIniFile)
|
if (m_AudioIniFile)
|
||||||
{
|
{
|
||||||
delete m_AudioIniFile;
|
delete m_AudioIniFile;
|
||||||
m_AudioIniFile = NULL;
|
m_AudioIniFile = nullptr;
|
||||||
}
|
}
|
||||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||||
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
|
m_VideoIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_VideoRDB).c_str());
|
||||||
|
@ -332,15 +332,15 @@ void CSettingTypeRomDatabase::Delete(uint32_t /*Index*/)
|
||||||
}
|
}
|
||||||
if (m_VideoSetting)
|
if (m_VideoSetting)
|
||||||
{
|
{
|
||||||
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
|
m_VideoIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
else if (m_AudioSetting)
|
else if (m_AudioSetting)
|
||||||
{
|
{
|
||||||
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
|
m_AudioIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), NULL);
|
m_SettingsIniFile->SaveString(Section(), m_KeyName.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,5 +92,5 @@ void CSettingTypeRomDatabaseIndex::Save (uint32_t /*Index*/, const char * /*Valu
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Delete (uint32_t /*Index*/ )
|
void CSettingTypeRomDatabaseIndex::Delete (uint32_t /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ class CSettingTypeTempBool :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeTempBool(bool initialValue, const char * name = NULL);
|
CSettingTypeTempBool(bool initialValue, const char * name = nullptr);
|
||||||
~CSettingTypeTempBool();
|
~CSettingTypeTempBool();
|
||||||
|
|
||||||
bool IndexBasedSetting(void) const { return false; }
|
bool IndexBasedSetting(void) const { return false; }
|
||||||
|
|
|
@ -35,7 +35,7 @@ void CProject64Input::InitiateControllers(CONTROL_INFO * ControlInfo)
|
||||||
{
|
{
|
||||||
CGuard guard(m_CS);
|
CGuard guard(m_CS);
|
||||||
m_ControlInfo = *ControlInfo;
|
m_ControlInfo = *ControlInfo;
|
||||||
if (m_DirectInput.get() == NULL)
|
if (m_DirectInput.get() == nullptr)
|
||||||
{
|
{
|
||||||
m_DirectInput.reset(new CDirectInput(m_hinst));
|
m_DirectInput.reset(new CDirectInput(m_hinst));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void CProject64Input::EndScanDevices(void)
|
||||||
CDirectInput::ScanResult CProject64Input::ScanDevices(BUTTON & Button)
|
CDirectInput::ScanResult CProject64Input::ScanDevices(BUTTON & Button)
|
||||||
{
|
{
|
||||||
CDirectInput::ScanResult Result = CDirectInput::SCAN_FAILED;
|
CDirectInput::ScanResult Result = CDirectInput::SCAN_FAILED;
|
||||||
if (m_DirectInput.get() != NULL)
|
if (m_DirectInput.get() != nullptr)
|
||||||
{
|
{
|
||||||
Result = m_DirectInput->ScanDevices(Button);
|
Result = m_DirectInput->ScanDevices(Button);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ CDirectInput::ScanResult CProject64Input::ScanDevices(BUTTON & Button)
|
||||||
|
|
||||||
std::wstring CProject64Input::ButtonAssignment(BUTTON & Button)
|
std::wstring CProject64Input::ButtonAssignment(BUTTON & Button)
|
||||||
{
|
{
|
||||||
if (m_DirectInput.get() != NULL)
|
if (m_DirectInput.get() != nullptr)
|
||||||
{
|
{
|
||||||
return m_DirectInput->ButtonAssignment(Button);
|
return m_DirectInput->ButtonAssignment(Button);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ std::wstring CProject64Input::ButtonAssignment(BUTTON & Button)
|
||||||
|
|
||||||
std::wstring CProject64Input::ControllerDevices(const N64CONTROLLER & Controller)
|
std::wstring CProject64Input::ControllerDevices(const N64CONTROLLER & Controller)
|
||||||
{
|
{
|
||||||
if (m_DirectInput.get() != NULL)
|
if (m_DirectInput.get() != nullptr)
|
||||||
{
|
{
|
||||||
return m_DirectInput->ControllerDevices(Controller);
|
return m_DirectInput->ControllerDevices(Controller);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
DeviceNotification::DeviceNotification()
|
DeviceNotification::DeviceNotification()
|
||||||
{
|
{
|
||||||
Create(NULL);
|
Create(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceNotification::~DeviceNotification()
|
DeviceNotification::~DeviceNotification()
|
||||||
|
|
|
@ -19,9 +19,9 @@ CDirectInput::CDirectInput(HINSTANCE hinst) :
|
||||||
typedef HRESULT(WINAPI *tylpGetDIHandle)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN);
|
typedef HRESULT(WINAPI *tylpGetDIHandle)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN);
|
||||||
tylpGetDIHandle lpGetDIHandle = (tylpGetDIHandle)GetProcAddress(m_hDirectInputDLL, "DirectInput8Create");
|
tylpGetDIHandle lpGetDIHandle = (tylpGetDIHandle)GetProcAddress(m_hDirectInputDLL, "DirectInput8Create");
|
||||||
|
|
||||||
if (lpGetDIHandle != NULL)
|
if (lpGetDIHandle != nullptr)
|
||||||
{
|
{
|
||||||
HRESULT hr = lpGetDIHandle(m_hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&m_pDIHandle, NULL);
|
HRESULT hr = lpGetDIHandle(m_hinst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&m_pDIHandle, nullptr);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -41,7 +41,7 @@ CDirectInput::~CDirectInput()
|
||||||
if (itr->second.didHandle != nullptr)
|
if (itr->second.didHandle != nullptr)
|
||||||
{
|
{
|
||||||
itr->second.didHandle->Release();
|
itr->second.didHandle->Release();
|
||||||
itr->second.didHandle = NULL;
|
itr->second.didHandle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,13 +118,13 @@ BOOL CDirectInput::EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi)
|
||||||
Device.dwDevType = lpddi->dwDevType;
|
Device.dwDevType = lpddi->dwDevType;
|
||||||
Device.ProductName = stdstr().FromUTF16(lpddi->tszProductName);
|
Device.ProductName = stdstr().FromUTF16(lpddi->tszProductName);
|
||||||
Device.InstanceName = stdstr().FromUTF16(lpddi->tszInstanceName);
|
Device.InstanceName = stdstr().FromUTF16(lpddi->tszInstanceName);
|
||||||
HRESULT hResult = m_pDIHandle->CreateDevice(lpddi->guidInstance, &Device.didHandle, NULL);
|
HRESULT hResult = m_pDIHandle->CreateDevice(lpddi->guidInstance, &Device.didHandle, nullptr);
|
||||||
if (!SUCCEEDED(hResult))
|
if (!SUCCEEDED(hResult))
|
||||||
{
|
{
|
||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCDIDATAFORMAT ppDiDataFormat = NULL;
|
LPCDIDATAFORMAT ppDiDataFormat = nullptr;
|
||||||
if (DeviceType == DI8DEVTYPE_KEYBOARD)
|
if (DeviceType == DI8DEVTYPE_KEYBOARD)
|
||||||
{
|
{
|
||||||
ppDiDataFormat = &c_dfDIKeyboard;
|
ppDiDataFormat = &c_dfDIKeyboard;
|
||||||
|
|
|
@ -197,7 +197,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser
|
||||||
else if (fdwReason == DLL_PROCESS_DETACH)
|
else if (fdwReason == DLL_PROCESS_DETACH)
|
||||||
{
|
{
|
||||||
delete g_InputPlugin;
|
delete g_InputPlugin;
|
||||||
g_InputPlugin = NULL;
|
g_InputPlugin = nullptr;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#include "wtl-BitmapPicture.h"
|
#include "wtl-BitmapPicture.h"
|
||||||
|
|
||||||
CBitmapPicture::CBitmapPicture() :
|
CBitmapPicture::CBitmapPicture() :
|
||||||
m_hBitmap(NULL),
|
m_hBitmap(nullptr),
|
||||||
m_nResourceID(-1),
|
m_nResourceID(-1),
|
||||||
m_ResourceIcon(false)
|
m_ResourceIcon(false)
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ LRESULT CBitmapPicture::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
|
||||||
CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), m_nResourceID > 0 ? MAKEINTRESOURCE(m_nResourceID) : m_strResourceName.c_str(), IMAGE_ICON, m_IconWidth, m_IconHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
|
CIcon hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), m_nResourceID > 0 ? MAKEINTRESOURCE(m_nResourceID) : m_strResourceName.c_str(), IMAGE_ICON, m_IconWidth, m_IconHeight, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
|
||||||
if (!hIcon.IsNull())
|
if (!hIcon.IsNull())
|
||||||
{
|
{
|
||||||
dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, NULL, DI_NORMAL);
|
dc.DrawIconEx(0, 0, hIcon, rect.Width(), rect.Height(), 0, nullptr, DI_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -45,7 +45,7 @@ void CScanButton::DetectKey(void)
|
||||||
time(&m_ScanStart);
|
time(&m_ScanStart);
|
||||||
g_InputPlugin->StartScanDevices(m_DisplayCtrlId);
|
g_InputPlugin->StartScanDevices(m_DisplayCtrlId);
|
||||||
m_DisplayCtrl.Invalidate();
|
m_DisplayCtrl.Invalidate();
|
||||||
m_ScanBtn.SetTimer(DETECT_KEY_TIMER, SACN_INTERVAL, NULL);
|
m_ScanBtn.SetTimer(DETECT_KEY_TIMER, SACN_INTERVAL, nullptr);
|
||||||
MakeOverlay();
|
MakeOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,10 +118,10 @@ void CScanButton::OnTimer(UINT_PTR nIDEvent)
|
||||||
CWindow Dialog = m_ScanBtn.GetParent().GetParent();
|
CWindow Dialog = m_ScanBtn.GetParent().GetParent();
|
||||||
Dialog.SetWindowText(L"Configure Input");
|
Dialog.SetWindowText(L"Configure Input");
|
||||||
|
|
||||||
if (m_Overlay.m_hWnd != NULL)
|
if (m_Overlay.m_hWnd != nullptr)
|
||||||
{
|
{
|
||||||
m_Overlay.DestroyWindow();
|
m_Overlay.DestroyWindow();
|
||||||
m_Overlay = NULL;
|
m_Overlay = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_InputPlugin->EndScanDevices();
|
g_InputPlugin->EndScanDevices();
|
||||||
|
@ -143,8 +143,8 @@ void CScanButton::MakeOverlay(void)
|
||||||
CRect size;
|
CRect size;
|
||||||
ControllerDlg.GetWindowRect(&size);
|
ControllerDlg.GetWindowRect(&size);
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
m_Overlay = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT, L"BlockerClass", L"Blocker", WS_POPUP, size.left, size.top, size.Width(), size.Height(), ControllerDlg, nullptr, g_InputPlugin->hInst(), NULL);
|
m_Overlay = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT, L"BlockerClass", L"Blocker", WS_POPUP, size.left, size.top, size.Width(), size.Height(), ControllerDlg, nullptr, g_InputPlugin->hInst(), nullptr);
|
||||||
if (m_Overlay == NULL)
|
if (m_Overlay == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CProject64VideoWtlModule :
|
||||||
public:
|
public:
|
||||||
CProject64VideoWtlModule(HINSTANCE hinst)
|
CProject64VideoWtlModule(HINSTANCE hinst)
|
||||||
{
|
{
|
||||||
Init(NULL, hinst);
|
Init(nullptr, hinst);
|
||||||
}
|
}
|
||||||
virtual ~CProject64VideoWtlModule(void)
|
virtual ~CProject64VideoWtlModule(void)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CProject64VideoWtlModule * WtlModule = NULL;
|
CProject64VideoWtlModule * WtlModule = nullptr;
|
||||||
|
|
||||||
void ConfigInit(void * hinst)
|
void ConfigInit(void * hinst)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ void ConfigCleanup(void)
|
||||||
if (WtlModule)
|
if (WtlModule)
|
||||||
{
|
{
|
||||||
delete WtlModule;
|
delete WtlModule;
|
||||||
WtlModule = NULL;
|
WtlModule = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ protected:
|
||||||
UINT m_uToolFlags;
|
UINT m_uToolFlags;
|
||||||
// Construction
|
// Construction
|
||||||
CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS)
|
CToolTipDialog(UINT uTTSTyle = TTS_NOPREFIX | TTS_BALLOON, UINT uToolFlags = TTF_IDISHWND | TTF_SUBCLASS)
|
||||||
: m_TT(NULL), m_uTTStyle(uTTSTyle),
|
: m_TT(nullptr), m_uTTStyle(uTTSTyle),
|
||||||
m_uToolFlags(uToolFlags | TTF_SUBCLASS)
|
m_uToolFlags(uToolFlags | TTF_SUBCLASS)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ protected:
|
||||||
{
|
{
|
||||||
T* pT = (T*)this;
|
T* pT = (T*)this;
|
||||||
ATLASSERT(::IsWindow(*pT));
|
ATLASSERT(::IsWindow(*pT));
|
||||||
m_TT.Create(*pT, NULL, NULL, m_uTTStyle);
|
m_TT.Create(*pT, nullptr, nullptr, m_uTTStyle);
|
||||||
CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD));
|
CToolInfo ToolInfo(pT->m_uToolFlags, *pT, 0, 0, MAKEINTRESOURCE(pT->IDD));
|
||||||
m_TT.AddTool(&ToolInfo);
|
m_TT.AddTool(&ToolInfo);
|
||||||
::EnumChildWindows(*pT, SetTool, (LPARAM)pT);
|
::EnumChildWindows(*pT, SetTool, (LPARAM)pT);
|
||||||
|
@ -203,7 +203,7 @@ class COptionsSheet : public CPropertySheetImpl < COptionsSheet >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Construction
|
// Construction
|
||||||
COptionsSheet(_U_STRINGorID /*title*/ = (LPCTSTR)NULL, UINT /*uStartPage*/ = 0, HWND /*hWndParent*/ = NULL);
|
COptionsSheet(_U_STRINGorID /*title*/ = (LPCTSTR)nullptr, UINT /*uStartPage*/ = 0, HWND /*hWndParent*/ = nullptr);
|
||||||
~COptionsSheet();
|
~COptionsSheet();
|
||||||
|
|
||||||
void UpdateTextureSettings(void);
|
void UpdateTextureSettings(void);
|
||||||
|
@ -819,7 +819,7 @@ COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND
|
||||||
m_pgBasicPage(new CConfigBasicPage(this)),
|
m_pgBasicPage(new CConfigBasicPage(this)),
|
||||||
m_pgEmuSettings(new CConfigEmuSettings),
|
m_pgEmuSettings(new CConfigEmuSettings),
|
||||||
m_pgDebugSettings(new CDebugSettings),
|
m_pgDebugSettings(new CDebugSettings),
|
||||||
m_pgTextureEnhancement(NULL),
|
m_pgTextureEnhancement(nullptr),
|
||||||
m_hTextureEnhancement(0)
|
m_hTextureEnhancement(0)
|
||||||
{
|
{
|
||||||
AddPage(&m_pgBasicPage->m_psp);
|
AddPage(&m_pgBasicPage->m_psp);
|
||||||
|
@ -846,19 +846,19 @@ void COptionsSheet::UpdateTextureSettings(void)
|
||||||
{
|
{
|
||||||
if (g_settings->texenh_options())
|
if (g_settings->texenh_options())
|
||||||
{
|
{
|
||||||
if (m_hTextureEnhancement == NULL)
|
if (m_hTextureEnhancement == nullptr)
|
||||||
{
|
{
|
||||||
m_pgTextureEnhancement = new CConfigTextureEnhancement;
|
m_pgTextureEnhancement = new CConfigTextureEnhancement;
|
||||||
m_hTextureEnhancement = m_pgTextureEnhancement->Create();
|
m_hTextureEnhancement = m_pgTextureEnhancement->Create();
|
||||||
AddPage(m_hTextureEnhancement);
|
AddPage(m_hTextureEnhancement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_hTextureEnhancement != NULL)
|
else if (m_hTextureEnhancement != nullptr)
|
||||||
{
|
{
|
||||||
RemovePage(m_hTextureEnhancement);
|
RemovePage(m_hTextureEnhancement);
|
||||||
m_hTextureEnhancement = NULL;
|
m_hTextureEnhancement = nullptr;
|
||||||
delete m_pgTextureEnhancement;
|
delete m_pgTextureEnhancement;
|
||||||
m_pgTextureEnhancement = NULL;
|
m_pgTextureEnhancement = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,7 +95,7 @@ extern "C" {
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void * hWnd; /* Render window */
|
void * hWnd; /* Render window */
|
||||||
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
|
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
|
||||||
|
|
||||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||||
// bswap on a dword (32 bits) boundry
|
// bswap on a dword (32 bits) boundry
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern int g_viewport_offset;
|
||||||
extern int g_width, g_height;
|
extern int g_width, g_height;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HINSTANCE hinstDLL = NULL;
|
HINSTANCE hinstDLL = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t region = 0;
|
uint32_t region = 0;
|
||||||
|
@ -60,7 +60,7 @@ unsigned int BMASK = 0x7FFFFF;
|
||||||
// Reality display processor structure
|
// Reality display processor structure
|
||||||
CRDP rdp;
|
CRDP rdp;
|
||||||
|
|
||||||
CSettings * g_settings = NULL;
|
CSettings * g_settings = nullptr;
|
||||||
|
|
||||||
VOODOO voodoo = { 0, 0, 0,
|
VOODOO voodoo = { 0, 0, 0,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
|
@ -362,14 +362,14 @@ void SetWindowDisplaySize(HWND hWnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_windowedMenu = GetMenu(hWnd);
|
g_windowedMenu = GetMenu(hWnd);
|
||||||
if (g_windowedMenu) SetMenu(hWnd, NULL);
|
if (g_windowedMenu) SetMenu(hWnd, nullptr);
|
||||||
|
|
||||||
HWND hStatusBar = FindWindowEx(hWnd, NULL, L"msctls_statusbar32", NULL); // 1964
|
HWND hStatusBar = FindWindowEx(hWnd, nullptr, L"msctls_statusbar32", nullptr); // 1964
|
||||||
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
|
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
|
||||||
|
|
||||||
SetWindowLong(hWnd, GWL_STYLE, 0);
|
SetWindowLong(hWnd, GWL_STYLE, 0);
|
||||||
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
|
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
|
||||||
SetWindowPos(hWnd, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
SetWindowPos(hWnd, nullptr, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||||
|
|
||||||
g_viewport_offset = 0;
|
g_viewport_offset = 0;
|
||||||
g_fullscreen = true;
|
g_fullscreen = true;
|
||||||
|
@ -377,21 +377,21 @@ void SetWindowDisplaySize(HWND hWnd)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RECT clientRect = { 0 }, toolbarRect = { 0 }, statusbarRect = { 0 }, windowedRect = { 0 };
|
RECT clientRect = { 0 }, toolbarRect = { 0 }, statusbarRect = { 0 }, windowedRect = { 0 };
|
||||||
HWND hToolBar = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL);
|
HWND hToolBar = FindWindowEx(hWnd, nullptr, REBARCLASSNAME, nullptr);
|
||||||
HWND hStatusBar = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL);
|
HWND hStatusBar = FindWindowEx(hWnd, nullptr, STATUSCLASSNAME, nullptr);
|
||||||
if (hStatusBar == NULL)
|
if (hStatusBar == nullptr)
|
||||||
{
|
{
|
||||||
hStatusBar = FindWindowEx(hWnd, NULL, L"msctls_statusbar32", NULL);
|
hStatusBar = FindWindowEx(hWnd, nullptr, L"msctls_statusbar32", nullptr);
|
||||||
}
|
}
|
||||||
if (hStatusBar != nullptr && !IsWindowVisible(hStatusBar))
|
if (hStatusBar != nullptr && !IsWindowVisible(hStatusBar))
|
||||||
{
|
{
|
||||||
hStatusBar = nullptr;
|
hStatusBar = nullptr;
|
||||||
}
|
}
|
||||||
if (hToolBar != NULL)
|
if (hToolBar != nullptr)
|
||||||
{
|
{
|
||||||
GetWindowRect(hToolBar, &toolbarRect);
|
GetWindowRect(hToolBar, &toolbarRect);
|
||||||
}
|
}
|
||||||
if (hStatusBar != NULL)
|
if (hStatusBar != nullptr)
|
||||||
{
|
{
|
||||||
GetWindowRect(hStatusBar, &statusbarRect);
|
GetWindowRect(hStatusBar, &statusbarRect);
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ void SetWindowDisplaySize(HWND hWnd)
|
||||||
GetClientRect(hWnd, &clientRect);
|
GetClientRect(hWnd, &clientRect);
|
||||||
g_windowedRect.right += (g_width - (clientRect.right - clientRect.left));
|
g_windowedRect.right += (g_width - (clientRect.right - clientRect.left));
|
||||||
g_windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
|
g_windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
|
||||||
SetWindowPos(hWnd, NULL, 0, 0, g_windowedRect.right - g_windowedRect.left, g_windowedRect.bottom - g_windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
|
SetWindowPos(hWnd, nullptr, 0, 0, g_windowedRect.right - g_windowedRect.left, g_windowedRect.bottom - g_windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
|
||||||
|
|
||||||
g_fullscreen = false;
|
g_fullscreen = false;
|
||||||
}
|
}
|
||||||
|
@ -410,8 +410,8 @@ void ExitFullScreen(void)
|
||||||
{
|
{
|
||||||
if (g_fullscreen)
|
if (g_fullscreen)
|
||||||
{
|
{
|
||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(nullptr, 0);
|
||||||
SetWindowPos((HWND)gfx.hWnd, NULL, g_windowedRect.left, g_windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
SetWindowPos((HWND)gfx.hWnd, nullptr, g_windowedRect.left, g_windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||||
SetWindowLong((HWND)gfx.hWnd, GWL_STYLE, g_windowedStyle);
|
SetWindowLong((HWND)gfx.hWnd, GWL_STYLE, g_windowedStyle);
|
||||||
SetWindowLong((HWND)gfx.hWnd, GWL_EXSTYLE, g_windowedExStyle);
|
SetWindowLong((HWND)gfx.hWnd, GWL_EXSTYLE, g_windowedExStyle);
|
||||||
if (g_windowedMenu) SetMenu((HWND)gfx.hWnd, g_windowedMenu);
|
if (g_windowedMenu) SetMenu((HWND)gfx.hWnd, g_windowedMenu);
|
||||||
|
@ -577,14 +577,14 @@ void ReleaseGfx()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CriticalSection * g_ProcessDListCS = NULL;
|
CriticalSection * g_ProcessDListCS = nullptr;
|
||||||
|
|
||||||
extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReserved*/)
|
extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReserved*/)
|
||||||
{
|
{
|
||||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||||
{
|
{
|
||||||
hinstDLL = hinst;
|
hinstDLL = hinst;
|
||||||
if (g_ProcessDListCS == NULL)
|
if (g_ProcessDListCS == nullptr)
|
||||||
{
|
{
|
||||||
g_ProcessDListCS = new CriticalSection();
|
g_ProcessDListCS = new CriticalSection();
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ void CALL CloseDLL(void)
|
||||||
if (g_settings)
|
if (g_settings)
|
||||||
{
|
{
|
||||||
delete g_settings;
|
delete g_settings;
|
||||||
g_settings = NULL;
|
g_settings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseGfx();
|
ReleaseGfx();
|
||||||
|
@ -786,7 +786,7 @@ void CALL MoveScreen(int xpos, int ypos)
|
||||||
void CALL PluginLoaded(void)
|
void CALL PluginLoaded(void)
|
||||||
{
|
{
|
||||||
SetupTrace();
|
SetupTrace();
|
||||||
if (g_settings == NULL)
|
if (g_settings == nullptr)
|
||||||
{
|
{
|
||||||
g_settings = new CSettings;
|
g_settings = new CSettings;
|
||||||
}
|
}
|
||||||
|
@ -1035,8 +1035,8 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize stuff */
|
/* initialize stuff */
|
||||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "png_create_write_struct failed");
|
WriteTrace(TracePNG, TraceError, "png_create_write_struct failed");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -1044,10 +1044,10 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
}
|
}
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (info_ptr == NULL)
|
if (info_ptr == nullptr)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "png_create_info_struct failed");
|
WriteTrace(TracePNG, TraceError, "png_create_info_struct failed");
|
||||||
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1055,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "Error during init_io");
|
WriteTrace(TracePNG, TraceError, "Error during init_io");
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "Error during writing header");
|
WriteTrace(TracePNG, TraceError, "Error during writing header");
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "Error during writing bytes");
|
WriteTrace(TracePNG, TraceError, "Error during writing bytes");
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1112,11 +1112,11 @@ void write_png_file(const char* file_name, int width, int height, uint8_t *buffe
|
||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
if (setjmp(png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
WriteTrace(TracePNG, TraceError, "Error during end of write");
|
WriteTrace(TracePNG, TraceError, "Error during end of write");
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_write_end(png_ptr, NULL);
|
png_write_end(png_ptr, nullptr);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ GLuint CompileShader(GLenum type, const std::string &source)
|
||||||
GLuint shader = glCreateShader(type);
|
GLuint shader = glCreateShader(type);
|
||||||
|
|
||||||
const char *sourceArray[1] = { source.c_str() };
|
const char *sourceArray[1] = { source.c_str() };
|
||||||
glShaderSource(shader, 1, sourceArray, NULL);
|
glShaderSource(shader, 1, sourceArray, nullptr);
|
||||||
glCompileShader(shader);
|
glCompileShader(shader);
|
||||||
|
|
||||||
GLint compileResult;
|
GLint compileResult;
|
||||||
|
@ -207,7 +207,7 @@ GLuint CompileShader(GLenum type, const std::string &source)
|
||||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
|
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||||
|
|
||||||
std::vector<GLchar> infoLog(infoLogLength);
|
std::vector<GLchar> infoLog(infoLogLength);
|
||||||
glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), NULL, infoLog.data());
|
glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), nullptr, infoLog.data());
|
||||||
|
|
||||||
WriteTrace(TraceGlitch, TraceError, "Shader compilation failed: %s", std::string(infoLog.begin(), infoLog.end()).c_str());
|
WriteTrace(TraceGlitch, TraceError, "Shader compilation failed: %s", std::string(infoLog.begin(), infoLog.end()).c_str());
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -223,7 +223,7 @@ void check_link(GLuint program)
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
char log[1024];
|
char log[1024];
|
||||||
glGetProgramInfoLog(program, 1024, NULL, log);
|
glGetProgramInfoLog(program, 1024, nullptr, log);
|
||||||
//LOGINFO(log);
|
//LOGINFO(log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,11 @@ PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
|
||||||
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
|
PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
|
||||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
|
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
|
||||||
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
|
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
|
||||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
|
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = nullptr;
|
||||||
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
|
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = nullptr;
|
||||||
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = NULL;
|
PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = nullptr;
|
||||||
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = NULL;
|
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = nullptr;
|
||||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
|
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = nullptr;
|
||||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||||
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ int lfb_color_fmt;
|
||||||
float invtex[2];
|
float invtex[2];
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static HDC hDC = NULL;
|
static HDC hDC = nullptr;
|
||||||
static HGLRC hGLRC = NULL;
|
static HGLRC hGLRC = nullptr;
|
||||||
static HWND hToolBar = NULL;
|
static HWND hToolBar = nullptr;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
static unsigned long fullscreen;
|
static unsigned long fullscreen;
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ void gfxColorMask(bool rgb, bool a)
|
||||||
int isExtensionSupported(const char *extension)
|
int isExtensionSupported(const char *extension)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
const GLubyte *extensions = NULL;
|
const GLubyte *extensions = nullptr;
|
||||||
const GLubyte *start;
|
const GLubyte *start;
|
||||||
GLubyte *where, *terminator;
|
GLubyte *where, *terminator;
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ int isExtensionSupported(const char *extension)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int isWglExtensionSupported(const char *extension)
|
int isWglExtensionSupported(const char *extension)
|
||||||
{
|
{
|
||||||
const GLubyte *extensions = NULL;
|
const GLubyte *extensions = nullptr;
|
||||||
const GLubyte *start;
|
const GLubyte *start;
|
||||||
GLubyte *where, *terminator;
|
GLubyte *where, *terminator;
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ bool gfxSstWinOpen(gfxColorFormat_t color_format, gfxOriginLocation_t origin_loc
|
||||||
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
|
glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
|
||||||
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
|
glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
|
||||||
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
|
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
|
||||||
use_fbo = g_settings->wrpFBO() && (glFramebufferRenderbufferEXT != NULL);
|
use_fbo = g_settings->wrpFBO() && (glFramebufferRenderbufferEXT != nullptr);
|
||||||
#else
|
#else
|
||||||
use_fbo = g_settings->wrpFBO();
|
use_fbo = g_settings->wrpFBO();
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -543,9 +543,9 @@ bool gfxSstWinClose()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (hGLRC)
|
if (hGLRC)
|
||||||
{
|
{
|
||||||
wglMakeCurrent(hDC, NULL);
|
wglMakeCurrent(hDC, nullptr);
|
||||||
wglDeleteContext(hGLRC);
|
wglDeleteContext(hGLRC);
|
||||||
hGLRC = NULL;
|
hGLRC = nullptr;
|
||||||
}
|
}
|
||||||
ExitFullScreen();
|
ExitFullScreen();
|
||||||
#endif
|
#endif
|
||||||
|
@ -759,7 +759,7 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin
|
||||||
add_tex(fbs[nb_fb].texid);
|
add_tex(fbs[nb_fb].texid);
|
||||||
glBindTexture(GL_TEXTURE_2D, fbs[nb_fb].texid);
|
glBindTexture(GL_TEXTURE_2D, fbs[nb_fb].texid);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, g_width, g_height, 0,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, g_width, g_height, 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
@ -1002,7 +1002,7 @@ void updateTexture()
|
||||||
void gfxRenderBuffer(gfxBuffer_t buffer)
|
void gfxRenderBuffer(gfxBuffer_t buffer)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static HANDLE region = NULL;
|
static HANDLE region = nullptr;
|
||||||
int realWidth = pBufferWidth, realHeight = pBufferHeight;
|
int realWidth = pBufferWidth, realHeight = pBufferHeight;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer);
|
WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <Project64-video/Renderer/Renderer.h>
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
int TMU_SIZE = 8 * 2048 * 2048;
|
int TMU_SIZE = 8 * 2048 * 2048;
|
||||||
static unsigned char* texture = NULL;
|
static unsigned char* texture = nullptr;
|
||||||
|
|
||||||
int packed_pixels_support = -1;
|
int packed_pixels_support = -1;
|
||||||
int ati_sucks = -1;
|
int ati_sucks = -1;
|
||||||
|
@ -40,7 +40,7 @@ typedef struct _texlist
|
||||||
} texlist;
|
} texlist;
|
||||||
|
|
||||||
static int nbTex = 0;
|
static int nbTex = 0;
|
||||||
static texlist *list = NULL;
|
static texlist *list = nullptr;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
||||||
|
@ -53,7 +53,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
texlist *aux = list;
|
texlist *aux = list;
|
||||||
int sz = nbTex;
|
int sz = nbTex;
|
||||||
if (aux == NULL) return;
|
if (aux == nullptr) return;
|
||||||
t = (unsigned int*)malloc(sz * sizeof(int));
|
t = (unsigned int*)malloc(sz * sizeof(int));
|
||||||
while (aux && aux->id >= idmin && aux->id < idmax)
|
while (aux && aux->id >= idmin && aux->id < idmax)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
|
||||||
list = aux;
|
list = aux;
|
||||||
nbTex--;
|
nbTex--;
|
||||||
}
|
}
|
||||||
while (aux != NULL && aux->next != NULL)
|
while (aux != nullptr && aux->next != nullptr)
|
||||||
{
|
{
|
||||||
if (aux->next->id >= idmin && aux->next->id < idmax)
|
if (aux->next->id >= idmin && aux->next->id < idmax)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ void add_tex(unsigned int id)
|
||||||
texlist *aux = list;
|
texlist *aux = list;
|
||||||
texlist *aux2;
|
texlist *aux2;
|
||||||
//printf("ADDTEX nbtex is now %d (%06x)\n", nbTex, id);
|
//printf("ADDTEX nbtex is now %d (%06x)\n", nbTex, id);
|
||||||
if (list == NULL || id < list->id)
|
if (list == nullptr || id < list->id)
|
||||||
{
|
{
|
||||||
nbTex++;
|
nbTex++;
|
||||||
list = (texlist*)malloc(sizeof(texlist));
|
list = (texlist*)malloc(sizeof(texlist));
|
||||||
|
@ -97,9 +97,9 @@ void add_tex(unsigned int id)
|
||||||
list->id = id;
|
list->id = id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (aux->next != NULL && aux->next->id < id) aux = aux->next;
|
while (aux->next != nullptr && aux->next->id < id) aux = aux->next;
|
||||||
// ZIGGY added this test so that add_tex now accept re-adding an existing texture
|
// ZIGGY added this test so that add_tex now accept re-adding an existing texture
|
||||||
if (aux->next != NULL && aux->next->id == id) return;
|
if (aux->next != nullptr && aux->next->id == id) return;
|
||||||
nbTex++;
|
nbTex++;
|
||||||
aux2 = aux->next;
|
aux2 = aux->next;
|
||||||
aux->next = (texlist*)malloc(sizeof(texlist));
|
aux->next = (texlist*)malloc(sizeof(texlist));
|
||||||
|
@ -112,7 +112,7 @@ void init_textures()
|
||||||
tex0_width = tex0_height = tex1_width = tex1_height = 2;
|
tex0_width = tex0_height = tex1_width = tex1_height = 2;
|
||||||
// ZIGGY because remove_tex isn't called (Pj64 doesn't like it), it's better
|
// ZIGGY because remove_tex isn't called (Pj64 doesn't like it), it's better
|
||||||
// to leave these so that they'll be reused (otherwise we have a memory leak)
|
// to leave these so that they'll be reused (otherwise we have a memory leak)
|
||||||
// list = NULL;
|
// list = nullptr;
|
||||||
// nbTex = 0;
|
// nbTex = 0;
|
||||||
|
|
||||||
if (!texture) texture = (unsigned char*)malloc(2048 * 2048 * 4);
|
if (!texture) texture = (unsigned char*)malloc(2048 * 2048 * 4);
|
||||||
|
@ -124,9 +124,9 @@ void free_textures()
|
||||||
// ZIGGY for some reasons, Pj64 doesn't like remove_tex on exit
|
// ZIGGY for some reasons, Pj64 doesn't like remove_tex on exit
|
||||||
remove_tex(0x00000000, 0xFFFFFFFF);
|
remove_tex(0x00000000, 0xFFFFFFFF);
|
||||||
#endif
|
#endif
|
||||||
if (texture != NULL) {
|
if (texture != nullptr) {
|
||||||
free(texture);
|
free(texture);
|
||||||
texture = NULL;
|
texture = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue