Merge remote-tracking branch 'refs/remotes/project64/master'

Conflicts:
	Source/Project64/Multilanguage.h
	Source/Project64/Multilanguage/Language Class.cpp
This commit is contained in:
Samuel Yuan 2015-11-14 19:44:42 -05:00
commit 937625f0c6
53 changed files with 1856 additions and 1856 deletions

View File

@ -0,0 +1,139 @@
#include "stdafx.h"
#include <Common\Util.h>
void FixDirectories(void);
void FixLocale(void);
static void IncreaseThreadPriority(void);
static CTraceFileLog * g_LogFile = NULL;
void LogLevelChanged(CTraceFileLog * LogFile)
{
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
}
void LogFlushChanged(CTraceFileLog * LogFile)
{
LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0);
}
void InitializeLog(void)
{
CPath LogFilePath(CPath::MODULE_DIRECTORY);
LogFilePath.AppendDirectory("Logs");
if (!LogFilePath.DirectoryExists())
{
LogFilePath.DirectoryCreate();
}
LogFilePath.SetNameExtension("Project64.log");
g_LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New, 500);
#ifdef VALIDATE_DEBUG
g_LogFile->SetTraceLevel((TraceLevel)(g_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate | TraceDebug));
#else
g_LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
#endif
AddTraceModule(g_LogFile);
g_Settings->RegisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
}
void AppInit(CNotification * Notify)
{
try
{
g_Notify = Notify;
FixDirectories();
FixLocale();
stdstr_f AppName("Project64 %s", VER_FILE_VERSION_STR);
IncreaseThreadPriority();
g_Settings = new CSettings;
g_Settings->Initialize(AppName.c_str());
if (g_Settings->LoadBool(Setting_CheckEmuRunning) &&
pjutil::TerminatedExistingExe())
{
delete g_Settings;
g_Settings = new CSettings;
g_Settings->Initialize(AppName.c_str());
}
InitializeLog();
WriteTrace(TraceDebug, __FUNCTION__ ": Application Starting");
CMipsMemoryVM::ReserveMemory();
//Create the plugin container
WriteTrace(TraceDebug, __FUNCTION__ ": Create Plugins");
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
g_Lang = new CLanguage();
g_Lang->LoadCurrentStrings();
g_Notify->AppInitDone();
}
catch (...)
{
g_Notify->DisplayError(stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str());
}
}
void AppCleanup(void)
{
g_Settings->UnregisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
WriteTrace(TraceDebug, __FUNCTION__ ": cleaning up global objects");
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
CMipsMemoryVM::FreeReservedMemory();
WriteTrace(TraceDebug, __FUNCTION__ ": Done");
CloseTrace();
}
void FixDirectories(void)
{
CPath Directory(CPath::MODULE_DIRECTORY);
Directory.AppendDirectory("Config");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Logs");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Save");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Screenshots");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("textures");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
}
#include <windows.h>
void FixLocale(void)
{
char *lbuffer = new char[10];
if (GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10))
{
setlocale(LC_ALL, lbuffer);
}
delete[] lbuffer;
}
void IncreaseThreadPriority(void)
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
}

View File

@ -0,0 +1,6 @@
#pragma once
#include <Project64\User Interface\Notification Class.h>
void AppInit(CNotification * Notify);
void AppCleanup(void);

View File

@ -1 +1,16 @@
/****************************************************************************
* *
* Project 64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
__interface CDebugger
{
virtual void TLBChanged(void) = 0;
};

View File

@ -117,7 +117,6 @@ enum LanguageStringID{
MENU_SLOT_8 = 198,
MENU_SLOT_9 = 199,
MENU_SLOT_10 = 200,
MENU_SLOT_SAVE = 201,
//Pop up Menu
POPUP_PLAY = 210,

View File

@ -124,7 +124,6 @@ void CLanguage::LoadDefaultStrings (void)
DEF_STR(MENU_SLOT_8, L"Slot 8");
DEF_STR(MENU_SLOT_9, L"Slot 9");
DEF_STR(MENU_SLOT_10, L"Slot 10");
DEF_STR(MENU_SLOT_SAVE, L"Save Slot (%s) selected");
//Pop up Menu
DEF_STR(POPUP_PLAY, L"Play Game");
@ -642,7 +641,7 @@ std::wstring CLanguage::GetLangString ( const char * FileName, LanguageStringID
LANG_STR CLanguage::GetNextLangString(void * OpenFile)
{
enum { MAX_STRING_LEN = 400 };
int StringID;
int32_t StringID;
char szString[MAX_STRING_LEN]; //temp store the string from the file
FILE * file = (FILE *)OpenFile;
@ -687,7 +686,7 @@ LANG_STR CLanguage::GetNextLangString (void * OpenFile)
StringID = EMPTY_STRING; return LANG_STR(0, L"");
}
int pos = 0;
int32_t pos = 0;
fread(&token, 1, 1, file);
while (token != '"' && !feof(file))
{

View File

@ -14,8 +14,9 @@
#include <string> //stl string
#include <map> //stl map
#include <list> //stl list
#include <common/stdtypes.h>
typedef std::map<int, std::wstring, std::less<int> > LANG_STRINGS;
typedef std::map<int32_t, std::wstring, std::less<int32_t> > LANG_STRINGS;
typedef LANG_STRINGS::value_type LANG_STR;
struct LanguageFile

View File

@ -339,7 +339,8 @@ void CInterpreterCPU::ExecuteCPU()
R4300iOp::m_NextInstruction = NORMAL;
}
}
} __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
}
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
{
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
}

View File

@ -375,6 +375,11 @@ void CN64System::StartEmulation(bool NewThread)
void CN64System::StartEmulationThread(ThreadInfo * Info)
{
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
{
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL);
}
CoInitialize(NULL);
EmulationStarting(*Info->ThreadHandle, Info->ThreadID);

View File

@ -182,6 +182,10 @@ void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
void CAudioPlugin::AudioThread(CAudioPlugin * _this) {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
{
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_HIGHEST);
}
for (;;)
{
_this->AiUpdate(true);

View File

@ -145,6 +145,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\AppInit.cpp"
>
</File>
<File
RelativePath=".\Logging.cpp"
>
@ -797,6 +801,10 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\AppInit.h"
>
</File>
<File
RelativePath=".\Logging.h"
>

View File

@ -44,6 +44,7 @@
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AppInit.cpp" />
<ClCompile Include="logging.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
@ -178,6 +179,7 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AppInit.h" />
<ClInclude Include="Logging.h" />
<ClInclude Include="Multilanguage.h" />
<ClInclude Include="Multilanguage\LanguageSelector.h" />

View File

@ -426,6 +426,9 @@
<ClCompile Include="Settings\Logging Settings.cpp">
<Filter>Source Files\N64 System Source</Filter>
</ClCompile>
<ClCompile Include="AppInit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="User Interface\Icons\left.ico">
@ -845,5 +848,8 @@
<ClInclude Include="Settings\Logging Settings.h">
<Filter>Header Files\Settings Headers</Filter>
</ClInclude>
<ClInclude Include="AppInit.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -9,6 +9,7 @@
* *
****************************************************************************/
#include "stdafx.h"
#include "Debug Settings.h"
int CDebugSettings::m_RefCount = 0;

