[Project64] Get settngs to use std int

This commit is contained in:
zilmar 2015-10-25 21:50:28 +11:00
parent a2a8eccbca
commit 81fdcb9373
62 changed files with 4416 additions and 4322 deletions

View File

@ -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);
}

View File

@ -3,210 +3,209 @@
#include <TChar.H>
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;
}

File diff suppressed because it is too large Load Diff

View File

@ -5,124 +5,121 @@
#include "std string.h"
#include <map>
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<ansi_string,long> FILELOC;
typedef FILELOC::iterator FILELOC_ITR;
typedef std::map<ansi_string,ansi_string, insensitive_compare> KeyValueList;
typedef std::string ansi_string;
typedef std::map<ansi_string,long> FILELOC;
typedef FILELOC::iterator FILELOC_ITR;
typedef std::map<ansi_string,ansi_string, insensitive_compare> KeyValueList;
public:
typedef std::map<stdstr,stdstr> KeyValueData;
typedef std::vector<stdstr> SectionList;
typedef std::map<stdstr,stdstr> KeyValueData;
typedef std::vector<stdstr> 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 CFileStorage>
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<CFile> CIniFile;

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,6 @@
****************************************************************************/
#pragma once
#include "..\support.h"
#pragma warning(disable:4786)
#include <string> //stl string
#include <map> //stl map
@ -22,8 +20,8 @@ typedef LANG_STRINGS::value_type LANG_STR;
struct LanguageFile
{
stdstr Filename;
std::wstring LanguageName;
std::string Filename;
std::wstring LanguageName;
};
typedef std::list<LanguageFile> LanguageList;
@ -33,30 +31,30 @@ class CLanguage
public:
CLanguage ();
const std::wstring & GetString ( LanguageStringID StringID );
LanguageList & GetLangList ( void );
void SetLanguage ( const wchar_t * LanguageName );
const std::wstring & GetString ( LanguageStringID StringID );
LanguageList & GetLangList ( void );
void SetLanguage ( const wchar_t * LanguageName );
void LoadCurrentStrings ( bool ShowSelectDialog );
bool IsCurrentLang ( LanguageFile & File );
bool IsCurrentLang ( LanguageFile & File );
private:
CLanguage(const CLanguage&); // Disable copy constructor
CLanguage& operator=(const CLanguage&); // Disable assignment
CLanguage(const CLanguage&); // Disable copy constructor
CLanguage& operator=(const CLanguage&); // Disable assignment
std::wstring m_SelectedLanguage;
const std::wstring m_emptyString;
std::wstring m_SelectedLanguage;
const std::wstring m_emptyString;
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
LanguageList m_LanguageList;
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
LanguageList m_LanguageList;
std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
LANG_STR GetNextLangString ( void * OpenFile );
void LoadDefaultStrings ( void );
std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
LANG_STR GetNextLangString ( void * OpenFile );
void LoadDefaultStrings ( void );
};
extern CLanguage * g_Lang;
inline LPCWSTR GS (LanguageStringID StringID)
inline const wchar_t * GS (LanguageStringID StringID)
{
return g_Lang->GetString(StringID).c_str();
return g_Lang->GetString(StringID).c_str();
}

View File

@ -81,7 +81,7 @@ void LoadLogOptions (LOG_OPTIONS * LogOptions, BOOL AlwaysFill)
HKEY hKeyResults = 0;
char String[200];
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadString(Setting_ApplicationName).c_str());
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
&hKeyResults);
@ -857,7 +857,7 @@ void SaveLogOptions (void)
DWORD Disposition = 0;
char String[200];
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadString(Setting_ApplicationName).c_str());
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);

View File

@ -131,7 +131,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
default:
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
{
g_Notify->DisplayError(L"Unknown EepromCommand %d",Command[2]);
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d",Command[2]).ToUTF16().c_str());
}
}
}
@ -143,8 +143,8 @@ void CEeprom::LoadEeprom()
memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
FileName.SetDriveDirectory( g_Settings->LoadString(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadString(Game_GameName).c_str());
FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
FileName.SetExtension("eep");
if (!FileName.DirectoryExists())

View File

@ -49,7 +49,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{
if (bHaveDebugger())
{
g_Notify->DisplayError(L"DmaFromFlashram FlipBuffer to small (len: %d)",len);
g_Notify->DisplayError(stdstr_f(__FUNCTION__ ": DmaFromFlashram FlipBuffer to small (len: %d)", len).ToUTF16().c_str());
}
len = 0x10000;
}
@ -57,7 +57,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{
if (bHaveDebugger())
{
g_Notify->DisplayError(L"Unaligned flash ram read ???");
g_Notify->DisplayError(__FUNCTIONW__ L": Unaligned flash ram read ???");
}
return;
}
@ -84,7 +84,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{
if (bHaveDebugger())
{
g_Notify->DisplayError(L"Reading m_FlashStatus not being handled correctly\nStart: %X len: %X",StartOffset,len);
g_Notify->DisplayError(stdstr_f(__FUNCTION__ ": Reading m_FlashStatus not being handled correctly\nStart: %X len: %X", StartOffset, len).ToUTF16().c_str());
}
}
*((DWORD *)(dest)) = (DWORD)((m_FlashStatus >> 32) & 0xFFFFFFFF);
@ -93,7 +93,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
default:
if (bHaveDebugger())
{
g_Notify->DisplayError(L"DmaFromFlashram Start: %X, Offset: %X len: %X",dest - g_MMU->Rdram(),StartOffset,len);
g_Notify->DisplayError(stdstr_f(__FUNCTION__": Start: %X, Offset: %X len: %X",dest - g_MMU->Rdram(),StartOffset,len).ToUTF16().c_str());
}
}
}
@ -108,7 +108,7 @@ void CFlashram::DmaToFlashram(BYTE * Source, int StartOffset, int len)
default:
if (bHaveDebugger())
{
g_Notify->DisplayError(L"DmaToFlashram Start: %X, Offset: %X len: %X",Source - g_MMU->Rdram(),StartOffset,len);
g_Notify->DisplayError(stdstr_f(__FUNCTION__ ": Start: %X, Offset: %X len: %X", Source - g_MMU->Rdram(), StartOffset, len).ToUTF16().c_str());
}
}
}
@ -122,7 +122,7 @@ DWORD CFlashram::ReadFromFlashStatus (DWORD PAddr)
default:
if (bHaveDebugger())
{
g_Notify->DisplayError(L"Reading from flash ram status (%X)",PAddr);
g_Notify->DisplayError(stdstr_f(__FUNCTION__ ": PAddr (%X)", PAddr).ToUTF16().c_str());
}
break;
}
@ -133,8 +133,8 @@ bool CFlashram::LoadFlashram()
{
CPath FileName;
FileName.SetDriveDirectory( g_Settings->LoadString(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadString(Game_GameName).c_str());
FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
FileName.SetExtension("fla");
if (!FileName.DirectoryExists())
@ -205,7 +205,7 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
}
break;
default:
g_Notify->DisplayError(L"Writing %X to flash ram command register\nm_FlashFlag: %d",FlashRAM_Command,m_FlashFlag);
g_Notify->DisplayError(stdstr_f("Writing %X to flash ram command register\nm_FlashFlag: %d",FlashRAM_Command,m_FlashFlag).ToUTF16().c_str());
}
m_FlashFlag = FLASHRAM_MODE_NOPES;
break;
@ -234,7 +234,7 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
default:
if (bHaveDebugger())
{
g_Notify->DisplayError(L"Writing %X to flash ram command register",FlashRAM_Command);
g_Notify->DisplayError(stdstr_f("Writing %X to flash ram command register",FlashRAM_Command).ToUTF16().c_str());
}
}
}

View File

