From 81fdcb93737983c0a198186eda953fbe3bb5dd8f Mon Sep 17 00:00:00 2001 From: zilmar Date: Sun, 25 Oct 2015 21:50:28 +1100 Subject: [PATCH] [Project64] Get settngs to use std int --- Source/Common/CriticalSection.cpp | 36 + Source/Common/File Class.cpp | 271 ++- Source/Common/Ini File Class.cpp | 1341 ++++++------ Source/Common/Ini File Class.h | 171 +- .../Multilanguage/Language Class.cpp | 1837 ++++++++--------- .../Project64/Multilanguage/Language Class.h | 36 +- .../Project64/N64 System/C Core/Logging.cpp | 4 +- Source/Project64/N64 System/Mips/Eeprom.cpp | 6 +- Source/Project64/N64 System/Mips/FlashRam.cpp | 20 +- Source/Project64/N64 System/Mips/Mempak.cpp | 4 +- Source/Project64/N64 System/Mips/Sram.cpp | 4 +- Source/Project64/N64 System/N64 Class.cpp | 87 +- Source/Project64/N64 System/N64 Class.h | 1 + Source/Project64/Plugins/Plugin Class.cpp | 38 +- Source/Project64/Plugins/Plugin List.cpp | 3 +- .../SettingType/SettingsType-Application.cpp | 382 ++-- .../SettingType/SettingsType-Application.h | 95 +- .../SettingsType-ApplicationIndex.cpp | 67 +- .../SettingsType-ApplicationIndex.h | 51 +- .../Settings/SettingType/SettingsType-Base.h | 70 +- .../SettingType/SettingsType-Cheats.cpp | 113 +- .../SettingType/SettingsType-Cheats.h | 69 +- .../SettingType/SettingsType-GameSetting.cpp | 341 ++- .../SettingType/SettingsType-GameSetting.h | 64 +- .../SettingsType-GameSettingIndex.cpp | 69 +- .../SettingsType-GameSettingIndex.h | 52 +- .../SettingType/SettingsType-RDBCpuType.cpp | 112 +- .../SettingType/SettingsType-RDBCpuType.h | 45 +- .../SettingType/SettingsType-RDBRamSize.cpp | 62 +- .../SettingType/SettingsType-RDBRamSize.h | 45 +- .../SettingType/SettingsType-RDBSaveChip.cpp | 119 +- .../SettingType/SettingsType-RDBSaveChip.h | 45 +- .../SettingType/SettingsType-RelativePath.cpp | 30 +- .../SettingType/SettingsType-RelativePath.h | 50 +- .../SettingType/SettingsType-RomDatabase.cpp | 414 ++-- .../SettingType/SettingsType-RomDatabase.h | 87 +- .../SettingsType-RomDatabaseIndex.cpp | 74 +- .../SettingsType-RomDatabaseIndex.h | 56 +- .../SettingsType-SelectedDirectory.cpp | 48 +- .../SettingsType-SelectedDirectory.h | 60 +- .../SettingType/SettingsType-TempBool.cpp | 36 +- .../SettingType/SettingsType-TempBool.h | 52 +- .../SettingType/SettingsType-TempNumber.cpp | 38 +- .../SettingType/SettingsType-TempNumber.h | 53 +- .../SettingType/SettingsType-TempString.cpp | 39 +- .../SettingType/SettingsType-TempString.h | 55 +- Source/Project64/Settings/Settings Class.cpp | 1671 ++++++++------- Source/Project64/Settings/Settings Class.h | 178 +- Source/Project64/User Interface/Gui Class.cpp | 16 +- .../User Interface/Main Menu Class.cpp | 20 +- .../User Interface/MenuShortCuts.cpp | 4 +- .../User Interface/Notification Class.cpp | 2 +- .../User Interface/Rom Browser Class.cpp | 42 +- Source/Project64/User Interface/Rom Browser.h | 5 +- .../User Interface/Settings Config.cpp | 12 +- .../Settings/Settings Page - Directories.cpp | 10 +- .../Settings Page - Game - General.cpp | 2 +- .../Settings Page - Game - Plugin.cpp | 6 +- .../Settings Page - Game - Status.cpp | 4 +- .../Settings/Settings Page - Plugin.cpp | 4 +- .../User Interface/Settings/Settings Page.h | 8 +- Source/Project64/main.cpp | 2 +- 62 files changed, 4416 insertions(+), 4322 deletions(-) create mode 100644 Source/Common/CriticalSection.cpp diff --git a/Source/Common/CriticalSection.cpp b/Source/Common/CriticalSection.cpp new file mode 100644 index 000000000..05c151cad --- /dev/null +++ b/Source/Common/CriticalSection.cpp @@ -0,0 +1,36 @@ +#include "stdafx.h" + +CriticalSection::CriticalSection() +{ + m_cs = new CRITICAL_SECTION; + ::InitializeCriticalSection((CRITICAL_SECTION *)m_cs); +} + +CriticalSection::~CriticalSection(void) +{ + ::DeleteCriticalSection((CRITICAL_SECTION *)m_cs); + delete (CRITICAL_SECTION *)m_cs; +} + +/** +* Enters a critical section of code. +* Prevents other threads from accessing the section between the enter and leave sections simultaneously. +* @note It is good practice to try and keep the critical section code as little as possible, so that +* other threads are not locked waiting for it. +*/ +void CriticalSection::enter(void) +{ + ::EnterCriticalSection((CRITICAL_SECTION *)m_cs); +} + +/** +* Leaves the critical section. +* Allows threads access to the critical code section again. +* @warning Note that an exception occurring with a critical section may not result in the expected leave being +* called. To ensure that your critical section is exception safe, ensure that you wrap the critical +* section in a try catch, and the catch calls the leave method. +*/ +void CriticalSection::leave(void) +{ + ::LeaveCriticalSection((CRITICAL_SECTION *)m_cs); +} \ No newline at end of file diff --git a/Source/Common/File Class.cpp b/Source/Common/File Class.cpp index bf3b29eb9..c5035fb97 100644 --- a/Source/Common/File Class.cpp +++ b/Source/Common/File Class.cpp @@ -3,210 +3,209 @@ #include CFile::CFile() : - m_hFile(INVALID_HANDLE_VALUE), - m_bCloseOnDelete(false) + m_hFile(INVALID_HANDLE_VALUE), + m_bCloseOnDelete(false) { } CFile::CFile(HANDLE hFile) : - m_hFile(hFile), - m_bCloseOnDelete(true) + m_hFile(hFile), + m_bCloseOnDelete(true) { - if (hFile == 0) - { - _ASSERTE(hFile != 0); - } + if (hFile == 0) + { + _ASSERTE(hFile != 0); + } } CFile::~CFile() { - if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete) - { - Close(); - } + if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete) + { + Close(); + } } -CFile::CFile(LPCTSTR lpszFileName, ULONG nOpenFlags) : - m_hFile(INVALID_HANDLE_VALUE), - m_bCloseOnDelete(true) +CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) : + m_hFile(INVALID_HANDLE_VALUE), + m_bCloseOnDelete(true) { - Open(lpszFileName, nOpenFlags); + Open(lpszFileName, nOpenFlags); } -bool CFile::Open(LPCTSTR lpszFileName, ULONG nOpenFlags) +bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags) { - if (!Close()) - { - return false; - } + if (!Close()) + { + return false; + } - if (lpszFileName == NULL || _tcslen(lpszFileName) == 0) - { - return false; - } + if (lpszFileName == NULL || _tcslen(lpszFileName) == 0) + { + return false; + } - m_bCloseOnDelete = true; - m_hFile = INVALID_HANDLE_VALUE; + m_bCloseOnDelete = true; + m_hFile = INVALID_HANDLE_VALUE; - ULONG dwAccess = 0; - switch (nOpenFlags & 3) - { - case modeRead: - dwAccess = GENERIC_READ; - break; - case modeWrite: - dwAccess = GENERIC_WRITE; - break; - case modeReadWrite: - dwAccess = GENERIC_READ|GENERIC_WRITE; - break; - default: - _ASSERTE(false); - } + ULONG dwAccess = 0; + switch (nOpenFlags & 3) + { + case modeRead: + dwAccess = GENERIC_READ; + break; + case modeWrite: + dwAccess = GENERIC_WRITE; + break; + case modeReadWrite: + dwAccess = GENERIC_READ|GENERIC_WRITE; + break; + default: + _ASSERTE(false); + } - // map share mode - ULONG dwShareMode = 0; - - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; } - if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; } - if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; } + // map share mode + ULONG dwShareMode = 0; - // map modeNoInherit flag - SECURITY_ATTRIBUTES sa; - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; } + if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; } + if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; } - // map creation flags - ULONG dwCreateFlag = 0; - if (nOpenFlags & modeCreate) - { - if (nOpenFlags & modeNoTruncate) - dwCreateFlag = OPEN_ALWAYS; - else - dwCreateFlag = CREATE_ALWAYS; - } - else - dwCreateFlag = OPEN_EXISTING; + // map modeNoInherit flag + SECURITY_ATTRIBUTES sa; + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0; - // attempt file creation - HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, - dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - { //#define ERROR_PATH_NOT_FOUND 3L - //ULONG err = GetLastError(); - return false; - } - m_hFile = hFile; - m_bCloseOnDelete = TRUE; + // map creation flags + ULONG dwCreateFlag = 0; + if (nOpenFlags & modeCreate) + { + if (nOpenFlags & modeNoTruncate) + dwCreateFlag = OPEN_ALWAYS; + else + dwCreateFlag = CREATE_ALWAYS; + } + else + dwCreateFlag = OPEN_EXISTING; - return TRUE; + // attempt file creation + HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, + dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { //#define ERROR_PATH_NOT_FOUND 3L + //ULONG err = GetLastError(); + return false; + } + m_hFile = hFile; + m_bCloseOnDelete = TRUE; + + return TRUE; } bool CFile::Close() { - bool bError = true; - if (m_hFile != INVALID_HANDLE_VALUE) - { - bError = !::CloseHandle(m_hFile); - } - m_hFile = INVALID_HANDLE_VALUE; - m_bCloseOnDelete = false; - return bError; + bool bError = true; + if (m_hFile != INVALID_HANDLE_VALUE) + { + bError = !::CloseHandle(m_hFile); + } + m_hFile = INVALID_HANDLE_VALUE; + m_bCloseOnDelete = false; + return bError; } -ULONG CFile::SeekToEnd ( void ) -{ - return Seek(0, CFile::end); +uint32_t CFile::SeekToEnd ( void ) +{ + return Seek(0, CFile::end); } void CFile::SeekToBegin ( void ) { - Seek(0, CFile::begin); + Seek(0, CFile::begin); } bool CFile::IsOpen( void ) const { - return m_hFile != INVALID_HANDLE_VALUE; + return m_hFile != INVALID_HANDLE_VALUE; } bool CFile::Flush() { - if (m_hFile == INVALID_HANDLE_VALUE) - { - return true; - } + if (m_hFile == INVALID_HANDLE_VALUE) + { + return true; + } - return ::FlushFileBuffers(m_hFile) != 0; + return ::FlushFileBuffers(m_hFile) != 0; } -bool CFile::Write(const void* lpBuf, ULONG nCount) +bool CFile::Write(const void* lpBuf, uint32_t nCount) { - if (nCount == 0) - { - return true; // avoid Win32 "null-write" option - } + if (nCount == 0) + { + return true; // avoid Win32 "null-write" option + } - ULONG nWritten = 0; - if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL)) - { - return false; - } + ULONG nWritten = 0; + if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL)) + { + return false; + } - if (nWritten != nCount) - { - // Win32s will not return an error all the time (usually DISK_FULL) - return false; - } - return true; + if (nWritten != nCount) + { + // Win32s will not return an error all the time (usually DISK_FULL) + return false; + } + return true; } -ULONG CFile::Read(void* lpBuf, ULONG nCount) +uint32_t CFile::Read(void* lpBuf, uint32_t nCount) { - if (nCount == 0) - { - return 0; // avoid Win32 "null-read" - } + if (nCount == 0) + { + return 0; // avoid Win32 "null-read" + } - ULONG dwRead = 0; - if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL)) - { - return 0; - } - return (UINT)dwRead; + ULONG dwRead = 0; + if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL)) + { + return 0; + } + return (UINT)dwRead; } long CFile::Seek(long lOff, SeekPosition nFrom) { - ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom); - if (dwNew == (ULONG)-1) - { - return -1; - } + ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom); + if (dwNew == (ULONG)-1) + { + return -1; + } - return dwNew; + return dwNew; } -ULONG CFile::GetPosition() const +uint32_t CFile::GetPosition() const { - return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT); + return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT); } -bool CFile::SetLength(ULONG dwNewLen) +bool CFile::SetLength(uint32_t dwNewLen) { - Seek((LONG)dwNewLen, begin); + Seek((LONG)dwNewLen, begin); - return ::SetEndOfFile(m_hFile) != 0; + return ::SetEndOfFile(m_hFile) != 0; } -ULONG CFile::GetLength() const +uint32_t CFile::GetLength() const { - return GetFileSize(m_hFile,0); + return GetFileSize(m_hFile,0); } bool CFile::SetEndOfFile() { - return ::SetEndOfFile(m_hFile) != 0; + return ::SetEndOfFile(m_hFile) != 0; } - diff --git a/Source/Common/Ini File Class.cpp b/Source/Common/Ini File Class.cpp index a779fe9dc..217de27a1 100644 --- a/Source/Common/Ini File Class.cpp +++ b/Source/Common/Ini File Class.cpp @@ -3,860 +3,857 @@ #include CIniFileBase::CIniFileBase(CFileBase & FileObject, LPCTSTR FileName) : - m_lastSectionSearch(0), - m_CurrentSectionFilePos(0), - m_LineFeed("\r\n"), - m_ReadOnly(true), - m_InstantFlush(true), - m_File(FileObject), - m_FileName(FileName), - m_CurrentSectionDirty(false) + m_lastSectionSearch(0), + m_CurrentSectionFilePos(0), + m_LineFeed("\r\n"), + m_ReadOnly(true), + m_InstantFlush(true), + m_File(FileObject), + m_FileName(FileName), + m_CurrentSectionDirty(false) { } CIniFileBase::~CIniFileBase(void) { - SaveCurrentSection(); + SaveCurrentSection(); } void CIniFileBase::fInsertSpaces ( int Pos, int NoOfSpaces ) { - enum { fIS_MvSize = 0x2000 }; + enum { fIS_MvSize = 0x2000 }; - unsigned char Data[fIS_MvSize + 1]; - int SizeToRead, result; - long end, WritePos; + unsigned char Data[fIS_MvSize + 1]; + int SizeToRead, result; + long end, WritePos; - m_File.Seek(0,CFileBase::end); - end = m_File.GetPosition(); + m_File.Seek(0,CFileBase::end); + end = m_File.GetPosition(); - if (NoOfSpaces > 0) - { - stdstr_f SpaceBuffer(_T("%*c"),NoOfSpaces,' '); + if (NoOfSpaces > 0) + { + stdstr_f SpaceBuffer(_T("%*c"),NoOfSpaces,' '); - do { - SizeToRead = end - Pos; - if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } - if (SizeToRead > 0) - { - m_File.Seek(SizeToRead * -1,CFileBase::current); - WritePos = m_File.GetPosition(); - memset(Data,0,sizeof(Data)); - result = m_File.Read(Data,SizeToRead); - m_File.Seek(WritePos,CFileBase::begin); - end = WritePos; + do { + SizeToRead = end - Pos; + if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } + if (SizeToRead > 0) + { + m_File.Seek(SizeToRead * -1,CFileBase::current); + WritePos = m_File.GetPosition(); + memset(Data,0,sizeof(Data)); + result = m_File.Read(Data,SizeToRead); + m_File.Seek(WritePos,CFileBase::begin); + end = WritePos; - m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length()); - m_File.Write(Data,result); - m_File.Seek(WritePos,CFileBase::begin); - } - } while (SizeToRead > 0); - } - if (NoOfSpaces < 0) - { - int ReadPos = Pos + (NoOfSpaces * -1); - int WritePos = Pos; + m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length()); + m_File.Write(Data,result); + m_File.Seek(WritePos,CFileBase::begin); + } + } while (SizeToRead > 0); + } + if (NoOfSpaces < 0) + { + int ReadPos = Pos + (NoOfSpaces * -1); + int WritePos = Pos; - do { - SizeToRead = end - ReadPos; - if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } - m_File.Seek(ReadPos,CFileBase::begin); - m_File.Read(Data,SizeToRead); - m_File.Seek(WritePos,CFileBase::begin); - m_File.Write(Data,SizeToRead); - ReadPos += SizeToRead; - WritePos += SizeToRead; - } while (SizeToRead > 0); + do { + SizeToRead = end - ReadPos; + if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; } + m_File.Seek(ReadPos,CFileBase::begin); + m_File.Read(Data,SizeToRead); + m_File.Seek(WritePos,CFileBase::begin); + m_File.Write(Data,SizeToRead); + ReadPos += SizeToRead; + WritePos += SizeToRead; + } while (SizeToRead > 0); - m_File.Seek(WritePos,CFileBase::begin); - stdstr_f SpaceBuffer(_T("%*c"),(NoOfSpaces * -1),' '); - m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length()); + m_File.Seek(WritePos,CFileBase::begin); + stdstr_f SpaceBuffer(_T("%*c"),(NoOfSpaces * -1),' '); + m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length()); - m_File.Seek(WritePos,CFileBase::begin); - m_File.SetEndOfFile(); - m_File.Seek(0,CFileBase::begin); - } + m_File.Seek(WritePos,CFileBase::begin); + m_File.SetEndOfFile(); + m_File.Seek(0,CFileBase::begin); + } } int CIniFileBase::GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos ) { - enum { BufferIncrease = 0x2000 }; - if (MaxDataSize == 0) - { - ReadPos = 0; - MaxDataSize = BufferIncrease; - Data = new char[MaxDataSize]; - DataSize = m_File.Read(&Data[DataSize],MaxDataSize); - } + enum { BufferIncrease = 0x2000 }; + if (MaxDataSize == 0) + { + ReadPos = 0; + MaxDataSize = BufferIncrease; + Data = new char[MaxDataSize]; + DataSize = m_File.Read(&Data[DataSize],MaxDataSize); + } - for (;;) - { - int count; + for (;;) + { + int count; - for (count = ReadPos; count < DataSize; count ++) - { - if (Data[count] == '\n') - { - int len = (count - ReadPos) + 1; - String = &Data[ReadPos]; - String[len-1] = 0; - ReadPos = count + 1; - return len; - } - } + for (count = ReadPos; count < DataSize; count ++) + { + if (Data[count] == '\n') + { + int len = (count - ReadPos) + 1; + String = &Data[ReadPos]; + String[len-1] = 0; + ReadPos = count + 1; + return len; + } + } - if (ReadPos != 0) - { - if ((DataSize - ReadPos) > 0 ) - { - memmove(Data,&Data[ReadPos],DataSize - ReadPos); - } - DataSize -= ReadPos; - ReadPos = 0; - } - else - { - //Increase buffer size - int NewMaxDataSize = MaxDataSize + BufferIncrease; - char * NewBuffer = new char[NewMaxDataSize]; - if (NewBuffer == NULL) - { - return -1; - } - memcpy(NewBuffer,Data,DataSize); - MaxDataSize = NewMaxDataSize; - delete [] Data; - Data = NewBuffer; - } + if (ReadPos != 0) + { + if ((DataSize - ReadPos) > 0 ) + { + memmove(Data,&Data[ReadPos],DataSize - ReadPos); + } + DataSize -= ReadPos; + ReadPos = 0; + } + else + { + //Increase buffer size + int NewMaxDataSize = MaxDataSize + BufferIncrease; + char * NewBuffer = new char[NewMaxDataSize]; + if (NewBuffer == NULL) + { + return -1; + } + memcpy(NewBuffer,Data,DataSize); + MaxDataSize = NewMaxDataSize; + delete [] Data; + Data = NewBuffer; + } - int dwRead = m_File.Read(&Data[DataSize],MaxDataSize - DataSize); - if (dwRead == 0) - { - if (DataSize > 0) - { - int len = DataSize + 1; - String = &Data[ReadPos]; - String[len-1] = 0; - DataSize = 0; - ReadPos = 0; - return len; - } - return -1; - } - DataSize += dwRead; - } + int dwRead = m_File.Read(&Data[DataSize],MaxDataSize - DataSize); + if (dwRead == 0) + { + if (DataSize > 0) + { + int len = DataSize + 1; + String = &Data[ReadPos]; + String[len-1] = 0; + DataSize = 0; + ReadPos = 0; + return len; + } + return -1; + } + DataSize += dwRead; + } } void CIniFileBase::SaveCurrentSection ( void ) { - if (!m_CurrentSectionDirty) - { - return; - } - m_CurrentSectionDirty = false; - if (m_CurrentSection.length() == 0) - { - m_CurrentSection = "default"; - } + if (!m_CurrentSectionDirty) + { + return; + } + m_CurrentSectionDirty = false; + if (m_CurrentSection.length() == 0) + { + m_CurrentSection = "default"; + } - int lineFeedLen = (int)strlen(m_LineFeed); + int lineFeedLen = (int)strlen(m_LineFeed); - if (m_CurrentSectionFilePos == -1) - { - //Section has not been added yet - m_File.Seek(0,CFileBase::end); + if (m_CurrentSectionFilePos == -1) + { + //Section has not been added yet + m_File.Seek(0,CFileBase::end); - int len = (int)m_CurrentSection.length() + (lineFeedLen * 2) + 5; - AUTO_PTR SectionName(new char[len]); - if (m_File.GetLength() < (int)strlen(m_LineFeed)) - { - sprintf(SectionName.get(),"[%s]%s",m_CurrentSection.c_str(),m_LineFeed); - } - else - { - sprintf(SectionName.get(),"%s[%s]%s",m_LineFeed,m_CurrentSection.c_str(),m_LineFeed); - } - m_File.Write(SectionName.get(),(int)strlen(SectionName.get())); - m_CurrentSectionFilePos = m_File.GetPosition(); - m_SectionsPos.insert(FILELOC::value_type(m_CurrentSection,m_CurrentSectionFilePos)); - } - else - { - //increase/decrease space needed - int NeededBufferLen = 0; - { - AUTO_PTR LineData(NULL); - int len = 0; + int len = (int)m_CurrentSection.length() + (lineFeedLen * 2) + 5; + AUTO_PTR SectionName(new char[len]); + if (m_File.GetLength() < (int)strlen(m_LineFeed)) + { + sprintf(SectionName.get(),"[%s]%s",m_CurrentSection.c_str(),m_LineFeed); + } + else + { + sprintf(SectionName.get(),"%s[%s]%s",m_LineFeed,m_CurrentSection.c_str(),m_LineFeed); + } + m_File.Write(SectionName.get(),(int)strlen(SectionName.get())); + m_CurrentSectionFilePos = m_File.GetPosition(); + m_SectionsPos.insert(FILELOC::value_type(m_CurrentSection,m_CurrentSectionFilePos)); + } + else + { + //increase/decrease space needed + int NeededBufferLen = 0; + { + AUTO_PTR LineData(NULL); + int len = 0; - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; - if (newLen > len) - { - LineData.reset(new char[newLen]); - len = newLen; - } - sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed); - NeededBufferLen += (int)strlen(LineData.get()); - } - } - int currentLen = 0; + for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) + { + int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; + if (newLen > len) + { + LineData.reset(new char[newLen]); + len = newLen; + } + sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed); + NeededBufferLen += (int)strlen(LineData.get()); + } + } + int currentLen = 0; - m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin); + m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin); - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - char *Input = NULL, *Data = NULL; - - //Skip first line as it is the section name - int StartPos = m_CurrentSectionFilePos; - int EndPos = StartPos; - do { - result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1 || Input[0] != '[') - { - EndPos = ((m_File.GetPosition() - DataSize) + ReadPos); + int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; + char *Input = NULL, *Data = NULL; - continue; - } - if (Input[0] == '[') - { - NeededBufferLen += lineFeedLen; - } - break; - } while (result >= 0); - currentLen = EndPos - StartPos; + //Skip first line as it is the section name + int StartPos = m_CurrentSectionFilePos; + int EndPos = StartPos; + do { + result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); + if (result <= 1) { continue; } + if (strlen(CleanLine(Input)) <= 1 || Input[0] != '[') + { + EndPos = ((m_File.GetPosition() - DataSize) + ReadPos); - if (Data) { delete [] Data; Data = NULL; } + continue; + } + if (Input[0] == '[') + { + NeededBufferLen += lineFeedLen; + } + break; + } while (result >= 0); + currentLen = EndPos - StartPos; - if (NeededBufferLen != currentLen) - { - fInsertSpaces(StartPos,NeededBufferLen - currentLen); - m_File.Flush(); - ClearSectionPosList(StartPos); - } - //set pointer to beginning of the start pos - m_File.Seek(StartPos, CFileBase::begin); - } + if (Data) { delete [] Data; Data = NULL; } + if (NeededBufferLen != currentLen) + { + fInsertSpaces(StartPos,NeededBufferLen - currentLen); + m_File.Flush(); + ClearSectionPosList(StartPos); + } + //set pointer to beginning of the start pos + m_File.Seek(StartPos, CFileBase::begin); + } - { - AUTO_PTR LineData(NULL); - int len = 0; - - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; - if (newLen > len) - { - LineData.reset(new char[newLen]); - len = newLen; - } - sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed); - m_File.Write(LineData.get(),(int)strlen(LineData.get())); - } - } - m_File.Flush(); + { + AUTO_PTR LineData(NULL); + int len = 0; + + for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) + { + int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5; + if (newLen > len) + { + LineData.reset(new char[newLen]); + len = newLen; + } + sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed); + m_File.Write(LineData.get(),(int)strlen(LineData.get())); + } + } + m_File.Flush(); } bool CIniFileBase::MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection ) { - if (strcmp(lpSectionName,m_CurrentSection.c_str()) == 0) - { - return true; - } - if (ChangeCurrentSection) - { - SaveCurrentSection(); - m_CurrentSection = ""; - } - - char *Input = NULL, *Data = NULL; - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; + if (strcmp(lpSectionName,m_CurrentSection.c_str()) == 0) + { + return true; + } + if (ChangeCurrentSection) + { + SaveCurrentSection(); + m_CurrentSection = ""; + } - FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName)); - bool bFoundSection = false; - if (iter != m_SectionsPos.end()) - { - if (ChangeCurrentSection) - { - m_CurrentSection = iter->first; - m_CurrentSectionFilePos = iter->second; - } - m_File.Seek(iter->second,CFileBase::begin); - bFoundSection = true; - } - else - { - m_File.Seek(m_lastSectionSearch, CFileBase::begin); + char *Input = NULL, *Data = NULL; + int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - //long Fpos; - BYTE pUTF8[3]; - pUTF8[0] = 0xef; - pUTF8[1] = 0xbb; - pUTF8[2] = 0xbf; + FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName)); + bool bFoundSection = false; + if (iter != m_SectionsPos.end()) + { + if (ChangeCurrentSection) + { + m_CurrentSection = iter->first; + m_CurrentSectionFilePos = iter->second; + } + m_File.Seek(iter->second,CFileBase::begin); + bFoundSection = true; + } + else + { + m_File.Seek(m_lastSectionSearch, CFileBase::begin); - do { - result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } + //long Fpos; + BYTE pUTF8[3]; + pUTF8[0] = 0xef; + pUTF8[1] = 0xbb; + pUTF8[2] = 0xbf; - //We Only care about sections - char * CurrentSection = Input; + do { + result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); + if (result <= 1) { continue; } + if (strlen(CleanLine(Input)) <= 1) { continue; } - if (m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3)) - { - CurrentSection += 3; - } + //We Only care about sections + char * CurrentSection = Input; - if (CurrentSection[0] != '[') { continue; } - int lineEndPos = (int)strlen(CurrentSection) - 1; - if (CurrentSection[lineEndPos] != ']') { continue; } - //take off the ']' from the end of the string - CurrentSection[lineEndPos] = 0; - CurrentSection += 1; - m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos; - m_SectionsPos.insert(FILELOC::value_type(CurrentSection,m_lastSectionSearch)); + if (m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3)) + { + CurrentSection += 3; + } - if (_stricmp(lpSectionName,CurrentSection) != 0) - { - continue; - } + if (CurrentSection[0] != '[') { continue; } + int lineEndPos = (int)strlen(CurrentSection) - 1; + if (CurrentSection[lineEndPos] != ']') { continue; } + //take off the ']' from the end of the string + CurrentSection[lineEndPos] = 0; + CurrentSection += 1; + m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos; + m_SectionsPos.insert(FILELOC::value_type(CurrentSection,m_lastSectionSearch)); - if (ChangeCurrentSection) - { - m_CurrentSection = lpSectionName; - m_CurrentSectionFilePos = m_lastSectionSearch; - } - else - { - m_File.Seek(m_lastSectionSearch,CFileBase::begin); - } - bFoundSection = true; - break; - } while (result >= 0); - } + if (_stricmp(lpSectionName,CurrentSection) != 0) + { + continue; + } - if (bFoundSection && ChangeCurrentSection) - { - m_CurrentSectionData.clear(); - do { - result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - if (Input[0] == '[') { break; } - char * Pos = strchr(Input,'='); - if (Pos == NULL) { continue; } - char * Value = &Pos[1]; + if (ChangeCurrentSection) + { + m_CurrentSection = lpSectionName; + m_CurrentSectionFilePos = m_lastSectionSearch; + } + else + { + m_File.Seek(m_lastSectionSearch,CFileBase::begin); + } + bFoundSection = true; + break; + } while (result >= 0); + } - char * Pos1 = Pos-1; - while (((*Pos1 == ' ') || (*Pos1 == '\t')) && (Pos1 > Input)) - { - Pos1--; - } - Pos1[1] = 0; + if (bFoundSection && ChangeCurrentSection) + { + m_CurrentSectionData.clear(); + do { + result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); + if (result <= 1) { continue; } + if (strlen(CleanLine(Input)) <= 1) { continue; } + if (Input[0] == '[') { break; } + char * Pos = strchr(Input,'='); + if (Pos == NULL) { continue; } + char * Value = &Pos[1]; - m_CurrentSectionData.insert(KeyValueList::value_type(Input,Value)); - } while (result >= 0); - } + char * Pos1 = Pos-1; + while (((*Pos1 == ' ') || (*Pos1 == '\t')) && (Pos1 > Input)) + { + Pos1--; + } + Pos1[1] = 0; - if (Data) { delete [] Data; Data = NULL; } - return bFoundSection; + m_CurrentSectionData.insert(KeyValueList::value_type(Input,Value)); + } while (result >= 0); + } + + if (Data) { delete [] Data; Data = NULL; } + return bFoundSection; } const char * CIniFileBase::CleanLine ( char * const Line ) { - char * Pos = Line; + char * Pos = Line; - //Remove any comment from the line - while (Pos != NULL) - { - Pos = strchr(Pos,'/'); - if (Pos != NULL) - { - if (Pos[1] == '/') - { - if (Pos > Line) - { - char * Pos_1 = Pos-1; + //Remove any comment from the line + while (Pos != NULL) + { + Pos = strchr(Pos,'/'); + if (Pos != NULL) + { + if (Pos[1] == '/') + { + if (Pos > Line) + { + char * Pos_1 = Pos-1; - if (Pos_1[0] != ':') - { - Pos[0] = 0; - } - else - Pos += 1; - } - else - { - Pos[0] = 0; - } - } - else - { - Pos += 1; - } - } - } + if (Pos_1[0] != ':') + { + Pos[0] = 0; + } + else + Pos += 1; + } + else + { + Pos[0] = 0; + } + } + else + { + Pos += 1; + } + } + } - //strip any spaces or line feeds from the end of the line - for (int count = (int)strlen(&Line[0]) - 1; count >= 0; count --) - { - if (Line[count] != ' ' && Line[count] != '\r') { break; } - Line[count] = 0; - } - return Line; + //strip any spaces or line feeds from the end of the line + for (int count = (int)strlen(&Line[0]) - 1; count >= 0; count --) + { + if (Line[count] != ' ' && Line[count] != '\r') { break; } + Line[count] = 0; + } + return Line; } void CIniFileBase::OpenIniFileReadOnly() { - if (m_File.Open(m_FileName.c_str(),CFileBase::modeRead)) - { - m_ReadOnly = true; - m_File.Seek(0,CFileBase::begin); - } + if (m_File.Open(m_FileName.c_str(),CFileBase::modeRead)) + { + m_ReadOnly = true; + m_File.Seek(0,CFileBase::begin); + } } void CIniFileBase::OpenIniFile(bool bCreate) { - //Open for reading/Writing - m_ReadOnly = false; - if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::shareDenyWrite)) - { - if (!m_File.Open(m_FileName.c_str(),CFileBase::modeRead)) - { - if(bCreate) - { - if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::modeCreate | CFileBase::shareDenyWrite)) - { - return; - } - } - } - else - { - m_ReadOnly = true; - } - } - m_File.Seek(0,CFileBase::begin); + //Open for reading/Writing + m_ReadOnly = false; + if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::shareDenyWrite)) + { + if (!m_File.Open(m_FileName.c_str(),CFileBase::modeRead)) + { + if(bCreate) + { + if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::modeCreate | CFileBase::shareDenyWrite)) + { + return; + } + } + } + else + { + m_ReadOnly = true; + } + } + m_File.Seek(0,CFileBase::begin); } bool CIniFileBase::IsEmpty() { - if (m_File.GetLength() == 0) - return true; - return false; + if (m_File.GetLength() == 0) + return true; + return false; } bool CIniFileBase::IsFileOpen ( void ) -{ - return m_File.IsOpen(); +{ + return m_File.IsOpen(); } bool CIniFileBase::DeleteSection ( LPCTSTR lpSectionName ) { - stdstr_f strSection("[%s]",lpSectionName); + stdstr_f strSection("[%s]",lpSectionName); - /*if(m_File.IsOpen()) - { - m_CurrentSectionFilePos = 0; - m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin); + /*if(m_File.IsOpen()) + { + m_CurrentSectionFilePos = 0; + m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin); - ULONG dwSize = m_File.GetLength(); - if(dwSize) - { - char *pData = new char[dwSize+1]; - if(pData) - { - ULONG dwRet = m_File.Read(pData, dwSize); - if(dwRet != 0) - { - if(dwRet <= dwSize) - { - pData[dwRet] = 0; + ULONG dwSize = m_File.GetLength(); + if(dwSize) + { + char *pData = new char[dwSize+1]; + if(pData) + { + ULONG dwRet = m_File.Read(pData, dwSize); + if(dwRet != 0) + { + if(dwRet <= dwSize) + { + pData[dwRet] = 0; - char *pSection = strstr(pData, strSection.c_str()); - if(pSection) - { - char tmp = pSection[0]; - pSection[0] = 0; + char *pSection = strstr(pData, strSection.c_str()); + if(pSection) + { + char tmp = pSection[0]; + pSection[0] = 0; - std::string strNewData = pData; - pSection[0] = tmp; + std::string strNewData = pData; + pSection[0] = tmp; - char *pEndSection = pSection + strlen(strSection.c_str()); - char *pNextSection = strstr(pEndSection, "["); - if(pNextSection) - { - strNewData += pNextSection; - } + char *pEndSection = pSection + strlen(strSection.c_str()); + char *pNextSection = strstr(pEndSection, "["); + if(pNextSection) + { + strNewData += pNextSection; + } - m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin); - m_File.Write(strNewData.c_str(), (ULONG)strlen(strNewData.c_str())); - m_File.Flush(); - m_File.SetEndOfFile(); - } - } - else - { - delete [] pData; + m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin); + m_File.Write(strNewData.c_str(), (ULONG)strlen(strNewData.c_str())); + m_File.Flush(); + m_File.SetEndOfFile(); + } + } + else + { + delete [] pData; - return false; - } - } + return false; + } + } - delete [] pData; - } - else - return false; - } - } - else - return false;*/ + delete [] pData; + } + else + return false; + } + } + else + return false;*/ - return true; + return true; } bool CIniFileBase::GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, stdstr & Value ) { - CGuard Guard(m_CS); + CGuard Guard(m_CS); - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } + if (lpSectionName == NULL || strlen(lpSectionName) == 0) + { + lpSectionName = "default"; + } - if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - Value = iter->second.c_str(); - return true; - } - } - Value = lpDefault; - return false; + if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true)) + { + KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); + if (iter != m_CurrentSectionData.end()) + { + Value = iter->second.c_str(); + return true; + } + } + Value = lpDefault; + return false; } stdstr CIniFileBase::GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault ) { - stdstr Value; - GetString(lpSectionName,lpKeyName,lpDefault,Value); - return Value; + stdstr Value; + GetString(lpSectionName,lpKeyName,lpDefault,Value); + return Value; } #ifdef _UNICODE bool CIniFileBase::GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value ) { - CGuard Guard(m_CS); + CGuard Guard(m_CS); - std::string strSection; + std::string strSection; - if (lpSectionName == NULL || wcslen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - stdstr::fromTString(lpSectionName,strSection); - } + if (lpSectionName == NULL || wcslen(lpSectionName) == 0) + { + strSection = "default"; + } + else + { + stdstr::fromTString(lpSectionName,strSection); + } - if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - stdstr::toTString(iter->second.c_str(),Value); - return true; - } - } - Value = lpDefault; - return false; + if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) + { + KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); + if (iter != m_CurrentSectionData.end()) + { + stdstr::toTString(iter->second.c_str(),Value); + return true; + } + } + Value = lpDefault; + return false; } stdstr CIniFileBase::GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault ) { - stdstr Value; - GetString(lpSectionName,lpKeyName,lpDefault,Value); - return Value; + stdstr Value; + GetString(lpSectionName,lpKeyName,lpDefault,Value); + return Value; } #endif -ULONG CIniFileBase::GetString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString, ULONG nSize ) +uint32_t CIniFileBase::GetString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString, uint32_t nSize ) { - CGuard Guard(m_CS); + CGuard Guard(m_CS); - std::string strSection; + std::string strSection; - if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } + if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) + { + strSection = "default"; + } + else + { + strSection = lpSectionName; + } - if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - _tcsncpy(lpReturnedString,iter->second.c_str(),nSize - 1); - lpReturnedString[nSize - 1] = 0; - return (ULONG)_tcslen(lpReturnedString); - } - } - _tcsncpy(lpReturnedString,lpDefault,nSize - 1); - lpReturnedString[nSize - 1] = 0; - return (ULONG)_tcslen(lpReturnedString); + if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true)) + { + KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); + if (iter != m_CurrentSectionData.end()) + { + _tcsncpy(lpReturnedString,iter->second.c_str(),nSize - 1); + lpReturnedString[nSize - 1] = 0; + return (ULONG)_tcslen(lpReturnedString); + } + } + _tcsncpy(lpReturnedString,lpDefault,nSize - 1); + lpReturnedString[nSize - 1] = 0; + return (ULONG)_tcslen(lpReturnedString); } #ifdef _UNICODE ULONG CIniFileBase::GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault ) { - ULONG Value; - GetNumber(lpSectionName,lpKeyName,nDefault,Value); - return Value; + ULONG Value; + GetNumber(lpSectionName,lpKeyName,nDefault,Value); + return Value; } bool CIniFileBase::GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault, ULONG & Value ) { - std::string strSection; + std::string strSection; - if (lpSectionName != NULL && wcslen(lpSectionName) > 0) - { - stdstr::fromTString(lpSectionName,strSection); - return GetNumber(strSection.c_str(),lpKeyName.c_str(),nDefault,Value); - } - else - { - return GetNumber(NULL,lpKeyName.c_str(),nDefault,Value); - } + if (lpSectionName != NULL && wcslen(lpSectionName) > 0) + { + stdstr::fromTString(lpSectionName,strSection); + return GetNumber(strSection.c_str(),lpKeyName.c_str(),nDefault,Value); + } + else + { + return GetNumber(NULL,lpKeyName.c_str(),nDefault,Value); + } } #endif -ULONG CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault ) +uint32_t CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, uint32_t nDefault ) { - ULONG Value; - GetNumber(lpSectionName,lpKeyName,nDefault,Value); - return Value; + uint32_t Value; + GetNumber(lpSectionName,lpKeyName,nDefault,Value); + return Value; } -bool CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault, ULONG & Value ) +bool CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, uint32_t nDefault, uint32_t & Value ) { - CGuard Guard(m_CS); + CGuard Guard(m_CS); - if (lpSectionName == NULL || strlen(lpSectionName) == 0) - { - lpSectionName = "default"; - } + if (lpSectionName == NULL || strlen(lpSectionName) == 0) + { + lpSectionName = "default"; + } - if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true)) - { - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - Value = 0; - sscanf(iter->second.c_str(), "%u", &Value); - return true; - } - } - Value = nDefault; - return false; + if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true)) + { + KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); + if (iter != m_CurrentSectionData.end()) + { + Value = 0; + sscanf(iter->second.c_str(), "%u", &Value); + return true; + } + } + Value = nDefault; + return false; } void CIniFileBase::SaveString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpString ) { - CGuard Guard(m_CS); - if (!m_File.IsOpen()) - { - if (lpString) - { - OpenIniFile(); - } - if (!m_File.IsOpen()) - { - return; - } - } - std::string strSection; + CGuard Guard(m_CS); + if (!m_File.IsOpen()) + { + if (lpString) + { + OpenIniFile(); + } + if (!m_File.IsOpen()) + { + return; + } + } + std::string strSection; - if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } + if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) + { + strSection = "default"; + } + else + { + strSection = lpSectionName; + } - if (!MoveToSectionNameData(strSection.c_str(),true)) - { - m_CurrentSection = strSection; - m_CurrentSectionData.clear(); - m_CurrentSectionFilePos = -1; - } - - KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); - if (iter != m_CurrentSectionData.end()) - { - if (lpString) - { - if (iter->second != lpString) - { - iter->second = lpString; - m_CurrentSectionDirty = true; - } - } - else - { - m_CurrentSectionData.erase(iter); - m_CurrentSectionDirty = true; - } - } - else - { - if (lpString) - { - m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName,lpString)); - m_CurrentSectionDirty = true; - } - } + if (!MoveToSectionNameData(strSection.c_str(),true)) + { + m_CurrentSection = strSection; + m_CurrentSectionData.clear(); + m_CurrentSectionFilePos = -1; + } - if (m_InstantFlush) - { - SaveCurrentSection(); - } + KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); + if (iter != m_CurrentSectionData.end()) + { + if (lpString) + { + if (iter->second != lpString) + { + iter->second = lpString; + m_CurrentSectionDirty = true; + } + } + else + { + m_CurrentSectionData.erase(iter); + m_CurrentSectionDirty = true; + } + } + else + { + if (lpString) + { + m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName,lpString)); + m_CurrentSectionDirty = true; + } + } + + if (m_InstantFlush) + { + SaveCurrentSection(); + } } -void CIniFileBase::SaveNumber ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, ULONG Value ) +void CIniFileBase::SaveNumber ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, uint32_t Value ) { - //translate the string to an ascii version and save as text - SaveString(lpSectionName,lpKeyName,stdstr_f(_T("%d"),Value).c_str()); + //translate the string to an ascii version and save as text + SaveString(lpSectionName,lpKeyName,stdstr_f(_T("%d"),Value).c_str()); } void CIniFileBase::FlushChanges (void) { - CGuard Guard(m_CS); - SaveCurrentSection(); + CGuard Guard(m_CS); + SaveCurrentSection(); } void CIniFileBase::SetAutoFlush (bool AutoFlush) { - m_InstantFlush = AutoFlush; - if (AutoFlush) - { - FlushChanges(); - } + m_InstantFlush = AutoFlush; + if (AutoFlush) + { + FlushChanges(); + } } - void CIniFileBase::GetKeyList ( LPCTSTR lpSectionName, strlist &List ) { - List.clear(); + List.clear(); - CGuard Guard(m_CS); - if (!m_File.IsOpen()) - { - return; - } + CGuard Guard(m_CS); + if (!m_File.IsOpen()) + { + return; + } - if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) - { - lpSectionName = "default"; - } + if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) + { + lpSectionName = "default"; + } - if (MoveToSectionNameData(lpSectionName,true)) - { - for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) - { - List.push_back(iter->first); - } - } + if (MoveToSectionNameData(lpSectionName,true)) + { + for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++) + { + List.push_back(iter->first); + } + } } void CIniFileBase::GetKeyValueData ( LPCTSTR lpSectionName, KeyValueData & List ) { - CGuard Guard(m_CS); - if (!m_File.IsOpen()) - { - return; - } + CGuard Guard(m_CS); + if (!m_File.IsOpen()) + { + return; + } - std::string strSection; + std::string strSection; - if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) - { - strSection = "default"; - } - else - { - strSection = lpSectionName; - } + if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) + { + strSection = "default"; + } + else + { + strSection = lpSectionName; + } - if (!MoveToSectionNameData(strSection.c_str(),false)) { return; } + if (!MoveToSectionNameData(strSection.c_str(),false)) { return; } - int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; - char *Input = NULL, *Data = NULL; - do { - result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); - if (result <= 1) { continue; } - if (strlen(CleanLine(Input)) <= 1) { continue; } - if (Input[0] == '[') { break; } - char * Pos = strchr(Input,'='); - if (Pos == NULL) { continue; } - Pos[0] = 0; + int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result; + char *Input = NULL, *Data = NULL; + do { + result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos); + if (result <= 1) { continue; } + if (strlen(CleanLine(Input)) <= 1) { continue; } + if (Input[0] == '[') { break; } + char * Pos = strchr(Input,'='); + if (Pos == NULL) { continue; } + Pos[0] = 0; - List.insert(KeyValueData::value_type(Input,&Pos[1])); - } while (result >= 0); - if (Data) { delete [] Data; Data = NULL; } + List.insert(KeyValueData::value_type(Input,&Pos[1])); + } while (result >= 0); + if (Data) { delete [] Data; Data = NULL; } } void CIniFileBase::ClearSectionPosList( long FilePos ) { - if (FilePos <= 0) - { - m_SectionsPos.clear(); - m_lastSectionSearch = 0; - } - else - { - FILELOC::iterator iter = m_SectionsPos.begin(); - while (iter != m_SectionsPos.end()) - { - FILELOC::iterator CurrentIter = iter; - iter ++; - long TestFilePos = CurrentIter->second; - if (TestFilePos > FilePos) - { - m_SectionsPos.erase(CurrentIter); - } - } - m_lastSectionSearch = FilePos; - } - + if (FilePos <= 0) + { + m_SectionsPos.clear(); + m_lastSectionSearch = 0; + } + else + { + FILELOC::iterator iter = m_SectionsPos.begin(); + while (iter != m_SectionsPos.end()) + { + FILELOC::iterator CurrentIter = iter; + iter ++; + long TestFilePos = CurrentIter->second; + if (TestFilePos > FilePos) + { + m_SectionsPos.erase(CurrentIter); + } + } + m_lastSectionSearch = FilePos; + } } void CIniFileBase::GetVectorOfSections( SectionList & sections) { - sections.clear(); + sections.clear(); - CGuard Guard(m_CS); - if (!m_File.IsOpen()) - { - return; - } + CGuard Guard(m_CS); + if (!m_File.IsOpen()) + { + return; + } - { - stdstr_f DoesNotExist(_T("DoesNotExist%d%d%d"),rand(),rand(),rand()); - MoveToSectionNameData(DoesNotExist.c_str(),false); - } + { + stdstr_f DoesNotExist(_T("DoesNotExist%d%d%d"),rand(),rand(),rand()); + MoveToSectionNameData(DoesNotExist.c_str(),false); + } - for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++) - { - sections.push_back(iter->first); - } -} + for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++) + { + sections.push_back(iter->first); + } +} \ No newline at end of file diff --git a/Source/Common/Ini File Class.h b/Source/Common/Ini File Class.h index cf14d62bd..55a10cf87 100644 --- a/Source/Common/Ini File Class.h +++ b/Source/Common/Ini File Class.h @@ -5,124 +5,121 @@ #include "std string.h" #include -class CIniFileBase +class CIniFileBase { - struct insensitive_compare - { - bool operator() (const std::string & a, const std::string & b) const { return _stricmp(a.c_str(),b.c_str()) < 0; } - }; + struct insensitive_compare + { + bool operator() (const std::string & a, const std::string & b) const { return _stricmp(a.c_str(),b.c_str()) < 0; } + }; - typedef std::string ansi_string; - typedef std::map FILELOC; - typedef FILELOC::iterator FILELOC_ITR; - typedef std::map KeyValueList; + typedef std::string ansi_string; + typedef std::map FILELOC; + typedef FILELOC::iterator FILELOC_ITR; + typedef std::map KeyValueList; public: - typedef std::map KeyValueData; - typedef std::vector SectionList; + typedef std::map KeyValueData; + typedef std::vector SectionList; protected: - CFileBase & m_File; - stdstr m_FileName; + CFileBase & m_File; + stdstr m_FileName; private: - ansi_string m_CurrentSection; - bool m_CurrentSectionDirty; - int m_CurrentSectionFilePos; // Where in the file is the current Section - KeyValueList m_CurrentSectionData; - - long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos + ansi_string m_CurrentSection; + bool m_CurrentSectionDirty; + int m_CurrentSectionFilePos; // Where in the file is the current Section + KeyValueList m_CurrentSectionData; + long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos - bool m_ReadOnly; - bool m_InstantFlush; - LPCSTR m_LineFeed; + bool m_ReadOnly; + bool m_InstantFlush; + const char * m_LineFeed; - CriticalSection m_CS; - FILELOC m_SectionsPos; + CriticalSection m_CS; + FILELOC m_SectionsPos; - //void AddItemData ( LPCTSTR lpKeyName, LPCTSTR lpString); - //bool ChangeItemData ( LPCTSTR lpKeyName, LPCTSTR lpString ); - //void DeleteItem ( LPCSTR lpKeyName ); - void fInsertSpaces ( int Pos, int NoOfSpaces ); - int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos ); - bool MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection ); - const char * CleanLine ( char * const Line ); - void ClearSectionPosList( long FilePos ); + //void AddItemData ( const char * lpKeyName, const char * lpString); + //bool ChangeItemData ( const char * lpKeyName, const char * lpString ); + //void DeleteItem ( const char * lpKeyName ); + void fInsertSpaces ( int Pos, int NoOfSpaces ); + int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos ); + bool MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection); + const char * CleanLine ( char * const Line ); + void ClearSectionPosList( long FilePos ); protected: - void OpenIniFileReadOnly(); - void OpenIniFile(bool bCreate = true); - void SaveCurrentSection ( void ); + void OpenIniFileReadOnly(); + void OpenIniFile(bool bCreate = true); + void SaveCurrentSection ( void ); public: - CIniFileBase( CFileBase & FileObject, LPCTSTR FileName ); - virtual ~CIniFileBase(void); + CIniFileBase(CFileBase & FileObject, const char * FileName); + virtual ~CIniFileBase(void); - bool IsEmpty(); - bool IsFileOpen ( void ); - bool DeleteSection ( LPCSTR lpSectionName ); - bool GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, stdstr & Value ); - stdstr GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault ); - ULONG GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, ULONG nSize ); - ULONG GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault ); - bool GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault, ULONG & Value ); + bool IsEmpty(); + bool IsFileOpen ( void ); + bool DeleteSection(const char * lpSectionName); + bool GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault, stdstr & Value ); + stdstr GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault ); + uint32_t GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize ); + uint32_t GetNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t nDefault ); + bool GetNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value ); #ifdef _UNICODE - bool DeleteSection ( LPCWSTR lpSectionName ); - bool GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value ); - stdstr GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault ); - ULONG GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPTSTR lpReturnedString, ULONG nSize ); - ULONG GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault ); - bool GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault, ULONG & Value ); + bool DeleteSection ( LPCWSTR lpSectionName ); + bool GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value ); + stdstr GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault ); + uint32_t GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPTSTR lpReturnedString, uint32_t nSize ); + uint32_t GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, uint32_t nDefault ); + bool GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, uint32_t nDefault, uint32_t & Value ); #endif - virtual void SaveString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpString ); - virtual void SaveNumber ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, ULONG Value ); - void SetAutoFlush (bool AutoFlush); - void FlushChanges (void); - void GetKeyList ( LPCTSTR lpSectionName, strlist &List ); - void GetKeyValueData ( LPCTSTR lpSectionName, KeyValueData & List ); - - void GetVectorOfSections( SectionList & sections); - const stdstr &GetFileName() {return m_FileName;} + virtual void SaveString ( const char * lpSectionName, const char * lpKeyName, const char * lpString ); + virtual void SaveNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t Value ); + void SetAutoFlush (bool AutoFlush); + void FlushChanges (void); + void GetKeyList ( const char * lpSectionName, strlist &List ); + void GetKeyValueData ( const char * lpSectionName, KeyValueData & List ); + + void GetVectorOfSections( SectionList & sections); + const stdstr &GetFileName() {return m_FileName;} }; template class CIniFileT : - public CIniFileBase + public CIniFileBase { public: - CIniFileT( LPCTSTR FileName ) : - CIniFileBase(m_FileObject,FileName) - { - //Try to open file for reading - OpenIniFile(); + CIniFileT( const char * FileName ) : + CIniFileBase(m_FileObject,FileName) + { + //Try to open file for reading + OpenIniFile(); + } - } - - CIniFileT( LPCTSTR FileName, bool bCreate, bool bReadOnly) : - CIniFileBase(m_FileObject,FileName) - { - if(bReadOnly) - { - OpenIniFileReadOnly(); - } - else - { - //Try to open file for reading - OpenIniFile(bCreate); - } - - } - virtual ~CIniFileT(void) - { - SaveCurrentSection(); - } + CIniFileT( const char * FileName, bool bCreate, bool bReadOnly) : + CIniFileBase(m_FileObject,FileName) + { + if(bReadOnly) + { + OpenIniFileReadOnly(); + } + else + { + //Try to open file for reading + OpenIniFile(bCreate); + } + } + virtual ~CIniFileT(void) + { + SaveCurrentSection(); + } protected: - CFileStorage m_FileObject; + CFileStorage m_FileObject; }; typedef CIniFileT CIniFile; diff --git a/Source/Project64/Multilanguage/Language Class.cpp b/Source/Project64/Multilanguage/Language Class.cpp index 1144ab209..d1e242981 100644 --- a/Source/Project64/Multilanguage/Language Class.cpp +++ b/Source/Project64/Multilanguage/Language Class.cpp @@ -9,6 +9,8 @@ * * ****************************************************************************/ #include "stdafx.h" +#include +#include CLanguage * g_Lang = NULL; @@ -16,481 +18,481 @@ void CLanguage::LoadDefaultStrings (void) { #define DEF_STR(ID,str) m_DefaultStrings.insert(LANG_STRINGS::value_type(ID,str)) - DEF_STR(EMPTY_STRING, L"" ); + DEF_STR(EMPTY_STRING, L"" ); -/********************************************************************************* -* Meta Information * -*********************************************************************************/ -//About DLL - DEF_STR(LANGUAGE_NAME, L"" ); - DEF_STR(LANGUAGE_AUTHOR, L"" ); - DEF_STR(LANGUAGE_VERSION, L"" ); - DEF_STR(LANGUAGE_DATE, L"" ); + /********************************************************************************* + * Meta Information * + *********************************************************************************/ + //About DLL + DEF_STR(LANGUAGE_NAME, L"" ); + DEF_STR(LANGUAGE_AUTHOR, L"" ); + DEF_STR(LANGUAGE_VERSION, L"" ); + DEF_STR(LANGUAGE_DATE, L"" ); -//About DLL Dialog - DEF_STR(INI_CURRENT_LANG, L"Current Language" ); - DEF_STR(INI_AUTHOR, L"Author" ); - DEF_STR(INI_VERSION, L"Version" ); - DEF_STR(INI_DATE, L"Date" ); - DEF_STR(INI_HOMEPAGE, L"Visit Home Page" ); - DEF_STR(INI_CURRENT_RDB, L"ROM Database (.RDB)" ); - DEF_STR(INI_CURRENT_CHT, L"Cheat Code File (.CHT)" ); - DEF_STR(INI_CURRENT_RDX, L"Extended ROM Info (.RDX)"); + //About DLL Dialog + DEF_STR(INI_CURRENT_LANG, L"Current Language" ); + DEF_STR(INI_AUTHOR, L"Author" ); + DEF_STR(INI_VERSION, L"Version" ); + DEF_STR(INI_DATE, L"Date" ); + DEF_STR(INI_HOMEPAGE, L"Visit Home Page" ); + DEF_STR(INI_CURRENT_RDB, L"ROM Database (.RDB)" ); + DEF_STR(INI_CURRENT_CHT, L"Cheat Code File (.CHT)" ); + DEF_STR(INI_CURRENT_RDX, L"Extended ROM Info (.RDX)"); -//About INI title - DEF_STR(INI_TITLE, L"About Config Files" ); + //About INI title + DEF_STR(INI_TITLE, L"About Config Files" ); -/********************************************************************************* -* Numbers * -*********************************************************************************/ - DEF_STR(NUMBER_0, L"0" ); - DEF_STR(NUMBER_1, L"1" ); - DEF_STR(NUMBER_2, L"2" ); - DEF_STR(NUMBER_3, L"3" ); - DEF_STR(NUMBER_4, L"4" ), - DEF_STR(NUMBER_5, L"5" ); - DEF_STR(NUMBER_6, L"6" ); - DEF_STR(NUMBER_7, L"7" ); - DEF_STR(NUMBER_8, L"8" ); - DEF_STR(NUMBER_9, L"9" ); + /********************************************************************************* + * Numbers * + *********************************************************************************/ + DEF_STR(NUMBER_0, L"0" ); + DEF_STR(NUMBER_1, L"1" ); + DEF_STR(NUMBER_2, L"2" ); + DEF_STR(NUMBER_3, L"3" ); + DEF_STR(NUMBER_4, L"4" ), + DEF_STR(NUMBER_5, L"5" ); + DEF_STR(NUMBER_6, L"6" ); + DEF_STR(NUMBER_7, L"7" ); + DEF_STR(NUMBER_8, L"8" ); + DEF_STR(NUMBER_9, L"9" ); -/********************************************************************************* -* Menu * -*********************************************************************************/ -//File Menu - DEF_STR(MENU_FILE, L"&File" ); - DEF_STR(MENU_OPEN, L"&Open ROM" ); - DEF_STR(MENU_ROM_INFO, L"ROM &Info...." ); - DEF_STR(MENU_START, L"Start Emulation" ); - DEF_STR(MENU_END, L"&End Emulation" ); - DEF_STR(MENU_CHOOSE_ROM, L"Choose ROM Directory..." ); - DEF_STR(MENU_REFRESH, L"Refresh ROM List" ); - DEF_STR(MENU_RECENT_ROM, L"Recent ROM" ); - DEF_STR(MENU_RECENT_DIR, L"Recent ROM Directories" ); - DEF_STR(MENU_EXIT, L"E&xit" ); + /********************************************************************************* + * Menu * + *********************************************************************************/ + //File Menu + DEF_STR(MENU_FILE, L"&File" ); + DEF_STR(MENU_OPEN, L"&Open ROM" ); + DEF_STR(MENU_ROM_INFO, L"ROM &Info...." ); + DEF_STR(MENU_START, L"Start Emulation" ); + DEF_STR(MENU_END, L"&End Emulation" ); + DEF_STR(MENU_CHOOSE_ROM, L"Choose ROM Directory..." ); + DEF_STR(MENU_REFRESH, L"Refresh ROM List" ); + DEF_STR(MENU_RECENT_ROM, L"Recent ROM" ); + DEF_STR(MENU_RECENT_DIR, L"Recent ROM Directories" ); + DEF_STR(MENU_EXIT, L"E&xit" ); -//System Menu - DEF_STR(MENU_SYSTEM, L"&System" ); - DEF_STR(MENU_RESET, L"&Reset" ); - DEF_STR(MENU_PAUSE, L"&Pause" ); - DEF_STR(MENU_BITMAP, L"Generate Bitmap" ); - DEF_STR(MENU_LIMIT_FPS, L"Limit FPS" ); - DEF_STR(MENU_SAVE, L"&Save State" ); - DEF_STR(MENU_SAVE_AS, L"Save As..." ); - DEF_STR(MENU_RESTORE, L"&Load State" ); - DEF_STR(MENU_LOAD, L"Load..." ); - DEF_STR(MENU_CURRENT_SAVE,L"Current Save S&tate" ); - DEF_STR(MENU_CHEAT, L"Cheats..." ); - DEF_STR(MENU_GS_BUTTON, L"GS Button" ); - DEF_STR(MENU_RESUME, L"R&esume" ); - DEF_STR(MENU_RESET_SOFT, L"&Soft Reset" ); - DEF_STR(MENU_RESET_HARD, L"&Hard Reset" ); + //System Menu + DEF_STR(MENU_SYSTEM, L"&System" ); + DEF_STR(MENU_RESET, L"&Reset" ); + DEF_STR(MENU_PAUSE, L"&Pause" ); + DEF_STR(MENU_BITMAP, L"Generate Bitmap" ); + DEF_STR(MENU_LIMIT_FPS, L"Limit FPS" ); + DEF_STR(MENU_SAVE, L"&Save State" ); + DEF_STR(MENU_SAVE_AS, L"Save As..." ); + DEF_STR(MENU_RESTORE, L"&Load State" ); + DEF_STR(MENU_LOAD, L"Load..." ); + DEF_STR(MENU_CURRENT_SAVE,L"Current Save S&tate" ); + DEF_STR(MENU_CHEAT, L"Cheats..." ); + DEF_STR(MENU_GS_BUTTON, L"GS Button" ); + DEF_STR(MENU_RESUME, L"R&esume" ); + DEF_STR(MENU_RESET_SOFT, L"&Soft Reset" ); + DEF_STR(MENU_RESET_HARD, L"&Hard Reset" ); -//Options Menu - DEF_STR(MENU_OPTIONS, L"&Options" ); - DEF_STR(MENU_FULL_SCREEN, L"&Full Screen" ); - DEF_STR(MENU_ON_TOP, L"&Always on &Top" ); - DEF_STR(MENU_CONFG_GFX, L"Configure Graphics Plugin..." ); - DEF_STR(MENU_CONFG_AUDIO, L"Configure Audio Plugin..." ); - DEF_STR(MENU_CONFG_CTRL, L"Configure Controller Plugin..." ); - DEF_STR(MENU_CONFG_RSP, L"Configure RSP Plugin..." ); - DEF_STR(MENU_SHOW_CPU, L"Show CPU Usage" ); - DEF_STR(MENU_SETTINGS, L"&Settings..." ); + //Options Menu + DEF_STR(MENU_OPTIONS, L"&Options" ); + DEF_STR(MENU_FULL_SCREEN, L"&Full Screen" ); + DEF_STR(MENU_ON_TOP, L"&Always on &Top" ); + DEF_STR(MENU_CONFG_GFX, L"Configure Graphics Plugin..." ); + DEF_STR(MENU_CONFG_AUDIO, L"Configure Audio Plugin..." ); + DEF_STR(MENU_CONFG_CTRL, L"Configure Controller Plugin..." ); + DEF_STR(MENU_CONFG_RSP, L"Configure RSP Plugin..." ); + DEF_STR(MENU_SHOW_CPU, L"Show CPU Usage" ); + DEF_STR(MENU_SETTINGS, L"&Settings..." ); -//Debugger Menu - DEF_STR(MENU_DEBUGGER, L"&Debugger" ); + //Debugger Menu + DEF_STR(MENU_DEBUGGER, L"&Debugger" ); -//Language Menu - DEF_STR(MENU_LANGUAGE, L"&Language" ); + //Language Menu + DEF_STR(MENU_LANGUAGE, L"&Language" ); -//Help Menu - DEF_STR(MENU_HELP, L"&Help" ); - DEF_STR(MENU_ABOUT_INI, L"About Conf&ig Files" ); - DEF_STR(MENU_ABOUT_PJ64, L"&About Project64" ); - DEF_STR(MENU_FORUM, L"Support &Forum" ); - DEF_STR(MENU_HOMEPAGE, L"&Homepage" ); + //Help Menu + DEF_STR(MENU_HELP, L"&Help" ); + DEF_STR(MENU_ABOUT_INI, L"About Conf&ig Files" ); + DEF_STR(MENU_ABOUT_PJ64, L"&About Project64" ); + DEF_STR(MENU_FORUM, L"Support &Forum" ); + DEF_STR(MENU_HOMEPAGE, L"&Homepage" ); -//Current Save Slot menu - DEF_STR(MENU_SLOT_DEFAULT, L"Default" ); - DEF_STR(MENU_SLOT_1, L"Slot 1" ); - DEF_STR(MENU_SLOT_2, L"Slot 2" ); - DEF_STR(MENU_SLOT_3, L"Slot 3" ); - DEF_STR(MENU_SLOT_4, L"Slot 4" ); - DEF_STR(MENU_SLOT_5, L"Slot 5" ); - DEF_STR(MENU_SLOT_6, L"Slot 6" ); - DEF_STR(MENU_SLOT_7, L"Slot 7" ); - DEF_STR(MENU_SLOT_8, L"Slot 8" ); - DEF_STR(MENU_SLOT_9, L"Slot 9" ); - DEF_STR(MENU_SLOT_10, L"Slot 10" ); + //Current Save Slot menu + DEF_STR(MENU_SLOT_DEFAULT,L"Default" ); + DEF_STR(MENU_SLOT_1, L"Slot 1" ); + DEF_STR(MENU_SLOT_2, L"Slot 2" ); + DEF_STR(MENU_SLOT_3, L"Slot 3" ); + DEF_STR(MENU_SLOT_4, L"Slot 4" ); + DEF_STR(MENU_SLOT_5, L"Slot 5" ); + DEF_STR(MENU_SLOT_6, L"Slot 6" ); + DEF_STR(MENU_SLOT_7, L"Slot 7" ); + DEF_STR(MENU_SLOT_8, L"Slot 8" ); + DEF_STR(MENU_SLOT_9, L"Slot 9" ); + DEF_STR(MENU_SLOT_10, L"Slot 10" ); -//Pop up Menu - DEF_STR(POPUP_PLAY, L"Play Game" ); - DEF_STR(POPUP_INFO, L"ROM Information" ); - DEF_STR(POPUP_SETTINGS, L"Edit Game Settings" ); - DEF_STR(POPUP_CHEATS, L"Edit Cheats" ); - DEF_STR(POPUP_GFX_PLUGIN,L"Graphics Plugin" ); + //Pop up Menu + DEF_STR(POPUP_PLAY, L"Play Game" ); + DEF_STR(POPUP_INFO, L"ROM Information" ); + DEF_STR(POPUP_SETTINGS, L"Edit Game Settings" ); + DEF_STR(POPUP_CHEATS, L"Edit Cheats" ); + DEF_STR(POPUP_GFX_PLUGIN,L"Graphics Plugin" ); -//Alternate Name to save Slot - DEF_STR(SAVE_SLOT_DEFAULT,L"Save Slot - Default" ); - DEF_STR(SAVE_SLOT_1, L"Save Slot - 1" ); - DEF_STR(SAVE_SLOT_2, L"Save Slot - 2" ); - DEF_STR(SAVE_SLOT_3, L"Save Slot - 3" ); - DEF_STR(SAVE_SLOT_4, L"Save Slot - 4" ); - DEF_STR(SAVE_SLOT_5, L"Save Slot - 5" ); - DEF_STR(SAVE_SLOT_6, L"Save Slot - 6" ); - DEF_STR(SAVE_SLOT_7, L"Save Slot - 7" ); - DEF_STR(SAVE_SLOT_8, L"Save Slot - 8" ); - DEF_STR(SAVE_SLOT_9, L"Save Slot - 9" ); - DEF_STR(SAVE_SLOT_10, L"Save Slot - 10" ); + //Alternate Name to save Slot + DEF_STR(SAVE_SLOT_DEFAULT,L"Save Slot - Default" ); + DEF_STR(SAVE_SLOT_1, L"Save Slot - 1" ); + DEF_STR(SAVE_SLOT_2, L"Save Slot - 2" ); + DEF_STR(SAVE_SLOT_3, L"Save Slot - 3" ); + DEF_STR(SAVE_SLOT_4, L"Save Slot - 4" ); + DEF_STR(SAVE_SLOT_5, L"Save Slot - 5" ); + DEF_STR(SAVE_SLOT_6, L"Save Slot - 6" ); + DEF_STR(SAVE_SLOT_7, L"Save Slot - 7" ); + DEF_STR(SAVE_SLOT_8, L"Save Slot - 8" ); + DEF_STR(SAVE_SLOT_9, L"Save Slot - 9" ); + DEF_STR(SAVE_SLOT_10, L"Save Slot - 10" ); -/********************************************************************************* -* ROM Browser * -*********************************************************************************/ -//ROM Browser Fields - DEF_STR(RB_FILENAME, L"File Name" ); - DEF_STR(RB_INTERNALNAME, L"Internal Name" ); - DEF_STR(RB_GOODNAME, L"Good Name" ); - DEF_STR(RB_STATUS, L"Status" ); - DEF_STR(RB_ROMSIZE, L"ROM Size" ); - DEF_STR(RB_NOTES_CORE, L"Notes (core)" ); - DEF_STR(RB_NOTES_PLUGIN, L"Notes (default plugins)" ); - DEF_STR(RB_NOTES_USER, L"Notes (user)" ); - DEF_STR(RB_CART_ID, L"Cartridge ID" ); - DEF_STR(RB_MANUFACTUER, L"Manufacturer" ); - DEF_STR(RB_COUNTRY, L"Country" ); - DEF_STR(RB_DEVELOPER, L"Developer" ); - DEF_STR(RB_CRC1, L"CRC1" ); - DEF_STR(RB_CRC2, L"CRC2" ); - DEF_STR(RB_CICCHIP, L"CIC Chip" ); - DEF_STR(RB_RELEASE_DATE, L"Release Date" ); - DEF_STR(RB_GENRE, L"Genre" ); - DEF_STR(RB_PLAYERS, L"Players" ); - DEF_STR(RB_FORCE_FEEDBACK,L"Force Feedback" ); - DEF_STR(RB_FILE_FORMAT, L"File Format" ); + /********************************************************************************* + * ROM Browser * + *********************************************************************************/ + //ROM Browser Fields + DEF_STR(RB_FILENAME, L"File Name" ); + DEF_STR(RB_INTERNALNAME, L"Internal Name" ); + DEF_STR(RB_GOODNAME, L"Good Name" ); + DEF_STR(RB_STATUS, L"Status" ); + DEF_STR(RB_ROMSIZE, L"ROM Size" ); + DEF_STR(RB_NOTES_CORE, L"Notes (core)" ); + DEF_STR(RB_NOTES_PLUGIN, L"Notes (default plugins)" ); + DEF_STR(RB_NOTES_USER, L"Notes (user)" ); + DEF_STR(RB_CART_ID, L"Cartridge ID" ); + DEF_STR(RB_MANUFACTUER, L"Manufacturer" ); + DEF_STR(RB_COUNTRY, L"Country" ); + DEF_STR(RB_DEVELOPER, L"Developer" ); + DEF_STR(RB_CRC1, L"CRC1" ); + DEF_STR(RB_CRC2, L"CRC2" ); + DEF_STR(RB_CICCHIP, L"CIC Chip" ); + DEF_STR(RB_RELEASE_DATE, L"Release Date" ); + DEF_STR(RB_GENRE, L"Genre" ); + DEF_STR(RB_PLAYERS, L"Players" ); + DEF_STR(RB_FORCE_FEEDBACK,L"Force Feedback" ); + DEF_STR(RB_FILE_FORMAT, L"File Format" ); -//Select ROM - DEF_STR(SELECT_ROM_DIR, L"Select current ROM directory" ); + //Select ROM + DEF_STR(SELECT_ROM_DIR, L"Select current ROM directory" ); -//Messages - DEF_STR(RB_NOT_GOOD_FILE,L"Bad ROM? Use GoodN64 & check for updated RDB." ); + //Messages + DEF_STR(RB_NOT_GOOD_FILE,L"Bad ROM? Use GoodN64 & check for updated RDB." ); -/********************************************************************************* -* Options * -*********************************************************************************/ -//Options Title - DEF_STR(OPTIONS_TITLE,L"Settings"); + /********************************************************************************* + * Options * + *********************************************************************************/ + //Options Title + DEF_STR(OPTIONS_TITLE,L"Settings"); -//Tabs - DEF_STR(TAB_PLUGIN, L"Plugins"); - DEF_STR(TAB_DIRECTORY, L"Directories"); - DEF_STR(TAB_OPTIONS, L"Options"); - DEF_STR(TAB_ROMSELECTION,L"ROM Selection"); - DEF_STR(TAB_ADVANCED, L"Advanced"); - DEF_STR(TAB_ROMSETTINGS, L"General Settings"); - DEF_STR(TAB_SHELLINTERGATION,L"Shell Integration"); - DEF_STR(TAB_ROMNOTES, L"Notes"); - DEF_STR(TAB_SHORTCUTS, L"Keyboard Shortcuts"); - DEF_STR(TAB_ROMSTATUS, L"Status"); - DEF_STR(TAB_RECOMPILER, L"Recompiler"); + //Tabs + DEF_STR(TAB_PLUGIN, L"Plugins"); + DEF_STR(TAB_DIRECTORY, L"Directories"); + DEF_STR(TAB_OPTIONS, L"Options"); + DEF_STR(TAB_ROMSELECTION,L"ROM Selection"); + DEF_STR(TAB_ADVANCED, L"Advanced"); + DEF_STR(TAB_ROMSETTINGS, L"General Settings"); + DEF_STR(TAB_SHELLINTERGATION,L"Shell Integration"); + DEF_STR(TAB_ROMNOTES, L"Notes"); + DEF_STR(TAB_SHORTCUTS, L"Keyboard Shortcuts"); + DEF_STR(TAB_ROMSTATUS, L"Status"); + DEF_STR(TAB_RECOMPILER, L"Recompiler"); -//Plugin Dialog - DEF_STR(PLUG_ABOUT, L"About"); - DEF_STR(PLUG_RSP, L" RSP (Reality Signal Processor) plugin: "); - DEF_STR(PLUG_GFX, L" Video (graphics) plugin: "); - DEF_STR(PLUG_AUDIO, L" Audio (sound) plugin: "); - DEF_STR(PLUG_CTRL, L" Input (controller) plugin: "); - DEF_STR(PLUG_HLE_GFX, L"Graphics HLE"); - DEF_STR(PLUG_HLE_AUDIO,L"Audio HLE"); - DEF_STR(PLUG_DEFAULT, L"** Use System Plugin **"); + //Plugin Dialog + DEF_STR(PLUG_ABOUT, L"About"); + DEF_STR(PLUG_RSP, L" RSP (Reality Signal Processor) plugin: "); + DEF_STR(PLUG_GFX, L" Video (graphics) plugin: "); + DEF_STR(PLUG_AUDIO, L" Audio (sound) plugin: "); + DEF_STR(PLUG_CTRL, L" Input (controller) plugin: "); + DEF_STR(PLUG_HLE_GFX, L"Graphics HLE"); + DEF_STR(PLUG_HLE_AUDIO,L"Audio HLE"); + DEF_STR(PLUG_DEFAULT, L"** Use System Plugin **"); -//Directory Dialog - DEF_STR(DIR_PLUGIN, L" Plugin directory: "); - DEF_STR(DIR_ROM, L" ROM directory: "); - DEF_STR(DIR_AUTO_SAVE, L" N64 native saves directory: "); - DEF_STR(DIR_INSTANT_SAVE, L" Saved states directory: "); - DEF_STR(DIR_SCREEN_SHOT, L" Screenshot directory: "); - DEF_STR(DIR_ROM_DEFAULT, L"Last folder that a ROM was open from"); - DEF_STR(DIR_SELECT_PLUGIN, L"Select plugin directory"); - DEF_STR(DIR_SELECT_ROM, L"Select ROM directory"); - DEF_STR(DIR_SELECT_AUTO, L"Select N64 native saves directory"); - DEF_STR(DIR_SELECT_INSTANT,L"Select saved states directory"); - DEF_STR(DIR_SELECT_SCREEN, L"Select screenshot directory"); - DEF_STR(DIR_TEXTURE, L" Texture pack directory: "); - DEF_STR(DIR_SELECT_TEXTURE, L"Select texture pack directory"); + //Directory Dialog + DEF_STR(DIR_PLUGIN, L" Plugin directory: "); + DEF_STR(DIR_ROM, L" ROM directory: "); + DEF_STR(DIR_AUTO_SAVE, L" N64 native saves directory: "); + DEF_STR(DIR_INSTANT_SAVE, L" Saved states directory: "); + DEF_STR(DIR_SCREEN_SHOT, L" Screenshot directory: "); + DEF_STR(DIR_ROM_DEFAULT, L"Last folder that a ROM was open from"); + DEF_STR(DIR_SELECT_PLUGIN, L"Select plugin directory"); + DEF_STR(DIR_SELECT_ROM, L"Select ROM directory"); + DEF_STR(DIR_SELECT_AUTO, L"Select N64 native saves directory"); + DEF_STR(DIR_SELECT_INSTANT,L"Select saved states directory"); + DEF_STR(DIR_SELECT_SCREEN, L"Select screenshot directory"); + DEF_STR(DIR_TEXTURE, L" Texture pack directory: "); + DEF_STR(DIR_SELECT_TEXTURE, L"Select texture pack directory"); -//Options (general) Tab - DEF_STR(OPTION_AUTO_SLEEP, L"Pause emulation when window is not active"); - DEF_STR(OPTION_AUTO_FULLSCREEN, L"Enter full-screen mode when loading a ROM"); - DEF_STR(OPTION_BASIC_MODE, L"Hide advanced settings"); - DEF_STR(OPTION_REMEMBER_CHEAT, L"Remember selected cheats"); - DEF_STR(OPTION_DISABLE_SS, L"Disable screen saver when running a ROM"); - DEF_STR(OPTION_DISPLAY_FR, L"Display speed"); - DEF_STR(OPTION_CHECK_RUNNING, L"Check if Project64 is already running"); - DEF_STR(OPTION_CHANGE_FR, L"Speed display:"); + //Options (general) Tab + DEF_STR(OPTION_AUTO_SLEEP, L"Pause emulation when window is not active"); + DEF_STR(OPTION_AUTO_FULLSCREEN, L"Enter full-screen mode when loading a ROM"); + DEF_STR(OPTION_BASIC_MODE, L"Hide advanced settings"); + DEF_STR(OPTION_REMEMBER_CHEAT, L"Remember selected cheats"); + DEF_STR(OPTION_DISABLE_SS, L"Disable screen saver when running a ROM"); + DEF_STR(OPTION_DISPLAY_FR, L"Display speed"); + DEF_STR(OPTION_CHECK_RUNNING, L"Check if Project64 is already running"); + DEF_STR(OPTION_CHANGE_FR, L"Speed display:"); -//ROM Browser Tab - DEF_STR(RB_MAX_ROMS, L"Max # of ROMs remembered (0-10):"); - DEF_STR(RB_ROMS, L"ROMs"); - DEF_STR(RB_MAX_DIRS, L"Max # of ROM dirs remembered (0-10):"); - DEF_STR(RB_DIRS, L"dirs"); - DEF_STR(RB_USE, L"Use ROM browser"); - DEF_STR(RB_DIR_RECURSION, L"Use directory recursion"); - DEF_STR(RB_AVALIABLE_FIELDS, L"Available fields:"); - DEF_STR(RB_SHOW_FIELDS, L"Show fields in this order:"); - DEF_STR(RB_ADD, L"Add ->"); - DEF_STR(RB_REMOVE, L"<- Remove"); - DEF_STR(RB_UP, L"Up"); - DEF_STR(RB_DOWN, L"Down"); - DEF_STR(RB_REFRESH, L"Automatically refresh browser"); + //ROM Browser Tab + DEF_STR(RB_MAX_ROMS, L"Max # of ROMs remembered (0-10):"); + DEF_STR(RB_ROMS, L"ROMs"); + DEF_STR(RB_MAX_DIRS, L"Max # of ROM dirs remembered (0-10):"); + DEF_STR(RB_DIRS, L"dirs"); + DEF_STR(RB_USE, L"Use ROM browser"); + DEF_STR(RB_DIR_RECURSION, L"Use directory recursion"); + DEF_STR(RB_AVALIABLE_FIELDS, L"Available fields:"); + DEF_STR(RB_SHOW_FIELDS, L"Show fields in this order:"); + DEF_STR(RB_ADD, L"Add ->"); + DEF_STR(RB_REMOVE, L"<- Remove"); + DEF_STR(RB_UP, L"Up"); + DEF_STR(RB_DOWN, L"Down"); + DEF_STR(RB_REFRESH, L"Automatically refresh browser"); -//Advanced Options - DEF_STR(ADVANCE_INFO, L"Most of these changes will not take effect until a new ROM is opened or current ROM is reset."); - DEF_STR(ADVANCE_DEFAULTS, L"Core Defaults"); - DEF_STR(ADVANCE_CPU_STYLE, L"CPU core style:"); - DEF_STR(ADVANCE_SMCM, L"Self-mod methods:"); - DEF_STR(ADVANCE_MEM_SIZE, L"Default memory size:"); - DEF_STR(ADVANCE_ABL, L"Advanced block linking"); - DEF_STR(ADVANCE_AUTO_START, L"Start emulation when ROM is opened"); - DEF_STR(ADVANCE_OVERWRITE, L"Always override default settings with ones from RDB"); - DEF_STR(ADVANCE_COMPRESS, L"Automatically compress saved states"); - DEF_STR(ADVANCE_DEBUGGER, L"Enable debugger"); - DEF_STR(ADVANCE_SMM_CACHE, L"Cache"); - DEF_STR(ADVANCE_SMM_PIDMA, L"PI DMA"); - DEF_STR(ADVANCE_SMM_VALIDATE,L"Start changed"); - DEF_STR(ADVANCE_SMM_PROTECT, L"Protect memory"); - DEF_STR(ADVANCE_SMM_TLB, L"TLB unmapping"); + //Advanced Options + DEF_STR(ADVANCE_INFO, L"Most of these changes will not take effect until a new ROM is opened or current ROM is reset."); + DEF_STR(ADVANCE_DEFAULTS, L"Core Defaults"); + DEF_STR(ADVANCE_CPU_STYLE, L"CPU core style:"); + DEF_STR(ADVANCE_SMCM, L"Self-mod methods:"); + DEF_STR(ADVANCE_MEM_SIZE, L"Default memory size:"); + DEF_STR(ADVANCE_ABL, L"Advanced block linking"); + DEF_STR(ADVANCE_AUTO_START, L"Start emulation when ROM is opened"); + DEF_STR(ADVANCE_OVERWRITE, L"Always override default settings with ones from RDB"); + DEF_STR(ADVANCE_COMPRESS, L"Automatically compress saved states"); + DEF_STR(ADVANCE_DEBUGGER, L"Enable debugger"); + DEF_STR(ADVANCE_SMM_CACHE, L"Cache"); + DEF_STR(ADVANCE_SMM_PIDMA, L"PI DMA"); + DEF_STR(ADVANCE_SMM_VALIDATE,L"Start changed"); + DEF_STR(ADVANCE_SMM_PROTECT, L"Protect memory"); + DEF_STR(ADVANCE_SMM_TLB, L"TLB unmapping"); -//ROM Options - DEF_STR(ROM_CPU_STYLE, L"CPU core style:"); - DEF_STR(ROM_VIREFRESH, L"VI refresh rate:"); - DEF_STR(ROM_MEM_SIZE, L"Memory size:"); - DEF_STR(ROM_ABL, L"Advanced block linking"); - DEF_STR(ROM_SAVE_TYPE, L"Default save type:"); - DEF_STR(ROM_COUNTER_FACTOR, L"Counter factor:"); - DEF_STR(ROM_LARGE_BUFFER, L"Larger compile buffer"); - DEF_STR(ROM_USE_TLB, L"Use TLB"); - DEF_STR(ROM_REG_CACHE, L"Register caching"); - DEF_STR(ROM_DELAY_SI, L"Delay SI interrupt"); - DEF_STR(ROM_FAST_SP, L"Fast SP"); - DEF_STR(ROM_DEFAULT, L"Default"); - DEF_STR(ROM_AUDIO_SIGNAL, L"RSP audio signal"); - DEF_STR(ROM_FIXED_AUDIO, L"Fixed audio timing"); - DEF_STR(ROM_FUNC_FIND, L"Function lookup method:"); - DEF_STR(ROM_CUSTOM_SMM, L"Custom self mod Method"); - DEF_STR(ROM_SYNC_AUDIO, L"Sync using audio"); - DEF_STR(ROM_COUNTPERBYTE, L"AI count per byte:"); - DEF_STR(ROM_32BIT, L"32-bit engine:"); - DEF_STR(ROM_DELAY_DP, L"Delay DP interrupt:"); + //ROM Options + DEF_STR(ROM_CPU_STYLE, L"CPU core style:"); + DEF_STR(ROM_VIREFRESH, L"VI refresh rate:"); + DEF_STR(ROM_MEM_SIZE, L"Memory size:"); + DEF_STR(ROM_ABL, L"Advanced block linking"); + DEF_STR(ROM_SAVE_TYPE, L"Default save type:"); + DEF_STR(ROM_COUNTER_FACTOR, L"Counter factor:"); + DEF_STR(ROM_LARGE_BUFFER, L"Larger compile buffer"); + DEF_STR(ROM_USE_TLB, L"Use TLB"); + DEF_STR(ROM_REG_CACHE, L"Register caching"); + DEF_STR(ROM_DELAY_SI, L"Delay SI interrupt"); + DEF_STR(ROM_FAST_SP, L"Fast SP"); + DEF_STR(ROM_DEFAULT, L"Default"); + DEF_STR(ROM_AUDIO_SIGNAL, L"RSP audio signal"); + DEF_STR(ROM_FIXED_AUDIO, L"Fixed audio timing"); + DEF_STR(ROM_FUNC_FIND, L"Function lookup method:"); + DEF_STR(ROM_CUSTOM_SMM, L"Custom self mod Method"); + DEF_STR(ROM_SYNC_AUDIO, L"Sync using audio"); + DEF_STR(ROM_COUNTPERBYTE, L"AI count per byte:"); + DEF_STR(ROM_32BIT, L"32-bit engine:"); + DEF_STR(ROM_DELAY_DP, L"Delay DP interrupt:"); -//Core Styles - DEF_STR(CORE_INTERPTER, L"Interpreter"); - DEF_STR(CORE_RECOMPILER, L"Recompiler"); - DEF_STR(CORE_SYNC, L"Synchronize cores"); + //Core Styles + DEF_STR(CORE_INTERPTER, L"Interpreter"); + DEF_STR(CORE_RECOMPILER, L"Recompiler"); + DEF_STR(CORE_SYNC, L"Synchronize cores"); -//Self Mod Methods - DEF_STR(SMCM_NONE, L"None"); - DEF_STR(SMCM_CACHE, L"Cache"); - DEF_STR(SMCM_PROECTED, L"Protect memory"); - DEF_STR(SMCM_CHECK_MEM, L"Check memory & cache"); - DEF_STR(SMCM_CHANGE_MEM, L"Change memory & cache"); - DEF_STR(SMCM_CHECK_ADV, L"Check memory advance"); - DEF_STR(SMCM_CACHE2, L"Clear code on cache"); + //Self Mod Methods + DEF_STR(SMCM_NONE, L"None"); + DEF_STR(SMCM_CACHE, L"Cache"); + DEF_STR(SMCM_PROECTED, L"Protect memory"); + DEF_STR(SMCM_CHECK_MEM, L"Check memory & cache"); + DEF_STR(SMCM_CHANGE_MEM, L"Change memory & cache"); + DEF_STR(SMCM_CHECK_ADV, L"Check memory advance"); + DEF_STR(SMCM_CACHE2, L"Clear code on cache"); -//Function Lookup method - DEF_STR(FLM_PLOOKUP, L"Physical lookup table"); - DEF_STR(FLM_VLOOKUP, L"Virtual lookup table"); - DEF_STR(FLM_CHANGEMEM, L"Change memory"); + //Function Lookup method + DEF_STR(FLM_PLOOKUP, L"Physical lookup table"); + DEF_STR(FLM_VLOOKUP, L"Virtual lookup table"); + DEF_STR(FLM_CHANGEMEM, L"Change memory"); -//RDRAM Size - DEF_STR(RDRAM_4MB, L"4 MB"); - DEF_STR(RDRAM_8MB, L"8 MB"); + //RDRAM Size + DEF_STR(RDRAM_4MB, L"4 MB"); + DEF_STR(RDRAM_8MB, L"8 MB"); -//Advanced Block Linking - DEF_STR(ABL_ON, L"On"); - DEF_STR(ABL_OFF, L"Off"); + //Advanced Block Linking + DEF_STR(ABL_ON, L"On"); + DEF_STR(ABL_OFF, L"Off"); -//Save Type - DEF_STR(SAVE_FIRST_USED, L"Use first-used save type"); - DEF_STR(SAVE_4K_EEPROM, L"4-kbit EEPROM"); - DEF_STR(SAVE_16K_EEPROM, L"16-kbit EEPROM"); - DEF_STR(SAVE_SRAM, L"32-kbyte SRAM"); - DEF_STR(SAVE_FLASHRAM, L"Flash RAM"); + //Save Type + DEF_STR(SAVE_FIRST_USED, L"Use first-used save type"); + DEF_STR(SAVE_4K_EEPROM, L"4-kbit EEPROM"); + DEF_STR(SAVE_16K_EEPROM, L"16-kbit EEPROM"); + DEF_STR(SAVE_SRAM, L"32-kbyte SRAM"); + DEF_STR(SAVE_FLASHRAM, L"Flash RAM"); -//Shell Integration Tab - DEF_STR(SHELL_TEXT, L"File extension association:"); + //Shell Integration Tab + DEF_STR(SHELL_TEXT, L"File extension association:"); -//ROM Notes - DEF_STR(NOTE_STATUS, L"ROM status:"); - DEF_STR(NOTE_CORE, L"Core note:"); - DEF_STR(NOTE_PLUGIN, L"Plugin note:"); + //ROM Notes + DEF_STR(NOTE_STATUS, L"ROM status:"); + DEF_STR(NOTE_CORE, L"Core note:"); + DEF_STR(NOTE_PLUGIN, L"Plugin note:"); -// Accelerator Selector - DEF_STR(ACCEL_CPUSTATE_TITLE, L"CPU state:"); - DEF_STR(ACCEL_MENUITEM_TITLE, L"Menu item:"); - DEF_STR(ACCEL_CURRENTKEYS_TITLE, L"Current keys:"); - DEF_STR(ACCEL_SELKEY_TITLE, L"Select new shortcut key:"); - DEF_STR(ACCEL_ASSIGNEDTO_TITLE, L"Currently assigned to:"); - DEF_STR(ACCEL_ASSIGN_BTN, L"Assign"); - DEF_STR(ACCEL_REMOVE_BTN, L"Remove"); - DEF_STR(ACCEL_RESETALL_BTN, L"Reset all"); - DEF_STR(ACCEL_CPUSTATE_1, L"Game not playing"); - DEF_STR(ACCEL_CPUSTATE_2, L"Game playing"); - DEF_STR(ACCEL_CPUSTATE_3, L"Game playing (windowed)"); - DEF_STR(ACCEL_CPUSTATE_4, L"Game playing (full-screen)"); - DEF_STR(ACCEL_DETECTKEY, L"Detect Key"); + // Accelerator Selector + DEF_STR(ACCEL_CPUSTATE_TITLE, L"CPU state:"); + DEF_STR(ACCEL_MENUITEM_TITLE, L"Menu item:"); + DEF_STR(ACCEL_CURRENTKEYS_TITLE, L"Current keys:"); + DEF_STR(ACCEL_SELKEY_TITLE, L"Select new shortcut key:"); + DEF_STR(ACCEL_ASSIGNEDTO_TITLE, L"Currently assigned to:"); + DEF_STR(ACCEL_ASSIGN_BTN, L"Assign"); + DEF_STR(ACCEL_REMOVE_BTN, L"Remove"); + DEF_STR(ACCEL_RESETALL_BTN, L"Reset all"); + DEF_STR(ACCEL_CPUSTATE_1, L"Game not playing"); + DEF_STR(ACCEL_CPUSTATE_2, L"Game playing"); + DEF_STR(ACCEL_CPUSTATE_3, L"Game playing (windowed)"); + DEF_STR(ACCEL_CPUSTATE_4, L"Game playing (full-screen)"); + DEF_STR(ACCEL_DETECTKEY, L"Detect Key"); -// Frame Rate Option - DEF_STR(STR_FR_VIS, L"Vertical interrupts per second"); - DEF_STR(STR_FR_DLS, L"Display lists per second"); - DEF_STR(STR_FR_PERCENT, L"Percentage of full speed"); + // Frame Rate Option + DEF_STR(STR_FR_VIS, L"Vertical interrupts per second"); + DEF_STR(STR_FR_DLS, L"Display lists per second"); + DEF_STR(STR_FR_PERCENT, L"Percentage of full speed"); -// Increase speed - DEF_STR(STR_INSREASE_SPEED, L"Increase Game Speed"); - DEF_STR(STR_DECREASE_SPEED, L"Decrease Game Speed"); + // Increase speed + DEF_STR(STR_INSREASE_SPEED, L"Increase Game Speed"); + DEF_STR(STR_DECREASE_SPEED, L"Decrease Game Speed"); -//Bottom page buttons - DEF_STR(BOTTOM_RESET_PAGE, L"Reset Page"); - DEF_STR(BOTTOM_RESET_ALL, L"Reset All"); - DEF_STR(BOTTOM_APPLY, L"Apply"); - DEF_STR(BOTTOM_CLOSE, L"Close"); - -/********************************************************************************* -* ROM Information * -*********************************************************************************/ -//ROM Info Title - DEF_STR(INFO_TITLE, L"ROM Information"); + //Bottom page buttons + DEF_STR(BOTTOM_RESET_PAGE, L"Reset Page"); + DEF_STR(BOTTOM_RESET_ALL, L"Reset All"); + DEF_STR(BOTTOM_APPLY, L"Apply"); + DEF_STR(BOTTOM_CLOSE, L"Close"); -//ROM Info Text - DEF_STR(INFO_ROM_NAME_TEXT, L"ROM name:"); - DEF_STR(INFO_FILE_NAME_TEXT, L"File name:"); - DEF_STR(INFO_LOCATION_TEXT, L"Location:"); - DEF_STR(INFO_SIZE_TEXT, L"ROM size:"); - DEF_STR(INFO_CART_ID_TEXT, L"Cartridge ID:"); - DEF_STR(INFO_MANUFACTURER_TEXT, L"Manufacturer:"); - DEF_STR(INFO_COUNTRY_TEXT, L"Country:"); - DEF_STR(INFO_CRC1_TEXT, L"CRC1:"); - DEF_STR(INFO_CRC2_TEXT, L"CRC2:"); - DEF_STR(INFO_CIC_CHIP_TEXT, L"CIC chip:"); - DEF_STR(INFO_MD5_TEXT, L"MD5:"); + /********************************************************************************* + * ROM Information * + *********************************************************************************/ + //ROM Info Title + DEF_STR(INFO_TITLE, L"ROM Information"); -/********************************************************************************* -* Cheats * -*********************************************************************************/ -//Cheat List - DEF_STR(CHEAT_TITLE, L"Cheats"); - DEF_STR(CHEAT_LIST_FRAME, L"Cheats:"); - DEF_STR(CHEAT_NOTES_FRAME, L" Notes: "); - DEF_STR(CHEAT_MARK_ALL, L"Mark All"); - DEF_STR(CHEAT_MARK_NONE, L"Unmark All"); + //ROM Info Text + DEF_STR(INFO_ROM_NAME_TEXT, L"ROM name:"); + DEF_STR(INFO_FILE_NAME_TEXT, L"File name:"); + DEF_STR(INFO_LOCATION_TEXT, L"Location:"); + DEF_STR(INFO_SIZE_TEXT, L"ROM size:"); + DEF_STR(INFO_CART_ID_TEXT, L"Cartridge ID:"); + DEF_STR(INFO_MANUFACTURER_TEXT, L"Manufacturer:"); + DEF_STR(INFO_COUNTRY_TEXT, L"Country:"); + DEF_STR(INFO_CRC1_TEXT, L"CRC1:"); + DEF_STR(INFO_CRC2_TEXT, L"CRC2:"); + DEF_STR(INFO_CIC_CHIP_TEXT, L"CIC chip:"); + DEF_STR(INFO_MD5_TEXT, L"MD5:"); -//Add Cheat - DEF_STR(CHEAT_ADDCHEAT_FRAME, L"Add Cheat"); - DEF_STR(CHEAT_ADDCHEAT_NAME, L"Name:"); - DEF_STR(CHEAT_ADDCHEAT_CODE, L"Code:"); - DEF_STR(CHEAT_ADDCHEAT_INSERT, L"Insert"); - DEF_STR(CHEAT_ADDCHEAT_CLEAR, L"Clear"); - DEF_STR(CHEAT_ADDCHEAT_NOTES, L" Cheat Notes: "); - DEF_STR(CHEAT_ADD_TO_DB, L"Add to DB"); + /********************************************************************************* + * Cheats * + *********************************************************************************/ + //Cheat List + DEF_STR(CHEAT_TITLE, L"Cheats"); + DEF_STR(CHEAT_LIST_FRAME, L"Cheats:"); + DEF_STR(CHEAT_NOTES_FRAME, L" Notes: "); + DEF_STR(CHEAT_MARK_ALL, L"Mark All"); + DEF_STR(CHEAT_MARK_NONE, L"Unmark All"); -//Code extension - DEF_STR(CHEAT_CODE_EXT_TITLE, L"Code Extensions"); - DEF_STR(CHEAT_CODE_EXT_TXT, L"Please choose a value to be used for:"); - DEF_STR(CHEAT_OK, L"OK"); - DEF_STR(CHEAT_CANCEL, L"Cancel"); + //Add Cheat + DEF_STR(CHEAT_ADDCHEAT_FRAME, L"Add Cheat"); + DEF_STR(CHEAT_ADDCHEAT_NAME, L"Name:"); + DEF_STR(CHEAT_ADDCHEAT_CODE, L"Code:"); + DEF_STR(CHEAT_ADDCHEAT_INSERT, L"Insert"); + DEF_STR(CHEAT_ADDCHEAT_CLEAR, L"Clear"); + DEF_STR(CHEAT_ADDCHEAT_NOTES, L" Cheat Notes: "); + DEF_STR(CHEAT_ADD_TO_DB, L"Add to DB"); -//Digital Value - DEF_STR(CHEAT_QUANTITY_TITLE, L"Quantity Digit"); - DEF_STR(CHEAT_CHOOSE_VALUE, L"Please choose a value for:"); - DEF_STR(CHEAT_VALUE, L"&Value"); - DEF_STR(CHEAT_FROM, L"from"); - DEF_STR(CHEAT_TO, L"to"); - DEF_STR(CHEAT_NOTES, L"&Notes:"); - DEF_STR(CHEAT_ADDCHEAT_ADD, L"Add Cheat"); - DEF_STR(CHEAT_ADDCHEAT_NEW, L"New Cheat"); - DEF_STR(CHEAT_ADDCHEAT_CODEDES,L"
"); - DEF_STR(CHEAT_ADDCHEAT_OPT, L"Options:"); - DEF_STR(CHEAT_ADDCHEAT_OPTDES, L"