[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> #include <TChar.H>
CFile::CFile() : CFile::CFile() :
m_hFile(INVALID_HANDLE_VALUE), m_hFile(INVALID_HANDLE_VALUE),
m_bCloseOnDelete(false) m_bCloseOnDelete(false)
{ {
} }
CFile::CFile(HANDLE hFile) : CFile::CFile(HANDLE hFile) :
m_hFile(hFile), m_hFile(hFile),
m_bCloseOnDelete(true) m_bCloseOnDelete(true)
{ {
if (hFile == 0) if (hFile == 0)
{ {
_ASSERTE(hFile != 0); _ASSERTE(hFile != 0);
} }
} }
CFile::~CFile() CFile::~CFile()
{ {
if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete) if (m_hFile != INVALID_HANDLE_VALUE && m_bCloseOnDelete)
{ {
Close(); Close();
} }
} }
CFile::CFile(LPCTSTR lpszFileName, ULONG nOpenFlags) : CFile::CFile(const char * lpszFileName, uint32_t nOpenFlags) :
m_hFile(INVALID_HANDLE_VALUE), m_hFile(INVALID_HANDLE_VALUE),
m_bCloseOnDelete(true) 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()) if (!Close())
{ {
return false; return false;
} }
if (lpszFileName == NULL || _tcslen(lpszFileName) == 0) if (lpszFileName == NULL || _tcslen(lpszFileName) == 0)
{ {
return false; return false;
} }
m_bCloseOnDelete = true; m_bCloseOnDelete = true;
m_hFile = INVALID_HANDLE_VALUE; m_hFile = INVALID_HANDLE_VALUE;
ULONG dwAccess = 0; ULONG dwAccess = 0;
switch (nOpenFlags & 3) switch (nOpenFlags & 3)
{ {
case modeRead: case modeRead:
dwAccess = GENERIC_READ; dwAccess = GENERIC_READ;
break; break;
case modeWrite: case modeWrite:
dwAccess = GENERIC_WRITE; dwAccess = GENERIC_WRITE;
break; break;
case modeReadWrite: case modeReadWrite:
dwAccess = GENERIC_READ|GENERIC_WRITE; dwAccess = GENERIC_READ|GENERIC_WRITE;
break; break;
default: default:
_ASSERTE(false); _ASSERTE(false);
} }
// map share mode // map share mode
ULONG dwShareMode = 0; ULONG dwShareMode = 0;
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; } if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; }
if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; } if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; }
if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; } if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; }
// map modeNoInherit flag // map modeNoInherit flag
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa); sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL; sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0; sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
// map creation flags // map creation flags
ULONG dwCreateFlag = 0; ULONG dwCreateFlag = 0;
if (nOpenFlags & modeCreate) if (nOpenFlags & modeCreate)
{ {
if (nOpenFlags & modeNoTruncate) if (nOpenFlags & modeNoTruncate)
dwCreateFlag = OPEN_ALWAYS; dwCreateFlag = OPEN_ALWAYS;
else else
dwCreateFlag = CREATE_ALWAYS; dwCreateFlag = CREATE_ALWAYS;
} }
else else
dwCreateFlag = OPEN_EXISTING; dwCreateFlag = OPEN_EXISTING;
// attempt file creation // attempt file creation
HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa,
dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL); dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ //#define ERROR_PATH_NOT_FOUND 3L { //#define ERROR_PATH_NOT_FOUND 3L
//ULONG err = GetLastError(); //ULONG err = GetLastError();
return false; return false;
} }
m_hFile = hFile; m_hFile = hFile;
m_bCloseOnDelete = TRUE; m_bCloseOnDelete = TRUE;
return TRUE; return TRUE;
} }
bool CFile::Close() bool CFile::Close()
{ {
bool bError = true; bool bError = true;
if (m_hFile != INVALID_HANDLE_VALUE) if (m_hFile != INVALID_HANDLE_VALUE)
{ {
bError = !::CloseHandle(m_hFile); bError = !::CloseHandle(m_hFile);
} }
m_hFile = INVALID_HANDLE_VALUE; m_hFile = INVALID_HANDLE_VALUE;
m_bCloseOnDelete = false; m_bCloseOnDelete = false;
return bError; return bError;
} }
ULONG CFile::SeekToEnd ( void ) uint32_t CFile::SeekToEnd ( void )
{ {
return Seek(0, CFile::end); return Seek(0, CFile::end);
} }
void CFile::SeekToBegin ( void ) void CFile::SeekToBegin ( void )
{ {
Seek(0, CFile::begin); Seek(0, CFile::begin);
} }
bool CFile::IsOpen( void ) const bool CFile::IsOpen( void ) const
{ {
return m_hFile != INVALID_HANDLE_VALUE; return m_hFile != INVALID_HANDLE_VALUE;
} }
bool CFile::Flush() bool CFile::Flush()
{ {
if (m_hFile == INVALID_HANDLE_VALUE) if (m_hFile == INVALID_HANDLE_VALUE)
{ {
return true; 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) if (nCount == 0)
{ {
return true; // avoid Win32 "null-write" option return true; // avoid Win32 "null-write" option
} }
ULONG nWritten = 0; ULONG nWritten = 0;
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL)) if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
{ {
return false; return false;
} }
if (nWritten != nCount) if (nWritten != nCount)
{ {
// Win32s will not return an error all the time (usually DISK_FULL) // Win32s will not return an error all the time (usually DISK_FULL)
return false; return false;
} }
return true; return true;
} }
ULONG CFile::Read(void* lpBuf, ULONG nCount) uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
{ {
if (nCount == 0) if (nCount == 0)
{ {
return 0; // avoid Win32 "null-read" return 0; // avoid Win32 "null-read"
} }
ULONG dwRead = 0; ULONG dwRead = 0;
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL)) if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
{ {
return 0; return 0;
} }
return (UINT)dwRead; return (UINT)dwRead;
} }
long CFile::Seek(long lOff, SeekPosition nFrom) long CFile::Seek(long lOff, SeekPosition nFrom)
{ {
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom); ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom);
if (dwNew == (ULONG)-1) if (dwNew == (ULONG)-1)
{ {
return -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() 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

@ -7,122 +7,119 @@
class CIniFileBase class CIniFileBase
{ {
struct insensitive_compare struct insensitive_compare
{ {
bool operator() (const std::string & a, const std::string & b) const { return _stricmp(a.c_str(),b.c_str()) < 0; } 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::string ansi_string;
typedef std::map<ansi_string,long> FILELOC; typedef std::map<ansi_string,long> FILELOC;
typedef FILELOC::iterator FILELOC_ITR; typedef FILELOC::iterator FILELOC_ITR;
typedef std::map<ansi_string,ansi_string, insensitive_compare> KeyValueList; typedef std::map<ansi_string,ansi_string, insensitive_compare> KeyValueList;
public: public:
typedef std::map<stdstr,stdstr> KeyValueData; typedef std::map<stdstr,stdstr> KeyValueData;
typedef std::vector<stdstr> SectionList; typedef std::vector<stdstr> SectionList;
protected: protected:
CFileBase & m_File; CFileBase & m_File;
stdstr m_FileName; stdstr m_FileName;
private: private:
ansi_string m_CurrentSection; ansi_string m_CurrentSection;
bool m_CurrentSectionDirty; bool m_CurrentSectionDirty;
int m_CurrentSectionFilePos; // Where in the file is the current Section int m_CurrentSectionFilePos; // Where in the file is the current Section
KeyValueList m_CurrentSectionData; KeyValueList m_CurrentSectionData;
long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos long m_lastSectionSearch; // When Scanning for a section, what was the last scanned pos
bool m_ReadOnly;
bool m_InstantFlush;
const char * m_LineFeed;
bool m_ReadOnly; CriticalSection m_CS;
bool m_InstantFlush; FILELOC m_SectionsPos;
LPCSTR m_LineFeed;
CriticalSection m_CS; //void AddItemData ( const char * lpKeyName, const char * lpString);
FILELOC m_SectionsPos; //bool ChangeItemData ( const char * lpKeyName, const char * lpString );
//void DeleteItem ( const char * lpKeyName );
//void AddItemData ( LPCTSTR lpKeyName, LPCTSTR lpString); void fInsertSpaces ( int Pos, int NoOfSpaces );
//bool ChangeItemData ( LPCTSTR lpKeyName, LPCTSTR lpString ); int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos );
//void DeleteItem ( LPCSTR lpKeyName ); bool MoveToSectionNameData(const char * lpSectionName, bool ChangeCurrentSection);
void fInsertSpaces ( int Pos, int NoOfSpaces ); const char * CleanLine ( char * const Line );
int GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos ); void ClearSectionPosList( long FilePos );
bool MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection );
const char * CleanLine ( char * const Line );
void ClearSectionPosList( long FilePos );
protected: protected:
void OpenIniFileReadOnly(); void OpenIniFileReadOnly();
void OpenIniFile(bool bCreate = true); void OpenIniFile(bool bCreate = true);
void SaveCurrentSection ( void ); void SaveCurrentSection ( void );
public: public:
CIniFileBase( CFileBase & FileObject, LPCTSTR FileName ); CIniFileBase(CFileBase & FileObject, const char * FileName);
virtual ~CIniFileBase(void); virtual ~CIniFileBase(void);
bool IsEmpty(); bool IsEmpty();
bool IsFileOpen ( void ); bool IsFileOpen ( void );
bool DeleteSection ( LPCSTR lpSectionName ); bool DeleteSection(const char * lpSectionName);
bool GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, stdstr & Value ); bool GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault, stdstr & Value );
stdstr GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault ); stdstr GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault );
ULONG GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, ULONG nSize ); uint32_t GetString ( const char * lpSectionName, const char * lpKeyName, const char * lpDefault, char * lpReturnedString, uint32_t nSize );
ULONG GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault ); uint32_t GetNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t nDefault );
bool GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault, ULONG & Value ); bool GetNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t nDefault, uint32_t & Value );
#ifdef _UNICODE #ifdef _UNICODE
bool DeleteSection ( LPCWSTR lpSectionName ); bool DeleteSection ( LPCWSTR lpSectionName );
bool GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value ); bool GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value );
stdstr GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault ); stdstr GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault );
ULONG GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPTSTR lpReturnedString, ULONG nSize ); uint32_t GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPTSTR lpReturnedString, uint32_t nSize );
ULONG GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault ); uint32_t GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, uint32_t nDefault );
bool GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault, ULONG & Value ); bool GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, uint32_t nDefault, uint32_t & Value );
#endif #endif
virtual void SaveString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpString ); virtual void SaveString ( const char * lpSectionName, const char * lpKeyName, const char * lpString );
virtual void SaveNumber ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, ULONG Value ); virtual void SaveNumber ( const char * lpSectionName, const char * lpKeyName, uint32_t Value );
void SetAutoFlush (bool AutoFlush); void SetAutoFlush (bool AutoFlush);
void FlushChanges (void); void FlushChanges (void);
void GetKeyList ( LPCTSTR lpSectionName, strlist &List ); void GetKeyList ( const char * lpSectionName, strlist &List );
void GetKeyValueData ( LPCTSTR lpSectionName, KeyValueData & List ); void GetKeyValueData ( const char * lpSectionName, KeyValueData & List );
void GetVectorOfSections( SectionList & sections); void GetVectorOfSections( SectionList & sections);
const stdstr &GetFileName() {return m_FileName;} const stdstr &GetFileName() {return m_FileName;}
}; };
template <class CFileStorage> template <class CFileStorage>
class CIniFileT : class CIniFileT :
public CIniFileBase public CIniFileBase
{ {
public: public:
CIniFileT( LPCTSTR FileName ) : CIniFileT( const char * FileName ) :
CIniFileBase(m_FileObject,FileName) CIniFileBase(m_FileObject,FileName)
{ {
//Try to open file for reading //Try to open file for reading
OpenIniFile(); OpenIniFile();
}
} CIniFileT( const char * FileName, bool bCreate, bool bReadOnly) :
CIniFileBase(m_FileObject,FileName)
CIniFileT( LPCTSTR FileName, bool bCreate, bool bReadOnly) : {
CIniFileBase(m_FileObject,FileName) if(bReadOnly)
{ {
if(bReadOnly) OpenIniFileReadOnly();
{ }
OpenIniFileReadOnly(); else
} {
else //Try to open file for reading
{ OpenIniFile(bCreate);
//Try to open file for reading }
OpenIniFile(bCreate); }
} virtual ~CIniFileT(void)
{
} SaveCurrentSection();
virtual ~CIniFileT(void) }
{
SaveCurrentSection();
}
protected: protected:
CFileStorage m_FileObject; CFileStorage m_FileObject;
}; };
typedef CIniFileT<CFile> CIniFile; typedef CIniFileT<CFile> CIniFile;

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,6 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "..\support.h"
#pragma warning(disable:4786) #pragma warning(disable:4786)
#include <string> //stl string #include <string> //stl string
#include <map> //stl map #include <map> //stl map
@ -22,8 +20,8 @@ typedef LANG_STRINGS::value_type LANG_STR;
struct LanguageFile struct LanguageFile
{ {
stdstr Filename; std::string Filename;
std::wstring LanguageName; std::wstring LanguageName;
}; };
typedef std::list<LanguageFile> LanguageList; typedef std::list<LanguageFile> LanguageList;
@ -33,30 +31,30 @@ class CLanguage
public: public:
CLanguage (); CLanguage ();
const std::wstring & GetString ( LanguageStringID StringID ); const std::wstring & GetString ( LanguageStringID StringID );
LanguageList & GetLangList ( void ); LanguageList & GetLangList ( void );
void SetLanguage ( const wchar_t * LanguageName ); void SetLanguage ( const wchar_t * LanguageName );
void LoadCurrentStrings ( bool ShowSelectDialog ); void LoadCurrentStrings ( bool ShowSelectDialog );
bool IsCurrentLang ( LanguageFile & File ); bool IsCurrentLang ( LanguageFile & File );
private: private:
CLanguage(const CLanguage&); // Disable copy constructor CLanguage(const CLanguage&); // Disable copy constructor
CLanguage& operator=(const CLanguage&); // Disable assignment CLanguage& operator=(const CLanguage&); // Disable assignment
std::wstring m_SelectedLanguage; std::wstring m_SelectedLanguage;
const std::wstring m_emptyString; const std::wstring m_emptyString;
LANG_STRINGS m_CurrentStrings, m_DefaultStrings; LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
LanguageList m_LanguageList; LanguageList m_LanguageList;
std::wstring GetLangString ( const char * FileName, LanguageStringID ID ); std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
LANG_STR GetNextLangString ( void * OpenFile ); LANG_STR GetNextLangString ( void * OpenFile );
void LoadDefaultStrings ( void ); void LoadDefaultStrings ( void );
}; };
extern CLanguage * g_Lang; 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; HKEY hKeyResults = 0;
char String[200]; 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, lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
&hKeyResults); &hKeyResults);
@ -857,7 +857,7 @@ void SaveLogOptions (void)
DWORD Disposition = 0; DWORD Disposition = 0;
char String[200]; 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, lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition); KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);