@ -31,9 +31,9 @@ void LoadMempak (int Control)
stdstr MempakName;
bool bFormatMempak = false;
MempakName.Format("%s_Cont_%d", g_Settings->LoadString(Game_GameName).c_str(), Control + 1);
MempakName.Format("%s_Cont_%d", g_Settings->LoadStringVal(Game_GameName).c_str(), Control + 1);
FileName.SetDriveDirectory(g_Settings->LoadString(Directory_NativeSave).c_str());
FileName.SetDriveDirectory(g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(MempakName.c_str());
FileName.SetExtension("mpk");

View File

@ -30,8 +30,8 @@ bool CSram::LoadSram()
{
CPath FileName;
FileName.SetDriveDirectory( g_Settings->LoadString(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadString(Game_GameName).c_str());
FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
FileName.SetExtension("sra");
if (!FileName.DirectoryExists())

View File

@ -186,7 +186,7 @@ bool CN64System::RunFileImage ( const char * FileLoc )
//Mark the rom as loading
g_Settings->SaveBool(GameRunning_LoadingInProgress,true);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
//Try to load the passed N64 rom
if (g_Rom == NULL)
@ -205,11 +205,11 @@ bool CN64System::RunFileImage ( const char * FileLoc )
g_System->RefreshGameSettings();
WriteTrace(TraceDebug,__FUNCTION__ ": Add Recent Rom");
g_Notify->AddRecentRom(FileLoc);
g_Notify->SetWindowCaption(g_Settings->LoadString(Game_GoodName).ToUTF16().c_str());
Notify().AddRecentRom(FileLoc);
Notify().SetWindowCaption(g_Settings->LoadStringVal(Game_GoodName).ToUTF16().c_str());
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
if (g_Settings->LoadDword(Setting_AutoStart) != 0)
{
@ -227,7 +227,7 @@ bool CN64System::RunFileImage ( const char * FileLoc )
delete g_Rom;
g_Rom = NULL;
g_Settings->SaveBool(GameRunning_LoadingInProgress,false);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
return false;
}
return true;
@ -254,7 +254,7 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
g_BaseSystem->m_CPU_ThreadID = ThreadId;
WriteTrace(TraceDebug,__FUNCTION__ ": Setting up N64 system done");
g_Settings->SaveBool(GameRunning_LoadingInProgress,false);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
try
{
WriteTrace(TraceDebug,__FUNCTION__ ": Game set to auto start, starting");
@ -274,7 +274,7 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
WriteTrace(TraceError,__FUNCTION__ ": SetActiveSystem failed");
g_Notify->DisplayError(__FUNCTIONW__ L": Failed to Initialize N64 System");
g_Settings->SaveBool(GameRunning_LoadingInProgress,false);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
bRes = false;
}
return bRes;
@ -286,7 +286,7 @@ void CN64System::StartEmulation2 ( bool NewThread )
{
WriteTrace(TraceDebug,__FUNCTION__ ": Starting");
g_Notify->HideRomBrowser();
Notify().HideRomBrowser();
if (bHaveDebugger())
{
@ -308,10 +308,10 @@ void CN64System::StartEmulation2 ( bool NewThread )
if (CpuType == CPU_SyncCores)
{
g_Notify->DisplayMessage(5,L"Copy Plugins");
g_Plugins->CopyPlugins(g_Settings->LoadString(Directory_PluginSync));
g_Plugins->CopyPlugins(g_Settings->LoadStringVal(Directory_PluginSync));
#if defined(WINDOWS_UI)
m_SyncWindow = new CMainGui(false);
m_SyncPlugins = new CPlugins( g_Settings->LoadString(Directory_PluginSync) );
m_SyncPlugins = new CPlugins( g_Settings->LoadStringVal(Directory_PluginSync) );
m_SyncPlugins->SetRenderWindows(m_SyncWindow,m_SyncWindow);
m_SyncCPU = new CN64System(m_SyncPlugins, true);
@ -341,11 +341,11 @@ void CN64System::StartEmulation2 ( bool NewThread )
g_Settings->SaveBool(GameRunning_LoadingInProgress,false);
g_Notify->DisplayError(MSG_PLUGIN_NOT_INIT);
g_Notify->RefreshMenu();
g_Notify->ShowRomBrowser();
Notify().RefreshMenu();
Notify().ShowRomBrowser();
}
g_Notify->MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
Notify().MakeWindowOnTop(g_Settings->LoadBool(UserInterface_AlwaysOnTop));
ThreadInfo * Info = new ThreadInfo;
HANDLE * hThread = new HANDLE;
@ -365,14 +365,14 @@ void CN64System::StartEmulation2 ( bool NewThread )
if (g_Settings->LoadBool(Setting_AutoFullscreen))
{
WriteTrace(TraceDebug,__FUNCTION__ " 15");
CIniFile RomIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
stdstr Status = g_Settings->LoadString(Rdb_Status);
CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
char String[100];
RomIniFile.GetString("Rom Status",stdstr_f("%s.AutoFullScreen", Status.c_str()).c_str(),"true",String,sizeof(String));
if (_stricmp(String,"true") == 0)
{
g_Notify->ChangeFullScreen();
Notify().ChangeFullScreen();
}
}
ExecuteCPU();
@ -427,7 +427,7 @@ void CN64System::CloseCpu()
for (int count = 0; count < 200; count ++ )
{
Sleep(100);
if (g_Notify->ProcessGuiMessages())
if (Notify().ProcessGuiMessages())
{
return;
}
@ -475,13 +475,13 @@ void CN64System::Pause()
}
ResetEvent(m_hPauseEvent);
g_Settings->SaveBool(GameRunning_CPU_Paused,true);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
g_Notify->DisplayMessage(5,MSG_CPU_PAUSED);
WaitForSingleObject(m_hPauseEvent, INFINITE);
ResetEvent(m_hPauseEvent);
g_Settings->SaveBool(GameRunning_CPU_Paused,(DWORD)false);
g_Notify->RefreshMenu();
g_Notify->DisplayMessage(5,MSG_CPU_RESUMED);
Notify().RefreshMenu();
Notify().DisplayMessage(5, MSG_CPU_RESUMED);
}
stdstr CN64System::ChooseFileToOpen ( HWND hParent )
@ -492,7 +492,7 @@ stdstr CN64System::ChooseFileToOpen ( HWND hParent )
memset(&FileName, 0, sizeof(FileName));
memset(&openfilename, 0, sizeof(openfilename));
strcpy(Directory,g_Settings->LoadString(Directory_Game).c_str());
strcpy(Directory,g_Settings->LoadStringVal(Directory_Game).c_str());
openfilename.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hParent;
@ -551,7 +551,7 @@ void CN64System::PluginReset()
}
}
}
g_Notify->RefreshMenu();
Notify().RefreshMenu();
if (m_Recomp)
{
m_Recomp->Reset();
@ -905,7 +905,7 @@ void CN64System::ExecuteCPU()
g_Notify->DisplayMessage(5,MSG_EMULATION_STARTED);
m_EndEmulation = false;
g_Notify->RefreshMenu();
Notify().RefreshMenu();
m_Plugins->RomOpened();
if (m_SyncCPU)
@ -926,7 +926,7 @@ void CN64System::ExecuteCPU()
default: ExecuteInterpret(); break;
}
g_Settings->SaveBool(GameRunning_CPU_Running,(DWORD)false);
g_Notify->WindowMode();
Notify().WindowMode();
m_Plugins->RomClosed();
if (m_SyncCPU)
{
@ -1406,22 +1406,22 @@ bool CN64System::SaveState()
if ((m_Reg.STATUS_REGISTER & STATUS_EXL) != 0) { return false; }
//Get the file Name
stdstr FileName, ExtraInfoFileName, CurrentSaveName = g_Settings->LoadString(GameRunning_InstantSaveFile);
stdstr FileName, ExtraInfoFileName, CurrentSaveName = g_Settings->LoadStringVal(GameRunning_InstantSaveFile);
if (CurrentSaveName.empty())
{
int Slot = g_Settings->LoadDword(Game_CurrentSaveState);
if (Slot != 0)
{
CurrentSaveName.Format("%s.pj%d",g_Settings->LoadString(Game_GoodName).c_str(), Slot);
CurrentSaveName.Format("%s.pj%d",g_Settings->LoadStringVal(Game_GoodName).c_str(), Slot);
}
else
{
CurrentSaveName.Format("%s.pj",g_Settings->LoadString(Game_GoodName).c_str());
CurrentSaveName.Format("%s.pj",g_Settings->LoadStringVal(Game_GoodName).c_str());
}
FileName.Format("%s%s",g_Settings->LoadString(Directory_InstantSave).c_str(),CurrentSaveName.c_str());
FileName.Format("%s%s",g_Settings->LoadStringVal(Directory_InstantSave).c_str(),CurrentSaveName.c_str());
stdstr_f ZipFileName("%s.zip",FileName.c_str());
//Make sure the target dir exists
CreateDirectory(g_Settings->LoadString(Directory_InstantSave).c_str(),NULL);
CreateDirectory(g_Settings->LoadStringVal(Directory_InstantSave).c_str(),NULL);
//delete any old save
DeleteFile(FileName.c_str());
DeleteFile(ZipFileName.c_str());
@ -1541,15 +1541,15 @@ bool CN64System::SaveState()
CPath SavedFileName(FileName);
g_Notify->DisplayMessage(5,L"%s %s",SaveMessage.c_str(),SavedFileName.GetNameExtension().ToUTF16().c_str());
g_Notify->RefreshMenu();
g_Notify->DisplayMessage(5,stdstr_f("%s %s",SaveMessage.c_str(),SavedFileName.GetNameExtension()).ToUTF16().c_str());
Notify().RefreshMenu();
WriteTrace(TraceDebug,__FUNCTION__ ": Done");
return true;
}
bool CN64System::LoadState()
{
stdstr InstantFileName = g_Settings->LoadString(GameRunning_InstantSaveFile);
stdstr InstantFileName = g_Settings->LoadStringVal(GameRunning_InstantSaveFile);
if (!InstantFileName.empty())
{
bool Result = LoadState(InstantFileName.c_str());
@ -1558,14 +1558,14 @@ bool CN64System::LoadState()
}
CPath FileName;
FileName.SetDriveDirectory(g_Settings->LoadString(Directory_InstantSave).c_str());
FileName.SetDriveDirectory(g_Settings->LoadStringVal(Directory_InstantSave).c_str());
if (g_Settings->LoadDword(Game_CurrentSaveState) != 0)
{
FileName.SetNameExtension(stdstr_f("%s.pj%d",g_Settings->LoadString(Game_GoodName).c_str(),g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
FileName.SetNameExtension(stdstr_f("%s.pj%d",g_Settings->LoadStringVal(Game_GoodName).c_str(),g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
}
else
{
FileName.SetNameExtension(stdstr_f("%s.pj",g_Settings->LoadString(Game_GoodName).c_str()).c_str());
FileName.SetNameExtension(stdstr_f("%s.pj",g_Settings->LoadStringVal(Game_GoodName).c_str()).c_str());
}
CPath ZipFileName;
@ -1582,11 +1582,11 @@ bool CN64System::LoadState()
//Use old file Name
if (g_Settings->LoadDword(Game_CurrentSaveState) != 0)
{
FileName.SetNameExtension(stdstr_f("%s.pj%d",g_Settings->LoadString(Game_GameName).c_str(),g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
FileName.SetNameExtension(stdstr_f("%s.pj%d",g_Settings->LoadStringVal(Game_GameName).c_str(),g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
}
else
{
FileName.SetNameExtension(stdstr_f("%s.pj",g_Settings->LoadString(Game_GameName).c_str()).c_str());
FileName.SetNameExtension(stdstr_f("%s.pj",g_Settings->LoadStringVal(Game_GameName).c_str()).c_str());
}
return LoadState(FileName);
}
@ -1707,7 +1707,7 @@ bool CN64System::LoadState(LPCSTR FileName)
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hSaveFile == INVALID_HANDLE_VALUE)
{
g_Notify->DisplayMessage(5,L"%s %s",GS(MSG_UNABLED_LOAD_STATE),FileNameStr.ToUTF16().c_str());
g_Notify->DisplayMessage(5,stdstr_f("%s %s",GS(MSG_UNABLED_LOAD_STATE),FileNameStr).ToUTF16().c_str());
return false;
}
@ -1835,11 +1835,16 @@ bool CN64System::LoadState(LPCSTR FileName)
}
WriteTrace(TraceDebug,__FUNCTION__ ": 13");
std::wstring LoadMsg = g_Lang->GetString(MSG_LOADED_STATE);
g_Notify->DisplayMessage(5,L"%s %s",LoadMsg.c_str(),CPath(FileNameStr).GetNameExtension().ToUTF16().c_str());
g_Notify->DisplayMessage(5,stdstr_f("%s %s",LoadMsg.c_str(),CPath(FileNameStr).GetNameExtension()).ToUTF16().c_str());
WriteTrace(TraceDebug,__FUNCTION__ ": Done");
return true;
}
void CN64System::DisplayRSPListCount()
{
g_Notify->DisplayMessage(0, stdstr_f("Dlist: %d Alist: %d Unknown: %d", m_DlistCount, m_AlistCount, m_UnknownCount).ToUTF16().c_str());
}
void CN64System::RunRSP()
{
WriteTraceF(TraceRSP, __FUNCTION__ ": Start (SP Status %X)",m_Reg.SP_STATUS_REG);
@ -1877,8 +1882,8 @@ void CN64System::RunRSP()
}
if (bShowDListAListCount())
{
g_Notify->DisplayMessage(0,L"Dlist: %d Alist: %d Unknown: %d",m_DlistCount,m_AlistCount,m_UnknownCount);
{
DisplayRSPListCount();
}
if (bShowCPUPer())
{

View File

@ -104,6 +104,7 @@ private:
void StartEmulation2 ( bool NewThread );
bool SetActiveSystem ( bool bActive = true );
void InitRegisters ( bool bPostPif, CMipsMemory & MMU );
void DisplayRSPListCount();
//CPU Methods
void ExecuteRecompiler();

View File

@ -53,10 +53,10 @@ void CPlugins::PluginChanged ( CPlugins * _this )
{
return;
}
bool bGfxChange = _stricmp(_this->m_GfxFile.c_str(),g_Settings->LoadString(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(),g_Settings->LoadString(Game_Plugin_Audio).c_str()) != 0;
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(),g_Settings->LoadString(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(_this->m_ControlFile.c_str(),g_Settings->LoadString(Game_Plugin_Controller).c_str()) != 0;
bool bGfxChange = _stricmp(_this->m_GfxFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(_this->m_ControlFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
if ( bGfxChange || bAudioChange || bRspChange || bContChange )
{
@ -71,7 +71,7 @@ void CPlugins::PluginChanged ( CPlugins * _this )
else
{
_this->Reset(NULL);
g_Notify->RefreshMenu();
Notify().RefreshMenu();
}
}
}
@ -83,7 +83,7 @@ static void LoadPlugin (SettingID PluginSettingID, SettingID PluginVerSettingID,
{
return;
}
FileName = g_Settings->LoadString(PluginSettingID);
FileName = g_Settings->LoadStringVal(PluginSettingID);
CPath PluginFileName(PluginDir,FileName.c_str());
plugin = new plugin_type();
if (plugin)
@ -125,7 +125,7 @@ void CPlugins::CreatePlugins( void )
if (bHaveDebugger())
{
g_Notify->RefreshMenu();
Notify().RefreshMenu();
}
}
@ -273,10 +273,10 @@ bool CPlugins::Reset ( CN64System * System )
{
WriteTrace(TraceDebug,__FUNCTION__ ": Start");
bool bGfxChange = _stricmp(m_GfxFile.c_str(),g_Settings->LoadString(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = _stricmp(m_AudioFile.c_str(),g_Settings->LoadString(Game_Plugin_Audio).c_str()) != 0;
bool bRspChange = _stricmp(m_RSPFile.c_str(),g_Settings->LoadString(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(m_ControlFile.c_str(),g_Settings->LoadString(Game_Plugin_Controller).c_str()) != 0;
bool bGfxChange = _stricmp(m_GfxFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = _stricmp(m_AudioFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
bool bRspChange = _stricmp(m_RSPFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(m_ControlFile.c_str(),g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
//if GFX and Audio has changed we also need to force reset of RSP
if (bGfxChange || bAudioChange)
@ -382,8 +382,8 @@ void CPlugins::CreatePluginDir ( const stdstr & DstDir ) const {
bool CPlugins::CopyPlugins ( const stdstr & DstDir ) const
{
//Copy GFX Plugin
CPath srcGfxPlugin(m_PluginDir.c_str(),g_Settings->LoadString(Game_Plugin_Gfx).c_str());
CPath dstGfxPlugin(DstDir.c_str(),g_Settings->LoadString(Game_Plugin_Gfx).c_str());
CPath srcGfxPlugin(m_PluginDir.c_str(),g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
CPath dstGfxPlugin(DstDir.c_str(),g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
if (CopyFile(srcGfxPlugin,dstGfxPlugin,false) == 0)
{
@ -395,8 +395,8 @@ bool CPlugins::CopyPlugins ( const stdstr & DstDir ) const
}
//Copy m_Audio Plugin
CPath srcAudioPlugin(m_PluginDir.c_str(),g_Settings->LoadString(Game_Plugin_Audio).c_str());
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadString(Game_Plugin_Audio).c_str());
CPath srcAudioPlugin(m_PluginDir.c_str(),g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
if (CopyFile(srcAudioPlugin,dstAudioPlugin,false) == 0) {
if (GetLastError() == ERROR_PATH_NOT_FOUND) { dstAudioPlugin.CreateDirectory(); }
if (!CopyFile(srcAudioPlugin,dstAudioPlugin,false))
@ -406,8 +406,8 @@ bool CPlugins::CopyPlugins ( const stdstr & DstDir ) const
}
//Copy RSP Plugin
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadString(Game_Plugin_RSP).c_str());
CPath dstRSPPlugin(DstDir.c_str(),g_Settings->LoadString(Game_Plugin_RSP).c_str());
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
CPath dstRSPPlugin(DstDir.c_str(),g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
if (CopyFile(srcRSPPlugin,dstRSPPlugin,false) == 0) {
if (GetLastError() == ERROR_PATH_NOT_FOUND) { dstRSPPlugin.CreateDirectory(); }
if (!CopyFile(srcRSPPlugin,dstRSPPlugin,false))
@ -417,8 +417,8 @@ bool CPlugins::CopyPlugins ( const stdstr & DstDir ) const
}
//Copy Controller Plugin
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadString(Game_Plugin_Controller).c_str());
CPath dstContPlugin(DstDir.c_str(),g_Settings->LoadString(Game_Plugin_Controller).c_str());
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
CPath dstContPlugin(DstDir.c_str(),g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
if (!srcContPlugin.CopyTo(dstContPlugin))
{
if (GetLastError() == ERROR_PATH_NOT_FOUND) { dstContPlugin.CreateDirectory(); }

View File

@ -9,9 +9,10 @@
* *
****************************************************************************/
#include "stdafx.h"
#include <io.h>
CPluginList::CPluginList(bool bAutoFill /* = true */) :
m_PluginDir(g_Settings->LoadString(Directory_Plugin),"")
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin),"")
{
if (bAutoFill)
{

View File

@ -10,47 +10,48 @@
****************************************************************************/
#include "stdafx.h"
#include "SettingsType-Application.h"
#include <Common/path.h>
bool CSettingTypeApplication::m_UseRegistry = false;
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, DWORD DefaultValue ) :
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue ) :
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
{
}
CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, bool DefaultValue ) :
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue ) :
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
{
}
CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ) :
m_DefaultStr(DefaultValue),
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue ) :
m_DefaultStr(DefaultValue),
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
{
}
CSettingTypeApplication::CSettingTypeApplication(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ) :
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting ) :
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_Section(FixSectionName(Section)),
m_KeyName(Name),
m_KeyNameIdex(m_KeyName)
{
}
@ -58,229 +59,228 @@ CSettingTypeApplication::~CSettingTypeApplication()
{
}
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
{
stdstr SettingsFile, OrigSettingsFile;
for (int i = 0; i < 100; i++)
{
OrigSettingsFile = SettingsFile;
if (!g_Settings->LoadString(SupportFile_Settings,SettingsFile) && i > 0)
{
break;
}
if (SettingsFile == OrigSettingsFile)
{
break;
}
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
}
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
if (!SettingsDir.DirectoryExists())
{
SettingsDir.CreateDirectory();
}
stdstr SettingsFile, OrigSettingsFile;
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
}
m_SettingsIniFile->SetAutoFlush(false);
m_UseRegistry = g_Settings->LoadBool(Setting_UseFromRegistry);
for (int i = 0; i < 100; i++)
{
OrigSettingsFile = SettingsFile;
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
{
break;
}
if (SettingsFile == OrigSettingsFile)
{
break;
}
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
}
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
if (!SettingsDir.DirectoryExists())
{
SettingsDir.CreateDirectory();
}
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
}
m_SettingsIniFile->SetAutoFlush(false);
m_UseRegistry = g_Settings->LoadBool(Setting_UseFromRegistry);
}
void CSettingTypeApplication::Flush()
{
if (m_SettingsIniFile)
{
m_SettingsIniFile->FlushChanges();
}
if (m_SettingsIniFile)
{
m_SettingsIniFile->FlushChanges();
}
}
void CSettingTypeApplication::CleanUp()
{
if (m_SettingsIniFile)
{
m_SettingsIniFile->SetAutoFlush(true);
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
}
if (m_SettingsIniFile)
{
m_SettingsIniFile->SetAutoFlush(true);
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
}
}
bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
{
bool bRes = false;
bool bRes = false;
if (!m_UseRegistry)
{
DWORD dwValue;
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
if (bRes)
{
Value = dwValue != 0;
}
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes && m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
return bRes;
if (!m_UseRegistry)
{
uint32_t dwValue;
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
if (bRes)
{
Value = dwValue != 0;
}
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes && m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
return bRes;
}
bool CSettingTypeApplication::Load ( int /*Index*/, ULONG & Value ) const
bool CSettingTypeApplication::Load ( int /*Index*/, uint32_t & Value ) const
{
bool bRes = false;
if (!m_UseRegistry)
{
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes && m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
return bRes;
bool bRes = false;
if (!m_UseRegistry)
{
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes && m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
return bRes;
}
LPCSTR CSettingTypeApplication::SectionName ( void ) const
const char * CSettingTypeApplication::SectionName ( void ) const
{
return m_Section.c_str();
return m_Section.c_str();
}
bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const
{
bool bRes = false;
if (!m_UseRegistry)
{
bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes)
{
CSettingTypeApplication::LoadDefault(Index,Value);
}
return bRes;
bool bRes = false;
if (!m_UseRegistry)
{
bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!bRes)
{
CSettingTypeApplication::LoadDefault(Index,Value);
}
return bRes;
}
//return the default values
void CSettingTypeApplication::LoadDefault ( int /*Index*/, bool & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
}
void CSettingTypeApplication::LoadDefault ( int /*Index*/, ULONG & Value ) const
void CSettingTypeApplication::LoadDefault ( int /*Index*/, uint32_t & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
}
void CSettingTypeApplication::LoadDefault ( int /*Index*/, stdstr & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultStr;
} else {
g_Settings->LoadString(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultStr;
} else {
g_Settings->LoadStringVal(m_DefaultSetting,Value);
}
}
}
//Update the settings
void CSettingTypeApplication::Save ( int /*Index*/, bool Value )
{
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}
void CSettingTypeApplication::Save ( int /*Index*/, ULONG Value )
void CSettingTypeApplication::Save ( int /*Index*/, uint32_t Value )
{
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}
void CSettingTypeApplication::Save ( int /*Index*/, const stdstr & Value )
{
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}
void CSettingTypeApplication::Save ( int /*Index*/, const char * Value )
{
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}
stdstr CSettingTypeApplication::FixSectionName(LPCSTR Section)
stdstr CSettingTypeApplication::FixSectionName(const char * Section)
{
stdstr SectionName(Section);
stdstr SectionName(Section);
if (!m_UseRegistry)
{
if (SectionName.empty())
{
SectionName = "default";
}
SectionName.Replace("\\","-");
}
return SectionName;
if (!m_UseRegistry)
{
if (SectionName.empty())
{
SectionName = "default";
}
SectionName.Replace("\\","-");
}
return SectionName;
}
void CSettingTypeApplication::Delete( int /*Index*/ )
{
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (!m_UseRegistry)
{
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}

View File

@ -10,59 +10,64 @@
****************************************************************************/
#pragma once
#include <Common/Ini File Class.h>
#include "SettingsType-Base.h"
class CSettingTypeApplication :
public CSettingType
public CSettingType
{
protected:
const LPCSTR m_DefaultStr;
const DWORD m_DefaultValue;
const SettingID m_DefaultSetting;
stdstr FixSectionName (LPCSTR Section);
static CIniFile * m_SettingsIniFile;
static bool m_UseRegistry;
const stdstr m_Section;
const stdstr m_KeyName;
mutable stdstr m_KeyNameIdex;
virtual LPCSTR SectionName ( void ) const;
public:
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue );
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, bool DefaultValue );
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, DWORD DefaultValue );
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting );
virtual ~CSettingTypeApplication();
CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue );
CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue );
CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue );
CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting );
virtual ~CSettingTypeApplication();
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return m_UseRegistry ? SettingType_Registry : SettingType_CfgFile; }
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return m_UseRegistry ? SettingType_Registry : SettingType_CfgFile; }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
// Initialize this class to use ini or registry
static void Initialize( const char * AppName );
static void CleanUp ( void );
static void Flush ( void );
// Initialize this class to use ini or registry
static void Initialize( const char * AppName );
static void CleanUp ( void );
static void Flush ( void );
LPCSTR GetKeyName ( void) const { return m_KeyName.c_str(); }
const char * GetKeyName ( void) const { return m_KeyName.c_str(); }
protected:
const char * m_DefaultStr;
const uint32_t m_DefaultValue;
const SettingID m_DefaultSetting;
stdstr FixSectionName (const char * Section);
static CIniFile * m_SettingsIniFile;
static bool m_UseRegistry;
const stdstr m_Section;
const stdstr m_KeyName;
mutable stdstr m_KeyNameIdex;
virtual const char * SectionName ( void ) const;
private:
CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
};

View File

@ -12,24 +12,23 @@
#include "SettingsType-Application.h"
#include "SettingsType-ApplicationIndex.h"
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, DWORD DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
{
}
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, bool DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
{
}
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue ) :
CSettingTypeApplication(Section,Name,DefaultValue)
{
}
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeApplication(Section,Name,DefaultSetting)
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting ) :
CSettingTypeApplication(Section,Name,DefaultSetting)
{
}
@ -39,68 +38,68 @@ CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void )
bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
}
bool CSettingTypeApplicationIndex::Load ( int Index, ULONG & Value ) const
bool CSettingTypeApplicationIndex::Load ( int Index, uint32_t & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
}
bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
return CSettingTypeApplication::Load(0,Value);
}
//return the default values
void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
}
void CSettingTypeApplicationIndex::LoadDefault ( int Index, ULONG & Value ) const
void CSettingTypeApplicationIndex::LoadDefault ( int Index, uint32_t & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
}
void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::LoadDefault(0,Value);
}
//Update the settings
void CSettingTypeApplicationIndex::Save ( int Index, bool Value )
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
}
void CSettingTypeApplicationIndex::Save ( int Index, ULONG Value )
void CSettingTypeApplicationIndex::Save ( int Index, uint32_t Value )
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
}
void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value )
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
}
void CSettingTypeApplicationIndex::Save ( int Index, const char * Value )
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,Value);
}
void CSettingTypeApplicationIndex::Delete ( int Index )
{
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,(const char *)NULL);
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
CSettingTypeApplication::Save(0,(const char *)NULL);
}

