Merge https://github.com/project64/project64 into onexecopcode
This commit is contained in:
commit
4b87f25f5f
|
@ -1,2 +1,2 @@
|
|||
[default]
|
||||
[Settings]
|
||||
ConfigFile=..\..\Config\Project64.cfg
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[default]
|
||||
[Settings]
|
||||
ConfigFile=..\..\Config\Project64.cfg
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[default]
|
||||
[Settings]
|
||||
ConfigFile=..\..\Config\Project64.cfg
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[default]
|
||||
[Settings]
|
||||
ConfigFile=..\..\Config\Project64.cfg
|
||||
|
|
|
@ -1,4 +1,65 @@
|
|||
// ============ Audio RDB for Project64 ====================================
|
||||
[5326696F-FE9A99C3-C:45]
|
||||
FPSBuffer=0
|
||||
Fixed Audio=0
|
||||
Good Name=Body Harvest (U)
|
||||
|
||||
[07861842-A12EBC9F-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=Excitebike 64 (U) (V1.0)
|
||||
Sync Audio=0
|
||||
|
||||
[776646F6-06B9AC2B-C:50]
|
||||
Fixed Audio=0
|
||||
Good Name=F-ZERO X (E)
|
||||
|
||||
[4D3E622E-9B828B4E-C:4A]
|
||||
Fixed Audio=0
|
||||
Good Name=F-ZERO X (J)
|
||||
|
||||
[B30ED978-3003C9F9-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=F-ZERO X (U)
|
||||
|
||||
[BBFDEC37-D93B9EC0-C:4A]
|
||||
Fixed Audio=0
|
||||
Good Name=F-ZERO X + Expansion Kit (J) [CART HACK]
|
||||
|
||||
[C6E39C0A-D2726676-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=F-ZERO X + Expansion Kit (U) [CART HACK]
|
||||
|
||||
[AA18B1A5-07DB6AEB-C:45]
|
||||
Good Name=Resident Evil 2 (U) (V1.1)
|
||||
Sync Audio=0
|
||||
|
||||
[9510D8D7-35100DD2-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=Stunt Racer 64 (U)
|
||||
Sync Audio=0
|
||||
|
||||
[7F43E701-536328D1-C:50]
|
||||
Good Name=Top Gear Rally (E)
|
||||
Sync Audio=0
|
||||
|
||||
[62269B3D-FE11B1E8-C:45]
|
||||
Good Name=Top Gear Rally (U)
|
||||
Sync Audio=0
|
||||
|
||||
[AC062778-DFADFCB8-C:50]
|
||||
Fixed Audio=0
|
||||
Good Name=World Driver Championship (E) (M5)
|
||||
Sync Audio=0
|
||||
|
||||
[308DFEC8-CE2EB5F6-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=World Driver Championship (U)
|
||||
Sync Audio=0
|
||||
|
||||
[00000000-00000000-C:4A]
|
||||
Fixed Audio=0
|
||||
Good Name=64DD IPL (JPN)
|
||||
|
||||
[00000000-00000000-C:45]
|
||||
Fixed Audio=0
|
||||
Good Name=64DD IPL (USA)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
[default]
|
||||
[Settings]
|
||||
7zipCache=..\..\Config\Project64.zcache
|
||||
AudioRDB=..\..\Config\Audio.rdb
|
||||
Auto Sleep=0
|
||||
Basic Mode=0
|
||||
Cheats=..\..\Config\Project64.cht
|
||||
ExtInfo=..\..\Config\Project64.rdx
|
||||
VideoRDB=..\..\Config\Video.rdb
|
||||
AudioRDB=..\..\Config\Audio.rdb
|
||||
Notes=..\..\Config\Project64.rdn
|
||||
RomDatabase=..\..\Config\Project64.rdb
|
||||
RomListCache=..\..\Config\Project64.cache3
|
||||
ShortCuts=..\..\Config\Project64.sc3
|
||||
VideoRDB=..\..\Config\Video.rdb
|
||||
|
||||
[Debugger]
|
||||
Debugger=1
|
||||
|
|
|
@ -1850,7 +1850,6 @@ Status=Compatible
|
|||
Plugin Note=[Glide64] missing menu effects
|
||||
32bit=No
|
||||
Culling=1
|
||||
Fixed Audio=0
|
||||
|
||||
[B30ED978-3003C9F9-C:45]
|
||||
Good Name=F-ZERO X (U)
|
||||
|
@ -5562,7 +5561,6 @@ Plugin Note=[video] HLE not supported [audio] needs audio plugin
|
|||
32bit=No
|
||||
AudioResetOnLoad=Yes
|
||||
HLE GFX=No
|
||||
Fixed Audio=0
|
||||
RDRAM Size=8
|
||||
RSP-Mfc0Count=10
|
||||
|
||||
|
@ -6871,7 +6869,6 @@ Status=Issues (plugin)
|
|||
Plugin Note=[video] HLE not supported [audio] needs audio plugin
|
||||
32bit=No
|
||||
AudioResetOnLoad=Yes
|
||||
Fixed Audio=0
|
||||
HLE GFX=No
|
||||
RSP-Mfc0Count=10
|
||||
|
||||
|
@ -6882,7 +6879,6 @@ Status=Issues (plugin)
|
|||
Plugin Note=[video] HLE not supported [audio] needs audio plugin
|
||||
32bit=No
|
||||
AudioResetOnLoad=Yes
|
||||
Fixed Audio=0
|
||||
HLE GFX=No
|
||||
RSP-Mfc0Count=10
|
||||
|
||||
|
@ -8207,14 +8203,12 @@ Status=Unsupported
|
|||
|
||||
[00000000-00000000-C:4A]
|
||||
32bit=No
|
||||
Fixed Audio=0
|
||||
Good Name=64DD IPL (JPN)
|
||||
RDRAM Size=8
|
||||
Status=Compatible
|
||||
|
||||
[00000000-00000000-C:45]
|
||||
32bit=No
|
||||
Fixed Audio=0
|
||||
Good Name=64DD IPL (USA)
|
||||
RDRAM Size=8
|
||||
Status=Compatible
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
#409# "Keyboard Shortcuts"
|
||||
#410# "Status"
|
||||
#411# "Recompiler"
|
||||
#412# "Defaults"
|
||||
|
||||
//Plugin Dialog
|
||||
#420# "About"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
CriticalSection::CriticalSection()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "HighResTimeStamp.h"
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void CIniFileBase::fInsertSpaces(int Pos, int NoOfSpaces)
|
|||
if (NoOfSpaces < 0)
|
||||
{
|
||||
int ReadPos = Pos + (NoOfSpaces * -1);
|
||||
int WritePos = Pos;
|
||||
WritePos = Pos;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -338,6 +338,18 @@ bool CIniFileBase::MoveToSectionNameData(const char * lpSectionName, bool Change
|
|||
} while (result >= 0);
|
||||
}
|
||||
|
||||
if (!bFoundSection && strcmp(lpSectionName, "default") == 0)
|
||||
{
|
||||
m_SectionsPos.insert(FILELOC::value_type(lpSectionName, 0));
|
||||
if (ChangeCurrentSection)
|
||||
{
|
||||
m_CurrentSection = lpSectionName;
|
||||
m_CurrentSectionFilePos = 0;
|
||||
}
|
||||
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
|
||||
bFoundSection = true;
|
||||
}
|
||||
|
||||
if (bFoundSection && ChangeCurrentSection)
|
||||
{
|
||||
m_CurrentSectionData.clear();
|
||||
|
@ -482,7 +494,7 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
uint32_t dwRet = m_File.Read(pData.get(), dwSize);
|
||||
uint32_t dwRet = m_File.Read(pData.get(), (uint32_t)dwSize);
|
||||
if (dwRet == 0 || dwRet < dwSize)
|
||||
{
|
||||
return false;
|
||||
|
@ -502,11 +514,11 @@ bool CIniFileBase::DeleteSection(const char * lpSectionName)
|
|||
|
||||
char *pEndSection = pSection + strlen(strSection.c_str()), *Data = pData.get();
|
||||
char *pNextSection = NULL;
|
||||
int result, ReadPos = pEndSection - pData.get();
|
||||
int result, ReadPos = (int)(pEndSection - pData.get());
|
||||
do
|
||||
{
|
||||
char * Input = NULL;
|
||||
int MaxDataSize = dwSize + 1;
|
||||
int MaxDataSize = (int)(dwSize + 1);
|
||||
result = -1;
|
||||
for (int count = ReadPos; count < MaxDataSize; count++)
|
||||
{
|
||||
|
|
|
@ -4,13 +4,15 @@
|
|||
/* for POSIX method away from Win32 _stricmp--see "Platform.h" */
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include "Platform.h"
|
||||
|
||||
#include "FileClass.h"
|
||||
#include "CriticalSection.h"
|
||||
#include "StdString.h"
|
||||
#include "SmartPointer.h"
|
||||
#include "Platform.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
class CIniFileBase
|
||||
{
|
||||
|
@ -27,8 +29,9 @@ class CIniFileBase
|
|||
typedef std::map<std::string, std::string, insensitive_compare> KeyValueList;
|
||||
|
||||
public:
|
||||
typedef std::map<std::string, std::string> KeyValueData;
|
||||
typedef std::vector<std::string> SectionList;
|
||||
typedef std::map<std::string, std::string> KeyValueData;
|
||||
typedef std::vector<std::string> SectionList;
|
||||
typedef std::list<std::string> strlist;
|
||||
|
||||
protected:
|
||||
CFileBase & m_File;
|
||||
|
|
|
@ -82,7 +82,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
|
|||
void CLog::Log( const char * Message )
|
||||
{
|
||||
if (!m_hLogFile.IsOpen()) { return; }
|
||||
uint32_t message_len = strlen(Message);
|
||||
uint32_t message_len = (uint32_t)strlen(Message);
|
||||
m_hLogFile.Write(Message, message_len);
|
||||
if (m_FlushOnWrite)
|
||||
{
|
||||
|
@ -113,8 +113,6 @@ void CLog::Log( const char * Message )
|
|||
do
|
||||
{
|
||||
uint8_t Data[300];
|
||||
uint32_t dwRead;
|
||||
|
||||
dwRead = m_hLogFile.Read(Data,sizeof(Data));
|
||||
if (dwRead == 0)
|
||||
{
|
||||
|
@ -146,7 +144,6 @@ void CLog::Log( const char * Message )
|
|||
|
||||
m_hLogFile.Seek(ReadPos,CFile::begin);
|
||||
|
||||
uint32_t dwRead;
|
||||
dwRead = m_hLogFile.Read(Data,SizeToRead);
|
||||
|
||||
m_hLogFile.Seek(WritePos,CFile::begin);
|
||||
|
|
|
@ -1,33 +1,42 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <crtdbg.h>
|
||||
#else
|
||||
#define _ASSERTE(expr) ((void)0)
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#pragma warning(disable:4786) //Disable std library warning
|
||||
#pragma warning(disable:4530) //Disable std library warning
|
||||
#include <string>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "MemTest.h"
|
||||
#ifdef MEM_LEAK_TEST
|
||||
|
||||
#include <shellapi.h> //Needed for ShellExecute
|
||||
#pragma comment(lib, "shell32.lib") //Needed for ShellExecute
|
||||
#if defined(MEM_LEAK_TEST) && defined(_WIN32)
|
||||
|
||||
#undef new
|
||||
#undef malloc
|
||||
#undef realloc
|
||||
#undef free
|
||||
#undef VirtualAlloc
|
||||
#undef VirtualFree
|
||||
|
||||
#ifndef MB_SERVICE_NOTIFICATION
|
||||
#define MB_SERVICE_NOTIFICATION 0x00200000L
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
static bool InInit = false;
|
||||
|
||||
class CMemList
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
char File[300];
|
||||
int line;
|
||||
int size;
|
||||
int order;
|
||||
} DEBUG_LOCATION;
|
||||
|
||||
typedef std::map<void *, DEBUG_LOCATION> MEMLIST;
|
||||
typedef MEMLIST::const_iterator MEMLIST_ITER;
|
||||
|
||||
public:
|
||||
CMemList();
|
||||
~CMemList();
|
||||
|
||||
void removeItem(void * ptr);
|
||||
void RecordAddItem(void * ptr, size_t size, const char * filename, int line);
|
||||
void DumpItems(void);
|
||||
|
||||
private:
|
||||
MEMLIST * m_MemList;
|
||||
HMODULE m_hModule;
|
||||
CRITICAL_SECTION m_cs;
|
||||
uint32_t m_NextOrder;
|
||||
};
|
||||
|
||||
CMemList *MemList(void)
|
||||
{
|
||||
|
@ -36,15 +45,15 @@ CMemList *MemList(void)
|
|||
return &m_MemList;
|
||||
}
|
||||
|
||||
CMemList::CMemList()
|
||||
CMemList::CMemList() :
|
||||
m_MemList(NULL),
|
||||
m_hModule(NULL),
|
||||
m_cs({0}),
|
||||
m_NextOrder(1)
|
||||
{
|
||||
MemList.clear();
|
||||
hSemaphone = CreateSemaphore(NULL, 1, 1, NULL);
|
||||
State = Initialized;
|
||||
order = 0;
|
||||
LogAllocate = false;
|
||||
ThreadID = 0;
|
||||
m_hModule = NULL;
|
||||
InInit = true;
|
||||
InitializeCriticalSection(&m_cs);
|
||||
m_MemList = new MEMLIST;
|
||||
|
||||
for (UINT_PTR TestLoc = ((UINT_PTR)::MemList) & ~0xFFF; TestLoc != 0; TestLoc -= 0x1000)
|
||||
{
|
||||
|
@ -56,259 +65,146 @@ CMemList::CMemList()
|
|||
m_hModule = (HMODULE)TestLoc;
|
||||
break;
|
||||
}
|
||||
InInit = false;
|
||||
}
|
||||
|
||||
CMemList::~CMemList()
|
||||
{
|
||||
size_t ItemsLeft = MemList.size();
|
||||
InInit = true;
|
||||
size_t ItemsLeft = m_MemList->size();
|
||||
if (ItemsLeft > 0)
|
||||
{
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME], ext[_MAX_EXT], LogFileName[_MAX_PATH];
|
||||
|
||||
memset(path_buffer, 0, sizeof(path_buffer));
|
||||
memset(drive, 0, sizeof(drive));
|
||||
memset(dir, 0, sizeof(dir));
|
||||
memset(fname, 0, sizeof(fname));
|
||||
memset(ext, 0, sizeof(ext));
|
||||
memset(LogFileName, 0, sizeof(LogFileName));
|
||||
|
||||
GetModuleFileName(m_hModule, path_buffer, sizeof(path_buffer));
|
||||
_splitpath(path_buffer, drive, dir, fname, ext);
|
||||
|
||||
_makepath(LogFileName, drive, dir, fname, "leak.csv");
|
||||
|
||||
HANDLE hLogFile = INVALID_HANDLE_VALUE;
|
||||
do
|
||||
{
|
||||
hLogFile = CreateFile(
|
||||
LogFileName,
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
NULL
|
||||
);
|
||||
if (hLogFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (GetLastError() == ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
TCHAR Msg[3000];
|
||||
sprintf(Msg, "%s\nCan not be opened for writing please close app using this file\n\nTry Again ?", LogFileName);
|
||||
int Result = MessageBox(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||
if (Result == IDNO)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (hLogFile == INVALID_HANDLE_VALUE);
|
||||
|
||||
if (hLogFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
|
||||
|
||||
DWORD dwWritten = 0;
|
||||
char Msg[800];
|
||||
_snprintf(Msg, sizeof(Msg), "Order, Source File, Line Number, Mem Size\r\n");
|
||||
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
|
||||
|
||||
for (MEMLIST_ITER item = MemList.begin(); item != MemList.end(); item++)
|
||||
{
|
||||
_snprintf(Msg, sizeof(Msg), "%d,%s, %d, %d\r\n",
|
||||
(*item).second.order,
|
||||
(*item).second.File,
|
||||
(*item).second.line,
|
||||
(*item).second.size);
|
||||
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
|
||||
}
|
||||
CloseHandle(hLogFile);
|
||||
}
|
||||
char Msg[3000];
|
||||
sprintf(Msg, "%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?", fname, ext);
|
||||
int Result = MessageBox(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||
if (Result == IDYES)
|
||||
{
|
||||
ShellExecute(NULL, "open", LogFileName, NULL, NULL, SW_SHOW);
|
||||
}
|
||||
DumpItems();
|
||||
}
|
||||
CloseHandle(hSemaphone);
|
||||
hSemaphone = NULL;
|
||||
State = NotInitialized;
|
||||
}
|
||||
|
||||
void * CMemList::AddItem(size_t size, char * filename, int line)
|
||||
{
|
||||
void *res = malloc(size);
|
||||
if (res == NULL)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
RecordAddItem(res, size, filename, line);
|
||||
return res;
|
||||
delete m_MemList;
|
||||
m_MemList = NULL;
|
||||
DeleteCriticalSection(&m_cs);
|
||||
}
|
||||
|
||||
void CMemList::RecordAddItem(void * ptr, size_t size, const char * filename, int line)
|
||||
{
|
||||
__try
|
||||
EnterCriticalSection(&m_cs);
|
||||
if (m_cs.RecursionCount > 1)
|
||||
{
|
||||
if (State == Initialized && hSemaphone != NULL)
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOCATION info;
|
||||
strncpy(info.File, filename, sizeof(info.File));
|
||||
info.line = line;
|
||||
info.size = (int)size;
|
||||
info.order = m_NextOrder++;
|
||||
m_MemList->insert(MEMLIST::value_type(ptr, info));
|
||||
LeaveCriticalSection(&m_cs);
|
||||
}
|
||||
|
||||
void CMemList::removeItem(void * ptr)
|
||||
{
|
||||
EnterCriticalSection(&m_cs);
|
||||
if (m_cs.RecursionCount > 1)
|
||||
{
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return;
|
||||
}
|
||||
MEMLIST_ITER item = m_MemList->find(ptr);
|
||||
if (item != m_MemList->end())
|
||||
{
|
||||
m_MemList->erase(item);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_cs);
|
||||
}
|
||||
|
||||
void CMemList::DumpItems(void)
|
||||
{
|
||||
char path_buffer[_MAX_PATH] = { 0 }, drive[_MAX_DRIVE] = { 0 }, dir[_MAX_DIR] = { 0 };
|
||||
char fname[_MAX_FNAME] = { 0 }, ext[_MAX_EXT] = { 0 }, LogFileName[_MAX_PATH] = { 0 };
|
||||
|
||||
GetModuleFileName(m_hModule, path_buffer, sizeof(path_buffer));
|
||||
_splitpath(path_buffer, drive, dir, fname, ext);
|
||||
_makepath(LogFileName, drive, dir, fname, "leak.csv");
|
||||
|
||||
HANDLE hLogFile = INVALID_HANDLE_VALUE;
|
||||
do
|
||||
{
|
||||
hLogFile = CreateFile( LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
|
||||
if (hLogFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD CurrentThread = GetCurrentThreadId();
|
||||
DWORD Result = WaitForSingleObject(hSemaphone, CurrentThread != ThreadID ? 30000 : 0);
|
||||
if (Result != WAIT_TIMEOUT)
|
||||
if (GetLastError() == ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
ThreadID = CurrentThread;
|
||||
|
||||
DEBUG_LOCATION info;
|
||||
strncpy(info.File, filename, sizeof(info.File));
|
||||
info.line = line;
|
||||
info.size = (int)size;
|
||||
info.order = order++;
|
||||
|
||||
Insert(ptr, info);
|
||||
|
||||
long dwSemCount = 0;
|
||||
ThreadID = (DWORD)-1;
|
||||
ReleaseSemaphore(hSemaphone, 1, &dwSemCount);
|
||||
TCHAR Msg[3000];
|
||||
sprintf(Msg, "%s\nCan not be opened for writing please close app using this file\n\nTry Again ?", LogFileName);
|
||||
int Result = MessageBox(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||
if (Result == IDNO)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
} while (hLogFile == INVALID_HANDLE_VALUE);
|
||||
|
||||
if (hLogFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
//_asm int 3
|
||||
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
|
||||
|
||||
DWORD dwWritten = 0;
|
||||
char Msg[800];
|
||||
_snprintf(Msg, sizeof(Msg), "Order, Source File, Line Number, Mem Size\r\n");
|
||||
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
|
||||
|
||||
for (MEMLIST_ITER item = m_MemList->begin(); item != m_MemList->end(); item++)
|
||||
{
|
||||
_snprintf(Msg, sizeof(Msg), "%d,%s, %d, %d\r\n", (*item).second.order, (*item).second.File, (*item).second.line, (*item).second.size);
|
||||
WriteFile(hLogFile, Msg, (DWORD)strlen(Msg), &dwWritten, NULL);
|
||||
}
|
||||
CloseHandle(hLogFile);
|
||||
}
|
||||
char Msg[3000];
|
||||
sprintf(Msg, "%s%s\n\nMemory Leaks detected\n\nOpen the Log File ?", fname, ext);
|
||||
int Result = MessageBox(NULL, Msg, "Memory Leak", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_SERVICE_NOTIFICATION);
|
||||
if (Result == IDYES)
|
||||
{
|
||||
ShellExecute(NULL, "open", LogFileName, NULL, NULL, SW_SHOW);
|
||||
}
|
||||
}
|
||||
|
||||
void CMemList::Insert(void *res, DEBUG_LOCATION &info)
|
||||
void* AllocateMemory(size_t size, const char* filename, unsigned int line)
|
||||
{
|
||||
MemList.insert(MEMLIST::value_type(res, info));
|
||||
}
|
||||
|
||||
void * CMemList::ReAllocItem(void * ptr, size_t size, const char * filename, int line)
|
||||
{
|
||||
void *res = realloc(ptr, size);
|
||||
void * res = malloc(size);
|
||||
if (res == NULL)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
if (ptr != res)
|
||||
if (!InInit)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if (State == Initialized && hSemaphone != NULL)
|
||||
{
|
||||
DWORD CurrentThread = GetCurrentThreadId();
|
||||
DWORD Result = WaitForSingleObject(hSemaphone, CurrentThread != ThreadID ? 30000 : 0);
|
||||
if (Result != WAIT_TIMEOUT)
|
||||
{
|
||||
ThreadID = CurrentThread;
|
||||
//Add new pointer
|
||||
DEBUG_LOCATION info;
|
||||
strncpy(info.File, filename, sizeof(info.File));
|
||||
info.line = line;
|
||||
info.size = (int)size;
|
||||
info.order = order++;
|
||||
|
||||
Insert(res, info);
|
||||
|
||||
//remove old pointer
|
||||
Remove(ptr);
|
||||
|
||||
long dwSemCount = 0;
|
||||
ThreadID = (DWORD)-1;
|
||||
ReleaseSemaphore(hSemaphone, 1, &dwSemCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
//_asm int 3
|
||||
}
|
||||
MemList()->RecordAddItem(res, size, filename, line);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void CMemList::Remove(void *ptr)
|
||||
void* operator new (size_t size, const char* filename, unsigned int line)
|
||||
{
|
||||
//remove old pointer
|
||||
MEMLIST_ITER item = MemList.find(ptr);
|
||||
if (item != MemList.end())
|
||||
{
|
||||
MemList.erase(ptr);
|
||||
}
|
||||
return AllocateMemory(size, filename, line);
|
||||
}
|
||||
|
||||
void CMemList::removeItem(void * ptr, bool bFree)
|
||||
void* operator new[] (size_t size, const char* filename, unsigned int line)
|
||||
{
|
||||
if (bFree)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
if (State == Initialized && hSemaphone != NULL)
|
||||
{
|
||||
DWORD CurrentThread = GetCurrentThreadId();
|
||||
DWORD Result = WaitForSingleObject(hSemaphone, CurrentThread != ThreadID ? 30000 : 0);
|
||||
if (Result != WAIT_TIMEOUT)
|
||||
{
|
||||
ThreadID = CurrentThread;
|
||||
|
||||
Remove(ptr);
|
||||
|
||||
long dwSemCount = 0;
|
||||
ThreadID = (DWORD)-1;
|
||||
ReleaseSemaphore(hSemaphone, 1, &dwSemCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
//_asm int 3
|
||||
}
|
||||
}
|
||||
|
||||
void MemTest_AddLeak(char* Comment)
|
||||
{
|
||||
MemList()->AddItem(1, Comment, -1);
|
||||
}
|
||||
|
||||
void* MemTest_malloc(size_t size, char* filename, int line)
|
||||
{
|
||||
return MemList()->AddItem(size, filename, line);
|
||||
}
|
||||
|
||||
void* MemTest_realloc(void* ptr, size_t size, char* filename, int line)
|
||||
{
|
||||
return MemList()->ReAllocItem(ptr, size, filename, line);
|
||||
}
|
||||
|
||||
void* operator new (size_t size, char* filename, int line)
|
||||
{
|
||||
return MemList()->AddItem(size, filename, line);
|
||||
return AllocateMemory(size, filename, line);
|
||||
}
|
||||
|
||||
void* operator new (size_t size)
|
||||
{
|
||||
return MemList()->AddItem(size, "Unknown", 0);
|
||||
}
|
||||
|
||||
void* operator new [](size_t size, char* filename, int line)
|
||||
{
|
||||
return MemList()->AddItem(size, filename, line);
|
||||
}
|
||||
|
||||
void* operator new [](size_t size)
|
||||
{
|
||||
return MemList()->AddItem(size, "Unknown", 0);
|
||||
return AllocateMemory(size, "Unknown", 0);
|
||||
}
|
||||
|
||||
void operator delete (void* ptr)
|
||||
{
|
||||
MemList()->removeItem(ptr, true);
|
||||
free(ptr);
|
||||
if (!InInit)
|
||||
{
|
||||
MemList()->removeItem(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr)
|
||||
|
@ -316,31 +212,14 @@ void operator delete[](void* ptr)
|
|||
delete ptr;
|
||||
}
|
||||
|
||||
LPVOID MemTest_VirtualAlloc(
|
||||
LPVOID lpAddress, // region to reserve or commit
|
||||
SIZE_T dwSize, // size of region
|
||||
DWORD flAllocationType, // type of allocation
|
||||
DWORD flProtect, // type of access protection
|
||||
LPCSTR filename,
|
||||
int line)
|
||||
void operator delete (void* ptr, const char* /*filename*/, unsigned int /*line*/)
|
||||
{
|
||||
LPVOID ptr = VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
|
||||
|
||||
if (ptr && lpAddress == NULL && (flAllocationType & MEM_RESERVE) != 0)
|
||||
{
|
||||
MemList()->RecordAddItem(ptr, dwSize, filename, line);
|
||||
}
|
||||
return ptr;
|
||||
delete ptr;
|
||||
}
|
||||
|
||||
BOOL MemTest_VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType)
|
||||
void operator delete[](void* ptr, const char* /*filename*/, unsigned int /*line*/)
|
||||
{
|
||||
if ((dwFreeType & MEM_RELEASE) != 0)
|
||||
{
|
||||
MemList()->removeItem(lpAddress, false);
|
||||
}
|
||||
return VirtualFree(lpAddress, dwSize, dwFreeType);
|
||||
delete ptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,102 +1,16 @@
|
|||
#ifdef _DEBUG
|
||||
#pragma once
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1900))
|
||||
#if (defined(_MSC_VER) && _DEBUG)
|
||||
#define MEM_LEAK_TEST
|
||||
#endif
|
||||
|
||||
#ifdef MEM_LEAK_TEST
|
||||
|
||||
#ifndef __MEM_TEST__H__
|
||||
#define __MEM_TEST__H__
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4291)
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
|
||||
#include <xdebug>
|
||||
#include <xlocale>
|
||||
#include <xiosbase>
|
||||
#include <xtree>
|
||||
|
||||
#define new new(__FILE__, __LINE__)
|
||||
#include <map>
|
||||
#include <windows.h>
|
||||
#undef new
|
||||
|
||||
/*
|
||||
#include <crtdbg.h>
|
||||
#include <malloc.h>
|
||||
#include <fstream>
|
||||
#include <xlocnum>
|
||||
#include <xlocmon>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
char File[300];
|
||||
int line;
|
||||
int size;
|
||||
int order;
|
||||
} DEBUG_LOCATION;
|
||||
|
||||
typedef std::map<void *, DEBUG_LOCATION> MEMLIST;
|
||||
typedef MEMLIST::iterator MEMLIST_ITER;
|
||||
|
||||
class CMemList {
|
||||
MEMLIST MemList;
|
||||
HANDLE hSemaphone;
|
||||
DWORD ThreadID;
|
||||
HMODULE m_hModule;
|
||||
|
||||
enum INIT { Initialized = 123, NotInitialized };
|
||||
INIT State;
|
||||
int order;
|
||||
bool LogAllocate;
|
||||
|
||||
void Insert(void *res, DEBUG_LOCATION &info);
|
||||
void Remove(void *ptr);
|
||||
|
||||
public:
|
||||
CMemList();
|
||||
~CMemList();
|
||||
void * AddItem ( size_t size, char * filename, int line );
|
||||
void * ReAllocItem ( void * ptr, size_t size, const char * filename, int line );
|
||||
void removeItem ( void * ptr, bool bFree );
|
||||
void RecordAddItem ( void * ptr, size_t size, const char * filename, int line );
|
||||
};
|
||||
|
||||
void* operator new (size_t size );
|
||||
void* operator new (size_t size, char* filename, int line);
|
||||
void* operator new [] (size_t size );
|
||||
void* operator new [] (size_t size, char* filename, int line);
|
||||
void operator delete ( void* ptr);
|
||||
void operator delete[](void* ptr);
|
||||
|
||||
void* MemTest_malloc(size_t size, char* filename, int line);
|
||||
void* MemTest_realloc(void* ptr, size_t size, char* filename, int line);
|
||||
void MemTest_AddLeak(char* Comment);
|
||||
LPVOID MemTest_VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, LPCSTR filename, int line);
|
||||
BOOL MemTest_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType );
|
||||
void* operator new (size_t size, const char* filename, unsigned int line);
|
||||
void* operator new[](size_t size, const char* filename, unsigned int line);
|
||||
void operator delete (void* ptr, const char* filename, unsigned int line);
|
||||
void operator delete[](void* ptr, const char* filename, unsigned int line);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#undef new
|
||||
#undef malloc
|
||||
#undef free
|
||||
#define new new(__FILE__, __LINE__)
|
||||
#define malloc(x) (MemTest_malloc((x),__FILE__, __LINE__))
|
||||
#define realloc(mem,x) (MemTest_realloc((mem),(x),__FILE__, __LINE__))
|
||||
#define free(x) (delete (x))
|
||||
#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect ) \
|
||||
(MemTest_VirtualAlloc((lpAddress), (dwSize), (flAllocationType), (flProtect),__FILE__, __LINE__))
|
||||
#define VirtualFree(lpAddress, dwSize, dwFreeType ) \
|
||||
(MemTest_VirtualFree((lpAddress), (dwSize), (dwFreeType)))
|
||||
|
||||
#endif
|
||||
#define new new(__FILE__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,6 +66,7 @@ void* AllocateAddressSpace(size_t size, void * base_address)
|
|||
bool FreeAddressSpace(void* addr, size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
size = 0; //unused
|
||||
return VirtualFree(addr, 0, MEM_RELEASE) != 0;
|
||||
#else
|
||||
msync(addr, size, MS_SYNC);
|
||||
|
|
|
@ -60,5 +60,5 @@ public:
|
|||
};
|
||||
#endif
|
||||
|
||||
typedef std::list<stdstr> strlist;
|
||||
typedef strlist::iterator strlist_iter;
|
||||
typedef std::list<stdstr> strlist;
|
||||
typedef strlist::iterator strlist_iter;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "Thread.h"
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/syscall.h>
|
||||
|
@ -64,7 +66,11 @@ void * CThread::ThreadWrapper (CThread * _this)
|
|||
void * res = NULL;
|
||||
try
|
||||
{
|
||||
#if defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM)
|
||||
res = (void *)_this->m_StartAddress(_this->m_lpThreadParameter);
|
||||
#else
|
||||
res = (void *)((uint64_t)_this->m_StartAddress(_this->m_lpThreadParameter));
|
||||
#endif
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <Common\stdtypes.h>
|
||||
|
||||
class CThread
|
||||
{
|
||||
|
|
|
@ -122,12 +122,18 @@ void CTraceLog::CloseTrace(void)
|
|||
{
|
||||
CGuard Guard(m_CS);
|
||||
m_Modules.clear();
|
||||
|
||||
if (g_ModuleLogLevel)
|
||||
{
|
||||
delete g_ModuleLogLevel;
|
||||
g_ModuleLogLevel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CTraceLog::FlushTrace(void)
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
for (uint32_t i = 0, n = m_Modules.size(); i < n; i++)
|
||||
for (size_t i = 0, n = m_Modules.size(); i < n; i++)
|
||||
{
|
||||
m_Modules[i]->FlushTrace();
|
||||
}
|
||||
|
@ -138,7 +144,7 @@ void CTraceLog::TraceMessage(uint32_t module, uint8_t severity, const char * fil
|
|||
{
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
for (uint32_t i = 0, n = m_Modules.size(); i < n; i++)
|
||||
for (size_t i = 0, n = m_Modules.size(); i < n; i++)
|
||||
{
|
||||
m_Modules[i]->Write(module, severity, file, line, function, Message);
|
||||
}
|
||||
|
@ -200,7 +206,7 @@ CTraceFileLog::CTraceFileLog(const char * FileName, bool FlushFile, CLog::LOG_OP
|
|||
{ /* Clamp file size to 5 MB if it exceeds 2047 or falls short of 3. */
|
||||
dwMaxFileSize = 5;
|
||||
}
|
||||
m_hLogFile.SetMaxFileSize(dwMaxFileSize * MB);
|
||||
m_hLogFile.SetMaxFileSize((uint32_t)(dwMaxFileSize * MB));
|
||||
|
||||
m_hLogFile.Open(FileName, eMode);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,8 @@ enum TraceSeverity
|
|||
TraceVerbose = 0x00000006,
|
||||
};
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <objbase.h>
|
||||
#else
|
||||
#define __interface struct
|
||||
#ifndef _WIN32
|
||||
#define __interface struct
|
||||
#endif
|
||||
|
||||
__interface CTraceModule
|
||||
|
|
|
@ -306,17 +306,47 @@ CPath::CPath(DIR_MODULE_FILE /*sdt*/)
|
|||
#ifdef _WIN32
|
||||
void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::string* pName, std::string* pExtension) const
|
||||
{
|
||||
char buff_drive[_MAX_DRIVE + 1];
|
||||
char buff_dir[_MAX_DIR + 1];
|
||||
char buff_name[_MAX_FNAME + 1];
|
||||
char buff_ext[_MAX_EXT + 1];
|
||||
WriteTrace(TracePath, TraceDebug, "Start (m_strPath: \"%s\")", m_strPath.c_str());
|
||||
|
||||
ZeroMemory(buff_drive, sizeof(buff_drive));
|
||||
ZeroMemory(buff_dir, sizeof(buff_dir));
|
||||
ZeroMemory(buff_name, sizeof(buff_name));
|
||||
ZeroMemory(buff_ext, sizeof(buff_ext));
|
||||
char buff_drive[_MAX_DRIVE + 1] = { 0 };
|
||||
char buff_dir[_MAX_DIR + 1] = { 0 };
|
||||
char buff_name[_MAX_FNAME + 1] = { 0 };
|
||||
char buff_ext[_MAX_EXT + 1] = { 0 };
|
||||
|
||||
_splitpath(m_strPath.c_str(), pDrive ? buff_drive : NULL, pDirectory ? buff_dir : NULL, pName ? buff_name : NULL, pExtension ? buff_ext : NULL);
|
||||
const char * BasePath = m_strPath.c_str();
|
||||
const char * DriveDir = strrchr(BasePath, DRIVE_DELIMITER);
|
||||
if (DriveDir != NULL)
|
||||
{
|
||||
int len = sizeof(buff_dir) < (DriveDir - BasePath) ? sizeof(buff_drive) : DriveDir - BasePath;
|
||||
strncpy(buff_drive, BasePath, len);
|
||||
BasePath += len + 1;
|
||||
}
|
||||
|
||||
const char * last = strrchr(BasePath, DIRECTORY_DELIMITER);
|
||||
if (last != NULL)
|
||||
{
|
||||
int len = sizeof(buff_dir) < (last - BasePath) ? sizeof(buff_dir) : last - BasePath;
|
||||
if (len > 0)
|
||||
{
|
||||
strncpy(buff_dir, BasePath, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
buff_dir[0] = DIRECTORY_DELIMITER;
|
||||
buff_dir[1] = '\0';
|
||||
}
|
||||
strncpy(buff_name, last + 1, sizeof(buff_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(buff_dir, BasePath, sizeof(buff_dir));
|
||||
}
|
||||
char * ext = strrchr(buff_name, '.');
|
||||
if (ext != NULL)
|
||||
{
|
||||
strncpy(buff_ext, ext + 1, sizeof(buff_ext));
|
||||
*ext = '\0';
|
||||
}
|
||||
|
||||
if (pDrive)
|
||||
{
|
||||
|
@ -334,24 +364,7 @@ void CPath::GetComponents(std::string* pDrive, std::string* pDirectory, std::str
|
|||
{
|
||||
*pExtension = buff_ext;
|
||||
}
|
||||
|
||||
// DOS's _splitpath returns "d:", we return "d"
|
||||
if (pDrive)
|
||||
{
|
||||
StripTrailingChar(*pDrive, DRIVE_DELIMITER);
|
||||
}
|
||||
|
||||
// DOS's _splitpath returns "\dir\subdir\", we return "\dir\subdir"
|
||||
if (pDirectory)
|
||||
{
|
||||
StripTrailingBackslash(*pDirectory);
|
||||
}
|
||||
|
||||
// DOS's _splitpath returns ".ext", we return "ext"
|
||||
if (pExtension)
|
||||
{
|
||||
StripLeadingChar(*pExtension, EXTENSION_DELIMITER);
|
||||
}
|
||||
WriteTrace(TracePath, TraceDebug, "Done (dir: \"%s\" name: \"%s\" ext: \"%s\")", buff_dir, buff_name, buff_ext);
|
||||
}
|
||||
#else
|
||||
void CPath::GetComponents(std::string* pDirectory, std::string* pName, std::string* pExtension) const
|
||||
|
@ -423,8 +436,8 @@ void CPath::GetDriveDirectory(std::string& rDriveDirectory) const
|
|||
if (!Drive.empty())
|
||||
{
|
||||
rDriveDirectory += DRIVE_DELIMITER;
|
||||
rDriveDirectory += Directory;
|
||||
}
|
||||
rDriveDirectory += Directory;
|
||||
}
|
||||
|
||||
std::string CPath::GetDriveDirectory(void) const
|
||||
|
@ -1438,6 +1451,53 @@ bool CPath::ChangeDirectory()
|
|||
#endif
|
||||
}
|
||||
|
||||
void CPath::NormalizePath(CPath BaseDir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
stdstr Directory = BaseDir.GetDriveDirectory();
|
||||
#else
|
||||
stdstr Directory = BaseDir.GetDirectory();
|
||||
#endif
|
||||
bool Changed = false;
|
||||
if (IsRelative())
|
||||
{
|
||||
EnsureTrailingBackslash(Directory);
|
||||
Directory += GetDirectory();
|
||||
Changed = true;
|
||||
}
|
||||
strvector Parts = Directory.Tokenize(DIRECTORY_DELIMITER);
|
||||
strvector NormalizesParts;
|
||||
for (strvector::const_iterator itr = Parts.begin(); itr != Parts.end(); itr++)
|
||||
{
|
||||
if (*itr == ".")
|
||||
{
|
||||
Changed = true;
|
||||
}
|
||||
else if (*itr == "..")
|
||||
{
|
||||
NormalizesParts.pop_back();
|
||||
Changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NormalizesParts.push_back(*itr);
|
||||
}
|
||||
}
|
||||
if (Changed)
|
||||
{
|
||||
Directory.clear();
|
||||
for (strvector::const_iterator itr = NormalizesParts.begin(); itr != NormalizesParts.end(); itr++)
|
||||
{
|
||||
Directory += *itr + DIRECTORY_DELIMITER;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
SetDriveDirectory(Directory.c_str());
|
||||
#else
|
||||
SetDirectory(Directory.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Pre : If bCreateIntermediates is TRUE, create all eventually
|
||||
// missing parent directories too
|
||||
|
|
|
@ -7,7 +7,7 @@ class CPath
|
|||
//Enums
|
||||
public:
|
||||
|
||||
enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 };
|
||||
enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 };
|
||||
#ifdef _WIN32
|
||||
enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 2 };
|
||||
enum DIR_MODULE_FILE { MODULE_FILE = 3 };
|
||||
|
@ -22,7 +22,6 @@ public:
|
|||
|
||||
//Attributes
|
||||
private:
|
||||
|
||||
std::string m_strPath;
|
||||
#ifdef _WIN32
|
||||
void * m_hFindFile;
|
||||
|
@ -119,15 +118,16 @@ public:
|
|||
bool DirectoryExists() const;
|
||||
|
||||
//File Information
|
||||
bool IsFile() const { return !IsDirectory(); }
|
||||
bool Exists() const;
|
||||
bool IsFile() const { return !IsDirectory(); }
|
||||
bool Exists() const;
|
||||
#ifdef _WIN32
|
||||
bool SelectFile(void * hwndOwner, const char * InitialDir, const char * FileFilter, bool FileMustExist);
|
||||
bool SelectFile(void * hwndOwner, const char * InitialDir, const char * FileFilter, bool FileMustExist);
|
||||
#endif
|
||||
|
||||
//Directory operations
|
||||
bool DirectoryCreate(bool bCreateIntermediates = true);
|
||||
bool ChangeDirectory();
|
||||
void NormalizePath(CPath BaseDir);
|
||||
|
||||
//File operations
|
||||
bool Delete(bool bEvenIfReadOnly = true) const;
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include "ConfigUI.h"
|
||||
#include "SettingsID.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
void SetTimerResolution ( void );
|
||||
#endif
|
||||
|
||||
/* Read header for type definition */
|
||||
AUDIO_INFO g_AudioInfo;
|
||||
|
||||
|
@ -51,6 +55,9 @@ void PluginInit(void)
|
|||
SetupTrace();
|
||||
SetupAudioSettings();
|
||||
StartTrace();
|
||||
#ifdef _WIN32
|
||||
SetTimerResolution();
|
||||
#endif
|
||||
g_PluginInit = true;
|
||||
}
|
||||
|
||||
|
@ -78,14 +85,16 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
|
|||
WriteTrace(TraceAudioInterface, TraceNotice, "Unknown/reserved bits in AI_DACRATE_REG set. 0x%08X", *g_AudioInfo.AI_DACRATE_REG);
|
||||
}
|
||||
|
||||
uint32_t video_clock = 0;
|
||||
uint32_t video_clock = 0; int32_t BufferSize = 0;
|
||||
double audio_clock = 0; double framerate = (30 / 1.001);
|
||||
|
||||
switch (SystemType)
|
||||
{
|
||||
case SYSTEM_NTSC: video_clock = 48681812; break;
|
||||
case SYSTEM_PAL: video_clock = 49656530; break;
|
||||
case SYSTEM_PAL: video_clock = 49656530; framerate = 25; break;
|
||||
case SYSTEM_MPAL: video_clock = 48628316; break;
|
||||
}
|
||||
uint32_t Frequency = video_clock / (g_Dacrate + 1);
|
||||
uint32_t Frequency = (video_clock / (g_Dacrate + 1));
|
||||
|
||||
if (Frequency < 4000)
|
||||
{
|
||||
|
@ -94,28 +103,16 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
|
|||
}
|
||||
else
|
||||
{
|
||||
int32_t BufferSize = 0; double audio_clock = 0; double framerate = 0;
|
||||
|
||||
if (g_settings->FPSBuffer() == true)
|
||||
if (g_settings->FPSBuffer() == false && SystemType != SYSTEM_PAL)
|
||||
{
|
||||
framerate = 59.94004;
|
||||
if (SystemType == SYSTEM_PAL) { framerate = 50; }
|
||||
framerate = 30.475; // Needed for Body Harvest (U)
|
||||
}
|
||||
else
|
||||
if (g_settings->TinyBuffer() == false)
|
||||
{
|
||||
framerate = 64;
|
||||
if (SystemType == SYSTEM_PAL) { framerate = 53.33333; }
|
||||
framerate = (framerate / 2);
|
||||
}
|
||||
if (g_settings->TinyBuffer() == true)
|
||||
{
|
||||
audio_clock = ((video_clock / framerate) * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_clock = ((video_clock / framerate) * 4);
|
||||
}
|
||||
|
||||
BufferSize = (int32_t)audio_clock / (g_Dacrate) + 1 & ~0x1;
|
||||
audio_clock = (video_clock / framerate);
|
||||
BufferSize = (int32_t)(audio_clock / (g_Dacrate + 1)) + 1 & ~0x1;
|
||||
g_SoundDriver->AI_SetFrequency(Frequency, BufferSize);
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +162,14 @@ EXPORT void CALL AiUpdate(int32_t Wait)
|
|||
EXPORT void CALL CloseDLL(void)
|
||||
{
|
||||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||
if (g_SoundDriver != NULL)
|
||||
{
|
||||
g_SoundDriver->AI_Shutdown();
|
||||
delete g_SoundDriver;
|
||||
g_SoundDriver = NULL;
|
||||
}
|
||||
CleanupAudioSettings();
|
||||
StopTrace();
|
||||
}
|
||||
|
||||
EXPORT void CALL DllAbout(void * /*hParent*/)
|
||||
|
@ -249,6 +253,10 @@ EXPORT void CALL ProcessAList(void)
|
|||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
extern "C" void UseUnregisteredSetting(int /*SettingID*/)
|
||||
{
|
||||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||
|
@ -256,3 +264,17 @@ extern "C" void UseUnregisteredSetting(int /*SettingID*/)
|
|||
DebugBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void SetTimerResolution(void)
|
||||
{
|
||||
HMODULE hMod = GetModuleHandle("ntdll.dll");
|
||||
if (hMod != NULL)
|
||||
{
|
||||
typedef LONG(NTAPI* tNtSetTimerResolution)(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
|
||||
tNtSetTimerResolution NtSetTimerResolution = (tNtSetTimerResolution)GetProcAddress(hMod, "NtSetTimerResolution");
|
||||
ULONG CurrentResolution = 0;
|
||||
NtSetTimerResolution(5000, TRUE, &CurrentResolution);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@ CSettings * g_settings = NULL;
|
|||
|
||||
CSettings::CSettings() :
|
||||
m_Set_EnableAudio(0),
|
||||
m_Set_FixedAudio(0),
|
||||
m_Set_SyncAudio(0),
|
||||
m_Set_FullSpeed(0),
|
||||
m_Set_LimitFPS(0),
|
||||
|
@ -31,6 +32,7 @@ CSettings::CSettings() :
|
|||
m_Volume(100),
|
||||
m_TinyBuffer(true),
|
||||
m_FPSBuffer(true),
|
||||
m_FixedAudio(false),
|
||||
m_SyncAudio(false),
|
||||
m_FullSpeed(true)
|
||||
{
|
||||
|
@ -42,6 +44,7 @@ CSettings::CSettings() :
|
|||
if (m_Set_basic_mode != 0) { SettingsRegisterChange(true, m_Set_basic_mode, this, stSettingsChanged); }
|
||||
if (m_Set_debugger != 0) { SettingsRegisterChange(true, m_Set_debugger, this, stSettingsChanged); }
|
||||
if (m_Set_log_flush != 0) { SettingsRegisterChange(true, m_Set_log_flush, this, stSettingsChanged); }
|
||||
if (m_Set_FixedAudio != 0) { SettingsRegisterChange(true, m_Set_FixedAudio, this, stSettingsChanged); }
|
||||
if (m_Set_SyncAudio != 0) { SettingsRegisterChange(true, m_Set_SyncAudio, this, stSettingsChanged); }
|
||||
if (m_Set_FullSpeed != 0) { SettingsRegisterChange(true, m_Set_FullSpeed, this, stSettingsChanged); }
|
||||
if (m_Set_LimitFPS != 0) { SettingsRegisterChange(true, m_Set_LimitFPS, this, stSettingsChanged); }
|
||||
|
@ -61,6 +64,7 @@ CSettings::~CSettings()
|
|||
if (m_Set_basic_mode != 0) { SettingsUnregisterChange(true, m_Set_basic_mode, this, stSettingsChanged); }
|
||||
if (m_Set_debugger != 0) { SettingsUnregisterChange(true, m_Set_debugger, this, stSettingsChanged); }
|
||||
if (m_Set_log_flush != 0) { SettingsUnregisterChange(true, m_Set_log_flush, this, stSettingsChanged); }
|
||||
if (m_Set_FixedAudio != 0) { SettingsUnregisterChange(true, m_Set_FixedAudio, this, stSettingsChanged); }
|
||||
if (m_Set_SyncAudio != 0) { SettingsUnregisterChange(true, m_Set_SyncAudio, this, stSettingsChanged); }
|
||||
if (m_Set_FullSpeed != 0) { SettingsUnregisterChange(true, m_Set_FullSpeed, this, stSettingsChanged); }
|
||||
if (m_Set_LimitFPS != 0) { SettingsUnregisterChange(true, m_Set_LimitFPS, this, stSettingsChanged); }
|
||||
|
@ -78,6 +82,7 @@ void CSettings::RegisterSettings(void)
|
|||
{
|
||||
SetModuleName("default");
|
||||
m_Set_EnableAudio = FindSystemSettingId("Enable Audio");
|
||||
m_Set_FixedAudio = FindSystemSettingId("Fixed Audio");
|
||||
m_Set_SyncAudio = FindSystemSettingId("Sync Audio");
|
||||
m_Set_FullSpeed = FindSystemSettingId("Full Speed");
|
||||
m_Set_LimitFPS = FindSystemSettingId("Limit FPS");
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
void LogLevelChanged(void);
|
||||
|
||||
short m_Set_EnableAudio;
|
||||
short m_Set_FixedAudio;
|
||||
short m_Set_SyncAudio;
|
||||
short m_Set_FullSpeed;
|
||||
short m_Set_LimitFPS;
|
||||
|
@ -61,6 +62,7 @@ private:
|
|||
uint32_t m_Volume;
|
||||
bool m_TinyBuffer;
|
||||
bool m_FPSBuffer;
|
||||
bool m_FixedAudio;
|
||||
bool m_SyncAudio;
|
||||
bool m_FullSpeed;
|
||||
};
|
||||
|
|
|
@ -79,4 +79,14 @@ void StartTrace(void)
|
|||
}
|
||||
g_LogFile = new CTraceFileLog(LogFilePath, g_settings->FlushLogs(), CLog::Log_New, 500);
|
||||
TraceAddModule(g_LogFile);
|
||||
}
|
||||
}
|
||||
|
||||
void StopTrace(void)
|
||||
{
|
||||
if (g_LogFile)
|
||||
{
|
||||
TraceRemoveModule(g_LogFile);
|
||||
delete g_LogFile;
|
||||
g_LogFile = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,3 +22,4 @@ enum TraceModuleAndroidAudio
|
|||
|
||||
void SetupTrace(void);
|
||||
void StartTrace(void);
|
||||
void StopTrace(void);
|
||||
|
|
|
@ -229,7 +229,8 @@ enum LanguageStringID
|
|||
TAB_ROMNOTES = 408,
|
||||
TAB_SHORTCUTS = 409,
|
||||
TAB_ROMSTATUS = 410,
|
||||
TAB_RECOMPILER = 411, //Added in 1.7.0.50
|
||||
TAB_RECOMPILER = 411,
|
||||
TAB_DEFAULTS = 412,
|
||||
|
||||
//Plugin Dialog
|
||||
PLUG_ABOUT = 420,
|
||||
|
@ -385,6 +386,7 @@ enum LanguageStringID
|
|||
STR_FR_DLS = 701,
|
||||
STR_FR_PERCENT = 702,
|
||||
STR_FR_DLS_VIS = 703,
|
||||
STR_FR_NONE = 704,
|
||||
|
||||
// Increase speed
|
||||
STR_INSREASE_SPEED = 710,
|
||||
|
|
|
@ -198,6 +198,7 @@ void CLanguage::LoadDefaultStrings(void)
|
|||
DEF_STR(TAB_SHORTCUTS, "Keyboard Shortcuts");
|
||||
DEF_STR(TAB_ROMSTATUS, "Status");
|
||||
DEF_STR(TAB_RECOMPILER, "Recompiler");
|
||||
DEF_STR(TAB_DEFAULTS, "Defaults");
|
||||
|
||||
//Plugin Dialog
|
||||
DEF_STR(PLUG_ABOUT, "About");
|
||||
|
@ -352,7 +353,8 @@ void CLanguage::LoadDefaultStrings(void)
|
|||
DEF_STR(STR_FR_VIS, "Vertical interrupts per second");
|
||||
DEF_STR(STR_FR_DLS, "Display lists per second");
|
||||
DEF_STR(STR_FR_PERCENT, "Percentage of full speed");
|
||||
DEF_STR(STR_FR_DLS_VIS, "VI/s & DL/s");
|
||||
DEF_STR(STR_FR_DLS_VIS, "VI/s & DL/s");
|
||||
DEF_STR(STR_FR_NONE, "None");
|
||||
|
||||
// Increase speed
|
||||
DEF_STR(STR_INSREASE_SPEED, "Increase Game Speed");
|
||||
|
|
|
@ -148,6 +148,9 @@ void CEeprom::LoadEeprom()
|
|||
{
|
||||
FileName.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
FileName.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
|
||||
if (!FileName.DirectoryExists())
|
||||
{
|
||||
|
|
|
@ -125,6 +125,9 @@ bool CFlashram::LoadFlashram()
|
|||
{
|
||||
FileName.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
FileName.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
|
||||
if (!FileName.DirectoryExists())
|
||||
{
|
||||
|
@ -133,11 +136,7 @@ bool CFlashram::LoadFlashram()
|
|||
|
||||
if (!m_File.Open(FileName, (m_ReadOnly ? CFileBase::modeRead : CFileBase::modeReadWrite) | CFileBase::modeNoTruncate | CFileBase::modeCreate))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (const char *)FileName, m_ReadOnly, GetLastError());
|
||||
#else
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d", (const char *)FileName, m_ReadOnly);
|
||||
#endif
|
||||
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_FLASH));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ void CMempak::LoadMempak(int32_t Control, bool Create)
|
|||
{
|
||||
MempakPath.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
MempakPath.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
|
||||
if (!Create && !MempakPath.Exists())
|
||||
{
|
||||
|
|
|
@ -28,6 +28,9 @@ bool CSram::LoadSram()
|
|||
{
|
||||
FileName.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
FileName.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
|
||||
if (!FileName.DirectoryExists())
|
||||
{
|
||||
|
@ -36,11 +39,7 @@ bool CSram::LoadSram()
|
|||
|
||||
if (!m_File.Open(FileName, (m_ReadOnly ? CFileBase::modeRead : CFileBase::modeReadWrite) | CFileBase::modeNoTruncate | CFileBase::modeCreate))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (const char *)FileName, m_ReadOnly, GetLastError());
|
||||
#else
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d", (const char *)FileName, m_ReadOnly);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
m_File.SeekToBegin();
|
||||
|
|
|
@ -1547,6 +1547,9 @@ bool CN64System::SaveState()
|
|||
{
|
||||
SaveFile.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
SaveFile.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
SaveFile.SetName(g_Settings->LoadStringVal(Rdb_GoodName).c_str());
|
||||
g_Settings->SaveDword(Game_LastSaveSlot, g_Settings->LoadDword(Game_CurrentSaveState));
|
||||
}
|
||||
|
@ -1702,6 +1705,9 @@ bool CN64System::LoadState()
|
|||
{
|
||||
FileName.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
FileName.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
#endif
|
||||
if (g_Settings->LoadDword(Game_CurrentSaveState) != 0)
|
||||
{
|
||||
FileName.SetNameExtension(stdstr_f("%s.pj%d", g_Settings->LoadStringVal(Rdb_GoodName).c_str(), g_Settings->LoadDword(Game_CurrentSaveState)).c_str());
|
||||
|
|
|
@ -45,7 +45,7 @@ enum CPU_TYPE
|
|||
|
||||
enum FRAMERATE_TYPE
|
||||
{
|
||||
FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2, FR_VIs_DLs = 3,
|
||||
FR_VIs = 0, FR_DLs = 1, FR_PERCENT = 2, FR_VIs_DLs = 3, FR_None = 4,
|
||||
};
|
||||
|
||||
enum SAVE_CHIP_TYPE
|
||||
|
|
|
@ -230,11 +230,11 @@ void CPlugin::Close(RenderWindow * Render)
|
|||
{
|
||||
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Start", PluginType());
|
||||
RomClose(Render);
|
||||
if (m_Initialized)
|
||||
{
|
||||
CloseDLL();
|
||||
m_Initialized = false;
|
||||
}
|
||||
m_Initialized = false;
|
||||
if (CloseDLL != NULL)
|
||||
{
|
||||
CloseDLL();
|
||||
}
|
||||
WriteTrace(PluginTraceType(), TraceDebug, "(%s): Done", PluginType());
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#pragma once
|
||||
#include <Common/path.h>
|
||||
#include <Common/IniFileClass.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/md5.h>
|
||||
#include <Common/Thread.h>
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
|
|
@ -90,44 +90,54 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Cmd_RomFile, new CSettingTypeTempString(""));
|
||||
|
||||
//Support Files
|
||||
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("", "ConfigFile", SupportFile_SettingsDefault));
|
||||
AddHandler(SupportFile_Settings, new CSettingTypeApplicationPath("Settings", "ConfigFile", SupportFile_SettingsDefault));
|
||||
AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config", "Project64.cfg"));
|
||||
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("", "RomDatabase", SupportFile_RomDatabaseDefault));
|
||||
AddHandler(SupportFile_RomDatabase, new CSettingTypeApplicationPath("Settings", "RomDatabase", SupportFile_RomDatabaseDefault));
|
||||
AddHandler(SupportFile_RomDatabaseDefault, new CSettingTypeRelativePath("Config", "Project64.rdb"));
|
||||
AddHandler(SupportFile_VideoRDB, new CSettingTypeApplicationPath("", "VideoRDB", SupportFile_VideoRDBDefault));
|
||||
AddHandler(SupportFile_VideoRDB, new CSettingTypeApplicationPath("Settings", "VideoRDB", SupportFile_VideoRDBDefault));
|
||||
AddHandler(SupportFile_VideoRDBDefault, new CSettingTypeRelativePath("Config", "Video.rdb"));
|
||||
AddHandler(SupportFile_AudioRDB, new CSettingTypeApplicationPath("", "AudioRDB", SupportFile_AudioRDBDefault));
|
||||
AddHandler(SupportFile_AudioRDB, new CSettingTypeApplicationPath("Settings", "AudioRDB", SupportFile_AudioRDBDefault));
|
||||
AddHandler(SupportFile_AudioRDBDefault, new CSettingTypeRelativePath("Config", "Audio.rdb"));
|
||||
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("", "Cheats", SupportFile_CheatsDefault));
|
||||
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("Settings", "Cheats", SupportFile_CheatsDefault));
|
||||
AddHandler(SupportFile_CheatsDefault, new CSettingTypeRelativePath("Config", "Project64.cht"));
|
||||
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("", "Notes", SupportFile_NotesDefault));
|
||||
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("Settings", "Notes", SupportFile_NotesDefault));
|
||||
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config", "Project64.rdn"));
|
||||
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("", "ExtInfo", SupportFile_ExtInfoDefault));
|
||||
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("Settings", "ExtInfo", SupportFile_ExtInfoDefault));
|
||||
AddHandler(SupportFile_ExtInfoDefault, new CSettingTypeRelativePath("Config", "Project64.rdx"));
|
||||
|
||||
//Settings location
|
||||
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_AutoStart, new CSettingTypeApplication("", "Auto Start", (uint32_t)true));
|
||||
AddHandler(Setting_AutoZipInstantSave, new CSettingTypeApplication("", "Auto Zip Saves", (uint32_t)true));
|
||||
AddHandler(Setting_EraseGameDefaults, new CSettingTypeApplication("", "Erase on default", (uint32_t)true));
|
||||
AddHandler(Setting_CheckEmuRunning, new CSettingTypeApplication("", "Check Running", (uint32_t)true));
|
||||
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("", "Force Interpreter CPU", false));
|
||||
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("", "Fixed Rdram Address", (uint32_t)0));
|
||||
AddHandler(Setting_RdbEditor, new CSettingTypeApplication("Settings", "Rdb Editor", false));
|
||||
AddHandler(Setting_CN64TimeCritical, new CSettingTypeApplication("Settings", "CN64TimeCritical", false));
|
||||
AddHandler(Setting_AutoStart, new CSettingTypeApplication("Settings", "Auto Start", (uint32_t)true));
|
||||
AddHandler(Setting_AutoZipInstantSave, new CSettingTypeApplication("Settings", "Auto Zip Saves", (uint32_t)true));
|
||||
AddHandler(Setting_EraseGameDefaults, new CSettingTypeApplication("Settings", "Erase on default", (uint32_t)true));
|
||||
AddHandler(Setting_CheckEmuRunning, new CSettingTypeApplication("Settings", "Check Running", (uint32_t)true));
|
||||
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", false));
|
||||
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0));
|
||||
|
||||
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("", "Remember Cheats", (uint32_t)false));
|
||||
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (uint32_t)false));
|
||||
#ifdef ANDROID
|
||||
AddHandler(Setting_UniqueSaveDir, new CSettingTypeTempBool(true));
|
||||
#else
|
||||
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("", "Unique Game Dir", (uint32_t)false));
|
||||
AddHandler(Setting_UniqueSaveDir, new CSettingTypeApplication("Settings", "Unique Game Dir", (uint32_t)false));
|
||||
#endif
|
||||
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("", "Current Language", ""));
|
||||
AddHandler(Setting_CurrentLanguage, new CSettingTypeApplication("Settings", "Current Language", ""));
|
||||
AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false));
|
||||
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", ""));
|
||||
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));
|
||||
|
||||
AddHandler(Default_RDRamSize, new CSettingTypeApplication("Defaults", "RDRAM Size", 0x400000u));
|
||||
AddHandler(Default_UseHleGfx, new CSettingTypeApplication("Defaults", "HLE GFX", true));
|
||||
AddHandler(Default_UseTlb, new CSettingTypeApplication("Defaults", "Use TLB", true));
|
||||
AddHandler(Default_ViRefreshRate, new CSettingTypeApplication("Defaults", "ViRefresh", 1500u));
|
||||
AddHandler(Default_AiCountPerBytes, new CSettingTypeApplication("Defaults", "AiCountPerBytes", 0u));
|
||||
AddHandler(Default_CounterFactor, new CSettingTypeApplication("Defaults", "Counter Factor", 2u));
|
||||
AddHandler(Default_32Bit, new CSettingTypeApplication("Defaults", "32bit", true));
|
||||
AddHandler(Default_SyncViaAudio, new CSettingTypeApplication("Defaults", "Audio-Sync Audio", true));
|
||||
AddHandler(Default_FixedAudio, new CSettingTypeApplication("Defaults", "Audio-Fixed Audio", true));
|
||||
|
||||
AddHandler(Rdb_GoodName, new CSettingTypeRomDatabase("Good Name", Game_GameName));
|
||||
AddHandler(Rdb_SaveChip, new CSettingTypeRDBSaveChip("Save Type", (uint32_t)SaveChip_Auto));
|
||||
#ifdef _DEBUG
|
||||
|
@ -135,15 +145,15 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
#else
|
||||
AddHandler(Rdb_CpuType, new CSettingTypeRDBCpuType("CPU Type", CPU_Recompiler));
|
||||
#endif
|
||||
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", 0x400000));
|
||||
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", (uint32_t)2));
|
||||
AddHandler(Rdb_UseTlb, new CSettingTypeRDBYesNo("Use TLB", true));
|
||||
AddHandler(Rdb_RDRamSize, new CSettingTypeRDBRDRamSize("RDRAM Size", Default_RDRamSize));
|
||||
AddHandler(Rdb_CounterFactor, new CSettingTypeRomDatabase("Counter Factor", Default_CounterFactor));
|
||||
AddHandler(Rdb_UseTlb, new CSettingTypeRDBYesNo("Use TLB", Default_UseTlb));
|
||||
AddHandler(Rdb_DelayDP, new CSettingTypeRDBYesNo("Delay DP", true));
|
||||
AddHandler(Rdb_DelaySi, new CSettingTypeRDBYesNo("Delay SI", false));
|
||||
AddHandler(Rdb_32Bit, new CSettingTypeRDBYesNo("32bit", true));
|
||||
AddHandler(Rdb_32Bit, new CSettingTypeRDBYesNo("32bit", Default_32Bit));
|
||||
AddHandler(Rdb_FastSP, new CSettingTypeRDBYesNo("Fast SP", true));
|
||||
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio", true));
|
||||
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Audio-Sync Audio", true));
|
||||
AddHandler(Rdb_FixedAudio, new CSettingTypeRomDatabase("Audio-Fixed Audio", Default_FixedAudio));
|
||||
AddHandler(Rdb_SyncViaAudio, new CSettingTypeRomDatabase("Audio-Sync Audio", Default_SyncViaAudio));
|
||||
AddHandler(Rdb_RspAudioSignal, new CSettingTypeRDBYesNo("Audio Signal", false));
|
||||
AddHandler(Rdb_TLB_VAddrStart, new CSettingTypeRomDatabase("TLB: Vaddr Start", (uint32_t)0));
|
||||
AddHandler(Rdb_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len", (uint32_t)0));
|
||||
|
@ -163,8 +173,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Rdb_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC", true));
|
||||
AddHandler(Rdb_GameCheatFix, new CSettingTypeRomDatabaseIndex("Cheat", "", ""));
|
||||
AddHandler(Rdb_GameCheatFixPlugin, new CSettingTypeRomDatabaseIndex("CheatPlugin", "", ""));
|
||||
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh", (uint32_t)1500));
|
||||
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes", (uint32_t)0));
|
||||
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh", Default_ViRefreshRate));
|
||||
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes", Default_AiCountPerBytes));
|
||||
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false));
|
||||
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false));
|
||||
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false));
|
||||
|
@ -229,13 +239,13 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Game_FullSpeed, new CSettingTypeTempBool(true, "Full Speed"));
|
||||
|
||||
//User Interface
|
||||
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("", "Display CPU Usage", (uint32_t)false));
|
||||
AddHandler(UserInterface_ShowCPUPer, new CSettingTypeApplication("Settings", "Display CPU Usage", (uint32_t)false));
|
||||
#ifdef ANDROID
|
||||
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("", "Display Frame Rate", (uint32_t)false));
|
||||
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("Settings", "Display Frame Rate", (uint32_t)false));
|
||||
#else
|
||||
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("", "Display Frame Rate", (uint32_t)true));
|
||||
AddHandler(UserInterface_DisplayFrameRate, new CSettingTypeApplication("Settings", "Display Frame Rate", (uint32_t)true));
|
||||
#endif
|
||||
AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("", "Frame Rate Display Type", (uint32_t)FR_VIs));
|
||||
AddHandler(UserInterface_FrameDisplayType, new CSettingTypeApplication("Settings", "Frame Rate Display Type", (uint32_t)FR_None));
|
||||
AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory("Dir:Plugin", Directory_PluginInitial, Directory_PluginSelected, Directory_PluginUseSelected, Directory_Plugin));
|
||||
#ifndef _M_X64
|
||||
AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin", ""));
|
||||
|
@ -285,13 +295,13 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Directory_LogUseSelected, new CSettingTypeApplication("Log Directory", "Use Selected", false));
|
||||
|
||||
AddHandler(RomList_RomListCacheDefault, new CSettingTypeRelativePath("Config", "Project64.cache3"));
|
||||
AddHandler(RomList_RomListCache, new CSettingTypeApplicationPath("", "RomListCache", RomList_RomListCacheDefault));
|
||||
AddHandler(RomList_RomListCache, new CSettingTypeApplicationPath("Settings", "RomListCache", RomList_RomListCacheDefault));
|
||||
AddHandler(RomList_GameDir, new CSettingTypeSelectedDirectory("Dir:Game", RomList_GameDirInitial, RomList_GameDirSelected, RomList_GameDirUseSelected, RomList_GameDir));
|
||||
AddHandler(RomList_GameDirInitial, new CSettingTypeRelativePath("Game Directory", ""));
|
||||
AddHandler(RomList_GameDirSelected, new CSettingTypeApplication("Game Directory", "Directory", RomList_GameDirInitial));
|
||||
AddHandler(RomList_GameDirUseSelected, new CSettingTypeApplication("Game Directory", "Use Selected", false));
|
||||
AddHandler(RomList_GameDirRecursive, new CSettingTypeApplication("Game Directory", "Recursive", false));
|
||||
AddHandler(RomList_7zipCache, new CSettingTypeApplicationPath("", "7zipCache", RomList_7zipCacheDefault));
|
||||
AddHandler(RomList_7zipCache, new CSettingTypeApplicationPath("Settings", "7zipCache", RomList_7zipCacheDefault));
|
||||
AddHandler(RomList_7zipCacheDefault, new CSettingTypeRelativePath("Config", "Project64.zcache"));
|
||||
|
||||
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
|
||||
|
@ -303,8 +313,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60));
|
||||
AddHandler(GameRunning_InReset, new CSettingTypeTempBool(false));
|
||||
|
||||
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("", "Basic Mode", (uint32_t)true));
|
||||
AddHandler(File_DiskIPLPath, new CSettingTypeApplicationPath("", "Disk IPL ROM Path", Default_None));
|
||||
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("Settings", "Basic Mode", (uint32_t)true));
|
||||
AddHandler(File_DiskIPLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL ROM Path", Default_None));
|
||||
|
||||
AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger", "Debugger", false));
|
||||
AddHandler(Debugger_ShowTLBMisses, new CSettingTypeApplication("Debugger", "Show TLB Misses", false));
|
||||
|
@ -352,11 +362,12 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
//Plugin
|
||||
#ifdef _WIN32
|
||||
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "RSP\\RSP 1.7.dll"));
|
||||
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "GFX\\Jabo_Direct3D8.dll"));
|
||||
#ifdef _DEBUG
|
||||
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio_d.dll"));
|
||||
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "GFX\\Project64-Video_d.dll"));
|
||||
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio_d.dll"));
|
||||
#else
|
||||
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio.dll"));
|
||||
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "GFX\\Project64-Video.dll"));
|
||||
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "Audio\\Project64-Audio.dll"));
|
||||
#endif
|
||||
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "Input\\PJ64_NRage.dll"));
|
||||
#else
|
||||
|
@ -370,7 +381,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Plugin_AUDIO_CurVer, new CSettingTypeApplication("Plugin", "Audio Dll Ver", ""));
|
||||
AddHandler(Plugin_CONT_CurVer, new CSettingTypeApplication("Plugin", "Controller Dll Ver", ""));
|
||||
|
||||
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true));
|
||||
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", Default_UseHleGfx));
|
||||
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false));
|
||||
AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true));
|
||||
|
||||
|
@ -644,7 +655,7 @@ bool CSettings::Initialize(const char * BaseDirectory, const char * AppName)
|
|||
{
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
||||
AddHowToHandleSetting(BaseDirectory);
|
||||
CSettingTypeApplication::Initialize(AppName);
|
||||
CSettingTypeApplication::Initialize();
|
||||
CSettingTypeRomDatabase::Initialize();
|
||||
CSettingTypeGame::Initialize();
|
||||
CSettingTypeCheats::Initialize();
|
||||
|
@ -1301,4 +1312,4 @@ void CSettings::UnregisterChangeCB(SettingID Type, void * Data, SettingChangedFu
|
|||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,32 +25,32 @@ CSettingTypeApplication::CSettingTypeApplication(const char * Section, const cha
|
|||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue) :
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ bool CSettingTypeApplication::IsSettingSet(void) const
|
|||
return m_SettingsIniFile ? m_SettingsIniFile->EntryExists(SectionName(), m_KeyNameIdex.c_str()) : false;
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Initialize(const char * /*AppName*/)
|
||||
void CSettingTypeApplication::Initialize(void)
|
||||
{
|
||||
WriteTrace(TraceAppInit, TraceDebug, "Start");
|
||||
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(), "");
|
||||
|
@ -91,17 +91,14 @@ void CSettingTypeApplication::Initialize(const char * /*AppName*/)
|
|||
{
|
||||
delete m_SettingsIniFile;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(), "");
|
||||
#else
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
|
||||
#endif
|
||||
if (!SettingsDir.DirectoryExists())
|
||||
CPath SettingPath(SettingsFile.c_str());
|
||||
SettingPath.NormalizePath(BaseDir);
|
||||
if (!SettingPath.DirectoryExists())
|
||||
{
|
||||
SettingsDir.DirectoryCreate();
|
||||
SettingPath.DirectoryCreate();
|
||||
}
|
||||
|
||||
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
|
||||
m_SettingsIniFile = new CIniFile(SettingPath);
|
||||
}
|
||||
|
||||
m_SettingsIniFile->SetAutoFlush(false);
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual void Delete(uint32_t Index);
|
||||
|
||||
// Initialize this class to use ini or registry
|
||||
static void Initialize(const char * AppName);
|
||||
static void Initialize(void);
|
||||
static void CleanUp(void);
|
||||
static void Flush(void);
|
||||
static void ResetAll(void);
|
||||
|
|
|
@ -45,7 +45,7 @@ bool CSettingTypeRDBRDRamSize::Load (uint32_t Index, uint32_t & Value ) const
|
|||
LoadDefault(Index,ulValue);
|
||||
}
|
||||
Value = 0x400000;
|
||||
if (ulValue == 8 || !existsInRdb) //default to 8MB if ROM is not in the RDB
|
||||
if (ulValue == 8 || ulValue == 0x800000 || !existsInRdb) //default to 8MB if ROM is not in the RDB
|
||||
{
|
||||
Value = 0x800000;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void CSettingTypeRDBRDRamSize::LoadDefault (uint32_t /*Index*/, bool & /*Value*/
|
|||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault (uint32_t /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
Value = m_DefaultSetting == Default_Constant ? m_DefaultValue : g_Settings->LoadDword(m_DefaultSetting);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault (uint32_t /*Index*/, std::string & /*Value*/ ) const
|
||||
|
|
|
@ -135,34 +135,44 @@ void CSettingTypeRomDatabase::GameChanged(void * /*Data */)
|
|||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load(uint32_t & Value) const
|
||||
{
|
||||
bool bRes = false;
|
||||
if (m_VideoSetting)
|
||||
{
|
||||
bRes = m_VideoIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
else if (m_AudioSetting)
|
||||
{
|
||||
bRes = m_AudioIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load(uint32_t Index, bool & Value) const
|
||||
{
|
||||
uint32_t temp_value = Value;
|
||||
bool bRes = Load(Index, temp_value);
|
||||
Value = temp_value != 0;
|
||||
return bRes;
|
||||
if (Load(temp_value))
|
||||
{
|
||||
Value = temp_value != 0;
|
||||
return true;
|
||||
}
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load(uint32_t Index, uint32_t & Value) const
|
||||
{
|
||||
bool bRes = false;
|
||||
if (m_VideoSetting)
|
||||
{
|
||||
bRes = m_VideoIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
else if (m_AudioSetting)
|
||||
{
|
||||
bRes = m_AudioIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetNumber(Section(), m_KeyName.c_str(), Value, Value);
|
||||
}
|
||||
if (!bRes)
|
||||
if (!Load(Value))
|
||||
{
|
||||
LoadDefault(Index, Value);
|
||||
}
|
||||
return bRes;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load(uint32_t Index, std::string & Value) const
|
||||
|
@ -211,13 +221,7 @@ void CSettingTypeRomDatabase::LoadDefault(uint32_t /*Index*/, uint32_t & Value)
|
|||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
else {
|
||||
g_Settings->LoadDword(m_DefaultSetting, Value);
|
||||
}
|
||||
Value = m_DefaultSetting == Default_Constant ? m_DefaultValue : g_Settings->LoadDword(m_DefaultSetting);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,4 +76,6 @@ private:
|
|||
CSettingTypeRomDatabase(); // Disable default constructor
|
||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||
|
||||
bool Load(uint32_t & Value) const;
|
||||
};
|
||||
|
|
|
@ -61,6 +61,17 @@ enum SettingID
|
|||
Setting_CurrentLanguage,
|
||||
Setting_EnableDisk,
|
||||
|
||||
//Default Settings
|
||||
Default_RDRamSize,
|
||||
Default_UseHleGfx,
|
||||
Default_UseTlb,
|
||||
Default_ViRefreshRate,
|
||||
Default_AiCountPerBytes,
|
||||
Default_CounterFactor,
|
||||
Default_32Bit,
|
||||
Default_SyncViaAudio,
|
||||
Default_FixedAudio,
|
||||
|
||||
//RDB Settings
|
||||
Rdb_GoodName,
|
||||
Rdb_SaveChip,
|
||||
|
|
|
@ -18,6 +18,9 @@ extern "C" {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include "3dmath.h"
|
||||
#include "trace.h"
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "ScreenResolution.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
|
@ -674,6 +675,7 @@ void CALL CloseDLL(void)
|
|||
voodoo.gamma_table_g = 0;
|
||||
delete[] voodoo.gamma_table_b;
|
||||
voodoo.gamma_table_b = 0;
|
||||
StopTrace();
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#include "ScreenResolution.h"
|
||||
#include "settings.h"
|
||||
#include "trace.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#include <Common/StdString.h>
|
||||
#include <vector>
|
||||
|
@ -268,7 +270,7 @@ void FullScreenResolutions::init()
|
|||
int current = 0;
|
||||
char smode[256];
|
||||
memset(&enumMode, 0, sizeof(DEVMODE));
|
||||
memset(&prevInfo, 0, sizeof(ResolutionInfo));
|
||||
prevInfo = ResolutionInfo();
|
||||
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
|
||||
{
|
||||
ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
|
||||
|
|
|
@ -96,4 +96,14 @@ void StartTrace(void)
|
|||
}
|
||||
g_LogFile = new CTraceFileLog(LogFilePath, g_settings->FlushLogs(), CLog::Log_New, 500);
|
||||
TraceAddModule(g_LogFile);
|
||||
}
|
||||
}
|
||||
|
||||
void StopTrace(void)
|
||||
{
|
||||
if (g_LogFile)
|
||||
{
|
||||
TraceRemoveModule(g_LogFile);
|
||||
delete g_LogFile;
|
||||
g_LogFile = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,3 +30,4 @@ enum TraceModuleGlide64
|
|||
|
||||
void SetupTrace(void);
|
||||
void StartTrace(void);
|
||||
void StopTrace(void);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<MinimumRequiredVersion Condition="'$(Platform)'=='x64'">5.02</MinimumRequiredVersion>
|
||||
<StackReserveSize>1</StackReserveSize>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
<LargeAddressAware>true</LargeAddressAware>
|
||||
</Link>
|
||||
<Manifest Condition="'$(PlatformToolset)'!='v90'">
|
||||
<EnableDPIAwareness>true</EnableDPIAwareness>
|
||||
|
@ -110,6 +111,7 @@
|
|||
<ClCompile Include="UserInterface\RomInformationClass.cpp" />
|
||||
<ClCompile Include="UserInterface\SettingsConfig.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Defaults.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
|
||||
|
@ -173,6 +175,7 @@
|
|||
<ClInclude Include="UserInterface\RomInformationClass.h" />
|
||||
<ClInclude Include="UserInterface\SettingsConfig.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Defaults.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
|
||||
|
|
|
@ -120,9 +120,6 @@
|
|||
<ClCompile Include="UserInterface\MenuShortCuts.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\NotificationClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
|
@ -216,6 +213,12 @@
|
|||
<ClCompile Include="UserInterface\WTLControls\EditNumber32.cpp">
|
||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Notification.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Defaults.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UserInterface\resource.h">
|
||||
|
@ -242,9 +245,6 @@
|
|||
<ClInclude Include="UserInterface\MenuShortCuts.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\NotificationClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\RomBrowser.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
|
@ -413,6 +413,12 @@
|
|||
<ClInclude Include="UserInterface\WTLControls\EditNumber32.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Notification.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Defaults.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\divider.cur">
|
||||
|
|
|
@ -52,6 +52,7 @@ CPath CSymbols::GetSymFilePath()
|
|||
{
|
||||
symFilePath.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
symFilePath.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
if (!symFilePath.DirectoryExists())
|
||||
{
|
||||
symFilePath.DirectoryCreate();
|
||||
|
|
|
@ -632,7 +632,8 @@ std::wstring CMainMenu::GetSaveSlotString(int Slot)
|
|||
{
|
||||
FileName.AppendDirectory(g_Settings->LoadStringVal(Game_UniqueSaveDir).c_str());
|
||||
}
|
||||
if (Slot != 0)
|
||||
FileName.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||
if (Slot != 0)
|
||||
{
|
||||
FileName.SetNameExtension(stdstr_f("%s.pj%d", g_Settings->LoadStringVal(Rdb_GoodName).c_str(), Slot).c_str());
|
||||
}
|
||||
|
|
|
@ -45,8 +45,9 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
|
|||
ComboBox->AddItemW(wGS(STR_FR_VIS).c_str(), FR_VIs);
|
||||
ComboBox->AddItemW(wGS(STR_FR_DLS).c_str(), FR_DLs);
|
||||
ComboBox->AddItemW(wGS(STR_FR_PERCENT).c_str(), FR_PERCENT);
|
||||
ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs);
|
||||
}
|
||||
ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs);
|
||||
ComboBox->AddItemW(wGS(STR_FR_NONE).c_str(), FR_None);
|
||||
}
|
||||
|
||||
m_IplDir.Attach(GetDlgItem(IDC_IPL_DIR));
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ class CAdvancedOptionsPage :
|
|||
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_DIR, SelectIplDir)
|
||||
COMMAND_HANDLER_EX(IDC_IPL_DIR, EN_UPDATE, IplDirChanged)
|
||||
COMMAND_HANDLER_EX(IDC_FRAME_DISPLAY_TYPE,LBN_SELCHANGE,ComboBoxChanged)
|
||||
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Settings_Advanced };
|
||||
|
@ -35,12 +34,12 @@ class CAdvancedOptionsPage :
|
|||
public:
|
||||
CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay );
|
||||
|
||||
LanguageStringID PageTitle ( void ) { return TAB_ADVANCED; }
|
||||
void HidePage ( void );
|
||||
void ShowPage ( void );
|
||||
void ApplySettings ( bool UpdateScreen );
|
||||
bool EnableReset ( void );
|
||||
void ResetPage ( void );
|
||||
LanguageStringID PageTitle ( void ) { return TAB_ADVANCED; }
|
||||
void HidePage ( void );
|
||||
void ShowPage ( void );
|
||||
void ApplySettings ( bool UpdateScreen );
|
||||
bool EnableReset ( void );
|
||||
void ResetPage ( void );
|
||||
|
||||
private:
|
||||
void SelectIplDir(UINT Code, int id, HWND ctl);
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - 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 *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsPage.h"
|
||||
|
||||
CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
|
||||
{
|
||||
if (!Create(hParent, rcDispay))
|
||||
{
|
||||
return;
|
||||
}
|
||||
UpdatePageSettings();
|
||||
|
||||
SetDlgItemTextW(m_hWnd, IDC_MEMORY_SIZE_TEXT, wGS(ROM_MEM_SIZE).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_HLE_GFX, wGS(PLUG_HLE_GFX).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_USE_TLB, wGS(ROM_USE_TLB).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
|
||||
SetDlgItemTextW(m_hWnd, IDC_SYNC_AUDIO, wGS(ROM_SYNC_AUDIO).c_str());
|
||||
|
||||
CModifiedComboBox * ComboBox;
|
||||
ComboBox = AddModComboBox(GetDlgItem(IDC_RDRAM_SIZE), Default_RDRamSize);
|
||||
if (ComboBox)
|
||||
{
|
||||
ComboBox->SetTextField(GetDlgItem(IDC_MEMORY_SIZE_TEXT));
|
||||
ComboBox->AddItemW(wGS(RDRAM_4MB).c_str(), 0x400000);
|
||||
ComboBox->AddItemW(wGS(RDRAM_8MB).c_str(), 0x800000);
|
||||
}
|
||||
|
||||
ComboBox = AddModComboBox(GetDlgItem(IDC_COUNTFACT), Default_CounterFactor);
|
||||
if (ComboBox)
|
||||
{
|
||||
ComboBox->SetTextField(GetDlgItem(IDC_COUNTFACT_TEXT));
|
||||
ComboBox->AddItemW(wGS(NUMBER_1).c_str(), 1);
|
||||
ComboBox->AddItemW(wGS(NUMBER_2).c_str(), 2);
|
||||
ComboBox->AddItemW(wGS(NUMBER_3).c_str(), 3);
|
||||
ComboBox->AddItemW(wGS(NUMBER_4).c_str(), 4);
|
||||
ComboBox->AddItemW(wGS(NUMBER_5).c_str(), 5);
|
||||
ComboBox->AddItemW(wGS(NUMBER_6).c_str(), 6);
|
||||
}
|
||||
|
||||
CModifiedEditBox * TxtBox = AddModTextBox(GetDlgItem(IDC_VIREFRESH), Default_ViRefreshRate, false);
|
||||
TxtBox->SetTextField(GetDlgItem(IDC_VIREFESH_TEXT));
|
||||
TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE), Default_AiCountPerBytes, false);
|
||||
TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT));
|
||||
|
||||
AddModCheckBox(GetDlgItem(IDC_HLE_GFX), Default_UseHleGfx);
|
||||
AddModCheckBox(GetDlgItem(IDC_USE_TLB), Default_UseTlb);
|
||||
AddModCheckBox(GetDlgItem(IDC_ROM_32BIT), Default_32Bit);
|
||||
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Default_SyncViaAudio);
|
||||
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO), Default_FixedAudio);
|
||||
|
||||
UpdatePageSettings();
|
||||
}
|
||||
|
||||
void CDefaultsOptionsPage::HidePage()
|
||||
{
|
||||
ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
void CDefaultsOptionsPage::ShowPage()
|
||||
{
|
||||
ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CDefaultsOptionsPage::ApplySettings(bool UpdateScreen)
|
||||
{
|
||||
CSettingsPageImpl<CDefaultsOptionsPage>::ApplySettings(UpdateScreen);
|
||||
}
|
||||
|
||||
bool CDefaultsOptionsPage::EnableReset(void)
|
||||
{
|
||||
if (CSettingsPageImpl<CDefaultsOptionsPage>::EnableReset()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
void CDefaultsOptionsPage::ResetPage()
|
||||
{
|
||||
CSettingsPageImpl<CDefaultsOptionsPage>::ResetPage();
|
||||
}
|
||||
|
||||
void CDefaultsOptionsPage::UpdatePageSettings(void)
|
||||
{
|
||||
m_InUpdateSettings = true;
|
||||
CSettingsPageImpl<CDefaultsOptionsPage>::UpdatePageSettings();
|
||||
m_InUpdateSettings = false;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - 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
|
||||
|
||||
class CDefaultsOptionsPage :
|
||||
public CSettingsPageImpl<CDefaultsOptionsPage>,
|
||||
public CSettingsPage
|
||||
{
|
||||
BEGIN_MSG_MAP_EX(CDefaultsOptionsPage)
|
||||
COMMAND_ID_HANDLER_EX(IDC_HLE_GFX, CheckBoxChanged)
|
||||
COMMAND_ID_HANDLER_EX(IDC_USE_TLB, CheckBoxChanged)
|
||||
COMMAND_ID_HANDLER_EX(IDC_ROM_32BIT, CheckBoxChanged)
|
||||
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO, CheckBoxChanged)
|
||||
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO, CheckBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, LBN_SELCHANGE, ComboBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_COUNTFACT, LBN_SELCHANGE, ComboBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_RDRAM_SIZE, EN_UPDATE, EditBoxChanged)
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Settings_Defaults };
|
||||
|
||||
public:
|
||||
CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay );
|
||||
|
||||
LanguageStringID PageTitle ( void ) { return TAB_DEFAULTS; }
|
||||
void HidePage ( void );
|
||||
void ShowPage ( void );
|
||||
void ApplySettings ( bool UpdateScreen );
|
||||
bool EnableReset ( void );
|
||||
void ResetPage ( void );
|
||||
|
||||
private:
|
||||
void UpdatePageSettings(void);
|
||||
|
||||
bool m_InUpdateSettings;
|
||||
};
|
|
@ -31,7 +31,7 @@ class CGameGeneralPage :
|
|||
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged)
|
||||
COMMAND_HANDLER_EX(IDC_OVER_CLOCK_MODIFIER, EN_UPDATE, EditBoxChanged)
|
||||
END_MSG_MAP()
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Settings_GameGeneral };
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ CGameStatusPage::CGameStatusPage(HWND hParent, const RECT & rcDispay)
|
|||
}
|
||||
|
||||
CIniFile RomIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
strlist Keys;
|
||||
CIniFile::strlist Keys;
|
||||
RomIniFile.GetKeyList("Rom Status", Keys);
|
||||
stdstr Status = UISettingsLoadStringVal(Rdb_Status);
|
||||
|
||||
|
@ -29,7 +29,7 @@ CGameStatusPage::CGameStatusPage(HWND hParent, const RECT & rcDispay)
|
|||
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE), Rdb_Status);
|
||||
if (ComboBox)
|
||||
{
|
||||
for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++)
|
||||
for (CIniFile::strlist::iterator item = Keys.begin(); item != Keys.end(); item++)
|
||||
{
|
||||
if (strstr(item->c_str(), ".Sel") != NULL) { continue; }
|
||||
if (strstr(item->c_str(), ".Auto") != NULL) { continue; }
|
||||
|
|
|
@ -582,6 +582,7 @@ public:
|
|||
};
|
||||
|
||||
#include "SettingsPage-AdvancedOptions.h"
|
||||
#include "SettingsPage-Defaults.h"
|
||||
#include "SettingsPage-Directories.h"
|
||||
#include "SettingsPage-Game-General.h"
|
||||
#include "SettingsPage-Game-Plugin.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) :
|
|||
m_CurrentPage(NULL),
|
||||
m_GeneralOptionsPage(NULL),
|
||||
m_AdvancedPage(NULL),
|
||||
m_DefaultsPage(NULL),
|
||||
m_GameConfig(bJustGameSetting)
|
||||
{
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ bool CSettingConfig::UpdateAdvanced(bool AdvancedMode, HTREEITEM hItem)
|
|||
while (hItem)
|
||||
{
|
||||
CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
|
||||
if (!AdvancedMode && Page == m_AdvancedPage)
|
||||
if (!AdvancedMode && (Page == m_AdvancedPage || Page == m_DefaultsPage))
|
||||
{
|
||||
m_PagesTreeList.DeleteItem(hItem);
|
||||
return true;
|
||||
|
@ -63,6 +64,7 @@ bool CSettingConfig::UpdateAdvanced(bool AdvancedMode, HTREEITEM hItem)
|
|||
if (AdvancedMode && Page == m_GeneralOptionsPage)
|
||||
{
|
||||
m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(m_AdvancedPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_AdvancedPage, hItem, TVI_FIRST);
|
||||
m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM, wGS(m_DefaultsPage->PageTitle()).c_str(), 0, 0, 0, 0, (ULONG)m_DefaultsPage, hItem, TVI_FIRST);
|
||||
return true;
|
||||
}
|
||||
if (UpdateAdvanced(AdvancedMode, m_PagesTreeList.GetChildItem(hItem)))
|
||||
|
@ -127,10 +129,12 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
|||
|
||||
m_GeneralOptionsPage = new CGeneralOptionsPage(this, this->m_hWnd, rcSettingInfo);
|
||||
m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd, rcSettingInfo);
|
||||
m_DefaultsPage = new CDefaultsOptionsPage(this->m_hWnd, rcSettingInfo);
|
||||
|
||||
SettingsSection = new CConfigSettingSection(wGS(TAB_OPTIONS).c_str());
|
||||
SettingsSection->AddPage(m_GeneralOptionsPage);
|
||||
SettingsSection->AddPage(m_AdvancedPage);
|
||||
SettingsSection->AddPage(m_DefaultsPage);
|
||||
SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd, rcSettingInfo));
|
||||
m_Sections.push_back(SettingsSection);
|
||||
|
||||
|
@ -177,7 +181,7 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
|||
for (size_t i = 0; i < Section->GetPageCount(); i++)
|
||||
{
|
||||
CSettingsPage * Page = Section->GetPage(i);
|
||||
if (HideAdvanced && Page == m_AdvancedPage)
|
||||
if (HideAdvanced && (Page == m_AdvancedPage || Page == m_DefaultsPage))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,6 @@ private:
|
|||
|
||||
CTreeViewCtrl m_PagesTreeList;
|
||||
SETTING_SECTIONS m_Sections;
|
||||
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage;
|
||||
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage, *m_DefaultsPage;
|
||||
bool m_GameConfig;
|
||||
};
|
||||
|
|
|
@ -1256,6 +1256,26 @@ BEGIN
|
|||
EDITTEXT IDC_DD48_EDIT,87,226,39,10,ES_UPPERCASE | ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
END
|
||||
|
||||
IDD_Settings_Defaults DIALOGEX 0, 0, 218, 169
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
LTEXT "Memory Size:",IDC_MEMORY_SIZE_TEXT,6,8,91,10
|
||||
COMBOBOX IDC_RDRAM_SIZE,102,6,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Use High Level GFX",IDC_HLE_GFX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,81,91,10
|
||||
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,58,91,10
|
||||
LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,32,91,10
|
||||
EDITTEXT IDC_VIREFRESH,102,30,109,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,45,91,10
|
||||
EDITTEXT IDC_COUNTPERBYTE,102,44,109,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Counter Factor:",IDC_COUNTFACT_TEXT,6,19,91,10
|
||||
COMBOBOX IDC_COUNTFACT,102,18,109,49,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,58,91,10
|
||||
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,69,91,10
|
||||
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,69,91,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -1669,6 +1689,14 @@ BEGIN
|
|||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 219
|
||||
END
|
||||
|
||||
IDD_Settings_Defaults, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 4
|
||||
RIGHTMARGIN, 216
|
||||
TOPMARGIN, 4
|
||||
BOTTOMMARGIN, 163
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
@ -1848,6 +1876,11 @@ BEGIN
|
|||
0, 0, 0, 0
|
||||
END
|
||||
|
||||
IDD_Settings_Defaults AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#define IDD_Debugger_RegRDRAM 198
|
||||
#define IDD_Debugger_RegVI 199
|
||||
#define IDD_Debugger_RegDD 200
|
||||
#define IDD_Settings_Defaults 201
|
||||
#define IDC_MENU_ITEM_TEXT 1000
|
||||
#define IDC_CLOSE_BUTTON 1001
|
||||
#define IDC_LIST2 1003
|
||||
|
@ -98,7 +99,6 @@
|
|||
#define IDC_INFO_CIC 1011
|
||||
#define IDC_CTL 1011
|
||||
#define IDC_CACHE 1011
|
||||
#define IDC_ROM_FIXEDAUDIO 1011
|
||||
#define IDC_DEBUGGER 1011
|
||||
#define IDC_USE_ALT_PC 1011
|
||||
#define IDC_HLE_GFX 1011
|
||||
|
@ -602,6 +602,7 @@
|
|||
#define IDC_DD40_EDIT 1442
|
||||
#define IDC_DD44_EDIT 1443
|
||||
#define IDC_DD48_EDIT 1444
|
||||
#define IDC_ROM_FIXEDAUDIO 1445
|
||||
#define ID_POPUP_SHOWINMEMORYVIEWER 40005
|
||||
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
|
||||
#define ID_POPUPMENU_ADDSYMBOL 40013
|
||||
|
@ -637,9 +638,9 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 194
|
||||
#define _APS_NEXT_RESOURCE_VALUE 195
|
||||
#define _APS_NEXT_COMMAND_VALUE 40043
|
||||
#define _APS_NEXT_CONTROL_VALUE 1445
|
||||
#define _APS_NEXT_CONTROL_VALUE 1446
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -8,4 +8,6 @@ Windows 2.4
|
|||
- fixed fpu issue - Indiana Jones (#76)
|
||||
- Fix bug in key assignment (#1309)
|
||||
- Add Shygoo's debugger code
|
||||
- New audio plugin
|
||||
- New audio plugin
|
||||
- large address aware
|
||||
- Ability to change defaults
|
||||
|
|
Loading…
Reference in New Issue