View File

@ -131,7 +131,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
default: default:
if (g_Settings->LoadDword(Debugger_ShowPifErrors)) 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)); memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
FileName.SetDriveDirectory( g_Settings->LoadString(Directory_NativeSave).c_str()); FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadString(Game_GameName).c_str()); FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
FileName.SetExtension("eep"); FileName.SetExtension("eep");
if (!FileName.DirectoryExists()) if (!FileName.DirectoryExists())

View File

@ -49,7 +49,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{ {
if (bHaveDebugger()) 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; len = 0x10000;
} }
@ -57,7 +57,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{ {
if (bHaveDebugger()) if (bHaveDebugger())
{ {
g_Notify->DisplayError(L"Unaligned flash ram read ???"); g_Notify->DisplayError(__FUNCTIONW__ L": Unaligned flash ram read ???");
} }
return; return;
} }
@ -84,7 +84,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
{ {
if (bHaveDebugger()) 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); *((DWORD *)(dest)) = (DWORD)((m_FlashStatus >> 32) & 0xFFFFFFFF);
@ -93,7 +93,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
default: default:
if (bHaveDebugger()) 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: default:
if (bHaveDebugger()) 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: default:
if (bHaveDebugger()) 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; break;
} }
@ -133,8 +133,8 @@ bool CFlashram::LoadFlashram()
{ {
CPath FileName; CPath FileName;
FileName.SetDriveDirectory( g_Settings->LoadString(Directory_NativeSave).c_str()); FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
FileName.SetName(g_Settings->LoadString(Game_GameName).c_str()); FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
FileName.SetExtension("fla"); FileName.SetExtension("fla");
if (!FileName.DirectoryExists()) if (!FileName.DirectoryExists())
@ -205,7 +205,7 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
} }
break; break;
default: 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; m_FlashFlag = FLASHRAM_MODE_NOPES;
break; break;
@ -234,7 +234,7 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
default: default:
if (bHaveDebugger()) 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; stdstr MempakName;
bool bFormatMempak = false; 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.SetName(MempakName.c_str());
FileName.SetExtension("mpk"); FileName.SetExtension("mpk");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,59 +10,64 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Common/Ini File Class.h>
#include "SettingsType-Base.h"
class CSettingTypeApplication : class CSettingTypeApplication :
public CSettingType public CSettingType
{ {
public:
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; }
//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, 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, 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 );
// Initialize this class to use ini or registry
static void Initialize( const char * AppName );
static void CleanUp ( void );
static void Flush ( void );
const char * GetKeyName ( void) const { return m_KeyName.c_str(); }
protected: protected:
const LPCSTR m_DefaultStr; const char * m_DefaultStr;
const DWORD m_DefaultValue; const uint32_t m_DefaultValue;
const SettingID m_DefaultSetting; const SettingID m_DefaultSetting;
stdstr FixSectionName (LPCSTR Section); stdstr FixSectionName (const char * Section);
static CIniFile * m_SettingsIniFile; static CIniFile * m_SettingsIniFile;
static bool m_UseRegistry; static bool m_UseRegistry;
const stdstr m_Section; const stdstr m_Section;
const stdstr m_KeyName; const stdstr m_KeyName;
mutable stdstr m_KeyNameIdex; mutable stdstr m_KeyNameIdex;
virtual LPCSTR SectionName ( void ) const; virtual const char * SectionName ( void ) const;
public: private:
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, LPCSTR DefaultValue ); CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, bool DefaultValue ); CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, DWORD DefaultValue );
CSettingTypeApplication(LPCSTR Section, LPCSTR Name, SettingID DefaultSetting );
virtual ~CSettingTypeApplication();
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 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;
//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 );
// 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 );
LPCSTR GetKeyName ( void) const { return m_KeyName.c_str(); }
}; };