View File

@ -11,35 +11,38 @@
#pragma once
class CSettingTypeApplicationIndex :
public CSettingTypeApplication
public CSettingTypeApplication
{
public:
CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue );
CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, bool DefaultValue );
CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, DWORD DefaultValue );
CSettingTypeApplicationIndex(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting );
~CSettingTypeApplicationIndex();
CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue );
CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue );
CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue );
CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting );
~CSettingTypeApplicationIndex();
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual bool IndexBasedSetting ( void ) const { return true; }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeApplicationIndex(void); // Disable default constructor
CSettingTypeApplicationIndex(const CSettingTypeApplicationIndex&); // Disable copy constructor
CSettingTypeApplicationIndex& operator=(const CSettingTypeApplicationIndex&); // Disable assignment
};

View File

@ -10,50 +10,50 @@
****************************************************************************/
#pragma once
#include "../Settings.h"
enum SettingType {
SettingType_Unknown = -1,
SettingType_ConstString = 0,
SettingType_ConstValue = 1,
SettingType_CfgFile = 2,
SettingType_Registry = 3,
SettingType_RelativePath = 4,
TemporarySetting = 5,
SettingType_RomDatabase = 6,
SettingType_CheatSetting = 7,
SettingType_GameSetting = 8,
SettingType_BoolVariable = 9,
SettingType_NumberVariable = 10,
SettingType_StringVariable = 11,
SettingType_SelectedDirectory = 12,
SettingType_RdbSetting = 13,
SettingType_Unknown = -1,
SettingType_ConstString = 0,
SettingType_ConstValue = 1,
SettingType_CfgFile = 2,
SettingType_Registry = 3,
SettingType_RelativePath = 4,
TemporarySetting = 5,
SettingType_RomDatabase = 6,
SettingType_CheatSetting = 7,
SettingType_GameSetting = 8,
SettingType_BoolVariable = 9,
SettingType_NumberVariable = 10,
SettingType_StringVariable = 11,
SettingType_SelectedDirectory = 12,
SettingType_RdbSetting = 13,
};
class CSettingType
{
public:
virtual ~CSettingType() {};
virtual ~CSettingType() {};
virtual SettingType GetSettingType ( void ) const = 0;
virtual bool IndexBasedSetting ( void ) const = 0;
virtual SettingType GetSettingType ( void ) const = 0;
virtual bool IndexBasedSetting ( void ) const = 0;
//return the values
virtual bool Load ( int Index, bool & Value ) const = 0;
virtual bool Load ( int Index, ULONG & Value ) const = 0;
virtual bool Load ( int Index, stdstr & Value ) const = 0;
//return the values
virtual bool Load ( int Index, bool & Value ) const = 0;
virtual bool Load ( int Index, uint32_t & Value ) const = 0;
virtual bool Load ( int Index, stdstr & Value ) const = 0;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const = 0;
virtual void LoadDefault ( int Index, ULONG & Value ) const = 0;
virtual void LoadDefault ( int Index, stdstr & Value ) const = 0;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const = 0;
virtual void LoadDefault ( int Index, uint32_t & Value ) const = 0;
virtual void LoadDefault ( int Index, stdstr & Value ) const = 0;
//Update the settings
virtual void Save ( int Index, bool Value ) = 0;
virtual void Save ( int Index, ULONG Value ) = 0;
virtual void Save ( int Index, const stdstr & Value ) = 0;
virtual void Save ( int Index, const char * Value ) = 0;
// Delete the setting
virtual void Delete ( int Index ) = 0;
//Update the settings
virtual void Save ( int Index, bool Value ) = 0;
virtual void Save ( int Index, uint32_t Value ) = 0;
virtual void Save ( int Index, const stdstr & Value ) = 0;
virtual void Save ( int Index, const char * Value ) = 0;
// Delete the setting
virtual void Delete ( int Index ) = 0;
};