View File

@ -10,7 +10,7 @@
****************************************************************************/
#pragma once
#include <N64 System/N64 Types.h>
#include <Project64\N64 System\N64 Types.h>
class CDebugSettings
{
@ -37,6 +37,6 @@ private:
static bool m_bShowTLBMisses;
static bool m_bShowDivByZero;
static int m_RefCount;
static int32_t m_RefCount;
static bool m_Registered;
};

View File

@ -9,6 +9,9 @@
* *
****************************************************************************/
#include "stdafx.h"
#include <Project64\N64 System\System Globals.h>
#include <Project64\N64 System\N64 Class.h>
#include "Game Settings.h"
bool CGameSettings::m_bSMM_StoreInstruc;
bool CGameSettings::m_bSMM_Protect;
@ -16,12 +19,12 @@ bool CGameSettings::m_bSMM_ValidFunc;
bool CGameSettings::m_bSMM_PIDMA;
bool CGameSettings::m_bSMM_TLB;
bool CGameSettings::m_bUseTlb;
DWORD CGameSettings::m_CountPerOp = 2;
DWORD CGameSettings::m_ViRefreshRate = 1500;
DWORD CGameSettings::m_AiCountPerBytes = 500;
uint32_t CGameSettings::m_CountPerOp = 2;
uint32_t CGameSettings::m_ViRefreshRate = 1500;
uint32_t CGameSettings::m_AiCountPerBytes = 500;
bool CGameSettings::m_DelayDP = false;
bool CGameSettings::m_DelaySI = false;
DWORD CGameSettings::m_RdramSize = 0;
uint32_t CGameSettings::m_RdramSize = 0;
bool CGameSettings::m_bFixedAudio = true;
bool CGameSettings::m_bSyncingToAudio = true;
bool CGameSettings::m_bSyncToAudio = true;
@ -31,7 +34,7 @@ bool CGameSettings::m_RspAudioSignal;
bool CGameSettings::m_bRomInMemory;
bool CGameSettings::m_RegCaching;
bool CGameSettings::m_bLinkBlocks;
DWORD CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;

View File

@ -10,7 +10,7 @@
****************************************************************************/
#pragma once
#include <N64 System/N64 Types.h>
#include <Project64\N64 System\N64 Types.h>
class CGameSettings
{
@ -22,12 +22,12 @@ public:
inline static bool bLinkBlocks(void) { return m_bLinkBlocks; }
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
inline static bool bUseTlb(void) { return m_bUseTlb; }
inline static DWORD CountPerOp ( void ) { return m_CountPerOp; }
inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; }
inline static DWORD AiCountPerBytes ( void ) { return m_AiCountPerBytes; }
inline static uint32_t CountPerOp(void) { return m_CountPerOp; }
inline static uint32_t ViRefreshRate(void) { return m_ViRefreshRate; }
inline static uint32_t AiCountPerBytes(void) { return m_AiCountPerBytes; }
inline static bool bDelayDP(void) { return m_DelayDP; }
inline static bool bDelaySI(void) { return m_DelaySI; }
inline static DWORD RdramSize ( void ) { return m_RdramSize; }
inline static uint32_t RdramSize(void) { return m_RdramSize; }
inline static bool bFixedAudio(void) { return m_bFixedAudio; }
inline static bool bSyncToAudio(void) { return m_bSyncingToAudio; }
inline static bool bFastSP(void) { return m_bFastSP; }
@ -42,21 +42,21 @@ public:
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
protected:
static void SpeedChanged (int SpeedLimit );
static void SpeedChanged(int32_t SpeedLimit);
private:
//Settings that can be changed on the fly
static bool m_bRomInMemory;
static bool m_RegCaching;
static bool m_bLinkBlocks;
static DWORD m_LookUpMode; //FUNC_LOOKUP_METHOD
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
static bool m_bUseTlb;
static DWORD m_CountPerOp;
static DWORD m_ViRefreshRate;
static DWORD m_AiCountPerBytes;
static uint32_t m_CountPerOp;
static uint32_t m_ViRefreshRate;
static uint32_t m_AiCountPerBytes;
static bool m_DelayDP;
static bool m_DelaySI;
static DWORD m_RdramSize;
static uint32_t m_RdramSize;
static bool m_bFixedAudio;
static bool m_bSyncingToAudio;
static bool m_bSyncToAudio;

View File

@ -9,8 +9,9 @@
* *
****************************************************************************/
#include "stdafx.h"
#include "N64System Settings.h"
int CN64SystemSettings::m_RefCount = 0;
int32_t CN64SystemSettings::m_RefCount = 0;
bool CN64SystemSettings::m_bShowCPUPer;
bool CN64SystemSettings::m_bProfiling;

View File