View File

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

View File

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

View File

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

View File

@ -10,46 +10,51 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "SettingsType-Base.h"
#include <Common/Ini File Class.h>
class CSettingTypeCheats : class CSettingTypeCheats :
public CSettingType public CSettingType
{ {
public:
CSettingTypeCheats(const char * PostFix );
~CSettingTypeCheats();
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, 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, 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, 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 );
// Initialize this class to use ini or registry
static void Initialize ( void );
static void CleanUp ( void );
static void FlushChanges ( void );
protected: protected:
static CIniFile * m_CheatIniFile; static CIniFile * m_CheatIniFile;
static stdstr * m_SectionIdent; static stdstr * m_SectionIdent;
const LPCSTR m_PostFix; const char * const m_PostFix;
static void GameChanged ( void * /*Data */ ); static void GameChanged ( void * /*Data */ );
public:
CSettingTypeCheats(LPCSTR PostFix );
~CSettingTypeCheats();
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 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;
//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 );
// 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 );
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; bool CSettingTypeGame::m_EraseDefaults = true;
stdstr * CSettingTypeGame::m_SectionIdent = NULL; stdstr * CSettingTypeGame::m_SectionIdent = NULL;
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ) : CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue) CSettingTypeApplication("",Name,DefaultValue)
{ {
} }
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, DWORD DefaultValue ) : CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
CSettingTypeApplication("",Name,DefaultValue) CSettingTypeApplication("",Name,DefaultValue)
{ {
} }
CSettingTypeGame::CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting ) : CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
CSettingTypeApplication("",Name,DefaultSetting) CSettingTypeApplication("",Name,DefaultSetting)
{ {
} }
@ -37,224 +37,223 @@ CSettingTypeGame::~CSettingTypeGame()
void CSettingTypeGame::Initialize ( void ) void CSettingTypeGame::Initialize ( void )
{ {
UpdateSettings(NULL); UpdateSettings(NULL);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings); g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
} }
void CSettingTypeGame::CleanUp ( void ) void CSettingTypeGame::CleanUp ( void )
{ {
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings); g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
if (m_SectionIdent) if (m_SectionIdent)
{ {
delete m_SectionIdent; delete m_SectionIdent;
m_SectionIdent = NULL; 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 */ ) void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
{ {
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor); m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults); m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
stdstr SectionIdent = g_Settings->LoadString(Game_IniKey); 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);
}
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 bool CSettingTypeGame::Load ( int Index, bool & Value ) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value); return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
} else { } else {
return g_Settings->LoadBool(m_DefaultSetting,Value); return g_Settings->LoadBool(m_DefaultSetting,Value);
} }
} }
return CSettingTypeApplication::Load(Index,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 (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value); return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
} else { } else {
return g_Settings->LoadDword(m_DefaultSetting,Value); return g_Settings->LoadDword(m_DefaultSetting,Value);
} }
} }
return CSettingTypeApplication::Load(Index,Value); return CSettingTypeApplication::Load(Index,Value);
} }
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value); return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
} else { } else {
return g_Settings->LoadString(m_DefaultSetting,Value); return g_Settings->LoadStringVal(m_DefaultSetting,Value);
} }
} }
return CSettingTypeApplication::Load(Index,Value); return CSettingTypeApplication::Load(Index,Value);
} }
//return the default values //return the default values
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value); g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->LoadDefaultBool(m_DefaultSetting,Value); g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::LoadDefault(Index,Value); 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 (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value); g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->LoadDefaultDword(m_DefaultSetting,Value); g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::LoadDefault(Index,Value); CSettingTypeApplication::LoadDefault(Index,Value);
} }
} }
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value); g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->LoadDefaultString(m_DefaultSetting,Value); g_Settings->LoadDefaultString(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::LoadDefault(Index,Value); CSettingTypeApplication::LoadDefault(Index,Value);
} }
} }
//Update the settings //Update the settings
void CSettingTypeGame::Save ( int Index, bool Value ) void CSettingTypeGame::Save ( int Index, bool Value )
{ {
if (m_EraseDefaults) if (m_EraseDefaults)
{ {
bool bDefault; bool bDefault;
LoadDefault(Index,bDefault); LoadDefault(Index,bDefault);
if (bDefault == Value) if (bDefault == Value)
{ {
Delete(Index); Delete(Index);
return; return;
} }
} }
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value); g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->SaveBool(m_DefaultSetting,Value); g_Settings->SaveBool(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::Save(Index,Value); CSettingTypeApplication::Save(Index,Value);
} }
} }
void CSettingTypeGame::Save ( int Index, ULONG Value ) void CSettingTypeGame::Save ( int Index, uint32_t Value )
{ {
if (m_EraseDefaults) if (m_EraseDefaults)
{ {
ULONG ulDefault; uint32_t ulDefault;
CSettingTypeGame::LoadDefault(Index,ulDefault); CSettingTypeGame::LoadDefault(Index,ulDefault);
if (ulDefault == Value) if (ulDefault == Value)
{ {
Delete(Index); Delete(Index);
return; return;
} }
} }
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value); g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->SaveDword(m_DefaultSetting,Value); g_Settings->SaveDword(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::Save(Index,Value); CSettingTypeApplication::Save(Index,Value);
} }
} }
void CSettingTypeGame::Save ( int Index, const stdstr & 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 ) void CSettingTypeGame::Save ( int Index, const char * Value )
{ {
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName) if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
{ {
stdstr szDefault; stdstr szDefault;
CSettingTypeGame::LoadDefault(Index,szDefault); CSettingTypeGame::LoadDefault(Index,szDefault);
if (_stricmp(szDefault.c_str(),Value) == 0) if (_stricmp(szDefault.c_str(),Value) == 0)
{ {
Delete(Index); Delete(Index);
return; return;
} }
} }
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value); g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
} else { } else {
g_Settings->SaveString(m_DefaultSetting,Value); g_Settings->SaveString(m_DefaultSetting,Value);
} }
} else { } else {
CSettingTypeApplication::Save(Index,Value); CSettingTypeApplication::Save(Index,Value);
} }
} }
void CSettingTypeGame::Delete ( int Index ) void CSettingTypeGame::Delete ( int Index )
{ {
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase) if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
{ {
if (g_Settings->IndexBasedSetting(m_DefaultSetting)) if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{ {
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index); g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
} else { } else {
g_Settings->DeleteSetting(m_DefaultSetting); g_Settings->DeleteSetting(m_DefaultSetting);
} }
} else { } else {
CSettingTypeApplication::Delete(Index); CSettingTypeApplication::Delete(Index);
} }
} }