View File

@ -11,11 +11,13 @@
#include "stdafx.h"
#include "SettingsType-Cheats.h"
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
CSettingTypeCheats::CSettingTypeCheats(LPCSTR PostFix ) :
m_PostFix(PostFix)
CSettingTypeCheats::CSettingTypeCheats(const char * PostFix ) :
m_PostFix(PostFix)
{
}
@ -25,123 +27,122 @@ CSettingTypeCheats::~CSettingTypeCheats ( void )
void CSettingTypeCheats::Initialize ( void )
{
m_CheatIniFile = new CIniFile(g_Settings->LoadString(SupportFile_Cheats).c_str());
m_CheatIniFile->SetAutoFlush(false);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadString(Game_IniKey));
GameChanged(NULL);
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
m_CheatIniFile->SetAutoFlush(false);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
GameChanged(NULL);
}
void CSettingTypeCheats::CleanUp ( void )
{
if (m_CheatIniFile)
{
m_CheatIniFile->SetAutoFlush(true);
delete m_CheatIniFile;
m_CheatIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
if (m_CheatIniFile)
{
m_CheatIniFile->SetAutoFlush(true);
delete m_CheatIniFile;
m_CheatIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
}
void CSettingTypeCheats::FlushChanges( void )
{
if (m_CheatIniFile)
{
m_CheatIniFile->FlushChanges();
}
if (m_CheatIniFile)
{
m_CheatIniFile->FlushChanges();
}
}
void CSettingTypeCheats::GameChanged ( void * /*Data */ )
{
*m_SectionIdent = g_Settings->LoadString(Game_IniKey);
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
}
/*stdstr CSettingTypeCheats::FixName ( LPCSTR Section, LPCSTR Name )
/*stdstr CSettingTypeCheats::FixName ( const char * Section, const char * Name )
{
}
LPCSTR CSettingTypeCheats::SectionName ( void ) const
const char * CSettingTypeCheats::SectionName ( void ) const
{
return "";
return "";
}
void CSettingTypeCheats::UpdateSettings ( void * )
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}*/
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeCheats::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeCheats::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const
{
if (m_CheatIniFile == NULL)
{
return false;
}
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
if (m_CheatIniFile == NULL)
{
return false;
}
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
}
//return the default values
void CSettingTypeCheats::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeCheats::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeCheats::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeCheats::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeCheats::Save ( int /*Index*/, bool /*Value*/ )
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeCheats::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeCheats::Save ( int /*Index*/, uint32_t /*Value*/ )
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
{
if (m_CheatIniFile == NULL) { return; }
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
if (m_CheatIniFile == NULL) { return; }
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
}
void CSettingTypeCheats::Save ( int Index, const char * Value )
{
if (m_CheatIniFile == NULL) { return; }
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
if (m_CheatIniFile == NULL) { return; }
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
}
void CSettingTypeCheats::Delete ( int Index )
{
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
}

View File

@ -10,46 +10,51 @@
****************************************************************************/
#pragma once
#include "SettingsType-Base.h"
#include <Common/Ini File Class.h>
class CSettingTypeCheats :
public CSettingType
public CSettingType
{
protected:
static CIniFile * m_CheatIniFile;
static stdstr * m_SectionIdent;
const LPCSTR m_PostFix;
static void GameChanged ( void * /*Data */ );
public:
CSettingTypeCheats(LPCSTR PostFix );
~CSettingTypeCheats();
CSettingTypeCheats(const char * PostFix );
~CSettingTypeCheats();
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
// Initialize this class to use ini or registry
static void Initialize ( void );
static void CleanUp ( void );
static void FlushChanges ( void );
// Initialize this class to use ini or registry
static void Initialize ( void );
static void CleanUp ( void );
static void FlushChanges ( void );
protected:
static CIniFile * m_CheatIniFile;
static stdstr * m_SectionIdent;
const char * const m_PostFix;
static void GameChanged ( void * /*Data */ );
private:
CSettingTypeCheats(void); // Disable default constructor
CSettingTypeCheats(const CSettingTypeCheats&); // Disable copy constructor
CSettingTypeCheats& operator=(const CSettingTypeCheats&); // Disable assignment
};

View File

@ -16,18 +16,18 @@ bool CSettingTypeGame::m_RdbEditor = false;
bool CSettingTypeGame::m_EraseDefaults = true;
stdstr * CSettingTypeGame::m_SectionIdent = NULL;
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
{
}
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, DWORD DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue)
{
}
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeApplication("",Name,DefaultSetting)
CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
CSettingTypeApplication("",Name,DefaultSetting)
{
}
@ -37,224 +37,223 @@ CSettingTypeGame::~CSettingTypeGame()
void CSettingTypeGame::Initialize ( void )
{
UpdateSettings(NULL);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
UpdateSettings(NULL);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
}
void CSettingTypeGame::CleanUp ( void )
{
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
}
LPCSTR CSettingTypeGame::SectionName ( void ) const
const char * CSettingTypeGame::SectionName ( void ) const
{
return m_SectionIdent ? m_SectionIdent->c_str() : "";
return m_SectionIdent ? m_SectionIdent->c_str() : "";
}
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
{
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
stdstr SectionIdent = g_Settings->LoadString(Game_IniKey);
if (m_SectionIdent == NULL)
{
m_SectionIdent = new stdstr;
}
if (SectionIdent != *m_SectionIdent)
{
*m_SectionIdent = SectionIdent;
g_Settings->SettingTypeChanged(SettingType_GameSetting);
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
}
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
if (m_SectionIdent == NULL)
{
m_SectionIdent = new stdstr;
}
if (SectionIdent != *m_SectionIdent)
{
*m_SectionIdent = SectionIdent;
g_Settings->SettingTypeChanged(SettingType_GameSetting);
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
}
}
bool CSettingTypeGame::Load ( int Index, bool & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
}
bool CSettingTypeGame::Load ( int Index, ULONG & Value ) const
bool CSettingTypeGame::Load ( int Index, uint32_t & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
}
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadString(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
} else {
return g_Settings->LoadStringVal(m_DefaultSetting,Value);
}
}
return CSettingTypeApplication::Load(Index,Value);
}
//return the default values
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
}
void CSettingTypeGame::LoadDefault ( int Index, ULONG & Value ) const
void CSettingTypeGame::LoadDefault ( int Index, uint32_t & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
}
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::LoadDefault(Index,Value);
}
}
//Update the settings
void CSettingTypeGame::Save ( int Index, bool Value )
{
if (m_EraseDefaults)
{
bool bDefault;
LoadDefault(Index,bDefault);
if (bDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveBool(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
if (m_EraseDefaults)
{
bool bDefault;
LoadDefault(Index,bDefault);
if (bDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveBool(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
}
void CSettingTypeGame::Save ( int Index, ULONG Value )
void CSettingTypeGame::Save ( int Index, uint32_t Value )
{
if (m_EraseDefaults)
{
ULONG ulDefault;
CSettingTypeGame::LoadDefault(Index,ulDefault);
if (ulDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveDword(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
if (m_EraseDefaults)
{
uint32_t ulDefault;
CSettingTypeGame::LoadDefault(Index,ulDefault);
if (ulDefault == Value)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveDword(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
}
void CSettingTypeGame::Save ( int Index, const stdstr & Value )
{
Save(Index,Value.c_str());
Save(Index,Value.c_str());
}
void CSettingTypeGame::Save ( int Index, const char * Value )
{
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
{
stdstr szDefault;
CSettingTypeGame::LoadDefault(Index,szDefault);
if (_stricmp(szDefault.c_str(),Value) == 0)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveString(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
{
stdstr szDefault;
CSettingTypeGame::LoadDefault(Index,szDefault);
if (_stricmp(szDefault.c_str(),Value) == 0)
{
Delete(Index);
return;
}
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
} else {
g_Settings->SaveString(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Save(Index,Value);
}
}
void CSettingTypeGame::Delete ( int Index )
{
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
} else {
g_Settings->DeleteSetting(m_DefaultSetting);
}
} else {
CSettingTypeApplication::Delete(Index);
}
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
} else {
g_Settings->DeleteSetting(m_DefaultSetting);
}
} else {
CSettingTypeApplication::Delete(Index);
}
}

View File

@ -11,46 +11,50 @@
#pragma once
class CSettingTypeGame :
public CSettingTypeApplication
public CSettingTypeApplication
{
protected:
static bool m_RdbEditor;
static bool m_EraseDefaults;
static stdstr * m_SectionIdent;
static bool m_RdbEditor;
static bool m_EraseDefaults;
static stdstr * m_SectionIdent;
static void UpdateSettings ( void * /*Data */ );
static void UpdateSettings ( void * /*Data */ );
virtual LPCSTR SectionName ( void ) const;
virtual const char * SectionName ( void ) const;
public:
CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue );
CSettingTypeGame(LPCSTR Name, DWORD DefaultValue );
CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting );
virtual ~CSettingTypeGame();
CSettingTypeGame(const char * Name, const char * DefaultValue );
CSettingTypeGame(const char * Name, uint32_t DefaultValue );
CSettingTypeGame(const char * Name, SettingID DefaultSetting );
virtual ~CSettingTypeGame();
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
static void Initialize( void );
static void CleanUp ( void );
static void Initialize( void );
static void CleanUp ( void );
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeGame(void); // Disable default constructor
CSettingTypeGame(const CSettingTypeGame&); // Disable copy constructor
CSettingTypeGame& operator=(const CSettingTypeGame&); // Disable assignment
};

View File

@ -13,25 +13,24 @@
#include "SettingsType-GameSetting.h"
#include "SettingsType-GameSettingIndex.h"
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) :
CSettingTypeGame("", DefaultSetting),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
CSettingTypeGame("", DefaultSetting),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ) :
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) :
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
@ -41,65 +40,65 @@ CSettingTypeGameIndex::~CSettingTypeGameIndex()
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(Index,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(Index,Value);
}
bool CSettingTypeGameIndex::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(0,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(0,Value);
}
//return the default values
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::LoadDefault(0,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::LoadDefault(0,Value);
}
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeGameIndex::Save ( int Index, bool Value )
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(Index,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(Index,Value);
}
void CSettingTypeGameIndex::Save ( int Index, ULONG Value )
void CSettingTypeGameIndex::Save(int Index, uint32_t Value)
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value);
}
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeGameIndex::Save ( int Index, const char * Value )
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value);
}
void CSettingTypeGameIndex::Delete ( int Index )
{
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Delete(0);
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Delete(0);
}

View File

@ -11,36 +11,40 @@
#pragma once
class CSettingTypeGameIndex :
public CSettingTypeGame
public CSettingTypeGame
{
stdstr m_PreIndex, m_PostIndex;
stdstr m_PreIndex, m_PostIndex;
public:
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue );
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue );
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting );
~CSettingTypeGameIndex();
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue );
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
~CSettingTypeGameIndex();
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeGameIndex(void); // Disable default constructor
CSettingTypeGameIndex(const CSettingTypeGameIndex&); // Disable copy constructor
CSettingTypeGameIndex& operator=(const CSettingTypeGameIndex&); // Disable assignment
};

View File

@ -11,14 +11,15 @@
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBCpuType.h"
#include "../../N64 System/N64 Types.h"
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
{
}
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
{
}
@ -28,96 +29,95 @@ CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeRDBCpuType::Load ( int Index, ULONG & Value ) const
bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
{
stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes)
{
LoadDefault(Index,Value);
return false;
}
LPCSTR String = strValue.c_str();
stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes)
{
LoadDefault(Index,Value);
return false;
}
const char * String = strValue.c_str();
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
}
else { Notify().BreakPoint(__FILEW__,__LINE__); }
return true;
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
}
else { g_Notify->BreakPoint(__FILEW__,__LINE__); }
return true;
}
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
//return the default values
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, ULONG & Value ) const
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, uint32_t & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
}
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBCpuType::Save ( int /*Index*/, ULONG Value )
void CSettingTypeRDBCpuType::Save ( int /*Index*/, uint32_t Value )
{
stdstr strValue;
switch (Value)
{
case CPU_Interpreter: strValue = "Interpreter"; break;
case CPU_Recompiler: strValue = "Recompiler"; break;
case CPU_SyncCores: strValue = "SyncCores"; break;
default:
Notify().BreakPoint(__FILEW__,__LINE__);
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
stdstr strValue;
switch (Value)
{
case CPU_Interpreter: strValue = "Interpreter"; break;
case CPU_Recompiler: strValue = "Recompiler"; break;
case CPU_SyncCores: strValue = "SyncCores"; break;
default:
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
}
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBCpuType::Delete( int /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -11,31 +11,34 @@
#pragma once
class CSettingTypeRDBCpuType :
public CSettingTypeRomDatabase
public CSettingTypeRomDatabase
{
public:
CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting );
CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue );
~CSettingTypeRDBCpuType();
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBCpuType(const char * Name, int DefaultValue );
~CSettingTypeRDBCpuType();
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeRDBCpuType(void); // Disable default constructor
CSettingTypeRDBCpuType(const CSettingTypeRDBCpuType&); // Disable copy constructor
CSettingTypeRDBCpuType& operator=(const CSettingTypeRDBCpuType&); // Disable assignment
};

View File

@ -14,13 +14,13 @@
// == 8 ? 0x800000 : 0x400000
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
{
}
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
{
}
@ -30,70 +30,70 @@ CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeRDBRDRamSize::Load ( int Index, ULONG & Value ) const
bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
{
ULONG ulValue;
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
if (!bRes)
{
LoadDefault(Index,ulValue);
}
Value = 0x400000;
if (ulValue == 8)
{
Value = 0x800000;
}
return bRes;
uint32_t ulValue;
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
if (!bRes)
{
LoadDefault(Index,ulValue);
}
Value = 0x400000;
if (ulValue == 8)
{
Value = 0x800000;
}
return bRes;
}
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
//return the default values
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, ULONG & Value ) const
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, uint32_t & Value ) const
{
Value = m_DefaultValue;
Value = m_DefaultValue;
}
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, ULONG Value )
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, uint32_t Value )
{
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
}
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -11,31 +11,34 @@
#pragma once
class CSettingTypeRDBRDRamSize :
public CSettingTypeRomDatabase
public CSettingTypeRomDatabase
{
public:
CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting );
CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue );
~CSettingTypeRDBRDRamSize();
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue );
~CSettingTypeRDBRDRamSize();
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeRDBRDRamSize(void); // Disable default constructor
CSettingTypeRDBRDRamSize(const CSettingTypeRDBRDRamSize&); // Disable copy constructor
CSettingTypeRDBRDRamSize& operator=(const CSettingTypeRDBRDRamSize&); // Disable assignment
};