@ -33,6 +33,5 @@ private:
static bool m_bShowDListAListCount;
static bool m_bDisplayFrameRate;
static int m_RefCount;
static int32_t m_RefCount;
};

View File

@ -9,6 +9,7 @@
* *
****************************************************************************/
#include "stdafx.h"
#include "Recompiler Settings.h"
int CRecompilerSettings::m_RefCount = 0;

View File

@ -10,7 +10,7 @@
****************************************************************************/
#pragma once
#include <N64 System/N64 Types.h>
#include <Project64\N64 System\N64 Types.h>
class CRecompilerSettings
{
@ -30,10 +30,9 @@ private:
void RefreshSettings(void);
//Settings that can be changed on the fly
static bool m_bShowRecompMemSize;
static bool m_bProfiling;
static int m_RefCount;
static int32_t m_RefCount;
};

View File

@ -27,23 +27,23 @@ public:
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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
// Initialize this class to use ini or registry
static void Initialize( const char * AppName );

View File

@ -23,23 +23,23 @@ public:
virtual bool IndexBasedSetting ( void ) const { return true; }
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeApplicationIndex(void); // Disable default constructor

View File

@ -19,7 +19,7 @@ public:
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
//return the values
virtual bool Load ( int Index, stdstr & Value ) const;
virtual bool Load ( int32_t Index, stdstr & Value ) const;
private:
CSettingTypeApplicationPath(void); // Disable default constructor

View File

@ -39,21 +39,21 @@ public:
virtual bool IndexBasedSetting ( void ) const = 0;
//return the values
virtual bool Load ( int Index, bool & Value ) const = 0;
virtual bool Load ( int Index, uint32_t & Value ) const = 0;
virtual bool Load ( int Index, stdstr & Value ) const = 0;
virtual bool Load ( int32_t Index, bool & Value ) const = 0;
virtual bool Load ( int32_t Index, uint32_t & Value ) const = 0;
virtual bool Load ( int32_t Index, stdstr & Value ) const = 0;
//return the default values
virtual void LoadDefault ( int Index, bool & Value ) const = 0;
virtual void LoadDefault ( int Index, uint32_t & Value ) const = 0;
virtual void LoadDefault ( int Index, stdstr & Value ) const = 0;
virtual void LoadDefault ( int32_t Index, bool & Value ) const = 0;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const = 0;
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const = 0;
//Update the settings
virtual void Save ( int Index, bool Value ) = 0;
virtual void Save ( int Index, uint32_t Value ) = 0;
virtual void Save ( int Index, const stdstr & Value ) = 0;
virtual void Save ( int Index, const char * Value ) = 0;
virtual void Save ( int32_t Index, bool Value ) = 0;
virtual void Save ( int32_t Index, uint32_t Value ) = 0;
virtual void Save ( int32_t Index, const stdstr & Value ) = 0;
virtual void Save ( int32_t Index, const char * Value ) = 0;
// Delete the setting
virtual void Delete ( int Index ) = 0;
virtual void Delete ( int32_t Index ) = 0;
};

View File

@ -24,23 +24,23 @@ public:
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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
// Initialize this class to use ini or registry
static void Initialize ( void );

View File

@ -35,23 +35,23 @@ public:
static void CleanUp ( void );
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeGame(void); // Disable default constructor

View File

@ -25,23 +25,23 @@ public:
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeGameIndex(void); // Disable default constructor

View File

@ -15,27 +15,27 @@ class CSettingTypeRDBCpuType :
{
public:
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBCpuType(const char * Name, int DefaultValue );
CSettingTypeRDBCpuType(const char * Name, int32_t DefaultValue );
~CSettingTypeRDBCpuType();
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRDBCpuType(void); // Disable default constructor

View File

@ -15,27 +15,27 @@ class CSettingTypeRDBOnOff :
{
public:
CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBOnOff(const char * Name, int DefaultValue );
CSettingTypeRDBOnOff(const char * Name, int32_t DefaultValue );
~CSettingTypeRDBOnOff();
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRDBOnOff(void); // Disable default constructor

View File

@ -15,27 +15,27 @@ class CSettingTypeRDBRDRamSize :
{
public:
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue );
CSettingTypeRDBRDRamSize(const char * Name, int32_t DefaultValue );
~CSettingTypeRDBRDRamSize();
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRDBRDRamSize(void); // Disable default constructor

View File

@ -15,27 +15,27 @@ class CSettingTypeRDBSaveChip :
{
public:
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBSaveChip(const char * Name, int DefaultValue );
CSettingTypeRDBSaveChip(const char * Name, int32_t DefaultValue );
~CSettingTypeRDBSaveChip();
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRDBSaveChip(void); // Disable default constructor

View File

@ -15,27 +15,27 @@ class CSettingTypeRDBYesNo :
{
public:
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting );
CSettingTypeRDBYesNo(const char * Name, int DefaultValue );
CSettingTypeRDBYesNo(const char * Name, int32_t DefaultValue );
~CSettingTypeRDBYesNo();
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRDBYesNo(void); // Disable default constructor

View File

@ -25,23 +25,23 @@ public:
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
//return the values
bool Load ( int /*Index*/, bool & /*Value*/ ) const { return false; };
bool Load ( int /*Index*/, uint32_t & /*Value*/ ) const { return false; };
bool Load ( int Index, stdstr & Value ) const;
bool Load ( int32_t /*Index*/, bool & /*Value*/ ) const { return false; };
bool Load ( int32_t /*Index*/, uint32_t & /*Value*/ ) const { return false; };
bool Load ( int32_t Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
void LoadDefault ( int32_t Index, bool & Value ) const;
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
void LoadDefault ( int32_t Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
void Save ( int32_t Index, bool Value );
void Save ( int32_t Index, uint32_t Value );
void Save ( int32_t Index, const stdstr & Value );
void Save ( int32_t Index, const char * Value );
// Delete the setting
void Delete ( int Index );
void Delete ( int32_t Index );
private:
CSettingTypeRelativePath(void); // Disable default constructor

View File

@ -19,7 +19,7 @@ class CSettingTypeRomDatabase :
public:
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue, bool DeleteOnDefault = false );
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
virtual ~CSettingTypeRomDatabase();
@ -28,23 +28,23 @@ public:
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
static void Initialize( void );
static void CleanUp ( void );
@ -58,7 +58,7 @@ protected:
mutable stdstr m_KeyName;
const char *const m_DefaultStr;
const int m_DefaultValue;
const int32_t m_DefaultValue;
const SettingID m_DefaultSetting;
const bool m_DeleteOnDefault;
bool m_GlideSetting;

View File

@ -16,7 +16,7 @@ class CSettingTypeRomDatabaseIndex :
public:
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int32_t DefaultValue );
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
virtual ~CSettingTypeRomDatabaseIndex();
@ -24,23 +24,23 @@ public:
virtual bool IndexBasedSetting ( void ) const { return true; }
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeRomDatabaseIndex(void); // Disable default constructor

View File

@ -6,22 +6,22 @@ class CSettingTypeRomDatabase :
public:
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue );
CSettingTypeRomDatabase(const char * Name, bool DefaultValue );
CSettingTypeRomDatabase(const char * Name, int DefaultValue );
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue );
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting );
~CSettingTypeRomDatabase();
virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; }
//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;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
static void Initilize ( void );
@ -32,7 +32,7 @@ private:
const const char * m_KeyName;
const const char * m_DefaultStr;
const int m_DefaultValue;
const int32_t m_DefaultValue;
const SettingID m_DefaultSetting;
static CIniFile * m_SettingsIniFile;