View File

@ -11,46 +11,50 @@
#pragma once #pragma once
class CSettingTypeGame : class CSettingTypeGame :
public CSettingTypeApplication public CSettingTypeApplication
{ {
protected: protected:
static bool m_RdbEditor; static bool m_RdbEditor;
static bool m_EraseDefaults; static bool m_EraseDefaults;
static stdstr * m_SectionIdent; 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: public:
CSettingTypeGame(LPCSTR Name, LPCSTR DefaultValue ); CSettingTypeGame(const char * Name, const char * DefaultValue );
CSettingTypeGame(LPCSTR Name, DWORD DefaultValue ); CSettingTypeGame(const char * Name, uint32_t DefaultValue );
CSettingTypeGame(LPCSTR Name, SettingID DefaultSetting ); CSettingTypeGame(const char * Name, SettingID DefaultSetting );
virtual ~CSettingTypeGame(); virtual ~CSettingTypeGame();
virtual bool IndexBasedSetting ( void ) const { return false; } virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
static void Initialize( void ); static void Initialize( void );
static void CleanUp ( void ); static void CleanUp ( void );
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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-GameSetting.h"
#include "SettingsType-GameSettingIndex.h" #include "SettingsType-GameSettingIndex.h"
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) : CSettingTypeGame("", DefaultSetting),
CSettingTypeGame("", DefaultSetting), m_PreIndex(PreIndex),
m_PreIndex(PreIndex), m_PostIndex(PostIndex)
m_PostIndex(PostIndex)
{ {
} }
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ) : CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
CSettingTypeGame("", DefaultValue), CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
CSettingTypeGameIndex::CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) : CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
CSettingTypeGame("", DefaultValue), CSettingTypeGame("", DefaultValue),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
@ -41,65 +40,65 @@ CSettingTypeGameIndex::~CSettingTypeGameIndex()
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(Index,Value); 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__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeGame::Load(0,Value); return CSettingTypeGame::Load(0,Value);
} }
//return the default values //return the default values
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::LoadDefault(0,Value); 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 void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeGameIndex::Save ( int Index, bool Value ) void CSettingTypeGameIndex::Save ( int Index, bool Value )
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(Index,Value); 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()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value); CSettingTypeGame::Save(0,Value);
} }
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*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 ) void CSettingTypeGameIndex::Save ( int Index, const char * Value )
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Save(0,Value); CSettingTypeGame::Save(0,Value);
} }
void CSettingTypeGameIndex::Delete ( int Index ) void CSettingTypeGameIndex::Delete ( int Index )
{ {
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeGame::Delete(0); CSettingTypeGame::Delete(0);
} }

View File