View File

@ -11,115 +11,116 @@
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBSaveChip.h"
#include "../../N64 System/N64 Types.h"
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting)
{
}
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue)
{
}
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
{
}
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeRDBSaveChip::Load ( int Index, ULONG & Value ) const
bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
{
stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes)
{
LoadDefault(Index,Value);
return false;
}
LPCSTR String = strValue.c_str();
stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes)
{
LoadDefault(Index,Value);
return false;
}
const char * String = strValue.c_str();
if (_stricmp(String,"First Save Type") == 0) { Value = (ULONG)SaveChip_Auto; }
else if (_stricmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
} else {
Notify().BreakPoint(__FILEW__,__LINE__);
}
return true;
if (_stricmp(String,"First Save Type") == 0) { Value = (uint32_t)SaveChip_Auto; }
else if (_stricmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
else if (_stricmp(String,"default") == 0)
{
LoadDefault(Index,Value);
return false;
} else {
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
return true;
}
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
//return the default values
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, ULONG & Value ) const
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, uint32_t & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
}
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, ULONG Value )
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, uint32_t Value )
{
switch (Value)
{
case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break;
case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break;
case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break;
case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"Sram"); break;
case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
default:
Notify().BreakPoint(__FILEW__,__LINE__);
}
switch (Value)
{
case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break;
case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break;
case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break;
case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"Sram"); break;
case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
default:
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
}
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -11,31 +11,34 @@
#pragma once
class CSettingTypeRDBSaveChip :
public CSettingTypeRomDatabase
public CSettingTypeRomDatabase
{
public:
CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting );
CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue );
~CSettingTypeRDBSaveChip();
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBSaveChip(const char * Name, int DefaultValue );
~CSettingTypeRDBSaveChip();
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeRDBSaveChip(void); // Disable default constructor
CSettingTypeRDBSaveChip(const CSettingTypeRDBSaveChip&); // Disable copy constructor
CSettingTypeRDBSaveChip& operator=(const CSettingTypeRDBSaveChip&); // Disable assignment
};

View File

@ -11,10 +11,10 @@
#include "stdafx.h"
#include "SettingsType-RelativePath.h"
CSettingTypeRelativePath::CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName)
CSettingTypeRelativePath::CSettingTypeRelativePath(const char * Path, const char * FileName)
{
m_FileName = CPath(CPath::MODULE_DIRECTORY,FileName);
m_FileName.AppendDirectory(Path);
m_FileName = CPath(CPath::MODULE_DIRECTORY,FileName);
m_FileName.AppendDirectory(Path);
}
CSettingTypeRelativePath::~CSettingTypeRelativePath ( void )
@ -23,47 +23,47 @@ CSettingTypeRelativePath::~CSettingTypeRelativePath ( void )
bool CSettingTypeRelativePath::Load ( int /*Index*/, stdstr & value ) const
{
value = (LPCSTR)m_FileName;
return true;
value = (const char *)m_FileName;
return true;
}
//return the default values
void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRelativePath::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRelativePath::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeRelativePath::Save ( int /*Index*/, uint32_t /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRelativePath::Save ( int /*Index*/, const stdstr & Value )
{
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value.c_str());
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value.c_str());
}
void CSettingTypeRelativePath::Save ( int /*Index*/, const char * Value )
{
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value);
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value);
}
void CSettingTypeRelativePath::Delete ( int /*Index*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}

View File

@ -9,36 +9,42 @@
* *
****************************************************************************/
#pragma once
#include <Common/path.h>
#include "SettingsType-Base.h"
class CSettingTypeRelativePath :
public CSettingType
public CSettingType
{
CPath m_FileName;
CPath m_FileName;
public:
CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName);
~CSettingTypeRelativePath();
CSettingTypeRelativePath(const char * Path, const char * FileName);
~CSettingTypeRelativePath();
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
//return the values
bool Load ( int /*Index*/, bool & /*Value*/ ) const { return false; };
bool Load ( int /*Index*/, ULONG & /*Value*/ ) const { return false; };
bool Load ( int Index, stdstr & Value ) const;
//return the values
bool Load ( int /*Index*/, bool & /*Value*/ ) const { return false; };
bool Load ( int /*Index*/, uint32_t & /*Value*/ ) const { return false; };
bool Load ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
// Delete the setting
void Delete ( int Index );
// Delete the setting
void Delete ( int Index );
private:
CSettingTypeRelativePath(void); // Disable default constructor
CSettingTypeRelativePath(const CSettingTypeRelativePath&); // Disable copy constructor
CSettingTypeRelativePath& operator=(const CSettingTypeRelativePath&); // Disable assignment
};

View File

@ -15,43 +15,43 @@ CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(""),
m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(DefaultValue),
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)),
m_DefaultStr(DefaultValue),
m_DefaultValue(0),
m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
m_KeyName(Name),
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
m_KeyName(Name),
m_DefaultStr(""),
m_DefaultValue(0),
m_DefaultSetting(DefaultSetting),
m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name))
{
}
@ -61,242 +61,240 @@ CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
void CSettingTypeRomDatabase::Initialize( void )
{
m_SettingsIniFile = new CIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
m_GlideIniFile = new CIniFile(g_Settings->LoadString(SupportFile_Glide64RDB).c_str());
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadString(Game_IniKey));
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
}
void CSettingTypeRomDatabase::CleanUp( void )
{
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
}
if (m_GlideIniFile)
{
delete m_GlideIniFile;
m_GlideIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
if (m_SettingsIniFile)
{
delete m_SettingsIniFile;
m_SettingsIniFile = NULL;
}
if (m_GlideIniFile)
{
delete m_GlideIniFile;
m_GlideIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
}
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
{
if (m_SectionIdent)
{
*m_SectionIdent = g_Settings->LoadString(Game_IniKey);
}
if (m_SectionIdent)
{
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
}
}
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
{
DWORD temp_value = Value;
bool bRes = Load(Index,temp_value);
Value = temp_value != 0;
return bRes;
uint32_t temp_value = Value;
bool bRes = Load(Index,temp_value);
Value = temp_value != 0;
return bRes;
}
bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const
bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
{
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
else
{
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
if (!bRes)
{
LoadDefault(Index,Value);
}
return bRes;
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
else
{
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
}
if (!bRes)
{
LoadDefault(Index,Value);
}
return bRes;
}
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
{
stdstr temp_value;
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
else
{
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
if (bRes)
{
Value = temp_value;
}
else
{
LoadDefault(Index,Value);
}
return bRes;
stdstr temp_value;
bool bRes = false;
if (m_GlideSetting)
{
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
else
{
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
}
if (bRes)
{
Value = temp_value;
}
else
{
LoadDefault(Index,Value);
}
return bRes;
}
//return the default values
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue != 0;
} else {
g_Settings->LoadBool(m_DefaultSetting,Value);
}
}
}
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, ULONG & Value ) const
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, uint32_t & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultValue;
} else {
g_Settings->LoadDword(m_DefaultSetting,Value);
}
}
}
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
{
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultStr;
} else {
g_Settings->LoadString(m_DefaultSetting,Value);
}
}
if (m_DefaultSetting != Default_None)
{
if (m_DefaultSetting == Default_Constant)
{
Value = m_DefaultStr;
} else {
g_Settings->LoadStringVal(m_DefaultSetting,Value);
}
}
}
//Update the settings
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
{
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
Notify().BreakPoint(__FILEW__,__LINE__);
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Save ( int Index, ULONG Value )
void CSettingTypeRomDatabase::Save ( int Index, uint32_t Value )
{
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
ULONG defaultValue = 0;
LoadDefault(Index,defaultValue);
if (defaultValue == Value)
{
Delete(Index);
return;
}
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_DeleteOnDefault)
{
uint32_t defaultValue = 0;
LoadDefault(Index,defaultValue);
if (defaultValue == Value)
{
Delete(Index);
return;
}
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
{
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
}
}
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
{
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
}
}
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
{
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
if (!g_Settings->LoadBool(Setting_RdbEditor))
{
return;
}
if (m_GlideSetting)
{
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
else
{
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
}
}
bool CSettingTypeRomDatabase::IsGlideSetting (LPCSTR Name)
bool CSettingTypeRomDatabase::IsGlideSetting (const char * Name)
{
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return true;
}
return false;
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return true;
}
return false;
}
LPCSTR CSettingTypeRomDatabase::StripNameSection (LPCSTR Name)
const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
{
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return &Name[8];
}
return Name;
if (_strnicmp(Name,"Glide64-",8) == 0)
{
return &Name[8];
}
return Name;
}

View File

@ -10,58 +10,65 @@
****************************************************************************/
#pragma once
#include <Common/Ini File Class.h>
#include "SettingsType-Base.h"
class CSettingTypeRomDatabase :
public CSettingType
public CSettingType
{
public:
CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
virtual ~CSettingTypeRomDatabase();
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
virtual ~CSettingTypeRomDatabase();
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
// Delete the setting
virtual void Delete ( int Index );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
static void Initialize( void );
static void CleanUp ( void );
// Delete the setting
virtual void Delete ( int Index );
static void Initialize( void );
static void CleanUp ( void );
protected:
static void GameChanged ( void * /*Data */ );
static void GameChanged ( void * /*Data */ );
static bool IsGlideSetting (LPCSTR Name);
static LPCSTR StripNameSection (LPCSTR Name);
virtual LPCSTR Section ( void ) const { return m_SectionIdent->c_str(); }
static bool IsGlideSetting (const char * Name);
static const char * StripNameSection (const char * Name);
virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
mutable stdstr m_KeyName;
const LPCSTR m_DefaultStr;
const int m_DefaultValue;
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
bool m_GlideSetting;
mutable stdstr m_KeyName;
const char *const m_DefaultStr;
const int m_DefaultValue;
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
bool m_GlideSetting;
static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile;
static CIniFile * m_GlideIniFile;
static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile;
static CIniFile * m_GlideIniFile;
private:
CSettingTypeRomDatabase(); // Disable default constructor
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
};

View File

@ -12,31 +12,31 @@
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RomDatabaseIndex.h"
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) :
CSettingTypeRomDatabase("",DefaultSetting),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
CSettingTypeRomDatabase("",DefaultSetting),
m_PreIndex(PreIndex),
m_PostIndex(PostIndex)
{
}
@ -44,63 +44,63 @@ CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
{
}
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
{
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeRomDatabase::Load(0,Value);
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeRomDatabase::Load(0,Value);
}
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
{
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
}
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, ULONG & Value ) const
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, uint32_t & Value ) const
{
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
}
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
{
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value);
}
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, uint32_t /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ )
{
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
}

View File

@ -11,37 +11,41 @@
#pragma once
class CSettingTypeRomDatabaseIndex :
public CSettingTypeRomDatabase
public CSettingTypeRomDatabase
{
stdstr m_PreIndex, m_PostIndex;
public:
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting );
virtual ~CSettingTypeRomDatabaseIndex();
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual ~CSettingTypeRomDatabaseIndex();
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
virtual bool IndexBasedSetting ( void ) const { return true; }
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
// Delete the setting
virtual void Delete ( int Index );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeRomDatabaseIndex(void); // Disable default constructor
CSettingTypeRomDatabaseIndex(const CSettingTypeRomDatabaseIndex&); // Disable copy constructor
CSettingTypeRomDatabaseIndex& operator=(const CSettingTypeRomDatabaseIndex&); // Disable assignment
stdstr m_PreIndex, m_PostIndex;
};

View File