View File

@ -25,23 +25,23 @@ public:
const char * GetName ( void ) const { return m_Name.c_str(); }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, uint32_t & Value ) const;
virtual bool Load ( int Index, stdstr & Value ) const;
virtual bool Load ( int32_t Index, bool & Value ) const;
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
virtual bool Load ( int32_t 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;
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
virtual void LoadDefault ( int32_t 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 );
virtual void Save ( int32_t Index, bool Value );
virtual void Save ( int32_t Index, uint32_t Value );
virtual void Save ( int32_t Index, const stdstr & Value );
virtual void Save ( int32_t Index, const char * Value );
// Delete the setting
virtual void Delete ( int Index );
virtual void Delete ( int32_t Index );
private:
CSettingTypeSelectedDirectory(void); // Disable default constructor

View File

@ -23,23 +23,23 @@ public:
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
bool Load ( int32_t Index, bool & Value ) const;
bool Load ( int32_t Index, uint32_t & Value ) const;
bool Load ( int32_t Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
void LoadDefault ( int32_t Index, bool & Value ) const;
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
void LoadDefault ( int32_t Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
void Save ( int32_t Index, bool Value );
void Save ( int32_t Index, uint32_t Value );
void Save ( int32_t Index, const stdstr & Value );
void Save ( int32_t Index, const char * Value );
// Delete the setting
void Delete ( int Index );
void Delete ( int32_t Index );
private:
CSettingTypeTempBool(void); // Disable default constructor

View File

@ -23,23 +23,23 @@ public:
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
bool Load ( int32_t Index, bool & Value ) const;
bool Load ( int32_t Index, uint32_t & Value ) const;
bool Load ( int32_t Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
void LoadDefault ( int32_t Index, bool & Value ) const;
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
void LoadDefault ( int32_t Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
void Save ( int32_t Index, bool Value );
void Save ( int32_t Index, uint32_t Value );
void Save ( int32_t Index, const stdstr & Value );
void Save ( int32_t Index, const char * Value );
// Delete the setting
void Delete ( int Index );
void Delete ( int32_t Index );
private:
CSettingTypeTempNumber(void); // Disable default constructor

View File

@ -23,23 +23,23 @@ public:
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
//return the values
bool Load ( int Index, bool & Value ) const;
bool Load ( int Index, uint32_t & Value ) const;
bool Load ( int Index, stdstr & Value ) const;
bool Load ( int32_t Index, bool & Value ) const;
bool Load ( int32_t Index, uint32_t & Value ) const;
bool Load ( int32_t Index, stdstr & Value ) const;
//return the default values
void LoadDefault ( int Index, bool & Value ) const;
void LoadDefault ( int Index, uint32_t & Value ) const;
void LoadDefault ( int Index, stdstr & Value ) const;
void LoadDefault ( int32_t Index, bool & Value ) const;
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
void LoadDefault ( int32_t Index, stdstr & Value ) const;
//Update the settings
void Save ( int Index, bool Value );
void Save ( int Index, uint32_t Value );
void Save ( int Index, const stdstr & Value );
void Save ( int Index, const char * Value );
void Save ( int32_t Index, bool Value );
void Save ( int32_t Index, uint32_t Value );
void Save ( int32_t Index, const stdstr & Value );
void Save ( int32_t Index, const char * Value );
// Delete the setting
void Delete ( int Index );
void Delete ( int32_t Index );
private:
CSettingTypeTempString(void); // Disable default constructor

View File

@ -30,6 +30,7 @@
#include "SettingType/SettingsType-TempNumber.h"
#include "SettingType/SettingsType-TempBool.h"
#include "Settings Class.h"
#include "N64 System/N64 Types.h"
#include <Common/TraceDefs.h>
CSettings * g_Settings = NULL;
@ -109,6 +110,7 @@ void CSettings::AddHowToHandleSetting()
AddHandler(Setting_ApplicationName, new CSettingTypeTempString(""));
AddHandler(Setting_UseFromRegistry, new CSettingTypeApplication("Settings", "Use Registry", (uint32_t)false));
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("", "Rdb Editor", false));
AddHandler(Setting_CN64TimeCritical,new CSettingTypeApplication("","CN64TimeCritical",false));
AddHandler(Setting_PluginPageFirst, new CSettingTypeApplication("", "Plugin Page First", false));
AddHandler(Setting_DisableScrSaver, new CSettingTypeApplication("", "Disable Screen Saver", (uint32_t)true));
AddHandler(Setting_AutoSleep, new CSettingTypeApplication("", "Auto Sleep", (uint32_t)true));
@ -418,7 +420,7 @@ const char * CSettings::GetSettingSz(CSettings * _this, SettingID Type, char * B
return Buffer;
}
void CSettings::SetSetting(CSettings * _this, SettingID ID, unsigned int Value)
void CSettings::SetSetting(CSettings * _this, SettingID ID, uint32_t Value)
{
_this->SaveDword(ID, Value);
}
@ -459,7 +461,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, Value));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, DefaultID));
}
break;
@ -468,7 +471,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, ""));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeApplication(Category, DefaultStr, DefaultID));
}
break;
@ -489,7 +493,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabase(Name.c_str(), (int)Value));
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), RdbSetting));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), DefaultID));
}
break;
@ -498,7 +503,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), ""));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeGame(Name.c_str(), DefaultID));
}
break;
@ -515,7 +521,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, (int)Value, true));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, (SettingID)Value, true));
}
break;
@ -524,7 +531,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, "", true));
}
else {
else
{
_this->AddHandler(ID, new CSettingTypeRomDatabase(DefaultStr, DefaultID, true));
}
break;
@ -540,7 +548,8 @@ void CSettings::RegisterSetting(CSettings * _this, SettingID ID, SettingID Defau
{
_this->AddHandler(ID, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, (int)Value, true));
}
else {
else
{
SettingID RdbSetting = (SettingID)_this->m_NextAutoSettingId;
_this->m_NextAutoSettingId += 1;
_this->AddHandler(RdbSetting, new CSettingTypeRomDatabaseSetting(Category, DefaultStr, DefaultID, true));
@ -588,7 +597,8 @@ bool CSettings::LoadBool(SettingID Type, bool & Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
return FindInfo->second->Load(0, Value);
}
return false;
@ -614,7 +624,8 @@ bool CSettings::LoadBoolIndex(SettingID Type, int index, bool & Value)
{
return FindInfo->second->Load(index, Value);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
return false;
@ -640,7 +651,8 @@ bool CSettings::LoadDword(SettingID Type, uint32_t & Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
return FindInfo->second->Load(0, Value);
}
return false;
@ -666,7 +678,8 @@ bool CSettings::LoadDwordIndex(SettingID Type, int index, uint32_t & Value)
{
return FindInfo->second->Load(index, Value);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
return false;
@ -692,7 +705,8 @@ bool CSettings::LoadStringVal(SettingID Type, stdstr & Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
return FindInfo->second->Load(0, Value);
}
return false;
@ -712,7 +726,8 @@ bool CSettings::LoadStringVal(SettingID Type, char * Buffer, int BufferSize)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
stdstr Value;
bRes = FindInfo->second->Load(0, Value);
int len = BufferSize;
@ -745,7 +760,8 @@ bool CSettings::LoadStringIndex(SettingID Type, int index, stdstr & Value)
{
return FindInfo->second->Load(index, Value);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
return false;
@ -773,12 +789,14 @@ void CSettings::LoadDefaultBool(SettingID Type, bool & Value)
//if not found do nothing
UnknownSetting(Type);
}
else {
else
{
if (FindInfo->second->IndexBasedSetting())
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->LoadDefault(0, Value);
}
}
@ -810,12 +828,14 @@ void CSettings::LoadDefaultDword(SettingID Type, uint32_t & Value)
//if not found do nothing
UnknownSetting(Type);
}
else {
else
{
if (FindInfo->second->IndexBasedSetting())
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->LoadDefault(0, Value);
}
}
@ -847,12 +867,14 @@ void CSettings::LoadDefaultString(SettingID Type, stdstr & Value)
//if not found do nothing
UnknownSetting(Type);
}
else {
else
{
if (FindInfo->second->IndexBasedSetting())
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->LoadDefault(0, Value);
}
}
@ -892,7 +914,8 @@ void CSettings::SaveBool(SettingID Type, bool Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->Save(0, Value);
}
NotifyCallBacks(Type);
@ -911,7 +934,8 @@ void CSettings::SaveBoolIndex(SettingID Type, int index, bool Value)
{
FindInfo->second->Save(index, Value);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
NotifyCallBacks(Type);
@ -930,7 +954,8 @@ void CSettings::SaveDword(SettingID Type, uint32_t Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->Save(0, Value);
}
NotifyCallBacks(Type);
@ -949,7 +974,8 @@ void CSettings::SaveDwordIndex(SettingID Type, int index, uint32_t Value)
{
FindInfo->second->Save(index, Value);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
NotifyCallBacks(Type);
@ -968,7 +994,8 @@ void CSettings::SaveString(SettingID Type, const stdstr & Value)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->Save(0, Value);
}
NotifyCallBacks(Type);
@ -986,7 +1013,8 @@ void CSettings::SaveString(SettingID Type, const char * Buffer)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->Save(0, Buffer);
}
NotifyCallBacks(Type);
@ -1004,7 +1032,8 @@ void CSettings::SaveStringIndex(SettingID Type, int index, const char * Buffer)
{
FindInfo->second->Save(index, Buffer);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
NotifyCallBacks(Type);
@ -1027,7 +1056,8 @@ void CSettings::DeleteSetting(SettingID Type)
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
else {
else
{
FindInfo->second->Delete(0);
}
NotifyCallBacks(Type);
@ -1045,7 +1075,8 @@ void CSettings::DeleteSettingIndex(SettingID Type, int index)
{
FindInfo->second->Delete(index);
}
else {
else
{
g_Notify->BreakPoint(__FILEW__, __LINE__);
}
NotifyCallBacks(Type);
@ -1124,7 +1155,8 @@ void CSettings::RegisterChangeCB(SettingID Type, void * Data, SettingChangedFunc
}
item->Next = new_item;
}
else {
else
{
m_Callback.insert(SETTING_CALLBACK::value_type(Type, new_item));
}
}
@ -1154,11 +1186,13 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
m_Callback.erase(Callback);
m_Callback.insert(SETTING_CALLBACK::value_type(Type, Next));
}
else {
else
{
m_Callback.erase(Callback);
}
}
else {
else
{
PrevItem->Next = item->Next;
}
delete item;
@ -1169,7 +1203,8 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
item = item->Next;
}
}
else {
else
{
UnknownSetting(Type);
return;
}

View File

@ -53,48 +53,48 @@ public:
//return the values
bool LoadBool ( SettingID Type );
bool LoadBool ( SettingID Type, bool & Value );
bool LoadBoolIndex ( SettingID Type, int index );
bool LoadBoolIndex ( SettingID Type, int index , bool & Value );
bool LoadBoolIndex ( SettingID Type, int32_t index );
bool LoadBoolIndex ( SettingID Type, int32_t index , bool & Value );
uint32_t LoadDword ( SettingID Type );
bool LoadDword ( SettingID Type, uint32_t & Value );
uint32_t LoadDwordIndex ( SettingID Type, int index );
bool LoadDwordIndex ( SettingID Type, int index, uint32_t & Value);
uint32_t LoadDwordIndex ( SettingID Type, int32_t index );
bool LoadDwordIndex ( SettingID Type, int32_t index, uint32_t & Value );
stdstr LoadStringVal ( SettingID Type );
bool LoadStringVal (SettingID Type, stdstr & Value);
bool LoadStringVal (SettingID Type, char * Buffer, int BufferSize);
stdstr LoadStringIndex ( SettingID Type, int index );
bool LoadStringIndex ( SettingID Type, int index, stdstr & Value );
bool LoadStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
bool LoadStringVal (SettingID Type, char * Buffer, int32_t BufferSize );
stdstr LoadStringIndex ( SettingID Type, int32_t index );
bool LoadStringIndex ( SettingID Type, int32_t index, stdstr & Value );
bool LoadStringIndex ( SettingID Type, int32_t index, char * Buffer, int32_t BufferSize );
//Load the default value for the setting
bool LoadDefaultBool ( SettingID Type );
void LoadDefaultBool ( SettingID Type, bool & Value );
bool LoadDefaultBoolIndex ( SettingID Type, int index );
void LoadDefaultBoolIndex ( SettingID Type, int index , bool & Value );
bool LoadDefaultBoolIndex ( SettingID Type, int32_t index );
void LoadDefaultBoolIndex ( SettingID Type, int32_t index , bool & Value );
uint32_t LoadDefaultDword ( SettingID Type );
void LoadDefaultDword ( SettingID Type, uint32_t & Value);
uint32_t LoadDefaultDwordIndex ( SettingID Type, int index );
void LoadDefaultDwordIndex ( SettingID Type, int index, uint32_t & Value);
uint32_t LoadDefaultDwordIndex ( SettingID Type, int32_t index );
void LoadDefaultDwordIndex ( SettingID Type, int32_t index, uint32_t & Value);
stdstr LoadDefaultString ( SettingID Type );
void LoadDefaultString ( SettingID Type, stdstr & Value );
void LoadDefaultString ( SettingID Type, char * Buffer, int BufferSize );
stdstr LoadDefaultStringIndex ( SettingID Type, int index );
void LoadDefaultStringIndex ( SettingID Type, int index, stdstr & Value );
void LoadDefaultStringIndex ( SettingID Type, int index, char * Buffer, int BufferSize );
void LoadDefaultString ( SettingID Type, char * Buffer, int32_t BufferSize );
stdstr LoadDefaultStringIndex ( SettingID Type, int32_t index );
void LoadDefaultStringIndex ( SettingID Type, int32_t index, stdstr & Value );
void LoadDefaultStringIndex ( SettingID Type, int32_t index, char * Buffer, int32_t BufferSize );
//Update the settings
void SaveBool ( SettingID Type, bool Value );
void SaveBoolIndex ( SettingID Type, int index, bool Value );
void SaveBoolIndex ( SettingID Type, int32_t index, bool Value );
void SaveDword ( SettingID Type, uint32_t Value );
void SaveDwordIndex ( SettingID Type, int index, uint32_t Value );
void SaveDwordIndex ( SettingID Type, int32_t index, uint32_t Value );
void SaveString ( SettingID Type, const stdstr & Value );
void SaveStringIndex ( SettingID Type, int index, const stdstr & Value );
void SaveStringIndex ( SettingID Type, int32_t index, const stdstr & Value );
void SaveString ( SettingID Type, const char * Buffer );
void SaveStringIndex ( SettingID Type, int index, const char * Buffer );
void SaveStringIndex ( SettingID Type, int32_t index, const char * Buffer );
// Delete a setting
void DeleteSetting ( SettingID Type );
void DeleteSettingIndex ( SettingID Type, int index );
void DeleteSettingIndex ( SettingID Type, int32_t index );
//Register Notification of change
void RegisterChangeCB ( SettingID Type, void * Data, SettingChangedFunc Func);
@ -107,8 +107,8 @@ public:
// static functions for plugins
static uint32_t GetSetting ( CSettings * _this, SettingID Type );
static const char * GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int BufferSize );
static void SetSetting ( CSettings * _this, SettingID ID, unsigned int Value );
static const char * GetSettingSz ( CSettings * _this, SettingID Type, char * Buffer, int32_t BufferSize );
static void SetSetting ( CSettings * _this, SettingID ID, uint32_t Value );
static void SetSettingSz ( CSettings * _this, SettingID ID, const char * Value );
static void RegisterSetting ( CSettings * _this, SettingID ID, SettingID DefaultID, SettingDataType DataType,
SettingType Type, const char * Category, const char * DefaultStr,
@ -121,7 +121,7 @@ private:
SETTING_MAP m_SettingInfo;
SETTING_CALLBACK m_Callback;
int m_NextAutoSettingId;
int32_t m_NextAutoSettingId;
};
extern CSettings * g_Settings;

View File

@ -48,6 +48,7 @@ enum SettingID
Setting_ApplicationName,
Setting_UseFromRegistry,
Setting_RdbEditor,
Setting_CN64TimeCritical,
Setting_PluginPageFirst,
Setting_DisableScrSaver,
Setting_AutoSleep,

View File

@ -5,7 +5,8 @@ CBaseMenu::CBaseMenu () :
{
}
bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) {
bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items)
{
if (Items.begin() == Items.end()) { return false; }
UINT ItemID, uFlags;
@ -69,4 +70,3 @@ bool CBaseMenu::AddMenu(HMENU hMenu, MenuItemList Items ) {
}
return true;
}

View File

@ -545,8 +545,13 @@ void CRomBrowser::NotificationCB(LPCWSTR Status, CRomBrowser * /*_this*/)
g_Notify->DisplayMessage(5, Status);
}
static const char* ROM_extensions[] = {
"zip", "7z", "v64", "z64", "n64", "rom", "jap", "pal", "usa", "eur", "bin",
};
void CRomBrowser::AddFileNameToList(strlist & FileList, const stdstr & Directory, CPath & File)
{
uint8_t i;
if (FileList.size() > 3000)
{
return;
@ -555,13 +560,15 @@ void CRomBrowser::AddFileNameToList(strlist & FileList, const stdstr & Directory
stdstr Drive, Dir, Name, Extension;
File.GetComponents(NULL, &Dir, &Name, &Extension);
Extension.ToLower();
if (Extension == "zip" || Extension == "7z" || Extension == "v64" || Extension == "z64" ||
Extension == "n64" || Extension == "rom" || Extension == "jap" || Extension == "pal" ||
Extension == "usa" || Extension == "eur" || Extension == "bin")
for (i = 0; i < sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); i++)
{
if (Extension == ROM_extensions[i])
{
stdstr FileName = Directory + Name + Extension;
FileName.ToLower();
FileList.push_back(FileName);
break;
}
}
}
@ -579,6 +586,10 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
do
{
uint8_t ext_ID;
int8_t new_list_entry = 0;
const uint8_t exts = sizeof(ROM_extensions) / sizeof(ROM_extensions[0]);
//TODO: Fix exception on Windows XP (Visual Studio 2010+)
//WriteTraceF(TraceDebug,__FUNCTION__ ": 2 %s m_StopRefresh = %d",(LPCSTR)SearchPath,m_StopRefresh);
if (m_StopRefresh) { break; }
@ -598,13 +609,20 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
stdstr Extension = SearchPath.GetExtension();
Extension.ToLower();
if (Extension == "zip" || Extension == "v64" || Extension == "z64" || Extension == "n64" ||
Extension == "rom" || Extension == "jap" || Extension == "pal" || Extension == "usa" ||
Extension == "eur" || Extension == "bin")
for (ext_ID = 0; ext_ID < exts; ext_ID++)
{
if (Extension == ROM_extensions[ext_ID] && Extension != "7z")
{
new_list_entry = 1;
break;
}
}
if (new_list_entry)
{
AddRomToList(SearchPath, lpLastRom);
continue;
}
if (Extension == "7z")
{
try
@ -641,11 +659,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
_splitpath(FileName.c_str(), drive2, dir2, FileName2, ext2);
WriteTraceF(TraceDebug, __FUNCTION__ ": 6 %s", ext2);
if (_stricmp(ext2, ".v64") != 0 && _stricmp(ext2, ".z64") != 0 &&
_stricmp(ext2, ".n64") != 0 && _stricmp(ext2, ".rom") != 0 &&
_stricmp(ext2, ".jap") != 0 && _stricmp(ext2, ".pal") != 0 &&
_stricmp(ext2, ".usa") != 0 && _stricmp(ext2, ".eur") != 0 &&
_stricmp(ext2, ".bin") == 0)
if (_stricmp(ext2, ".bin") == 0)
{
continue;
}

View File

@ -1,247 +1,21 @@
#include "stdafx.h"
#include <Project64\AppInit.h>
#include "Multilanguage\LanguageSelector.h"
#include <Tlhelp32.h>
CTraceFileLog * LogFile = NULL;
void LogLevelChanged (CTraceFileLog * LogFile)
{
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
}
void LogFlushChanged (CTraceFileLog * LogFile)
{
LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0);
}
void InitializeLog ( void)
{
CPath LogFilePath(CPath::MODULE_DIRECTORY);
LogFilePath.AppendDirectory("Logs");
if (!LogFilePath.DirectoryExists())
{
LogFilePath.DirectoryCreate();
}
LogFilePath.SetNameExtension("Project64.log");
LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New,500);
#ifdef VALIDATE_DEBUG
LogFile->SetTraceLevel((TraceLevel)(g_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate | TraceDebug));
#else
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
#endif
AddTraceModule(LogFile);
g_Settings->RegisterChangeCB(Debugger_AppLogLevel,LogFile,(CSettings::SettingChangedFunc)LogLevelChanged);
g_Settings->RegisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged);
}
/*bool ChangeDirPermission ( const CPath & Dir)
{
if (Dir.DirectoryExists())
{
HANDLE hDir = CreateFile(Dir,READ_CONTROL|WRITE_DAC,0,NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL);
if (hDir != INVALID_HANDLE_VALUE)
{
ACL * pOldDACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
if (GetSecurityInfo(hDir,SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,NULL,NULL,&pOldDACL,NULL,&pSD) == ERROR_SUCCESS)
{
bool bAdd = true;
PEXPLICIT_ACCESS_W pListOfExplictEntries;
ULONG cCountOfExplicitEntries;
if (GetExplicitEntriesFromAclW(pOldDACL,&cCountOfExplicitEntries,&pListOfExplictEntries) == ERROR_SUCCESS)
{
for (int i = 0; i < cCountOfExplicitEntries; i ++)
{
EXPLICIT_ACCESS_W &ea = pListOfExplictEntries[i];
if (ea.grfAccessMode != GRANT_ACCESS) { continue; }
if (ea.grfAccessPermissions != GENERIC_ALL) { continue; }
if ((ea.grfInheritance & (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)) != (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)) { continue; }
if (ea.Trustee.TrusteeType == TRUSTEE_IS_SID)
{
}
bAdd = false;
}
}
if (bAdd)
{
EXPLICIT_ACCESS ea = {0};
ea.grfAccessMode = GRANT_ACCESS;
ea.grfAccessPermissions = GENERIC_ALL;
ea.grfInheritance = CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE;
ea.Trustee.TrusteeType = TRUSTEE_IS_GROUP;
ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
ea.Trustee.ptstrName = TEXT("Users");
ACL * pNewDACL = NULL;
SetEntriesInAcl(1,&ea,pOldDACL,&pNewDACL);
SetSecurityInfo(hDir,SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,NULL,NULL,pNewDACL,NULL);
LocalFree(pNewDACL);
}
LocalFree(pSD);
}
CloseHandle(hDir);
}
}
return true;
}*/
void FixDirectories ( void )
{
CPath Directory(CPath::MODULE_DIRECTORY);
Directory.AppendDirectory("Config");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Logs");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Save");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("Screenshots");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
Directory.UpDirectory();
Directory.AppendDirectory("textures");
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
}
bool TerminatedExistingEmu()
{
bool bTerminated = false;
bool AskedUser = false;
DWORD pid = GetCurrentProcessId();
HANDLE nSearch = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(nSearch != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 lppe;
memset(&lppe, 0, sizeof(PROCESSENTRY32));
lppe.dwSize = sizeof(PROCESSENTRY32);
stdstr ModuleName = CPath(CPath::MODULE_FILE).GetNameExtension();
if (Process32First(nSearch, &lppe))
{
do
{
if(_stricmp(lppe.szExeFile, ModuleName.c_str()) != 0 ||
lppe.th32ProcessID == pid)
{
continue;
}
if (!AskedUser)
{
AskedUser = true;
int res = MessageBox(NULL,stdstr_f("Project64.exe currently running\n\nTerminate pid %d now?",lppe.th32ProcessID).c_str(),"Terminate project64",MB_YESNO|MB_ICONEXCLAMATION);
if (res != IDYES)
{
break;
}
}
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
if(hHandle != NULL)
{
if (TerminateProcess(hHandle, 0))
{
bTerminated = true;
} else {
MessageBox(NULL,stdstr_f("Failed to terminate pid %d",lppe.th32ProcessID).c_str(),"Terminate project64 failed!",MB_YESNO|MB_ICONEXCLAMATION);
}
CloseHandle(hHandle);
}
} while (Process32Next(nSearch, &lppe));
}
CloseHandle(nSearch);
}
return bTerminated;
}
const char * AppName ( void )
{
static stdstr Name;
if (Name.empty())
{
Name = stdstr_f("Project64 %s", VER_FILE_VERSION_STR);
}
return Name.c_str();
}
#ifndef WINDOWS_UI
int main(int argc, char* argv[])
{
while (argc > 0)
{
puts(argv[--argc]);
}
putchar('\n');
fprintf(
stderr,
"Cross-platform (graphical/terminal?) UI not yet implemented.\n"
);
return 0;
}
#else
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpszArgs*/, int /*nWinMode*/)
{
FixDirectories();
char *lbuffer = new char[10];
if (GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10))
setlocale(LC_ALL, lbuffer);
delete[] lbuffer;
CoInitialize(NULL);
try
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL );
g_Settings = new CSettings;
g_Settings->Initialize(AppName());
if (g_Settings->LoadBool(Setting_CheckEmuRunning) &&
TerminatedExistingEmu())
{
delete g_Settings;
g_Settings = new CSettings;
g_Settings->Initialize(AppName());
}
InitializeLog();
WriteTrace(TraceDebug,__FUNCTION__ ": Application Starting");
CMipsMemoryVM::ReserveMemory();
g_Notify = &Notify();
//Create the plugin container
WriteTrace(TraceDebug,__FUNCTION__ ": Create Plugins");
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
//Select the language
g_Lang = new CLanguage();
if (!g_Lang->LoadCurrentStrings())
CoInitialize(NULL);
AppInit(&Notify());
if (!g_Lang->IsLanguageLoaded())
{
CLanguageSelector().Select();
}
//Create the main window with Menu
WriteTrace(TraceDebug, __FUNCTION__ ": Create Main Window");
stdstr WinTitle(AppName());
WinTitle.Format("Project64 %s", VER_FILE_VERSION_STR);
CMainGui MainWindow(true,WinTitle.c_str()), HiddenWindow(false);
CMainGui MainWindow(true, stdstr_f("Project64 %s", VER_FILE_VERSION_STR).c_str()), HiddenWindow(false);
CMainMenu MainMenu(&MainWindow);
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
Notify().SetMainWindow(&MainWindow);
@ -261,7 +35,8 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
MainWindow.ShowRomList();
MainWindow.Show(true); //Show the main window
MainWindow.HighLightLastRom();
} else {
}
else {
WriteTrace(TraceDebug, __FUNCTION__ ": Show Main Window");
MainWindow.Show(true); //Show the main window
}
@ -279,27 +54,13 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
g_BaseSystem = NULL;
}
WriteTrace(TraceDebug, __FUNCTION__ ": System Closed");
g_Settings->UnregisterChangeCB(Debugger_AppLogLevel,LogFile,(CSettings::SettingChangedFunc)LogLevelChanged);
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged);
}
catch (...)
{
WriteTraceF(TraceError, __FUNCTION__ ": Exception caught (File: \"%s\" Line: %d)", __FILE__, __LINE__);
MessageBox(NULL, stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).c_str(), "Exception", MB_OK);
}
WriteTrace(TraceDebug,__FUNCTION__ ": cleaning up global objects");
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
CMipsMemoryVM::FreeReservedMemory();
AppCleanup();
CoUninitialize();
WriteTrace(TraceDebug,__FUNCTION__ ": Done");
CloseTrace();
return true;
}
#endif