@ -11,36 +11,40 @@
#pragma once #pragma once
class CSettingTypeGameIndex : class CSettingTypeGameIndex :
public CSettingTypeGame public CSettingTypeGame
{ {
stdstr m_PreIndex, m_PostIndex; stdstr m_PreIndex, m_PostIndex;
public: public:
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ); CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, DWORD DefaultValue ); CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue );
CSettingTypeGameIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ); CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
~CSettingTypeGameIndex(); ~CSettingTypeGameIndex();
virtual bool IndexBasedSetting ( void ) const { return true; } virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; } virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-RomDatabase.h" #include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBCpuType.h" #include "SettingsType-RDBCpuType.h"
#include "../../N64 System/N64 Types.h"
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting ) : CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting) CSettingTypeRomDatabase(Name,DefaultSetting)
{ {
} }
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue ) : CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue) CSettingTypeRomDatabase(Name,DefaultValue)
{ {
} }
@ -28,96 +29,95 @@ CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeRDBCpuType::Load ( int Index, ULONG & Value ) const bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
{ {
stdstr strValue; stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes) if (!bRes)
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
return false; return false;
} }
LPCSTR String = strValue.c_str(); const char * String = strValue.c_str();
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; } if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; } else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; } else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
else if (_stricmp(String,"default") == 0) else if (_stricmp(String,"default") == 0)
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
return false; return false;
} }
else { Notify().BreakPoint(__FILEW__,__LINE__); } else { g_Notify->BreakPoint(__FILEW__,__LINE__); }
return true; return true;
} }
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultValue; Value = m_DefaultValue;
} else { } else {
g_Settings->LoadDword(m_DefaultSetting,Value); g_Settings->LoadDword(m_DefaultSetting,Value);
} }
} }
} }
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ ) 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;
stdstr strValue; switch (Value)
switch (Value) {
{ case CPU_Interpreter: strValue = "Interpreter"; break;
case CPU_Interpreter: strValue = "Interpreter"; break; case CPU_Recompiler: strValue = "Recompiler"; break;
case CPU_Recompiler: strValue = "Recompiler"; break; case CPU_SyncCores: strValue = "SyncCores"; break;
case CPU_SyncCores: strValue = "SyncCores"; break; default:
default: g_Notify->BreakPoint(__FILEW__,__LINE__);
Notify().BreakPoint(__FILEW__,__LINE__); }
} m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
} }
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ ) 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*/ ) void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeRDBCpuType::Delete( int /*Index*/ ) 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 #pragma once
class CSettingTypeRDBCpuType : class CSettingTypeRDBCpuType :
public CSettingTypeRomDatabase public CSettingTypeRomDatabase
{ {
public: public:
CSettingTypeRDBCpuType(LPCSTR Name, SettingID DefaultSetting ); CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBCpuType(LPCSTR Name, int DefaultValue ); CSettingTypeRDBCpuType(const char * Name, int DefaultValue );
~CSettingTypeRDBCpuType(); ~CSettingTypeRDBCpuType();
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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 // == 8 ? 0x800000 : 0x400000
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting ) : CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting) CSettingTypeRomDatabase(Name,DefaultSetting)
{ {
} }
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue ) : CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue) CSettingTypeRomDatabase(Name,DefaultValue)
{ {
} }
@ -30,70 +30,70 @@ CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeRDBRDRamSize::Load ( int Index, ULONG & Value ) const bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
{ {
ULONG ulValue; uint32_t ulValue;
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue); bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
if (!bRes) if (!bRes)
{ {
LoadDefault(Index,ulValue); LoadDefault(Index,ulValue);
} }
Value = 0x400000; Value = 0x400000;
if (ulValue == 8) if (ulValue == 8)
{ {
Value = 0x800000; Value = 0x800000;
} }
return bRes; return bRes;
} }
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ ) 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*/ ) 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*/ ) void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ ) 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 #pragma once
class CSettingTypeRDBRDRamSize : class CSettingTypeRDBRDRamSize :
public CSettingTypeRomDatabase public CSettingTypeRomDatabase
{ {
public: public:
CSettingTypeRDBRDRamSize(LPCSTR Name, SettingID DefaultSetting ); CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBRDRamSize(LPCSTR Name, int DefaultValue ); CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue );
~CSettingTypeRDBRDRamSize(); ~CSettingTypeRDBRDRamSize();
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-RomDatabase.h" #include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBSaveChip.h" #include "SettingsType-RDBSaveChip.h"
#include "../../N64 System/N64 Types.h"
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting ) : CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
CSettingTypeRomDatabase(Name,DefaultSetting) CSettingTypeRomDatabase(Name,DefaultSetting)
{ {
} }
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue ) : CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
CSettingTypeRomDatabase(Name,DefaultValue) CSettingTypeRomDatabase(Name,DefaultValue)
{ {
} }
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip() CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
{ {
} }
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeRDBSaveChip::Load ( int Index, ULONG & Value ) const bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
{ {
stdstr strValue; stdstr strValue;
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue); bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
if (!bRes) if (!bRes)
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
return false; return false;
} }
LPCSTR String = strValue.c_str(); const char * String = strValue.c_str();
if (_stricmp(String,"First Save Type") == 0) { Value = (ULONG)SaveChip_Auto; } 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,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; } else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; } else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; } else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
else if (_stricmp(String,"default") == 0) else if (_stricmp(String,"default") == 0)
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
return false; return false;
} else { } else {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
return true; return true;
} }
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultValue; Value = m_DefaultValue;
} else { } else {
g_Settings->LoadDword(m_DefaultSetting,Value); g_Settings->LoadDword(m_DefaultSetting,Value);
} }
} }
} }
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ ) 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) switch (Value)
{ {
case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break; 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_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_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_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; case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
default: default:
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
} }
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ ) 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*/ ) void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ ) 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 #pragma once
class CSettingTypeRDBSaveChip : class CSettingTypeRDBSaveChip :
public CSettingTypeRomDatabase public CSettingTypeRomDatabase
{ {
public: public:
CSettingTypeRDBSaveChip(LPCSTR Name, SettingID DefaultSetting ); CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBSaveChip(LPCSTR Name, int DefaultValue ); CSettingTypeRDBSaveChip(const char * Name, int DefaultValue );
~CSettingTypeRDBSaveChip(); ~CSettingTypeRDBSaveChip();
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-RelativePath.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 = CPath(CPath::MODULE_DIRECTORY,FileName);
m_FileName.AppendDirectory(Path); m_FileName.AppendDirectory(Path);
} }
CSettingTypeRelativePath::~CSettingTypeRelativePath ( void ) CSettingTypeRelativePath::~CSettingTypeRelativePath ( void )
@ -23,47 +23,47 @@ CSettingTypeRelativePath::~CSettingTypeRelativePath ( void )
bool CSettingTypeRelativePath::Load ( int /*Index*/, stdstr & value ) const bool CSettingTypeRelativePath::Load ( int /*Index*/, stdstr & value ) const
{ {
value = (LPCSTR)m_FileName; value = (const char *)m_FileName;
return true; return true;
} }
//return the default values //return the default values
void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeRelativePath::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeRelativePath::Save ( int /*Index*/, bool /*Value*/ ) 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 ) 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 ) 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*/ ) void CSettingTypeRelativePath::Delete ( int /*Index*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }

View File

@ -9,36 +9,42 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Common/path.h>
#include "SettingsType-Base.h"
class CSettingTypeRelativePath : class CSettingTypeRelativePath :
public CSettingType public CSettingType
{ {
CPath m_FileName; CPath m_FileName;
public: public:
CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName); CSettingTypeRelativePath(const char * Path, const char * FileName);
~CSettingTypeRelativePath(); ~CSettingTypeRelativePath();
bool IndexBasedSetting ( void ) const { return false; } bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; } SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
//return the values //return the values
bool Load ( int /*Index*/, bool & /*Value*/ ) const { return false; }; bool Load ( int /*Index*/, bool & /*Value*/ ) const { return false; };
bool Load ( int /*Index*/, ULONG & /*Value*/ ) const { return false; }; bool Load ( int /*Index*/, uint32_t & /*Value*/ ) const { return false; };
bool Load ( int Index, stdstr & Value ) const; bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
void LoadDefault ( int Index, bool & Value ) const; void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const; void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const; void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
void Save ( int Index, bool Value ); void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value ); void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value ); void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value ); void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
void Delete ( int Index ); 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; CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL; stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault ) : CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)), m_KeyName(StripNameSection(Name)),
m_DefaultStr(""), m_DefaultStr(""),
m_DefaultValue(DefaultValue), m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant), m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault), m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name)) m_GlideSetting(IsGlideSetting(Name))
{ {
} }
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault ) : CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)), m_KeyName(StripNameSection(Name)),
m_DefaultStr(""), m_DefaultStr(""),
m_DefaultValue(DefaultValue), m_DefaultValue(DefaultValue),
m_DefaultSetting(Default_Constant), m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault), m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name)) m_GlideSetting(IsGlideSetting(Name))
{ {
} }
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault ) : CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
m_KeyName(StripNameSection(Name)), m_KeyName(StripNameSection(Name)),
m_DefaultStr(DefaultValue), m_DefaultStr(DefaultValue),
m_DefaultValue(0), m_DefaultValue(0),
m_DefaultSetting(Default_Constant), m_DefaultSetting(Default_Constant),
m_DeleteOnDefault(DeleteOnDefault), m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name)) m_GlideSetting(IsGlideSetting(Name))
{ {
} }
CSettingTypeRomDatabase::CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultSetting, bool DeleteOnDefault ) : CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
m_KeyName(Name), m_KeyName(Name),
m_DefaultStr(""), m_DefaultStr(""),
m_DefaultValue(0), m_DefaultValue(0),
m_DefaultSetting(DefaultSetting), m_DefaultSetting(DefaultSetting),
m_DeleteOnDefault(DeleteOnDefault), m_DeleteOnDefault(DeleteOnDefault),
m_GlideSetting(IsGlideSetting(Name)) m_GlideSetting(IsGlideSetting(Name))
{ {
} }
@ -61,242 +61,240 @@ CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
void CSettingTypeRomDatabase::Initialize( void ) void CSettingTypeRomDatabase::Initialize( void )
{ {
m_SettingsIniFile = new CIniFile(g_Settings->LoadString(SupportFile_RomDatabase).c_str()); m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_GlideIniFile = new CIniFile(g_Settings->LoadString(SupportFile_Glide64RDB).c_str()); m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged); g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadString(Game_IniKey)); m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
} }
void CSettingTypeRomDatabase::CleanUp( void ) void CSettingTypeRomDatabase::CleanUp( void )
{ {
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged); g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
if (m_SettingsIniFile) if (m_SettingsIniFile)
{ {
delete m_SettingsIniFile; delete m_SettingsIniFile;
m_SettingsIniFile = NULL; m_SettingsIniFile = NULL;
} }
if (m_GlideIniFile) if (m_GlideIniFile)
{ {
delete m_GlideIniFile; delete m_GlideIniFile;
m_GlideIniFile = NULL; m_GlideIniFile = NULL;
} }
if (m_SectionIdent) if (m_SectionIdent)
{ {
delete m_SectionIdent; delete m_SectionIdent;
m_SectionIdent = NULL; m_SectionIdent = NULL;
} }
} }
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ ) void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
{ {
if (m_SectionIdent) if (m_SectionIdent)
{ {
*m_SectionIdent = g_Settings->LoadString(Game_IniKey); *m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
} }
} }
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
{ {
DWORD temp_value = Value; uint32_t temp_value = Value;
bool bRes = Load(Index,temp_value); bool bRes = Load(Index,temp_value);
Value = temp_value != 0; Value = temp_value != 0;
return bRes; return bRes;
} }
bool CSettingTypeRomDatabase::Load ( int Index, ULONG & Value ) const bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
{ {
bool bRes = false; bool bRes = false;
if (m_GlideSetting) if (m_GlideSetting)
{ {
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value); bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
} }
else else
{ {
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value); bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
} }
if (!bRes) if (!bRes)
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
} }
return bRes; return bRes;
} }
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
{ {
stdstr temp_value; stdstr temp_value;
bool bRes = false; bool bRes = false;
if (m_GlideSetting) if (m_GlideSetting)
{ {
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value); bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
} }
else else
{ {
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value); bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
} }
if (bRes) if (bRes)
{ {
Value = temp_value; Value = temp_value;
} }
else else
{ {
LoadDefault(Index,Value); LoadDefault(Index,Value);
} }
return bRes; return bRes;
} }
//return the default values //return the default values
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
{ {
if (m_DefaultSetting != Default_None) if (m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultValue != 0; Value = m_DefaultValue != 0;
} else { } else {
g_Settings->LoadBool(m_DefaultSetting,Value); 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_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultValue; Value = m_DefaultValue;
} else { } else {
g_Settings->LoadDword(m_DefaultSetting,Value); g_Settings->LoadDword(m_DefaultSetting,Value);
} }
} }
} }
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
{ {
if (m_DefaultSetting != Default_None) if (m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) if (m_DefaultSetting == Default_Constant)
{ {
Value = m_DefaultStr; Value = m_DefaultStr;
} else { } else {
g_Settings->LoadString(m_DefaultSetting,Value); g_Settings->LoadStringVal(m_DefaultSetting,Value);
} }
} }
} }
//Update the settings //Update the settings
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value ) void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
{ {
if (!g_Settings->LoadBool(Setting_RdbEditor)) if (!g_Settings->LoadBool(Setting_RdbEditor))
{ {
return; return;
} }
if (m_DeleteOnDefault) if (m_DeleteOnDefault)
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
if (m_GlideSetting) if (m_GlideSetting)
{ {
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value); m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
} }
else else
{ {
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value); 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)) if (!g_Settings->LoadBool(Setting_RdbEditor))
{ {
return; return;
} }
if (m_DeleteOnDefault) if (m_DeleteOnDefault)
{ {
ULONG defaultValue = 0; uint32_t defaultValue = 0;
LoadDefault(Index,defaultValue); LoadDefault(Index,defaultValue);
if (defaultValue == Value) if (defaultValue == Value)
{ {
Delete(Index); Delete(Index);
return; return;
} }
} }
if (m_GlideSetting) if (m_GlideSetting)
{ {
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value); m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
} }
else else
{ {
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value); m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
} }
} }
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value ) void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
{ {
if (!g_Settings->LoadBool(Setting_RdbEditor)) if (!g_Settings->LoadBool(Setting_RdbEditor))
{ {
return; return;
} }
if (m_GlideSetting) if (m_GlideSetting)
{ {
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str()); m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
} }
else else
{ {
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str()); m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
} }
} }
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value ) void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
{ {
if (!g_Settings->LoadBool(Setting_RdbEditor)) if (!g_Settings->LoadBool(Setting_RdbEditor))
{ {
return; return;
} }
if (m_GlideSetting) if (m_GlideSetting)
{ {
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value); m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
} }
else else
{ {
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value); m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
} }
} }
void CSettingTypeRomDatabase::Delete ( int /*Index*/ ) void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
{ {
if (!g_Settings->LoadBool(Setting_RdbEditor)) if (!g_Settings->LoadBool(Setting_RdbEditor))
{ {
return; return;
} }
if (m_GlideSetting) if (m_GlideSetting)
{ {
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL); m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
} }
else else
{ {
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL); 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) if (_strnicmp(Name,"Glide64-",8) == 0)
{ {
return true; return true;
} }
return false; return false;
} }
LPCSTR CSettingTypeRomDatabase::StripNameSection (LPCSTR Name) const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
{ {
if (_strnicmp(Name,"Glide64-",8) == 0) if (_strnicmp(Name,"Glide64-",8) == 0)
{ {
return &Name[8]; return &Name[8];
} }
return Name; return Name;
} }