@ -11,77 +11,75 @@
#include "stdafx.h"
#include "SettingsType-SelectedDirectory.h"
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
m_Name(Name),
m_InitialDir(InitialDir),
m_SelectedDir(SelectedDir),
m_UseSelected(UseSelected)
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
m_Name(Name),
m_InitialDir(InitialDir),
m_SelectedDir(SelectedDir),
m_UseSelected(UseSelected)
{
}
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
{
}
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
{
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
return g_Settings->LoadString(DirSettingId, Value);
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
return g_Settings->LoadStringVal(DirSettingId, Value);
}
//return the default values
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
//Update the settings
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, uint32_t /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
{
g_Settings->SaveBool(m_UseSelected,true);
g_Settings->SaveString(m_SelectedDir,Value);
g_Settings->SaveBool(m_UseSelected,true);
g_Settings->SaveString(m_SelectedDir,Value);
}
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}

View File

@ -10,40 +10,46 @@
****************************************************************************/
#pragma once
#include "SettingsType-Base.h"
class CSettingTypeSelectedDirectory :
public CSettingType
public CSettingType
{
std::string m_Name;
SettingID m_InitialDir;
SettingID m_SelectedDir;
SettingID m_UseSelected;
public:
CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
~CSettingTypeSelectedDirectory();
CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
~CSettingTypeSelectedDirectory();
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
LPCSTR GetName ( void ) const { return m_Name.c_str(); }
const char * GetName ( void ) const { return m_Name.c_str(); }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
//Update the settings
virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
// Delete the setting
virtual void Delete ( int Index );
private:
CSettingTypeSelectedDirectory(void); // Disable default constructor
CSettingTypeSelectedDirectory(const CSettingTypeSelectedDirectory&); // Disable copy constructor
CSettingTypeSelectedDirectory& operator=(const CSettingTypeSelectedDirectory&); // Disable assignment
std::string m_Name;
SettingID m_InitialDir;
SettingID m_SelectedDir;
SettingID m_UseSelected;
};

View File

@ -12,7 +12,7 @@
#include "SettingsType-TempBool.h"
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :
m_value(initialValue)
m_value(initialValue)
{
}
@ -22,59 +22,59 @@ CSettingTypeTempBool::~CSettingTypeTempBool ( void )
bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
{
Value = m_value;
return true;
Value = m_value;
return true;
}
bool CSettingTypeTempBool::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
//return the default values
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value )
{
m_value = Value;
m_value = Value;
}
void CSettingTypeTempBool::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeTempBool::Save ( int /*Index*/, uint32_t /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempBool::Delete( int /*Index*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}

View File

@ -10,35 +10,41 @@
****************************************************************************/
#pragma once
#include "SettingsType-Base.h"
class CSettingTypeTempBool :
public CSettingType
public CSettingType
{
bool m_value;
public:
CSettingTypeTempBool(bool initialValue );
~CSettingTypeTempBool();
CSettingTypeTempBool(bool initialValue );
~CSettingTypeTempBool();
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, ULONG & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
// Delete the setting
void Delete ( int Index );
// Delete the setting
void Delete ( int Index );
private:
CSettingTypeTempBool(void); // Disable default constructor
CSettingTypeTempBool(const CSettingTypeTempBool&); // Disable copy constructor
CSettingTypeTempBool& operator=(const CSettingTypeTempBool&); // Disable assignment
bool m_value;
};

View File

@ -11,8 +11,8 @@
#include "stdafx.h"
#include "SettingsType-TempNumber.h"
CSettingTypeTempNumber::CSettingTypeTempNumber(ULONG initialValue) :
m_value(initialValue)
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
m_value(initialValue)
{
}
@ -22,59 +22,59 @@ CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return true;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return true;
}
bool CSettingTypeTempNumber::Load ( int /*Index*/, ULONG & Value ) const
bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
{
Value = m_value;
return false;
Value = m_value;
return false;
}
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
//return the default values
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::Save ( int /*Index*/, ULONG Value )
void CSettingTypeTempNumber::Save ( int /*Index*/, uint32_t Value )
{
m_value = Value;
m_value = Value;
}
void CSettingTypeTempNumber::Save ( int /*Index*/, const stdstr & /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempNumber::Delete( int /*Index*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}

View File

@ -10,36 +10,41 @@
****************************************************************************/
#pragma once
#include "SettingsType-Base.h"
class CSettingTypeTempNumber :
public CSettingType
public CSettingType
{
ULONG m_value;
public:
CSettingTypeTempNumber(ULONG initialValue);
~CSettingTypeTempNumber();
CSettingTypeTempNumber(uint32_t initialValue);
~CSettingTypeTempNumber();
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, ULONG & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
// Delete the setting
void Delete ( int Index );
// Delete the setting
void Delete ( int Index );
private:
CSettingTypeTempNumber(void); // Disable default constructor
CSettingTypeTempNumber(const CSettingTypeTempNumber&); // Disable copy constructor
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
uint32_t m_value;
};

View File

@ -11,8 +11,8 @@
#include "stdafx.h"
#include "SettingsType-TempString.h"
CSettingTypeTempString::CSettingTypeTempString(LPCSTR initialValue) :
m_value(initialValue)
CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
m_value(initialValue)
{
}
@ -20,62 +20,61 @@ CSettingTypeTempString::~CSettingTypeTempString ( void )
{
}
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeTempString::Load ( int /*Index*/, ULONG & /*Value*/ ) const
bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
return false;
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
}
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
{
Value = m_value;
return true;
Value = m_value;
return true;
}
//return the default values
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempString::LoadDefault ( int /*Index*/, ULONG & /*Value*/ ) const
void CSettingTypeTempString::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempString::Save ( int /*Index*/, ULONG /*Value*/ )
void CSettingTypeTempString::Save ( int /*Index*/, uint32_t /*Value*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}
void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
{
m_value = Value;
m_value = Value;
}
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
{
m_value = Value;
m_value = Value;
}
void CSettingTypeTempString::Delete( int /*Index*/ )
{
Notify().BreakPoint(__FILEW__,__LINE__);
g_Notify->BreakPoint(__FILEW__,__LINE__);
}

View File

@ -10,36 +10,41 @@
****************************************************************************/
#pragma once
#include "SettingsType-Base.h"
class CSettingTypeTempString :
public CSettingType
public CSettingType
{
stdstr m_value;
public:
CSettingTypeTempString(LPCSTR initialValue);
~CSettingTypeTempString();
CSettingTypeTempString(const char * initialValue);
~CSettingTypeTempString();
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, ULONG & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
// Delete the setting
void Delete ( int Index );
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
// Delete the setting
void Delete ( int Index );
private:
CSettingTypeTempString(void); // Disable default constructor
CSettingTypeTempString(const CSettingTypeTempString&); // Disable copy constructor
CSettingTypeTempString& operator=(const CSettingTypeTempString&); // Disable assignment
stdstr m_value;
};

File diff suppressed because it is too large Load Diff

View File

@ -12,114 +12,116 @@
#include "SettingType/SettingsType-Base.h"
enum SettingDataType {
Data_DWORD = 0,
Data_String = 1,
Data_CPUTYPE = 2,
Data_SelfMod = 3,
Data_OnOff = 4,
Data_YesNo = 5,
Data_SaveChip = 6
enum SettingDataType
{
Data_DWORD = 0,
Data_String = 1,
Data_CPUTYPE = 2,
Data_SelfMod = 3,
Data_OnOff = 4,
Data_YesNo = 5,
Data_SaveChip = 6
};
class CSettings {
class CSettings
{
public:
typedef void (* SettingChangedFunc)(void *);
typedef void (* SettingChangedFunc)(void *);
private:
void AddHandler ( SettingID TypeID, CSettingType * Handler );
void AddHowToHandleSetting (void);
void UnknownSetting (SettingID Type);
void AddHandler ( SettingID TypeID, CSettingType * Handler );
void AddHowToHandleSetting (void);
void UnknownSetting (SettingID Type);
struct SETTING_CHANGED_CB
{
void * Data;
SettingChangedFunc Func;
SETTING_CHANGED_CB * Next;
};
struct SETTING_CHANGED_CB
{
void * Data;
SettingChangedFunc Func;
SETTING_CHANGED_CB * Next;
};
typedef std::map<SettingID, SETTING_CHANGED_CB *> SETTING_CALLBACK;
typedef std::map<SettingID, CSettingType *> SETTING_MAP;
typedef SETTING_MAP::iterator SETTING_HANDLER;
typedef std::map<SettingID, SETTING_CHANGED_CB *> SETTING_CALLBACK;
typedef std::map<SettingID, CSettingType *> SETTING_MAP;
typedef SETTING_MAP::iterator SETTING_HANDLER;
public:
CSettings(void);
~CSettings(void);
bool Initialize ( const char * AppName );
CSettings(void);
~CSettings(void);
//return the values
bool LoadBool ( SettingID Type );
bool LoadBool ( SettingID Type, bool & Value );
bool LoadBoolIndex ( SettingID Type, int index );
bool LoadBoolIndex ( SettingID Type, int index , bool & Value );
DWORD LoadDword ( SettingID Type );
bool LoadDword ( SettingID Type, DWORD & Value);
DWORD LoadDwordIndex ( SettingID Type, int index );
bool LoadDwordIndex ( SettingID Type, int index, DWORD & Value);
stdstr LoadString ( SettingID Type );
bool LoadString ( SettingID Type, stdstr & Value );
bool LoadString ( SettingID Type, char * Buffer, int BufferSize );
stdstr LoadStringIndex ( SettingID Type, int index );
bool LoadStringIndex ( SettingID Type, int index, stdstr & Value );
bool LoadStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
bool Initialize ( const char * AppName );
//Load the default value for the setting
bool LoadDefaultBool ( SettingID Type );
void LoadDefaultBool ( SettingID Type, bool & Value );
bool LoadDefaultBoolIndex ( SettingID Type, int index );
void LoadDefaultBoolIndex ( SettingID Type, int index , bool & Value );
DWORD LoadDefaultDword ( SettingID Type );
void LoadDefaultDword ( SettingID Type, DWORD & Value);
DWORD LoadDefaultDwordIndex ( SettingID Type, int index );
void LoadDefaultDwordIndex ( SettingID Type, int index, DWORD & Value);
stdstr LoadDefaultString ( SettingID Type );
void LoadDefaultString ( SettingID Type, stdstr & Value );
void LoadDefaultString ( SettingID Type, char * Buffer, int BufferSize );
stdstr LoadDefaultStringIndex ( SettingID Type, int index );
void LoadDefaultStringIndex ( SettingID Type, int index, stdstr & Value );
void LoadDefaultStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
//return the values
bool LoadBool ( SettingID Type );
bool LoadBool ( SettingID Type, bool & Value );
bool LoadBoolIndex ( SettingID Type, int index );
bool LoadBoolIndex ( SettingID Type, int index , bool & Value );
uint32_t LoadDword ( SettingID Type );
bool LoadDword ( SettingID Type, uint32_t & Value);
uint32_t LoadDwordIndex ( SettingID Type, int index );
bool LoadDwordIndex ( SettingID Type, int index, uint32_t & Value);
stdstr LoadStringVal ( SettingID Type );
bool LoadStringVal (SettingID Type, stdstr & Value);
bool LoadStringVal (SettingID Type, char * Buffer, int BufferSize);
stdstr LoadStringIndex ( SettingID Type, int index );
bool LoadStringIndex ( SettingID Type, int index, stdstr & Value );
bool LoadStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
//Update the settings
void SaveBool ( SettingID Type, bool Value );
void SaveBoolIndex ( SettingID Type, int index, bool Value );
void SaveDword ( SettingID Type, DWORD Value );
void SaveDwordIndex ( SettingID Type, int index, DWORD Value );
void SaveString ( SettingID Type, const stdstr & Value );
void SaveStringIndex ( SettingID Type, int index, const stdstr & Value );
void SaveString ( SettingID Type, const char * Buffer );
void SaveStringIndex ( SettingID Type, int index, const char * Buffer );
//Load the default value for the setting
bool LoadDefaultBool ( SettingID Type );
void LoadDefaultBool ( SettingID Type, bool & Value );
bool LoadDefaultBoolIndex ( SettingID Type, int index );
void LoadDefaultBoolIndex ( SettingID Type, int index , bool & Value );
uint32_t LoadDefaultDword ( SettingID Type );
void LoadDefaultDword ( SettingID Type, uint32_t & Value);
uint32_t LoadDefaultDwordIndex ( SettingID Type, int index );
void LoadDefaultDwordIndex ( SettingID Type, int index, uint32_t & Value);
stdstr LoadDefaultString ( SettingID Type );
void LoadDefaultString ( SettingID Type, stdstr & Value );
void LoadDefaultString ( SettingID Type, char * Buffer, int BufferSize );
stdstr LoadDefaultStringIndex ( SettingID Type, int index );
void LoadDefaultStringIndex ( SettingID Type, int index, stdstr & Value );
void LoadDefaultStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
// Delete a setting
void DeleteSetting ( SettingID Type );
void DeleteSettingIndex ( SettingID Type, int index );
//Register Notification of change
void RegisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func);
void UnregisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func);
//Update the settings
void SaveBool ( SettingID Type, bool Value );
void SaveBoolIndex ( SettingID Type, int index, bool Value );
void SaveDword ( SettingID Type, uint32_t Value );
void SaveDwordIndex ( SettingID Type, int index, uint32_t Value );
void SaveString ( SettingID Type, const stdstr & Value );
void SaveStringIndex ( SettingID Type, int index, const stdstr & Value );
void SaveString ( SettingID Type, const char * Buffer );
void SaveStringIndex ( SettingID Type, int index, const char * Buffer );
// information about setting
SettingType GetSettingType ( SettingID Type );
bool IndexBasedSetting ( SettingID Type );
void SettingTypeChanged ( SettingType Type );
// Delete a setting
void DeleteSetting ( SettingID Type );
void DeleteSettingIndex ( SettingID Type, int index );
// static functions for plugins
static DWORD GetSetting ( CSettings * _this, SettingID Type );
static LPCSTR GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize );
//Register Notification of change
void RegisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func);
void UnregisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func);
// information about setting
SettingType GetSettingType ( SettingID Type );
bool IndexBasedSetting ( SettingID Type );
void SettingTypeChanged ( SettingType Type );
// static functions for plugins
static uint32_t GetSetting ( CSettings * _this, SettingID Type );
static const char * GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize );
static void SetSetting ( CSettings * _this, SettingID ID, unsigned int Value );
static void SetSettingSz ( CSettings * _this, SettingID ID, const char * Value );
static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
SettingType Type, const char * Category, const char * DefaultStr,
DWORD Value );
static DWORD FindSetting ( CSettings * _this, char * Name );
static void FlushSettings ( CSettings * _this );
static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
SettingType Type, const char * Category, const char * DefaultStr,
uint32_t Value );
static uint32_t FindSetting ( CSettings * _this, const char * Name );
static void FlushSettings ( CSettings * _this );
private:
void NotifyCallBacks ( SettingID Type );
void NotifyCallBacks ( SettingID Type );
SETTING_MAP m_SettingInfo;
SETTING_CALLBACK m_Callback;
int m_NextAutoSettingId;
SETTING_MAP m_SettingInfo;
SETTING_CALLBACK m_Callback;
int m_NextAutoSettingId;
};
extern CSettings * g_Settings;