View File

@ -10,58 +10,65 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Common/Ini File Class.h>
#include "SettingsType-Base.h"
class CSettingTypeRomDatabase : class CSettingTypeRomDatabase :
public CSettingType public CSettingType
{ {
public: public:
CSettingTypeRomDatabase(LPCSTR Name, LPCSTR DefaultValue, bool DeleteOnDefault = false ); CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, bool DefaultValue, bool DeleteOnDefault = false ); CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, int DefaultValue, bool DeleteOnDefault = false ); CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(LPCSTR Name, SettingID DefaultSetting, bool DeleteOnDefault = false ); CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
virtual ~CSettingTypeRomDatabase(); virtual ~CSettingTypeRomDatabase();
virtual bool IndexBasedSetting ( void ) const { return false; } virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; } virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); virtual void Delete ( int Index );
static void Initialize( void ); static void Initialize( void );
static void CleanUp ( void ); static void CleanUp ( void );
protected: protected:
static void GameChanged ( void * /*Data */ ); static void GameChanged ( void * /*Data */ );
static bool IsGlideSetting (LPCSTR Name); static bool IsGlideSetting (const char * Name);
static LPCSTR StripNameSection (LPCSTR Name); static const char * StripNameSection (const char * Name);
virtual LPCSTR Section ( void ) const { return m_SectionIdent->c_str(); } virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
mutable stdstr m_KeyName; mutable stdstr m_KeyName;
const LPCSTR m_DefaultStr; const char *const m_DefaultStr;
const int m_DefaultValue; const int m_DefaultValue;
const SettingID m_DefaultSetting; const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault; const bool m_DeleteOnDefault;
bool m_GlideSetting; bool m_GlideSetting;
static stdstr * m_SectionIdent; static stdstr * m_SectionIdent;
static CIniFile * m_SettingsIniFile; static CIniFile * m_SettingsIniFile;
static CIniFile * m_GlideIniFile; 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-RomDatabase.h"
#include "SettingsType-RomDatabaseIndex.h" #include "SettingsType-RomDatabaseIndex.h"
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ) : CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue), CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue ) : CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue), CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue ) : CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
CSettingTypeRomDatabase("",DefaultValue), CSettingTypeRomDatabase("",DefaultValue),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ) : CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
CSettingTypeRomDatabase("",DefaultSetting), CSettingTypeRomDatabase("",DefaultSetting),
m_PreIndex(PreIndex), m_PreIndex(PreIndex),
m_PostIndex(PostIndex) m_PostIndex(PostIndex)
{ {
} }
@ -46,61 +46,61 @@ CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, ULONG & /*Value*/ ) const bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
{ {
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
return CSettingTypeRomDatabase::Load(0,Value); return CSettingTypeRomDatabase::Load(0,Value);
} }
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
{ {
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value); 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()); m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value); CSettingTypeRomDatabase::LoadDefault(0,Value);
} }
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
{ {
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
CSettingTypeRomDatabase::LoadDefault(0,Value); CSettingTypeRomDatabase::LoadDefault(0,Value);
} }
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*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*/ ) 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*/ ) void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ ) 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 #pragma once
class CSettingTypeRomDatabaseIndex : class CSettingTypeRomDatabaseIndex :
public CSettingTypeRomDatabase public CSettingTypeRomDatabase
{ {
stdstr m_PreIndex, m_PostIndex;
public: public:
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, LPCSTR DefaultValue ); CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, bool DefaultValue ); CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, int DefaultValue ); CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue );
CSettingTypeRomDatabaseIndex(LPCSTR PreIndex, LPCSTR PostIndex, SettingID DefaultSetting ); CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
virtual ~CSettingTypeRomDatabaseIndex(); virtual ~CSettingTypeRomDatabaseIndex();
virtual bool IndexBasedSetting ( void ) const { return true; } virtual bool IndexBasedSetting ( void ) const { return true; }
//return the values //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-SelectedDirectory.h" #include "SettingsType-SelectedDirectory.h"
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) : m_Name(Name),
m_Name(Name), m_InitialDir(InitialDir),
m_InitialDir(InitialDir), m_SelectedDir(SelectedDir),
m_SelectedDir(SelectedDir), m_UseSelected(UseSelected)
m_UseSelected(UseSelected)
{ {
} }
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory() CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
{ {
} }
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, ULONG & /*Value*/ ) const bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
{ {
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir; SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
return g_Settings->LoadString(DirSettingId, Value); return g_Settings->LoadStringVal(DirSettingId, Value);
} }
//return the default values //return the default values
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
//Update the settings //Update the settings
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ ) 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*/ ) 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 ) void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
{ {
g_Settings->SaveBool(m_UseSelected,true); g_Settings->SaveBool(m_UseSelected,true);
g_Settings->SaveString(m_SelectedDir,Value); g_Settings->SaveString(m_SelectedDir,Value);
} }
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ ) void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }

View File

@ -10,40 +10,46 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "SettingsType-Base.h"
class CSettingTypeSelectedDirectory : class CSettingTypeSelectedDirectory :
public CSettingType public CSettingType
{ {
std::string m_Name;
SettingID m_InitialDir;
SettingID m_SelectedDir;
SettingID m_UseSelected;
public: public:
CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ); CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
~CSettingTypeSelectedDirectory(); ~CSettingTypeSelectedDirectory();
virtual bool IndexBasedSetting ( void ) const { return false; } virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; } 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 //return the values
virtual bool Load ( int Index, bool & Value ) const; virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const; virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const; virtual bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
virtual void LoadDefault ( int Index, bool & Value ) const; virtual void LoadDefault ( int Index, bool & Value ) const;
virtual void LoadDefault ( int Index, ULONG & Value ) const; virtual void LoadDefault ( int Index, uint32_t & Value ) const;
virtual void LoadDefault ( int Index, stdstr & Value ) const; virtual void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
virtual void Save ( int Index, bool Value ); virtual void Save ( int Index, bool Value );
virtual void Save ( int Index, ULONG Value ); virtual void Save ( int Index, uint32_t Value );
virtual void Save ( int Index, const stdstr & Value ); virtual void Save ( int Index, const stdstr & Value );
virtual void Save ( int Index, const char * Value ); virtual void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
virtual void Delete ( int Index ); 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" #include "SettingsType-TempBool.h"
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) : 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 bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
{ {
Value = m_value; Value = m_value;
return true; return true;
} }
bool CSettingTypeTempBool::Load ( int /*Index*/, ULONG & /*Value*/ ) const bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value ) 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*/ ) 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*/ ) void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeTempBool::Delete( int /*Index*/ ) void CSettingTypeTempBool::Delete( int /*Index*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }

View File

@ -10,35 +10,41 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "SettingsType-Base.h"
class CSettingTypeTempBool : class CSettingTypeTempBool :
public CSettingType public CSettingType
{ {
bool m_value;
public: public:
CSettingTypeTempBool(bool initialValue ); CSettingTypeTempBool(bool initialValue );
~CSettingTypeTempBool(); ~CSettingTypeTempBool();
bool IndexBasedSetting ( void ) const { return false; } bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; } SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
//return the values //return the values
bool Load ( int Index, bool & Value ) const; bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, ULONG & Value ) const; bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const; bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
void LoadDefault ( int Index, bool & Value ) const; void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const; void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const; void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
void Save ( int Index, bool Value ); void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value ); void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value ); void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value ); void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-TempNumber.h" #include "SettingsType-TempNumber.h"
CSettingTypeTempNumber::CSettingTypeTempNumber(ULONG initialValue) : CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
m_value(initialValue) m_value(initialValue)
{ {
} }
@ -22,59 +22,59 @@ CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return true; return true;
} }
bool CSettingTypeTempNumber::Load ( int /*Index*/, ULONG & Value ) const bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
{ {
Value = m_value; Value = m_value;
return false; return false;
} }
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
//return the default values //return the default values
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ ) 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*/ ) 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*/ ) void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeTempNumber::Delete( int /*Index*/ ) void CSettingTypeTempNumber::Delete( int /*Index*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }

View File

@ -10,36 +10,41 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include "SettingsType-Base.h"
class CSettingTypeTempNumber : class CSettingTypeTempNumber :
public CSettingType public CSettingType
{ {
ULONG m_value;
public: public:
CSettingTypeTempNumber(ULONG initialValue); CSettingTypeTempNumber(uint32_t initialValue);
~CSettingTypeTempNumber(); ~CSettingTypeTempNumber();
bool IndexBasedSetting ( void ) const { return false; } bool IndexBasedSetting ( void ) const { return false; }
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; } SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
//return the values //return the values
bool Load ( int Index, bool & Value ) const; bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, ULONG & Value ) const; bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const; bool Load ( int Index, stdstr & Value ) const;
//return the default values //return the default values
void LoadDefault ( int Index, bool & Value ) const; void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, ULONG & Value ) const; void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const; void LoadDefault ( int Index, stdstr & Value ) const;
//Update the settings //Update the settings
void Save ( int Index, bool Value ); void Save ( int Index, bool Value );
void Save ( int Index, ULONG Value ); void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value ); void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value ); void Save ( int Index, const char * Value );
// Delete the setting // Delete the setting
void Delete ( int Index ); 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 "stdafx.h"
#include "SettingsType-TempString.h" #include "SettingsType-TempString.h"
CSettingTypeTempString::CSettingTypeTempString(LPCSTR initialValue) : CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
m_value(initialValue) m_value(initialValue)
{ {
} }
@ -20,62 +20,61 @@ CSettingTypeTempString::~CSettingTypeTempString ( void )
{ {
} }
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeTempString::Load ( int /*Index*/, ULONG & /*Value*/ ) const bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
} }
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
{ {
Value = m_value; Value = m_value;
return true; return true;
} }
//return the default values //return the default values
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const 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 void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ ) 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 ) void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
{ {
m_value = Value; m_value = Value;
} }
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value ) void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
{ {
m_value = Value; m_value = Value;
} }
void CSettingTypeTempString::Delete( int /*Index*/ ) void CSettingTypeTempString::Delete( int /*Index*/ )
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
} }

View File

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

View File

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

View File