View File

@ -197,7 +197,7 @@ DWORD CALLBACK AboutIniBoxProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD /*lPa
}
//RDB
CIniFile RdbIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
CIniFile RdbIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
wcsncpy(String, RdbIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
@ -223,7 +223,7 @@ DWORD CALLBACK AboutIniBoxProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD /*lPa
//Cheat
SetDlgItemTextW(hDlg,IDC_CHT,GS(INI_CURRENT_CHT));
CIniFile CheatIniFile(g_Settings->LoadString(SupportFile_Cheats).c_str());
CIniFile CheatIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
wcsncpy(String, CheatIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
@ -247,7 +247,7 @@ DWORD CALLBACK AboutIniBoxProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD /*lPa
//Extended Info
SetDlgItemTextW(hDlg, IDC_RDX, GS(INI_CURRENT_RDX));
CIniFile RdxIniFile(g_Settings->LoadString(SupportFile_ExtInfo).c_str());
CIniFile RdxIniFile(g_Settings->LoadStringVal(SupportFile_ExtInfo).c_str());
wcsncpy(String, RdxIniFile.GetString("Meta","Author","").ToUTF16().c_str(),sizeof(String) / sizeof(String[0]));
if (wcslen(String) == 0)
{
@ -547,8 +547,8 @@ LRESULT CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DW
int X = (GetSystemMetrics( SM_CXSCREEN ) - _this->Width()) / 2;
int Y = (GetSystemMetrics( SM_CYSCREEN ) - _this->Height()) / 2;
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
g_Settings->LoadDword(UserInterface_MainWindowTop,(uint32_t &)Y);
g_Settings->LoadDword(UserInterface_MainWindowLeft, (uint32_t &)X);
_this->SetPos(X,Y);
@ -777,7 +777,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DW
{
if (!fActive && g_Settings->LoadBool(UserInterface_InFullScreen))
{
g_Notify->WindowMode();
Notify().WindowMode();
if (bAutoSleep() && g_BaseSystem)
{
//System->ExternalEvent(PauseCPU_AppLostActiveDelayed );
@ -846,7 +846,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DW
CN64Rom Rom;
Rom.LoadN64Image(_this->CurrentedSelectedRom(),true);
Rom.SaveRomSettingID(true);
/*if (g_Settings->LoadString(ROM_MD5).length() == 0) {
/*if (g_Settings->LoadStringVal(ROM_MD5).length() == 0) {
Rom.LoadN64Image(_this->CurrentedSelectedRom(),false);
g_Settings->SaveString(ROM_MD5,Rom.GetRomMD5().c_str());
g_Settings->SaveString(ROM_InternalName,Rom.GetRomName().c_str());
@ -928,7 +928,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DW
CMainGui * _this = (CMainGui *)GetProp((HWND)hWnd,"Class");
if (_this->m_bMainWindow)
{
g_Notify->WindowMode();
Notify().WindowMode();
}
_this->m_hMainWindow = NULL;
WriteTrace(TraceDebug,__FUNCTION__ ": WM_DESTROY - 1");

View File

@ -124,7 +124,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
break;
case ID_SYSTEM_BITMAP:
{
stdstr Dir(g_Settings->LoadString(Directory_SnapShot));
stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot));
WriteTraceF(TraceGfxPlugin,__FUNCTION__ ": CaptureScreen(%s): Starting",Dir.c_str());
g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": CaptureScreen: Done");
@ -148,7 +148,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
memset(&SaveFile, 0, sizeof(SaveFile));
memset(&openfilename, 0, sizeof(openfilename));
g_Settings->LoadString(Directory_LastSave, Directory,sizeof(Directory));
g_Settings->LoadStringVal(Directory_LastSave, Directory,sizeof(Directory));
openfilename.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hWnd;
@ -191,7 +191,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
memset(&SaveFile, 0, sizeof(SaveFile));
memset(&openfilename, 0, sizeof(openfilename));
g_Settings->LoadString(Directory_LastSave, Directory,sizeof(Directory));
g_Settings->LoadStringVal(Directory_LastSave, Directory,sizeof(Directory));
openfilename.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hWnd;
@ -471,7 +471,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUGGER_INTERRUPT_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
case ID_CURRENT_SAVE_DEFAULT:
Notify().DisplayMessage(3,L"Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str());
Notify().DisplayMessage(3,stdstr_f("Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str()).ToUTF16().c_str());
g_Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
break;
case ID_CURRENT_SAVE_1:
@ -484,7 +484,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_CURRENT_SAVE_8:
case ID_CURRENT_SAVE_9:
case ID_CURRENT_SAVE_10:
Notify().DisplayMessage(3,L"Save Slot (%s) selected",GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1).c_str());
Notify().DisplayMessage(3,stdstr_f("Save Slot (%s) selected",GetSaveSlotString((MenuID - ID_CURRENT_SAVE_1) + 1)).ToUTF16().c_str());
g_Settings->SaveDword(Game_CurrentSaveState,(DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1));
break;
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); break;
@ -505,7 +505,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
stdstr Dir = g_Settings->LoadStringIndex(Directory_RecentGameDirIndex,Offset);
if (Dir.length() > 0) {
g_Settings->SaveString(Directory_Game,Dir.c_str());
g_Notify->AddRecentDir(Dir.c_str());
Notify().AddRecentDir(Dir.c_str());
_Gui->RefreshMenu();
if (_Gui->RomBrowserVisible()) {
_Gui->RefreshRomBrowser();
@ -601,8 +601,8 @@ std::wstring CMainMenu::GetSaveSlotString (int Slot)
stdstr LastSaveTime;
//check first save name
stdstr _GoodName = g_Settings->LoadString(Game_GoodName);
stdstr _InstantSaveDirectory = g_Settings->LoadString(Directory_InstantSave);
stdstr _GoodName = g_Settings->LoadStringVal(Game_GoodName);
stdstr _InstantSaveDirectory = g_Settings->LoadStringVal(Directory_InstantSave);
stdstr CurrentSaveName;
if (Slot != 0)
{
@ -627,7 +627,7 @@ std::wstring CMainMenu::GetSaveSlotString (int Slot)
// Check old file name
if (LastSaveTime.empty())
{
stdstr _RomName = g_Settings->LoadString(Game_GameName);
stdstr _RomName = g_Settings->LoadStringVal(Game_GameName);
if (Slot > 0)
{
FileName.Format("%s%s.pj%d", _InstantSaveDirectory.c_str(), _RomName.c_str(),Slot);
@ -661,7 +661,7 @@ void CMainMenu::FillOutMenu ( HMENU hMenu )
bool inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
bool CPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
bool RomLoading = g_Settings->LoadBool(GameRunning_LoadingInProgress);
bool RomLoaded = g_Settings->LoadString(Game_GameName).length() > 0;
bool RomLoaded = g_Settings->LoadStringVal(Game_GameName).length() > 0;
bool RomList = g_Settings->LoadBool(RomBrowser_Enabled) && !CPURunning;
CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING;

View File

@ -348,7 +348,7 @@ void CShortCuts::Load (bool InitialValues )
AddShortCut(ID_OPTIONS_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, CMenuShortCutKey::GAME_RUNNING );
AddShortCut(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, CMenuShortCutKey::NOT_IN_FULLSCREEN );
CPath ShortCutFile = g_Settings->LoadString(SupportFile_ShortCuts);
CPath ShortCutFile = g_Settings->LoadStringVal(SupportFile_ShortCuts);
if (!ShortCutFile.Exists() || InitialValues)
{
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,CMenuShortCutKey::GAME_RUNNING);
@ -416,7 +416,7 @@ void CShortCuts::Save( void )
{
CGuard CS(m_CS);
stdstr FileName = g_Settings->LoadString(SupportFile_ShortCuts);
stdstr FileName = g_Settings->LoadStringVal(SupportFile_ShortCuts);
FILE *file = fopen(FileName.c_str(),"w");
if (file == NULL)
{

View File

@ -158,7 +158,7 @@ void CNotification::SetWindowCaption (const wchar_t * Caption)
static const size_t TITLE_SIZE = 256;
wchar_t WinTitle[TITLE_SIZE];
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadString(Setting_ApplicationName).ToUTF16().c_str());
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadStringVal(Setting_ApplicationName).ToUTF16().c_str());
WinTitle[TITLE_SIZE - 1] = 0;
#if defined(WINDOWS_UI)
m_hWnd->Caption(WinTitle);

View File

@ -17,10 +17,10 @@ CRomBrowser::CRomBrowser (HWND & MainWindow, HWND & StatusWindow ) :
{
if (g_Settings)
{
m_RomIniFile = new CIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str());
m_NotesIniFile = new CIniFile(g_Settings->LoadString(SupportFile_Notes).c_str());
m_ExtIniFile = new CIniFile(g_Settings->LoadString(SupportFile_ExtInfo).c_str());
m_ZipIniFile = new CIniFile(g_Settings->LoadString(SupportFile_7zipCache).c_str());
m_RomIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_NotesIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Notes).c_str());
m_ExtIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_ExtInfo).c_str());
m_ZipIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_7zipCache).c_str());
}
m_hRomList = 0;
@ -441,7 +441,7 @@ void CRomBrowser::FillRomExtensionInfo(ROM_INFO * pRomInfo)
}
if (m_Fields[RB_Players].Pos() >= 0)
{
m_ExtIniFile->GetNumber(Identifier,"Players",1,(DWORD &)pRomInfo->Players);
m_ExtIniFile->GetNumber(Identifier,"Players",1,(uint32_t &)pRomInfo->Players);
}
if (m_Fields[RB_ForceFeedback].Pos() >= 0)
{
@ -588,7 +588,7 @@ bool CRomBrowser::GetRomFileNames( strlist & FileList, const CPath & BaseDirecto
void CRomBrowser::NotificationCB ( LPCWSTR Status, CRomBrowser * /*_this*/ )
{
g_Notify->DisplayMessage(5,L"%s",Status);
g_Notify->DisplayMessage(5,Status);
}
@ -767,7 +767,7 @@ void CRomBrowser::FillRomList ( strlist & FileList, const CPath & BaseDirectory,
RomInfo.Country = *(RomData + 0x3D);
RomInfo.CRC1 = *(DWORD *)(RomData + 0x10);
RomInfo.CRC2 = *(DWORD *)(RomData + 0x14);
m_ZipIniFile->GetNumber(SectionName.c_str(),stdstr_f("%s-Cic",FileName.c_str()).c_str(), (ULONG)-1,(DWORD &)RomInfo.CicChip);
m_ZipIniFile->GetNumber(SectionName.c_str(),stdstr_f("%s-Cic",FileName.c_str()).c_str(), (ULONG)-1,(uint32_t &)RomInfo.CicChip);
WriteTrace(TraceDebug,__FUNCTION__ ": 16");
FillRomExtensionInfo(&RomInfo);
@ -979,7 +979,7 @@ void CRomBrowser::ByteSwapRomData (BYTE * Data, int DataLen)
}
void CRomBrowser::LoadRomList (void) {
stdstr FileName = g_Settings->LoadString(SupportFile_RomListCache);
stdstr FileName = g_Settings->LoadStringVal(SupportFile_RomListCache);
//Open the cache file
HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
@ -1072,7 +1072,7 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this)
if (_this->m_hRomList == NULL) { return; }
//delete cache
stdstr CacheFileName = g_Settings->LoadString(SupportFile_RomListCache);
stdstr CacheFileName = g_Settings->LoadStringVal(SupportFile_RomListCache);
DeleteFile(CacheFileName.c_str());
//clear all current items
@ -1085,7 +1085,7 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this)
Sleep(100);
WriteTrace(TraceDebug,__FUNCTION__ " 3");
if (_this->m_WatchRomDir != g_Settings->LoadString(Directory_Game))
if (_this->m_WatchRomDir != g_Settings->LoadStringVal(Directory_Game))
{
WriteTrace(TraceDebug,__FUNCTION__ " 4");
_this->WatchThreadStop();
@ -1095,7 +1095,7 @@ void CRomBrowser::RefreshRomBrowserStatic (CRomBrowser * _this)
}
WriteTrace(TraceDebug,__FUNCTION__ " 7");
stdstr RomDir = g_Settings->LoadString(Directory_Game);
stdstr RomDir = g_Settings->LoadStringVal(Directory_Game);
stdstr LastRom = g_Settings->LoadStringIndex(File_RecentGameFileIndex,0);
WriteTrace(TraceDebug,__FUNCTION__ " 8");
@ -1586,7 +1586,7 @@ void CRomBrowser::SaveRomList ( strlist & FileList )
{
MD5 ListHash = RomListHash(FileList);
stdstr FileName = g_Settings->LoadString(SupportFile_RomListCache);
stdstr FileName = g_Settings->LoadStringVal(SupportFile_RomListCache);
HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
DWORD dwWritten;
@ -1669,7 +1669,7 @@ void CRomBrowser::SelectRomDir(void)
BROWSEINFOW bi;
WriteTrace(TraceDebug,__FUNCTION__ " 1");
stdstr RomDir = g_Settings->LoadString(Directory_Game);
stdstr RomDir = g_Settings->LoadStringVal(Directory_Game);
bi.hwndOwner = m_MainWindow;
bi.pidlRoot = NULL;
bi.pszDisplayName = SelectedDir;
@ -1695,7 +1695,7 @@ void CRomBrowser::SelectRomDir(void)
WriteTrace(TraceDebug,__FUNCTION__ " 6");
g_Settings->SaveString(Directory_Game,Directory);
WriteTrace(TraceDebug,__FUNCTION__ " 7");
g_Notify->AddRecentDir(Directory);
Notify().AddRecentDir(Directory);
WriteTrace(TraceDebug,__FUNCTION__ " 8");
RefreshRomBrowser();
WriteTrace(TraceDebug,__FUNCTION__ " 9");
@ -1718,8 +1718,8 @@ void CRomBrowser::FixRomListWindow (void)
int Y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
//Load the value from settings, if none is available, default to above
g_Settings->LoadDword(RomBrowser_Top, (DWORD &)Y);
g_Settings->LoadDword(RomBrowser_Left,(DWORD &)X);
g_Settings->LoadDword(RomBrowser_Top, (uint32_t &)Y);
g_Settings->LoadDword(RomBrowser_Left, (uint32_t &)X);
SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
@ -1800,8 +1800,8 @@ void CRomBrowser::HideRomList (void)
GetWindowRect(m_MainWindow,&rect);
int X = (GetSystemMetrics( SM_CXSCREEN ) - (rect.right - rect.left)) / 2;
int Y = (GetSystemMetrics( SM_CYSCREEN ) - (rect.bottom - rect.top)) / 2;
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
g_Settings->LoadDword(UserInterface_MainWindowTop,(uint32_t &)Y);
g_Settings->LoadDword(UserInterface_MainWindowLeft, (uint32_t &)X);
SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
//Mark the window as not visible
@ -1818,7 +1818,7 @@ bool CRomBrowser::RomDirNeedsRefresh ( void )
bool InWatchThread = (m_WatchThreadID == GetCurrentThreadId());
//Get Old MD5 of file names
stdstr FileName = g_Settings->LoadString(SupportFile_RomListCache);
stdstr FileName = g_Settings->LoadStringVal(SupportFile_RomListCache);
HANDLE hFile = CreateFile(FileName.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
@ -1833,7 +1833,7 @@ bool CRomBrowser::RomDirNeedsRefresh ( void )
//Get Current MD5 of file names
strlist FileNames;
if (!GetRomFileNames(FileNames,CPath(g_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread ))
if (!GetRomFileNames(FileNames,CPath(g_Settings->LoadStringVal(Directory_Game)),stdstr(""), InWatchThread ))
{
return false;
}
@ -1866,7 +1866,7 @@ void CRomBrowser::WatchRomDirChanged ( CRomBrowser * _this )
try
{
WriteTrace(TraceDebug,__FUNCTION__ ": 1");
_this->m_WatchRomDir = g_Settings->LoadString(Directory_Game);
_this->m_WatchRomDir = g_Settings->LoadStringVal(Directory_Game);
WriteTrace(TraceDebug,__FUNCTION__ ": 2");
if (_this->RomDirNeedsRefresh())
{

View File

@ -13,14 +13,13 @@
#include <vector>
class CMainGui;
class CNotification;
class CPlugins;
class ROMBROWSER_FIELDS {
stdstr m_Name;
size_t m_Pos, m_DefaultPos;
int m_ID;
ULONG m_ColWidth;
uint32_t m_ColWidth;
LanguageStringID m_LangID;
bool m_PosChanged;
@ -37,7 +36,7 @@ public:
{
if (!UseDefault)
{
m_PosChanged = g_Settings->LoadDwordIndex(RomBrowser_PosIndex,m_ID,(ULONG &)m_Pos );
m_PosChanged = g_Settings->LoadDwordIndex(RomBrowser_PosIndex,m_ID,(uint32_t &)m_Pos );
g_Settings->LoadDwordIndex(RomBrowser_WidthIndex,m_ID,m_ColWidth);
}
}

View File

@ -77,11 +77,11 @@ bool CSettingConfig::UpdateAdvanced ( bool AdvancedMode, HTREEITEM hItem )
LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
stdstr ConfigRomTitle, GameIni(g_Settings->LoadString(Game_IniKey));
stdstr ConfigRomTitle, GameIni(g_Settings->LoadStringVal(Game_IniKey));
if (!GameIni.empty())
{
ConfigRomTitle.Format("Config: %s",g_Settings->LoadString(Game_GoodName).c_str());
ConfigRomTitle.Format("Config: %s",g_Settings->LoadStringVal(Game_GoodName).c_str());
}
RECT rcSettingInfo;
@ -246,12 +246,12 @@ LRESULT CSettingConfig::OnClicked (WORD /*wNotifyCode*/, WORD wID, HWND , BOOL&
void CSettingConfig::ApplySettings( bool UpdateScreen )
{
stdstr GameIni(g_Settings->LoadString(Game_IniKey));
stdstr GameIni(g_Settings->LoadStringVal(Game_IniKey));
if (!GameIni.empty())
{
stdstr GoodName;
if (!g_Settings->LoadString(Game_GoodName,GoodName))
if (!g_Settings->LoadStringVal(Game_GoodName,GoodName))
{
g_Settings->SaveString(Game_GoodName,GoodName);
}
@ -275,9 +275,9 @@ void CSettingConfig::ApplySettings( bool UpdateScreen )
}
if (!g_Settings->LoadString(Game_IniKey).empty())
if (!g_Settings->LoadStringVal(Game_IniKey).empty())
{
stdstr GoodName = g_Settings->LoadString(Rdb_GoodName);
stdstr GoodName = g_Settings->LoadStringVal(Rdb_GoodName);
if (GoodName.length() > 0)
{
g_Settings->SaveString(Game_GoodName,GoodName);

View File

@ -168,15 +168,15 @@ void COptionsDirectoriesPage::UpdatePageSettings()
stdstr Directory;
m_InUpdateSettings = true;
m_PluginDir.SetChanged(g_Settings->LoadString(Directory_PluginSelected,Directory));
m_PluginDir.SetChanged(g_Settings->LoadStringVal(Directory_PluginSelected,Directory));
m_PluginDir.SetWindowText(Directory.c_str());
m_AutoSaveDir.SetChanged(g_Settings->LoadString(Directory_NativeSaveSelected,Directory));
m_AutoSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_NativeSaveSelected,Directory));
m_AutoSaveDir.SetWindowText(Directory.c_str());
m_InstantSaveDir.SetChanged(g_Settings->LoadString(Directory_InstantSaveSelected,Directory));
m_InstantSaveDir.SetChanged(g_Settings->LoadStringVal(Directory_InstantSaveSelected,Directory));
m_InstantSaveDir.SetWindowText(Directory.c_str());
m_ScreenShotDir.SetChanged(g_Settings->LoadString(Directory_SnapShotSelected,Directory));
m_ScreenShotDir.SetChanged(g_Settings->LoadStringVal(Directory_SnapShotSelected,Directory));
m_ScreenShotDir.SetWindowText(Directory.c_str());
m_TextureDir.SetChanged(g_Settings->LoadString(Directory_TextureSelected,Directory));
m_TextureDir.SetChanged(g_Settings->LoadStringVal(Directory_TextureSelected,Directory));
m_TextureDir.SetWindowText(Directory.c_str());
bool UseSelected;

View File

@ -78,7 +78,7 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
ComboBox->AddItemW(GS(NUMBER_6), 6 );
}
SetDlgItemText(IDC_GOOD_NAME,g_Settings->LoadString(Game_GoodName).c_str());
SetDlgItemText(IDC_GOOD_NAME,g_Settings->LoadStringVal(Game_GoodName).c_str());
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));

View File

@ -54,7 +54,7 @@ CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay )
void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType )
{
stdstr Default;
bool PluginSelected = g_Settings->LoadString(Type,Default);
bool PluginSelected = g_Settings->LoadStringVal(Type,Default);
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type);
@ -183,7 +183,7 @@ void CGamePluginPage::UpdatePageSettings ( void )
CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue;
bool PluginChanged = g_Settings->LoadString(cb_iter->first,SelectedValue);
bool PluginChanged = g_Settings->LoadStringVal(cb_iter->first,SelectedValue);
ComboBox->SetChanged(PluginChanged);
if (PluginChanged)
{
@ -259,7 +259,7 @@ void CGamePluginPage::ApplyComboBoxes ( void )
if (Plugin)
{
if (g_Settings->LoadString(cb_iter->first) != Plugin->FileName.c_str())
if (g_Settings->LoadStringVal(cb_iter->first) != Plugin->FileName.c_str())
{
g_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str());
}

View File

@ -21,10 +21,10 @@ CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay )
return;
}
CIniFile RomIniFile (g_Settings->LoadString(SupportFile_RomDatabase).c_str());
CIniFile RomIniFile (g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
strlist Keys;
RomIniFile.GetKeyList("Rom Status",Keys);
stdstr Status = g_Settings->LoadString(Rdb_Status);
stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
CModifiedComboBoxTxt * ComboBox;
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status);

View File

@ -52,7 +52,7 @@ COptionPluginPage::COptionPluginPage (HWND hParent, const RECT & rcDispay )
void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType )
{
stdstr Default = g_Settings->LoadString(Type);
stdstr Default = g_Settings->LoadStringVal(Type);
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type);
@ -175,7 +175,7 @@ void COptionPluginPage::UpdatePageSettings ( void )
CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue;
ComboBox->SetChanged(g_Settings->LoadString(cb_iter->first,SelectedValue));
ComboBox->SetChanged(g_Settings->LoadStringVal(cb_iter->first,SelectedValue));
for (int i = 0, n = ComboBox->GetCount(); i < n; i++ )
{
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i);

View File

@ -254,14 +254,14 @@ protected:
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
stdstr SelectedValue;
ComboBox->SetChanged(g_Settings->LoadString(cbtxt_iter->first,SelectedValue));
ComboBox->SetChanged(g_Settings->LoadStringVal(cbtxt_iter->first,SelectedValue));
ComboBox->SetDefault(SelectedValue);
}
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{
CModifiedComboBox * ComboBox = cb_iter->second;
DWORD SelectedValue;
uint32_t SelectedValue;
ComboBox->SetChanged(g_Settings->LoadDword(cb_iter->first,SelectedValue));
ComboBox->SetDefault(SelectedValue);
@ -278,10 +278,10 @@ protected:
if (TextBox->IsbString())
{
stdstr SelectedValue;
TextBox->SetChanged(g_Settings->LoadString(iter->first,SelectedValue));
TextBox->SetChanged(g_Settings->LoadStringVal(iter->first,SelectedValue));
TextBox->SetWindowText(SelectedValue.c_str());
} else {
DWORD SelectedValue;
uint32_t SelectedValue;
TextBox->SetChanged(g_Settings->LoadDword(iter->first,SelectedValue));
TextBox->SetWindowText(stdstr_f("%d",SelectedValue).c_str());
}

View File

@ -229,7 +229,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
//Create the plugin container
WriteTrace(TraceDebug,__FUNCTION__ ": Create Plugins");
g_Plugins = new CPlugins(g_Settings->LoadString(Directory_Plugin));
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
//Select the language
g_Lang->LoadCurrentStrings(true);