@ -124,7 +124,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
break; break;
case ID_SYSTEM_BITMAP: 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()); WriteTraceF(TraceGfxPlugin,__FUNCTION__ ": CaptureScreen(%s): Starting",Dir.c_str());
g_Plugins->Gfx()->CaptureScreen(Dir.c_str()); g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
WriteTrace(TraceGfxPlugin,__FUNCTION__ ": CaptureScreen: Done"); WriteTrace(TraceGfxPlugin,__FUNCTION__ ": CaptureScreen: Done");
@ -148,7 +148,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
memset(&SaveFile, 0, sizeof(SaveFile)); memset(&SaveFile, 0, sizeof(SaveFile));
memset(&openfilename, 0, sizeof(openfilename)); 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.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hWnd; openfilename.hwndOwner = (HWND)hWnd;
@ -191,7 +191,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
memset(&SaveFile, 0, sizeof(SaveFile)); memset(&SaveFile, 0, sizeof(SaveFile));
memset(&openfilename, 0, sizeof(openfilename)); 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.lStructSize = sizeof( openfilename );
openfilename.hwndOwner = (HWND)hWnd; 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_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break; case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
case ID_CURRENT_SAVE_DEFAULT: 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)); g_Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
break; break;
case ID_CURRENT_SAVE_1: 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_8:
case ID_CURRENT_SAVE_9: case ID_CURRENT_SAVE_9:
case ID_CURRENT_SAVE_10: 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)); g_Settings->SaveDword(Game_CurrentSaveState,(DWORD)((MenuID - ID_CURRENT_SAVE_1) + 1));
break; break;
case ID_HELP_SUPPORTFORUM: ShellExecute(NULL, "open", "http://forum.pj64-emu.com/", NULL, NULL, SW_SHOWMAXIMIZED); 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); stdstr Dir = g_Settings->LoadStringIndex(Directory_RecentGameDirIndex,Offset);
if (Dir.length() > 0) { if (Dir.length() > 0) {
g_Settings->SaveString(Directory_Game,Dir.c_str()); g_Settings->SaveString(Directory_Game,Dir.c_str());
g_Notify->AddRecentDir(Dir.c_str()); Notify().AddRecentDir(Dir.c_str());
_Gui->RefreshMenu(); _Gui->RefreshMenu();
if (_Gui->RomBrowserVisible()) { if (_Gui->RomBrowserVisible()) {
_Gui->RefreshRomBrowser(); _Gui->RefreshRomBrowser();
@ -601,8 +601,8 @@ std::wstring CMainMenu::GetSaveSlotString (int Slot)
stdstr LastSaveTime; stdstr LastSaveTime;
//check first save name //check first save name
stdstr _GoodName = g_Settings->LoadString(Game_GoodName); stdstr _GoodName = g_Settings->LoadStringVal(Game_GoodName);
stdstr _InstantSaveDirectory = g_Settings->LoadString(Directory_InstantSave); stdstr _InstantSaveDirectory = g_Settings->LoadStringVal(Directory_InstantSave);
stdstr CurrentSaveName; stdstr CurrentSaveName;
if (Slot != 0) if (Slot != 0)
{ {
@ -627,7 +627,7 @@ std::wstring CMainMenu::GetSaveSlotString (int Slot)
// Check old file name // Check old file name
if (LastSaveTime.empty()) if (LastSaveTime.empty())
{ {
stdstr _RomName = g_Settings->LoadString(Game_GameName); stdstr _RomName = g_Settings->LoadStringVal(Game_GameName);
if (Slot > 0) if (Slot > 0)
{ {
FileName.Format("%s%s.pj%d", _InstantSaveDirectory.c_str(), _RomName.c_str(),Slot); 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 inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
bool CPURunning = g_Settings->LoadBool(GameRunning_CPU_Running); bool CPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
bool RomLoading = g_Settings->LoadBool(GameRunning_LoadingInProgress); 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; bool RomList = g_Settings->LoadBool(RomBrowser_Enabled) && !CPURunning;
CMenuShortCutKey::ACCESS_MODE AccessLevel = CMenuShortCutKey::GAME_NOT_RUNNING; 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_CPU_USAGE, STR_SHORTCUT_OPTIONS, MENU_SHOW_CPU, CMenuShortCutKey::GAME_RUNNING );
AddShortCut(ID_OPTIONS_SETTINGS, STR_SHORTCUT_OPTIONS, MENU_SETTINGS, CMenuShortCutKey::NOT_IN_FULLSCREEN ); 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) if (!ShortCutFile.Exists() || InitialValues)
{ {
m_ShortCuts.find(ID_FILE_OPEN_ROM)->second.AddShortCut('O',TRUE,false,false,CMenuShortCutKey::GAME_RUNNING); 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); 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"); FILE *file = fopen(FileName.c_str(),"w");
if (file == NULL) if (file == NULL)
{ {

View File

@ -158,7 +158,7 @@ void CNotification::SetWindowCaption (const wchar_t * Caption)
static const size_t TITLE_SIZE = 256; static const size_t TITLE_SIZE = 256;
wchar_t WinTitle[TITLE_SIZE]; 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; WinTitle[TITLE_SIZE - 1] = 0;
#if defined(WINDOWS_UI) #if defined(WINDOWS_UI)
m_hWnd->Caption(WinTitle); m_hWnd->Caption(WinTitle);

View File

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

View File

@ -13,14 +13,13 @@
#include <vector> #include <vector>
class CMainGui; class CMainGui;
class CNotification;
class CPlugins; class CPlugins;
class ROMBROWSER_FIELDS { class ROMBROWSER_FIELDS {
stdstr m_Name; stdstr m_Name;
size_t m_Pos, m_DefaultPos; size_t m_Pos, m_DefaultPos;
int m_ID; int m_ID;
ULONG m_ColWidth; uint32_t m_ColWidth;
LanguageStringID m_LangID; LanguageStringID m_LangID;
bool m_PosChanged; bool m_PosChanged;
@ -37,7 +36,7 @@ public:
{ {
if (!UseDefault) 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); 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*/) 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()) 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; RECT rcSettingInfo;
@ -246,12 +246,12 @@ LRESULT CSettingConfig::OnClicked (WORD /*wNotifyCode*/, WORD wID, HWND , BOOL&
void CSettingConfig::ApplySettings( bool UpdateScreen ) void CSettingConfig::ApplySettings( bool UpdateScreen )
{ {
stdstr GameIni(g_Settings->LoadString(Game_IniKey)); stdstr GameIni(g_Settings->LoadStringVal(Game_IniKey));
if (!GameIni.empty()) if (!GameIni.empty())
{ {
stdstr GoodName; stdstr GoodName;
if (!g_Settings->LoadString(Game_GoodName,GoodName)) if (!g_Settings->LoadStringVal(Game_GoodName,GoodName))
{ {
g_Settings->SaveString(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) if (GoodName.length() > 0)
{ {
g_Settings->SaveString(Game_GoodName,GoodName); g_Settings->SaveString(Game_GoodName,GoodName);

View File

@ -168,15 +168,15 @@ void COptionsDirectoriesPage::UpdatePageSettings()
stdstr Directory; stdstr Directory;
m_InUpdateSettings = true; 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_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_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_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_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()); m_TextureDir.SetWindowText(Directory.c_str());
bool UseSelected; bool UseSelected;

View File

@ -78,7 +78,7 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
ComboBox->AddItemW(GS(NUMBER_6), 6 ); 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); CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH),Game_ViRefreshRate, false);
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT)); 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 ) void CGamePluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType )
{ {
stdstr Default; stdstr Default;
bool PluginSelected = g_Settings->LoadString(Type,Default); bool PluginSelected = g_Settings->LoadStringVal(Type,Default);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type); ComboBox = AddModComboBox(GetDlgItem(ListId),Type);
@ -183,7 +183,7 @@ void CGamePluginPage::UpdatePageSettings ( void )
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue; stdstr SelectedValue;
bool PluginChanged = g_Settings->LoadString(cb_iter->first,SelectedValue); bool PluginChanged = g_Settings->LoadStringVal(cb_iter->first,SelectedValue);
ComboBox->SetChanged(PluginChanged); ComboBox->SetChanged(PluginChanged);
if (PluginChanged) if (PluginChanged)
{ {
@ -259,7 +259,7 @@ void CGamePluginPage::ApplyComboBoxes ( void )
if (Plugin) 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()); g_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str());
} }

View File

@ -21,10 +21,10 @@ CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay )
return; return;
} }
CIniFile RomIniFile (g_Settings->LoadString(SupportFile_RomDatabase).c_str()); CIniFile RomIniFile (g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
strlist Keys; strlist Keys;
RomIniFile.GetKeyList("Rom Status",Keys); RomIniFile.GetKeyList("Rom Status",Keys);
stdstr Status = g_Settings->LoadString(Rdb_Status); stdstr Status = g_Settings->LoadStringVal(Rdb_Status);
CModifiedComboBoxTxt * ComboBox; CModifiedComboBoxTxt * ComboBox;
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status); 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 ) void COptionPluginPage::AddPlugins (int ListId,SettingID Type, PLUGIN_TYPE PluginType )
{ {
stdstr Default = g_Settings->LoadString(Type); stdstr Default = g_Settings->LoadStringVal(Type);
CModifiedComboBox * ComboBox; CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(ListId),Type); ComboBox = AddModComboBox(GetDlgItem(ListId),Type);
@ -175,7 +175,7 @@ void COptionPluginPage::UpdatePageSettings ( void )
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
stdstr SelectedValue; 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++ ) for (int i = 0, n = ComboBox->GetCount(); i < n; i++ )
{ {
const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i); const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(i);

View File

@ -254,14 +254,14 @@ protected:
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second; CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
stdstr SelectedValue; stdstr SelectedValue;
ComboBox->SetChanged(g_Settings->LoadString(cbtxt_iter->first,SelectedValue)); ComboBox->SetChanged(g_Settings->LoadStringVal(cbtxt_iter->first,SelectedValue));
ComboBox->SetDefault(SelectedValue); ComboBox->SetDefault(SelectedValue);
} }
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
{ {
CModifiedComboBox * ComboBox = cb_iter->second; CModifiedComboBox * ComboBox = cb_iter->second;
DWORD SelectedValue; uint32_t SelectedValue;
ComboBox->SetChanged(g_Settings->LoadDword(cb_iter->first,SelectedValue)); ComboBox->SetChanged(g_Settings->LoadDword(cb_iter->first,SelectedValue));
ComboBox->SetDefault(SelectedValue); ComboBox->SetDefault(SelectedValue);
@ -278,10 +278,10 @@ protected:
if (TextBox->IsbString()) if (TextBox->IsbString())
{ {
stdstr SelectedValue; stdstr SelectedValue;
TextBox->SetChanged(g_Settings->LoadString(iter->first,SelectedValue)); TextBox->SetChanged(g_Settings->LoadStringVal(iter->first,SelectedValue));
TextBox->SetWindowText(SelectedValue.c_str()); TextBox->SetWindowText(SelectedValue.c_str());
} else { } else {
DWORD SelectedValue; uint32_t SelectedValue;
TextBox->SetChanged(g_Settings->LoadDword(iter->first,SelectedValue)); TextBox->SetChanged(g_Settings->LoadDword(iter->first,SelectedValue));
TextBox->SetWindowText(stdstr_f("%d",SelectedValue).c_str()); 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 //Create the plugin container
WriteTrace(TraceDebug,__FUNCTION__ ": Create Plugins"); 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 //Select the language
g_Lang->LoadCurrentStrings(true); g_Lang->LoadCurrentStrings(true);