Resolve merge conflicts from `Controller Plugin.cpp`.
This commit is contained in:
commit
dc65c0a075
|
@ -4,6 +4,14 @@
|
|||
*.sdf
|
||||
*.suo
|
||||
*.user
|
||||
|
||||
# compiler-generated sources (MSVC, GCC)
|
||||
*.asm
|
||||
*.s
|
||||
|
||||
# assembled linker objects (GCC)
|
||||
*.o
|
||||
|
||||
Thumbs.db
|
||||
/Bin/Debug
|
||||
/Bin/Debug64
|
||||
|
|
Binary file not shown.
|
@ -88,6 +88,7 @@
|
|||
#198# "插槽 8"
|
||||
#199# "插槽 9"
|
||||
#200# "插槽 10"
|
||||
#201# "插槽 (%ws) 被选"
|
||||
|
||||
//Pop up Menu
|
||||
#210# "运行游戏"
|
||||
|
@ -224,7 +225,7 @@
|
|||
#452# " 选择材质包目录"
|
||||
|
||||
//Options Dialog
|
||||
#460# "当窗口处于非活动状态时暂停模拟器"
|
||||
#460# "当模拟器窗口不是处于屏幕最上方,暂停模拟器"
|
||||
#461# "载入ROM后切换为全屏模式"
|
||||
#462# "隐藏高级设置"
|
||||
#463# "记住已选择的金手指"
|
||||
|
@ -255,7 +256,7 @@
|
|||
#503# "自我修改码方案:"
|
||||
#504# "默认存档容量:"
|
||||
#505# "高级模块连接"
|
||||
#506# "当ROM加载后,开始模拟"
|
||||
#506# "当读取完ROM后,开始模拟"
|
||||
#507# "总是从 RDB 中覆盖默认设置"
|
||||
#508# "自动压缩即时存档文件"
|
||||
#509# "开启调试器"
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
#198# "Slot 8"
|
||||
#199# "Slot 9"
|
||||
#200# "Slot 10"
|
||||
#201# "Save Slot (%ws) selected"
|
||||
|
||||
//Pop up Menu
|
||||
#210# "Play Game"
|
||||
|
|
BIN
Project64.sln
BIN
Project64.sln
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
|
||||
<ImportGroup Label="PropertySheets">
|
||||
|
|
|
@ -79,16 +79,11 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
|||
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
|
||||
|
||||
// map creation flags
|
||||
ULONG dwCreateFlag = 0;
|
||||
ULONG dwCreateFlag = OPEN_EXISTING;
|
||||
if (nOpenFlags & modeCreate)
|
||||
{
|
||||
if (nOpenFlags & modeNoTruncate)
|
||||
dwCreateFlag = OPEN_ALWAYS;
|
||||
else
|
||||
dwCreateFlag = CREATE_ALWAYS;
|
||||
dwCreateFlag = ((nOpenFlags & modeNoTruncate) != 0) ? OPEN_ALWAYS : CREATE_ALWAYS;
|
||||
}
|
||||
else
|
||||
dwCreateFlag = OPEN_EXISTING;
|
||||
|
||||
// attempt file creation
|
||||
HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
@ -140,19 +135,15 @@ bool CFile::Flush()
|
|||
return ::FlushFileBuffers(m_hFile) != 0;
|
||||
}
|
||||
|
||||
bool CFile::Write(const void* lpBuf, size_t nCount)
|
||||
bool CFile::Write(const void* lpBuf, uint32_t nCount)
|
||||
{
|
||||
if (nCount == 0)
|
||||
{
|
||||
return true; // avoid Win32 "null-write" option
|
||||
}
|
||||
if (nCount > ULONG_MAX)
|
||||
{
|
||||
nCount = ULONG_MAX; /* Or should we loop WriteFile() every 2 GB? */
|
||||
}
|
||||
|
||||
DWORD nWritten = 0;
|
||||
if (!::WriteFile(m_hFile, lpBuf, (DWORD)nCount, &nWritten, NULL))
|
||||
ULONG nWritten = 0;
|
||||
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -165,23 +156,19 @@ bool CFile::Write(const void* lpBuf, size_t nCount)
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t CFile::Read(void* lpBuf, size_t nCount)
|
||||
uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
|
||||
{
|
||||
if (nCount == 0)
|
||||
{
|
||||
return 0; // avoid Win32 "null-read"
|
||||
}
|
||||
if (nCount > ULONG_MAX)
|
||||
{
|
||||
nCount = ULONG_MAX; /* Or should we loop ReadFile() every 2 GB? */
|
||||
}
|
||||
|
||||
DWORD dwRead = 0;
|
||||
if (!::ReadFile(m_hFile, lpBuf, (DWORD)nCount, &dwRead, NULL))
|
||||
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return (dwRead);
|
||||
return (uint32_t)dwRead;
|
||||
}
|
||||
|
||||
long CFile::Seek(long lOff, SeekPosition nFrom)
|
||||
|
|
|
@ -40,8 +40,8 @@ public:
|
|||
virtual bool SetLength(uint32_t dwNewLen) = 0;
|
||||
virtual uint32_t GetLength() const = 0;
|
||||
|
||||
virtual size_t Read(void* lpBuf, size_t nCount) = 0;
|
||||
virtual bool Write(const void* lpBuf, size_t nCount) = 0;
|
||||
virtual uint32_t Read(void* lpBuf, uint32_t nCount) = 0;
|
||||
virtual bool Write(const void* lpBuf, uint32_t nCount) = 0;
|
||||
|
||||
virtual bool Flush() = 0;
|
||||
virtual bool Close() = 0;
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
virtual bool SetLength(uint32_t dwNewLen);
|
||||
virtual uint32_t GetLength() const;
|
||||
|
||||
virtual size_t Read(void* lpBuf, size_t nCount);
|
||||
virtual bool Write(const void* lpBuf, size_t nCount);
|
||||
virtual uint32_t Read(void* lpBuf, uint32_t nCount);
|
||||
virtual bool Write(const void* lpBuf, uint32_t nCount);
|
||||
|
||||
virtual bool Flush();
|
||||
virtual bool Close();
|
||||
|
|
|
@ -120,7 +120,7 @@ void CLog::LogArgs(const char * Message, va_list & args )
|
|||
void CLog::Log( const char * Message )
|
||||
{
|
||||
if (!m_hLogFile.IsOpen()) { return; }
|
||||
m_hLogFile.Write(Message, strlen(Message)*sizeof(TCHAR));
|
||||
m_hLogFile.Write(Message,(uint32_t)strlen(Message)*sizeof(TCHAR));
|
||||
if (m_FlushOnWrite)
|
||||
{
|
||||
m_hLogFile.Flush();
|
||||
|
@ -145,13 +145,13 @@ void CLog::Log( const char * Message )
|
|||
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
|
||||
|
||||
// Find next end of line
|
||||
size_t NextEnter = 0, dwRead = 0;
|
||||
uint32_t NextEnter = 0, dwRead = 0;
|
||||
do
|
||||
{
|
||||
BYTE Data[300];
|
||||
size_t dwRead;
|
||||
uint32_t dwRead;
|
||||
|
||||
dwRead = m_hLogFile.Read(Data, sizeof(Data));
|
||||
dwRead = m_hLogFile.Read(Data,sizeof(Data));
|
||||
if (dwRead == 0)
|
||||
{
|
||||
break;
|
||||
|
@ -170,9 +170,8 @@ void CLog::Log( const char * Message )
|
|||
} while(dwRead != 0);
|
||||
|
||||
// copy content of log to the new file
|
||||
size_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
||||
uint32_t WritePos = 0;
|
||||
size_t SizeToRead;
|
||||
uint32_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
||||
uint32_t SizeToRead, WritePos = 0;
|
||||
do
|
||||
{
|
||||
enum { fIS_MvSize = 0x5000 };
|
||||
|
@ -183,8 +182,8 @@ void CLog::Log( const char * Message )
|
|||
|
||||
m_hLogFile.Seek(ReadPos,CFile::begin);
|
||||
|
||||
size_t dwRead;
|
||||
dwRead = m_hLogFile.Read(Data, SizeToRead);
|
||||
uint32_t dwRead;
|
||||
dwRead = m_hLogFile.Read(Data,SizeToRead);
|
||||
|
||||
m_hLogFile.Seek(WritePos,CFile::begin);
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ class CLog
|
|||
bool m_FlushOnWrite;
|
||||
stdstr m_FileName;
|
||||
bool m_TruncateFileLog;
|
||||
size_t m_MaxFileSize;
|
||||
size_t m_FileChangeSize;
|
||||
uint32_t m_MaxFileSize;
|
||||
uint32_t m_FileChangeSize;
|
||||
|
||||
public:
|
||||
CLog ( void );
|
||||
|
@ -29,10 +29,10 @@ public:
|
|||
bool Empty ( void );
|
||||
void Close ( void );
|
||||
|
||||
inline void SetMaxFileSize(size_t Size)
|
||||
inline void SetMaxFileSize ( uint32_t Size )
|
||||
{
|
||||
m_MaxFileSize = Size;
|
||||
m_FileChangeSize = (size_t)(Size * 0.1);
|
||||
m_FileChangeSize = (uint32_t)(Size * 0.1);
|
||||
}
|
||||
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
|
||||
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }
|
||||
|
|
|
@ -51,5 +51,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class stdwstr_f : public std::wstring
|
||||
{
|
||||
public:
|
||||
stdwstr_f(const wchar_t * strFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, strFormat);
|
||||
|
||||
wchar_t Msg[1000];
|
||||
_vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args);
|
||||
|
||||
va_end(args);
|
||||
|
||||
this->assign(Msg);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::list<stdstr> strlist;
|
||||
typedef strlist::iterator strlist_iter;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
[Setup]
|
||||
AppId={{BEB5FB69-4080-466F-96C4-F15DF271718B}
|
||||
AppName=Project 64
|
||||
AppName=Project64
|
||||
AppVersion={#AppVersion}
|
||||
DefaultDirName={pf}\Project64 2.2
|
||||
VersionInfoVersion={#AppVersion}
|
||||
|
@ -21,7 +21,7 @@ UninstallDisplayIcon={uninstallexe}
|
|||
SetupIconFile={#BaseDir}\Source\Project64\User Interface\Icons\pj64.ico
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\Project64.exe"; Description: "{cm:LaunchProgram,{#StringChange('Project 64', '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
Filename: "{app}\Project64.exe"; Description: "{cm:LaunchProgram,{#StringChange('Project64', '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Files]
|
||||
Source: "{#BaseDir}\Bin\{#Configuration}\Project64.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
|
@ -44,9 +44,9 @@ Name: "{app}\Screenshots"; Permissions: users-modify
|
|||
Name: "{app}\Textures"; Permissions: users-modify
|
||||
|
||||
[Icons]
|
||||
Name: "{commonprograms}\Project 64 2.2\Project 64"; Filename: "{app}\Project64.exe"
|
||||
Name: "{commonprograms}\Project 64 2.2\Uninstall Project64 2.2"; Filename: "{uninstallexe}"; Parameters: "/LOG"
|
||||
Name: "{commonprograms}\Project 64 2.2\Support"; Filename: "http://forum.pj64-emu.com"
|
||||
Name: "{commonprograms}\Project64 2.2\Project64"; Filename: "{app}\Project64.exe"
|
||||
Name: "{commonprograms}\Project64 2.2\Uninstall Project64 2.2"; Filename: "{uninstallexe}"; Parameters: "/LOG"
|
||||
Name: "{commonprograms}\Project64 2.2\Support"; Filename: "http://forum.pj64-emu.com"
|
||||
|
||||
[Code]
|
||||
function HaveCommandlineParam (inParam: String): Boolean;
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
#include "stdafx.h"
|
||||
#include <Common\Util.h>
|
||||
|
||||
void FixDirectories(void);
|
||||
void FixLocale(void);
|
||||
|
||||
static void IncreaseThreadPriority(void);
|
||||
|
||||
static CTraceFileLog * g_LogFile = NULL;
|
||||
|
||||
void LogLevelChanged(CTraceFileLog * LogFile)
|
||||
{
|
||||
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
|
||||
}
|
||||
|
||||
void LogFlushChanged(CTraceFileLog * LogFile)
|
||||
{
|
||||
LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0);
|
||||
}
|
||||
|
||||
void InitializeLog(void)
|
||||
{
|
||||
CPath LogFilePath(CPath::MODULE_DIRECTORY);
|
||||
LogFilePath.AppendDirectory("Logs");
|
||||
if (!LogFilePath.DirectoryExists())
|
||||
{
|
||||
LogFilePath.DirectoryCreate();
|
||||
}
|
||||
LogFilePath.SetNameExtension("Project64.log");
|
||||
|
||||
g_LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New, 500);
|
||||
#ifdef VALIDATE_DEBUG
|
||||
g_LogFile->SetTraceLevel((TraceLevel)(g_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate | TraceDebug));
|
||||
#else
|
||||
g_LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
|
||||
#endif
|
||||
AddTraceModule(g_LogFile);
|
||||
|
||||
g_Settings->RegisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
|
||||
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||
}
|
||||
|
||||
void AppInit(CNotification * Notify)
|
||||
{
|
||||
try
|
||||
{
|
||||
g_Notify = Notify;
|
||||
|
||||
FixDirectories();
|
||||
FixLocale();
|
||||
|
||||
stdstr_f AppName("Project64 %s", VER_FILE_VERSION_STR);
|
||||
IncreaseThreadPriority();
|
||||
|
||||
g_Settings = new CSettings;
|
||||
g_Settings->Initialize(AppName.c_str());
|
||||
|
||||
if (g_Settings->LoadBool(Setting_CheckEmuRunning) &&
|
||||
pjutil::TerminatedExistingExe())
|
||||
{
|
||||
delete g_Settings;
|
||||
g_Settings = new CSettings;
|
||||
g_Settings->Initialize(AppName.c_str());
|
||||
}
|
||||
|
||||
InitializeLog();
|
||||
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Application Starting");
|
||||
CMipsMemoryVM::ReserveMemory();
|
||||
|
||||
//Create the plugin container
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Create Plugins");
|
||||
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
|
||||
|
||||
g_Lang = new CLanguage();
|
||||
g_Lang->LoadCurrentStrings();
|
||||
g_Notify->AppInitDone();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void AppCleanup(void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
|
||||
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": cleaning up global objects");
|
||||
|
||||
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
|
||||
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
|
||||
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
|
||||
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
|
||||
|
||||
CMipsMemoryVM::FreeReservedMemory();
|
||||
|
||||
WriteTrace(TraceDebug, __FUNCTION__ ": Done");
|
||||
CloseTrace();
|
||||
}
|
||||
|
||||
void FixDirectories(void)
|
||||
{
|
||||
CPath Directory(CPath::MODULE_DIRECTORY);
|
||||
Directory.AppendDirectory("Config");
|
||||
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||
|
||||
Directory.UpDirectory();
|
||||
Directory.AppendDirectory("Logs");
|
||||
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||
|
||||
Directory.UpDirectory();
|
||||
Directory.AppendDirectory("Save");
|
||||
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||
|
||||
Directory.UpDirectory();
|
||||
Directory.AppendDirectory("Screenshots");
|
||||
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||
|
||||
Directory.UpDirectory();
|
||||
Directory.AppendDirectory("textures");
|
||||
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||
}
|
||||
|
||||
#include <windows.h>
|
||||
void FixLocale(void)
|
||||
{
|
||||
char *lbuffer = new char[10];
|
||||
if (GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10))
|
||||
{
|
||||
setlocale(LC_ALL, lbuffer);
|
||||
}
|
||||
delete[] lbuffer;
|
||||
}
|
||||
|
||||
void IncreaseThreadPriority(void)
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Project64\User Interface\Notification Class.h>
|
||||
|
||||
void AppInit(CNotification * Notify);
|
||||
void AppCleanup(void);
|
|
@ -1 +1,16 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
__interface CDebugger
|
||||
{
|
||||
virtual void TLBChanged(void) = 0;
|
||||
};
|
||||
|
|
|
@ -1,919 +0,0 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <prsht.h>
|
||||
|
||||
void LoadLogSetting (HKEY hKey,char * String, bool * Value);
|
||||
void SaveLogOptions (void);
|
||||
|
||||
LRESULT CALLBACK LogGeneralProc ( HWND, UINT, WPARAM, LPARAM );
|
||||
LRESULT CALLBACK LogPifProc ( HWND, UINT, WPARAM, LPARAM );
|
||||
LRESULT CALLBACK LogRegProc ( HWND, UINT, WPARAM, LPARAM );
|
||||
|
||||
static HANDLE g_hLogFile = NULL;
|
||||
LOG_OPTIONS g_LogOptions, TempOptions;
|
||||
|
||||
void EnterLogOptions(HWND hwndOwner)
|
||||
{
|
||||
PROPSHEETPAGE psp[3];
|
||||
PROPSHEETHEADER psh;
|
||||
|
||||
psp[0].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[0].dwFlags = PSP_USETITLE;
|
||||
psp[0].hInstance = GetModuleHandle(NULL);
|
||||
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers);
|
||||
psp[0].pfnDlgProc = (DLGPROC)LogRegProc;
|
||||
psp[0].pszTitle = "Registers";
|
||||
psp[0].lParam = 0;
|
||||
psp[0].pfnCallback = NULL;
|
||||
|
||||
psp[1].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[1].dwFlags = PSP_USETITLE;
|
||||
psp[1].hInstance = GetModuleHandle(NULL);
|
||||
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam);
|
||||
psp[1].pfnDlgProc = (DLGPROC)LogPifProc;
|
||||
psp[1].pszTitle = "Pif Ram";
|
||||
psp[1].lParam = 0;
|
||||
psp[1].pfnCallback = NULL;
|
||||
|
||||
psp[2].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[2].dwFlags = PSP_USETITLE;
|
||||
psp[2].hInstance = GetModuleHandle(NULL);
|
||||
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General);
|
||||
psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc;
|
||||
psp[2].pszTitle = "General";
|
||||
psp[2].lParam = 0;
|
||||
psp[2].pfnCallback = NULL;
|
||||
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
||||
psh.hwndParent = hwndOwner;
|
||||
psh.hInstance = GetModuleHandle(NULL);
|
||||
psh.pszCaption = (LPSTR) "Log Options";
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = (LPCPROPSHEETPAGE) &psp;
|
||||
psh.pfnCallback = NULL;
|
||||
|
||||
LoadLogOptions(&TempOptions,TRUE);
|
||||
#if defined(WINDOWS_UI)
|
||||
PropertySheet(&psh);
|
||||
#else
|
||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
||||
#endif
|
||||
SaveLogOptions();
|
||||
LoadLogOptions(&g_LogOptions, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
void LoadLogOptions (LOG_OPTIONS * LogOptions, bool AlwaysFill)
|
||||
{
|
||||
int32_t lResult;
|
||||
HKEY hKeyResults = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
|
||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
|
||||
&hKeyResults);
|
||||
|
||||
if (lResult == ERROR_SUCCESS)
|
||||
{
|
||||
//LoadLogSetting(hKeyResults,"Generate Log File",&LogOptions->GenerateLog);
|
||||
if (LogOptions->GenerateLog || AlwaysFill)
|
||||
{
|
||||
LoadLogSetting(hKeyResults,"Log RDRAM",&LogOptions->LogRDRamRegisters);
|
||||
LoadLogSetting(hKeyResults,"Log SP",&LogOptions->LogSPRegisters);
|
||||
LoadLogSetting(hKeyResults,"Log DP Command",&LogOptions->LogDPCRegisters);
|
||||
LoadLogSetting(hKeyResults,"Log DP Span",&LogOptions->LogDPSRegisters);
|
||||
LoadLogSetting(hKeyResults,"Log MIPS Interface (MI)",&LogOptions->LogMIPSInterface);
|
||||
LoadLogSetting(hKeyResults,"Log Video Interface (VI)",&LogOptions->LogVideoInterface);
|
||||
LoadLogSetting(hKeyResults,"Log Audio Interface (AI)",&LogOptions->LogAudioInterface);
|
||||
LoadLogSetting(hKeyResults,"Log Peripheral Interface (PI)",&LogOptions->LogPerInterface);
|
||||
LoadLogSetting(hKeyResults,"Log RDRAM Interface (RI)",&LogOptions->LogRDRAMInterface);
|
||||
LoadLogSetting(hKeyResults,"Log Serial Interface (SI)",&LogOptions->LogSerialInterface);
|
||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Operations",&LogOptions->LogPRDMAOperations);
|
||||
LoadLogSetting(hKeyResults,"Log PifRam Direct Memory Loads",&LogOptions->LogPRDirectMemLoads);
|
||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Memory Loads",&LogOptions->LogPRDMAMemLoads);
|
||||
LoadLogSetting(hKeyResults,"Log PifRam Direct Memory Stores",&LogOptions->LogPRDirectMemStores);
|
||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Memory Stores",&LogOptions->LogPRDMAMemStores);
|
||||
LoadLogSetting(hKeyResults,"Log Controller Pak",&LogOptions->LogControllerPak);
|
||||
LoadLogSetting(hKeyResults,"Log CP0 changes",&LogOptions->LogCP0changes);
|
||||
LoadLogSetting(hKeyResults,"Log CP0 reads",&LogOptions->LogCP0reads);
|
||||
LoadLogSetting(hKeyResults,"Log Exceptions",&LogOptions->LogExceptions);
|
||||
LoadLogSetting(hKeyResults,"No Interrupts",&LogOptions->NoInterrupts);
|
||||
LoadLogSetting(hKeyResults,"Log TLB",&LogOptions->LogTLB);
|
||||
LoadLogSetting(hKeyResults,"Log Cache Operations",&LogOptions->LogCache);
|
||||
LoadLogSetting(hKeyResults,"Log Rom Header",&LogOptions->LogRomHeader);
|
||||
LoadLogSetting(hKeyResults,"Log Unknown access",&LogOptions->LogUnknown);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogOptions->GenerateLog = FALSE;
|
||||
LogOptions->LogRDRamRegisters = FALSE;
|
||||
LogOptions->LogSPRegisters = FALSE;
|
||||
LogOptions->LogDPCRegisters = FALSE;
|
||||
LogOptions->LogDPSRegisters = FALSE;
|
||||
LogOptions->LogMIPSInterface = FALSE;
|
||||
LogOptions->LogVideoInterface = FALSE;
|
||||
LogOptions->LogAudioInterface = FALSE;
|
||||
LogOptions->LogPerInterface = FALSE;
|
||||
LogOptions->LogRDRAMInterface = FALSE;
|
||||
LogOptions->LogSerialInterface = FALSE;
|
||||
|
||||
LogOptions->LogPRDMAOperations = FALSE;
|
||||
LogOptions->LogPRDirectMemLoads = FALSE;
|
||||
LogOptions->LogPRDMAMemLoads = FALSE;
|
||||
LogOptions->LogPRDirectMemStores = FALSE;
|
||||
LogOptions->LogPRDMAMemStores = FALSE;
|
||||
LogOptions->LogControllerPak = FALSE;
|
||||
|
||||
LogOptions->LogCP0changes = FALSE;
|
||||
LogOptions->LogCP0reads = FALSE;
|
||||
LogOptions->LogCache = FALSE;
|
||||
LogOptions->LogExceptions = FALSE;
|
||||
LogOptions->NoInterrupts = FALSE;
|
||||
LogOptions->LogTLB = FALSE;
|
||||
LogOptions->LogRomHeader = FALSE;
|
||||
LogOptions->LogUnknown = FALSE;
|
||||
}
|
||||
|
||||
void LoadLogSetting (HKEY hKey,char * String, bool * Value)
|
||||
{
|
||||
DWORD Type, dwResult, Bytes = 4;
|
||||
int32_t lResult;
|
||||
|
||||
lResult = RegQueryValueEx(hKey,String,0,&Type,(LPBYTE)(&dwResult),&Bytes);
|
||||
if (Type == REG_DWORD && lResult == ERROR_SUCCESS)
|
||||
{
|
||||
*Value = dwResult != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Value = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK LogGeneralProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
if (TempOptions.LogCP0changes) { CheckDlgButton(hDlg,IDC_CP0_WRITE,BST_CHECKED); }
|
||||
if (TempOptions.LogCP0reads) { CheckDlgButton(hDlg,IDC_CP0_READ,BST_CHECKED); }
|
||||
if (TempOptions.LogCache) { CheckDlgButton(hDlg,IDC_CACHE,BST_CHECKED); }
|
||||
if (TempOptions.LogExceptions) { CheckDlgButton(hDlg,IDC_EXCEPTIONS,BST_CHECKED); }
|
||||
if (TempOptions.NoInterrupts) { CheckDlgButton(hDlg,IDC_INTERRUPTS,BST_CHECKED); }
|
||||
if (TempOptions.LogTLB) { CheckDlgButton(hDlg,IDC_TLB,BST_CHECKED); }
|
||||
if (TempOptions.LogRomHeader) { CheckDlgButton(hDlg,IDC_ROM_HEADER,BST_CHECKED); }
|
||||
if (TempOptions.LogUnknown) { CheckDlgButton(hDlg,IDC_UNKOWN,BST_CHECKED); }
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY) { break; }
|
||||
TempOptions.LogCP0changes = IsDlgButtonChecked(hDlg,IDC_CP0_WRITE) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogCP0reads = IsDlgButtonChecked(hDlg,IDC_CP0_READ) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogCache = IsDlgButtonChecked(hDlg,IDC_CACHE) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogExceptions = IsDlgButtonChecked(hDlg,IDC_EXCEPTIONS) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.NoInterrupts = IsDlgButtonChecked(hDlg,IDC_INTERRUPTS) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogTLB = IsDlgButtonChecked(hDlg,IDC_TLB) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogRomHeader = IsDlgButtonChecked(hDlg,IDC_ROM_HEADER) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogUnknown = IsDlgButtonChecked(hDlg,IDC_UNKOWN) == BST_CHECKED?TRUE:FALSE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Log_LW (uint32_t PC, uint32_t VAddr)
|
||||
{
|
||||
if (!g_LogOptions.GenerateLog)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
|
||||
{
|
||||
uint32_t PAddr;
|
||||
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
|
||||
{
|
||||
if (g_LogOptions.LogUnknown)
|
||||
{
|
||||
LogMessage("%08X: read from unknown ??? (%08X)",PC,VAddr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
VAddr = PAddr + 0xA0000000;
|
||||
}
|
||||
|
||||
uint32_t Value;
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024)
|
||||
{
|
||||
if (!g_LogOptions.LogRDRamRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA3F00000: LogMessage("%08X: read from RDRAM_CONFIG_REG/RDRAM_DEVICE_TYPE_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00004: LogMessage("%08X: read from RDRAM_DEVICE_ID_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00008: LogMessage("%08X: read from RDRAM_DELAY_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F0000C: LogMessage("%08X: read from RDRAM_MODE_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00010: LogMessage("%08X: read from RDRAM_REF_INTERVAL_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00014: LogMessage("%08X: read from RDRAM_REF_ROW_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00018: LogMessage("%08X: read from RDRAM_RAS_INTERVAL_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F0001C: LogMessage("%08X: read from RDRAM_MIN_INTERVAL_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00020: LogMessage("%08X: read from RDRAM_ADDR_SELECT_REG (%08X)",PC, Value); return;
|
||||
case 0xA3F00024: LogMessage("%08X: read from RDRAM_DEVICE_MANUF_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xA4040000 && VAddr <= 0xA404001C )
|
||||
{
|
||||
if (!g_LogOptions.LogSPRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4040000: LogMessage("%08X: read from SP_MEM_ADDR_REG (%08X)",PC, Value); break;
|
||||
case 0xA4040004: LogMessage("%08X: read from SP_DRAM_ADDR_REG (%08X)",PC, Value); break;
|
||||
case 0xA4040008: LogMessage("%08X: read from SP_RD_LEN_REG (%08X)",PC, Value); break;
|
||||
case 0xA404000C: LogMessage("%08X: read from SP_WR_LEN_REG (%08X)",PC, Value); break;
|
||||
case 0xA4040010: LogMessage("%08X: read from SP_STATUS_REG (%08X)",PC, Value); break;
|
||||
case 0xA4040014: LogMessage("%08X: read from SP_DMA_FULL_REG (%08X)",PC, Value); break;
|
||||
case 0xA4040018: LogMessage("%08X: read from SP_DMA_BUSY_REG (%08X)",PC, Value); break;
|
||||
case 0xA404001C: LogMessage("%08X: read from SP_SEMAPHORE_REG (%08X)",PC, Value); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( VAddr == 0xA4080000)
|
||||
{
|
||||
if (!g_LogOptions.LogSPRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read from SP_PC (%08X)",PC, Value);
|
||||
return;
|
||||
}
|
||||
if (VAddr >= 0xA4100000 && VAddr <= 0xA410001C)
|
||||
{
|
||||
if (!g_LogOptions.LogDPCRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4100000: LogMessage("%08X: read from DPC_START_REG (%08X)",PC, Value); return;
|
||||
case 0xA4100004: LogMessage("%08X: read from DPC_END_REG (%08X)",PC, Value); return;
|
||||
case 0xA4100008: LogMessage("%08X: read from DPC_CURRENT_REG (%08X)",PC, Value); return;
|
||||
case 0xA410000C: LogMessage("%08X: read from DPC_STATUS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4100010: LogMessage("%08X: read from DPC_CLOCK_REG (%08X)",PC, Value); return;
|
||||
case 0xA4100014: LogMessage("%08X: read from DPC_BUFBUSY_REG (%08X)",PC, Value); return;
|
||||
case 0xA4100018: LogMessage("%08X: read from DPC_PIPEBUSY_REG (%08X)",PC, Value); return;
|
||||
case 0xA410001C: LogMessage("%08X: read from DPC_TMEM_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if (VAddr >= 0xA4300000 && VAddr <= 0xA430000C)
|
||||
{
|
||||
if (!g_LogOptions.LogMIPSInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4300000: LogMessage("%08X: read from MI_INIT_MODE_REG/MI_MODE_REG (%08X)",PC, Value); return;
|
||||
case 0xA4300004: LogMessage("%08X: read from MI_VERSION_REG/MI_NOOP_REG (%08X)",PC, Value); return;
|
||||
case 0xA4300008: LogMessage("%08X: read from MI_INTR_REG (%08X)",PC, Value); return;
|
||||
case 0xA430000C: LogMessage("%08X: read from MI_INTR_MASK_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if (VAddr >= 0xA4400000 && VAddr <= 0xA4400034)
|
||||
{
|
||||
if (!g_LogOptions.LogVideoInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4400000: LogMessage("%08X: read from VI_STATUS_REG/VI_CONTROL_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400004: LogMessage("%08X: read from VI_ORIGIN_REG/VI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400008: LogMessage("%08X: read from VI_WIDTH_REG/VI_H_WIDTH_REG (%08X)",PC, Value); return;
|
||||
case 0xA440000C: LogMessage("%08X: read from VI_INTR_REG/VI_V_INTR_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400010: LogMessage("%08X: read from VI_CURRENT_REG/VI_V_CURRENT_LINE_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400014: LogMessage("%08X: read from VI_BURST_REG/VI_TIMING_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400018: LogMessage("%08X: read from VI_V_SYNC_REG (%08X)",PC, Value); return;
|
||||
case 0xA440001C: LogMessage("%08X: read from VI_H_SYNC_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400020: LogMessage("%08X: read from VI_LEAP_REG/VI_H_SYNC_LEAP_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400024: LogMessage("%08X: read from VI_H_START_REG/VI_H_VIDEO_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400028: LogMessage("%08X: read from VI_V_START_REG/VI_V_VIDEO_REG (%08X)",PC, Value); return;
|
||||
case 0xA440002C: LogMessage("%08X: read from VI_V_BURST_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400030: LogMessage("%08X: read from VI_X_SCALE_REG (%08X)",PC, Value); return;
|
||||
case 0xA4400034: LogMessage("%08X: read from VI_Y_SCALE_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if (VAddr >= 0xA4500000 && VAddr <= 0xA4500014)
|
||||
{
|
||||
if (!g_LogOptions.LogAudioInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4500000: LogMessage("%08X: read from AI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
||||
case 0xA4500004: LogMessage("%08X: read from AI_LEN_REG (%08X)",PC, Value); return;
|
||||
case 0xA4500008: LogMessage("%08X: read from AI_CONTROL_REG (%08X)",PC, Value); return;
|
||||
case 0xA450000C: LogMessage("%08X: read from AI_STATUS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4500010: LogMessage("%08X: read from AI_DACRATE_REG (%08X)",PC, Value); return;
|
||||
case 0xA4500014: LogMessage("%08X: read from AI_BITRATE_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if (VAddr >= 0xA4600000 && VAddr <= 0xA4600030)
|
||||
{
|
||||
if (!g_LogOptions.LogPerInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4600000: LogMessage("%08X: read from PI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600004: LogMessage("%08X: read from PI_CART_ADDR_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600008: LogMessage("%08X: read from PI_RD_LEN_REG (%08X)",PC, Value); return;
|
||||
case 0xA460000C: LogMessage("%08X: read from PI_WR_LEN_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600010: LogMessage("%08X: read from PI_STATUS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600014: LogMessage("%08X: read from PI_BSD_DOM1_LAT_REG/PI_DOMAIN1_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600018: LogMessage("%08X: read from PI_BSD_DOM1_PWD_REG (%08X)",PC, Value); return;
|
||||
case 0xA460001C: LogMessage("%08X: read from PI_BSD_DOM1_PGS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600020: LogMessage("%08X: read from PI_BSD_DOM1_RLS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600024: LogMessage("%08X: read from PI_BSD_DOM2_LAT_REG/PI_DOMAIN2_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600028: LogMessage("%08X: read from PI_BSD_DOM2_PWD_REG (%08X)",PC, Value); return;
|
||||
case 0xA460002C: LogMessage("%08X: read from PI_BSD_DOM2_PGS_REG (%08X)",PC, Value); return;
|
||||
case 0xA4600030: LogMessage("%08X: read from PI_BSD_DOM2_RLS_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if (VAddr >= 0xA4700000 && VAddr <= 0xA470001C)
|
||||
{
|
||||
if (!g_LogOptions.LogRDRAMInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4700000: LogMessage("%08X: read from RI_MODE_REG (%08X)",PC, Value); return;
|
||||
case 0xA4700004: LogMessage("%08X: read from RI_CONFIG_REG (%08X)",PC, Value); return;
|
||||
case 0xA4700008: LogMessage("%08X: read from RI_CURRENT_LOAD_REG (%08X)",PC, Value); return;
|
||||
case 0xA470000C: LogMessage("%08X: read from RI_SELECT_REG (%08X)",PC, Value); return;
|
||||
case 0xA4700010: LogMessage("%08X: read from RI_REFRESH_REG/RI_COUNT_REG (%08X)",PC, Value); return;
|
||||
case 0xA4700014: LogMessage("%08X: read from RI_LATENCY_REG (%08X)",PC, Value); return;
|
||||
case 0xA4700018: LogMessage("%08X: read from RI_RERROR_REG (%08X)",PC, Value); return;
|
||||
case 0xA470001C: LogMessage("%08X: read from RI_WERROR_REG (%08X)",PC, Value); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr == 0xA4800000)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read from SI_DRAM_ADDR_REG (%08X)",PC, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr == 0xA4800004)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read from SI_PIF_ADDR_RD64B_REG (%08X)",PC, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr == 0xA4800010)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read from SI_PIF_ADDR_WR64B_REG (%08X)",PC, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr == 0xA4800018)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xBFC00000 && VAddr <= 0xBFC007C0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC )
|
||||
{
|
||||
if (!g_LogOptions.LogPRDirectMemLoads)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xB0000040 && ((VAddr - 0xB0000000) < g_Rom->GetRomSize()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xB0000000 && VAddr < 0xB0000040)
|
||||
{
|
||||
if (!g_LogOptions.LogRomHeader)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_MMU->LW_VAddr(VAddr,Value);
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xB0000004: LogMessage("%08X: read from Rom Clock Rate (%08X)",PC, Value); break;
|
||||
case 0xB0000008: LogMessage("%08X: read from Rom Boot address offset (%08X)",PC, Value); break;
|
||||
case 0xB000000C: LogMessage("%08X: read from Rom Release offset (%08X)",PC, Value); break;
|
||||
case 0xB0000010: LogMessage("%08X: read from Rom CRC1 (%08X)",PC, Value); break;
|
||||
case 0xB0000014: LogMessage("%08X: read from Rom CRC2 (%08X)",PC, Value); break;
|
||||
default: LogMessage("%08X: read from Rom header 0x%X (%08X)",PC, VAddr & 0xFF,Value); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!g_LogOptions.LogUnknown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: read from unknown ??? (%08X)",PC,VAddr);
|
||||
}
|
||||
|
||||
void Log_SW (uint32_t PC, uint32_t VAddr, uint32_t Value)
|
||||
{
|
||||
if (!g_LogOptions.GenerateLog)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
|
||||
{
|
||||
uint32_t PAddr;
|
||||
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
|
||||
{
|
||||
if (g_LogOptions.LogUnknown)
|
||||
{
|
||||
LogMessage("%08X: Writing 0x%08X to %08X",PC, Value, VAddr );
|
||||
}
|
||||
return;
|
||||
}
|
||||
VAddr = PAddr + 0xA0000000;
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024)
|
||||
{
|
||||
if (!g_LogOptions.LogRDRamRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA3F00000: LogMessage("%08X: Writing 0x%08X to RDRAM_CONFIG_REG/RDRAM_DEVICE_TYPE_REG",PC, Value ); return;
|
||||
case 0xA3F00004: LogMessage("%08X: Writing 0x%08X to RDRAM_DEVICE_ID_REG",PC, Value ); return;
|
||||
case 0xA3F00008: LogMessage("%08X: Writing 0x%08X to RDRAM_DELAY_REG",PC, Value ); return;
|
||||
case 0xA3F0000C: LogMessage("%08X: Writing 0x%08X to RDRAM_MODE_REG",PC, Value ); return;
|
||||
case 0xA3F00010: LogMessage("%08X: Writing 0x%08X to RDRAM_REF_INTERVAL_REG",PC, Value ); return;
|
||||
case 0xA3F00014: LogMessage("%08X: Writing 0x%08X to RDRAM_REF_ROW_REG",PC, Value ); return;
|
||||
case 0xA3F00018: LogMessage("%08X: Writing 0x%08X to RDRAM_RAS_INTERVAL_REG",PC, Value ); return;
|
||||
case 0xA3F0001C: LogMessage("%08X: Writing 0x%08X to RDRAM_MIN_INTERVAL_REG",PC, Value ); return;
|
||||
case 0xA3F00020: LogMessage("%08X: Writing 0x%08X to RDRAM_ADDR_SELECT_REG",PC, Value ); return;
|
||||
case 0xA3F00024: LogMessage("%08X: Writing 0x%08X to RDRAM_DEVICE_MANUF_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4040000 && VAddr <= 0xA404001C)
|
||||
{
|
||||
if (!g_LogOptions.LogSPRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4040000: LogMessage("%08X: Writing 0x%08X to SP_MEM_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4040004: LogMessage("%08X: Writing 0x%08X to SP_DRAM_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4040008: LogMessage("%08X: Writing 0x%08X to SP_RD_LEN_REG",PC, Value ); return;
|
||||
case 0xA404000C: LogMessage("%08X: Writing 0x%08X to SP_WR_LEN_REG",PC, Value ); return;
|
||||
case 0xA4040010: LogMessage("%08X: Writing 0x%08X to SP_STATUS_REG",PC, Value ); return;
|
||||
case 0xA4040014: LogMessage("%08X: Writing 0x%08X to SP_DMA_FULL_REG",PC, Value ); return;
|
||||
case 0xA4040018: LogMessage("%08X: Writing 0x%08X to SP_DMA_BUSY_REG",PC, Value ); return;
|
||||
case 0xA404001C: LogMessage("%08X: Writing 0x%08X to SP_SEMAPHORE_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr == 0xA4080000)
|
||||
{
|
||||
if (!g_LogOptions.LogSPRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to SP_PC",PC, Value ); return;
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4100000 && VAddr <= 0xA410001C)
|
||||
{
|
||||
if (!g_LogOptions.LogDPCRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4100000: LogMessage("%08X: Writing 0x%08X to DPC_START_REG",PC, Value ); return;
|
||||
case 0xA4100004: LogMessage("%08X: Writing 0x%08X to DPC_END_REG",PC, Value ); return;
|
||||
case 0xA4100008: LogMessage("%08X: Writing 0x%08X to DPC_CURRENT_REG",PC, Value ); return;
|
||||
case 0xA410000C: LogMessage("%08X: Writing 0x%08X to DPC_STATUS_REG",PC, Value ); return;
|
||||
case 0xA4100010: LogMessage("%08X: Writing 0x%08X to DPC_CLOCK_REG",PC, Value ); return;
|
||||
case 0xA4100014: LogMessage("%08X: Writing 0x%08X to DPC_BUFBUSY_REG",PC, Value ); return;
|
||||
case 0xA4100018: LogMessage("%08X: Writing 0x%08X to DPC_PIPEBUSY_REG",PC, Value ); return;
|
||||
case 0xA410001C: LogMessage("%08X: Writing 0x%08X to DPC_TMEM_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4200000 && VAddr <= 0xA420000C)
|
||||
{
|
||||
if (!g_LogOptions.LogDPSRegisters)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4200000: LogMessage("%08X: Writing 0x%08X to DPS_TBIST_REG",PC, Value ); return;
|
||||
case 0xA4200004: LogMessage("%08X: Writing 0x%08X to DPS_TEST_MODE_REG",PC, Value ); return;
|
||||
case 0xA4200008: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_ADDR_REG",PC, Value ); return;
|
||||
case 0xA420000C: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_DATA_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4300000 && VAddr <= 0xA430000C)
|
||||
{
|
||||
if (!g_LogOptions.LogMIPSInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4300000: LogMessage("%08X: Writing 0x%08X to MI_INIT_MODE_REG/MI_MODE_REG",PC, Value ); return;
|
||||
case 0xA4300004: LogMessage("%08X: Writing 0x%08X to MI_VERSION_REG/MI_NOOP_REG",PC, Value ); return;
|
||||
case 0xA4300008: LogMessage("%08X: Writing 0x%08X to MI_INTR_REG",PC, Value ); return;
|
||||
case 0xA430000C: LogMessage("%08X: Writing 0x%08X to MI_INTR_MASK_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr >= 0xA4400000 && VAddr <= 0xA4400034)
|
||||
{
|
||||
if (!g_LogOptions.LogVideoInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4400000: LogMessage("%08X: Writing 0x%08X to VI_STATUS_REG/VI_CONTROL_REG",PC, Value ); return;
|
||||
case 0xA4400004: LogMessage("%08X: Writing 0x%08X to VI_ORIGIN_REG/VI_DRAM_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4400008: LogMessage("%08X: Writing 0x%08X to VI_WIDTH_REG/VI_H_WIDTH_REG",PC, Value ); return;
|
||||
case 0xA440000C: LogMessage("%08X: Writing 0x%08X to VI_INTR_REG/VI_V_INTR_REG",PC, Value ); return;
|
||||
case 0xA4400010: LogMessage("%08X: Writing 0x%08X to VI_CURRENT_REG/VI_V_CURRENT_LINE_REG",PC, Value ); return;
|
||||
case 0xA4400014: LogMessage("%08X: Writing 0x%08X to VI_BURST_REG/VI_TIMING_REG",PC, Value ); return;
|
||||
case 0xA4400018: LogMessage("%08X: Writing 0x%08X to VI_V_SYNC_REG",PC, Value ); return;
|
||||
case 0xA440001C: LogMessage("%08X: Writing 0x%08X to VI_H_SYNC_REG",PC, Value ); return;
|
||||
case 0xA4400020: LogMessage("%08X: Writing 0x%08X to VI_LEAP_REG/VI_H_SYNC_LEAP_REG",PC, Value ); return;
|
||||
case 0xA4400024: LogMessage("%08X: Writing 0x%08X to VI_H_START_REG/VI_H_VIDEO_REG",PC, Value ); return;
|
||||
case 0xA4400028: LogMessage("%08X: Writing 0x%08X to VI_V_START_REG/VI_V_VIDEO_REG",PC, Value ); return;
|
||||
case 0xA440002C: LogMessage("%08X: Writing 0x%08X to VI_V_BURST_REG",PC, Value ); return;
|
||||
case 0xA4400030: LogMessage("%08X: Writing 0x%08X to VI_X_SCALE_REG",PC, Value ); return;
|
||||
case 0xA4400034: LogMessage("%08X: Writing 0x%08X to VI_Y_SCALE_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4500000 && VAddr <= 0xA4500014)
|
||||
{
|
||||
if (!g_LogOptions.LogAudioInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4500000: LogMessage("%08X: Writing 0x%08X to AI_DRAM_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4500004: LogMessage("%08X: Writing 0x%08X to AI_LEN_REG",PC, Value ); return;
|
||||
case 0xA4500008: LogMessage("%08X: Writing 0x%08X to AI_CONTROL_REG",PC, Value ); return;
|
||||
case 0xA450000C: LogMessage("%08X: Writing 0x%08X to AI_STATUS_REG",PC, Value ); return;
|
||||
case 0xA4500010: LogMessage("%08X: Writing 0x%08X to AI_DACRATE_REG",PC, Value ); return;
|
||||
case 0xA4500014: LogMessage("%08X: Writing 0x%08X to AI_BITRATE_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA4600000 && VAddr <= 0xA4600030)
|
||||
{
|
||||
if (!g_LogOptions.LogPerInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4600000: LogMessage("%08X: Writing 0x%08X to PI_DRAM_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4600004: LogMessage("%08X: Writing 0x%08X to PI_CART_ADDR_REG",PC, Value ); return;
|
||||
case 0xA4600008: LogMessage("%08X: Writing 0x%08X to PI_RD_LEN_REG",PC, Value ); return;
|
||||
case 0xA460000C: LogMessage("%08X: Writing 0x%08X to PI_WR_LEN_REG",PC, Value ); return;
|
||||
case 0xA4600010: LogMessage("%08X: Writing 0x%08X to PI_STATUS_REG",PC, Value ); return;
|
||||
case 0xA4600014: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_LAT_REG/PI_DOMAIN1_REG",PC, Value ); return;
|
||||
case 0xA4600018: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_PWD_REG",PC, Value ); return;
|
||||
case 0xA460001C: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_PGS_REG",PC, Value ); return;
|
||||
case 0xA4600020: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_RLS_REG",PC, Value ); return;
|
||||
case 0xA4600024: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_LAT_REG/PI_DOMAIN2_REG",PC, Value ); return;
|
||||
case 0xA4600028: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_PWD_REG",PC, Value ); return;
|
||||
case 0xA460002C: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_PGS_REG",PC, Value ); return;
|
||||
case 0xA4600030: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_RLS_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr >= 0xA4700000 && VAddr <= 0xA470001C)
|
||||
{
|
||||
if (!g_LogOptions.LogRDRAMInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (VAddr)
|
||||
{
|
||||
case 0xA4700000: LogMessage("%08X: Writing 0x%08X to RI_MODE_REG",PC, Value ); return;
|
||||
case 0xA4700004: LogMessage("%08X: Writing 0x%08X to RI_CONFIG_REG",PC, Value ); return;
|
||||
case 0xA4700008: LogMessage("%08X: Writing 0x%08X to RI_CURRENT_LOAD_REG",PC, Value ); return;
|
||||
case 0xA470000C: LogMessage("%08X: Writing 0x%08X to RI_SELECT_REG",PC, Value ); return;
|
||||
case 0xA4700010: LogMessage("%08X: Writing 0x%08X to RI_REFRESH_REG/RI_COUNT_REG",PC, Value ); return;
|
||||
case 0xA4700014: LogMessage("%08X: Writing 0x%08X to RI_LATENCY_REG",PC, Value ); return;
|
||||
case 0xA4700018: LogMessage("%08X: Writing 0x%08X to RI_RERROR_REG",PC, Value ); return;
|
||||
case 0xA470001C: LogMessage("%08X: Writing 0x%08X to RI_WERROR_REG",PC, Value ); return;
|
||||
}
|
||||
}
|
||||
if ( VAddr == 0xA4800000)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to SI_DRAM_ADDR_REG",PC, Value ); return;
|
||||
}
|
||||
if ( VAddr == 0xA4800004)
|
||||
{
|
||||
if (g_LogOptions.LogPRDMAOperations)
|
||||
{
|
||||
LogMessage("%08X: A DMA transfer from the PIF ram has occured",PC );
|
||||
}
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to SI_PIF_ADDR_RD64B_REG",PC, Value ); return;
|
||||
}
|
||||
if ( VAddr == 0xA4800010)
|
||||
{
|
||||
if (g_LogOptions.LogPRDMAOperations)
|
||||
{
|
||||
LogMessage("%08X: A DMA transfer to the PIF ram has occured",PC );
|
||||
}
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to SI_PIF_ADDR_WR64B_REG",PC, Value ); return;
|
||||
}
|
||||
if ( VAddr == 0xA4800018)
|
||||
{
|
||||
if (!g_LogOptions.LogSerialInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to SI_STATUS_REG",PC, Value ); return;
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC )
|
||||
{
|
||||
if (!g_LogOptions.LogPRDirectMemStores)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to Pif Ram at 0x%X",PC,Value, VAddr - 0xBFC007C0);
|
||||
return;
|
||||
}
|
||||
if (!g_LogOptions.LogUnknown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LogMessage("%08X: Writing 0x%08X to %08X ????",PC, Value, VAddr );
|
||||
}
|
||||
|
||||
LRESULT CALLBACK LogPifProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
if (TempOptions.LogPRDMAOperations) { CheckDlgButton(hDlg,IDC_SI_DMA,BST_CHECKED); }
|
||||
if (TempOptions.LogPRDirectMemLoads) { CheckDlgButton(hDlg,IDC_DIRECT_WRITE,BST_CHECKED); }
|
||||
if (TempOptions.LogPRDMAMemLoads) { CheckDlgButton(hDlg,IDC_DMA_WRITE,BST_CHECKED); }
|
||||
if (TempOptions.LogPRDirectMemStores) { CheckDlgButton(hDlg,IDC_DIRECT_READ,BST_CHECKED); }
|
||||
if (TempOptions.LogPRDMAMemStores) { CheckDlgButton(hDlg,IDC_DMA_READ,BST_CHECKED); }
|
||||
if (TempOptions.LogControllerPak) { CheckDlgButton(hDlg,IDC_CONT_PAK,BST_CHECKED); }
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY)
|
||||
{
|
||||
break;
|
||||
}
|
||||
TempOptions.LogPRDMAOperations = IsDlgButtonChecked(hDlg,IDC_SI_DMA) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogPRDirectMemLoads = IsDlgButtonChecked(hDlg,IDC_DIRECT_WRITE) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogPRDMAMemLoads = IsDlgButtonChecked(hDlg,IDC_DMA_WRITE) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogPRDirectMemStores = IsDlgButtonChecked(hDlg,IDC_DIRECT_READ) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogPRDMAMemStores = IsDlgButtonChecked(hDlg,IDC_DMA_READ) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogControllerPak = IsDlgButtonChecked(hDlg,IDC_CONT_PAK) == BST_CHECKED?TRUE:FALSE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK LogRegProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
if (TempOptions.LogRDRamRegisters) { CheckDlgButton(hDlg,IDC_RDRAM,BST_CHECKED); }
|
||||
if (TempOptions.LogSPRegisters) { CheckDlgButton(hDlg,IDC_SP_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogDPCRegisters) { CheckDlgButton(hDlg,IDC_DPC_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogDPSRegisters) { CheckDlgButton(hDlg,IDC_DPS_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogMIPSInterface) { CheckDlgButton(hDlg,IDC_MI_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogVideoInterface) { CheckDlgButton(hDlg,IDC_VI_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogAudioInterface) { CheckDlgButton(hDlg,IDC_AI_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogPerInterface) { CheckDlgButton(hDlg,IDC_PI_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogRDRAMInterface) { CheckDlgButton(hDlg,IDC_RI_REG,BST_CHECKED); }
|
||||
if (TempOptions.LogSerialInterface) { CheckDlgButton(hDlg,IDC_SI_REG,BST_CHECKED); }
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY)
|
||||
{
|
||||
break;
|
||||
}
|
||||
TempOptions.LogRDRamRegisters = IsDlgButtonChecked(hDlg,IDC_RDRAM) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogSPRegisters = IsDlgButtonChecked(hDlg,IDC_SP_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogDPCRegisters = IsDlgButtonChecked(hDlg,IDC_DPC_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogDPSRegisters = IsDlgButtonChecked(hDlg,IDC_DPS_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogMIPSInterface = IsDlgButtonChecked(hDlg,IDC_MI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogVideoInterface = IsDlgButtonChecked(hDlg,IDC_VI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogAudioInterface = IsDlgButtonChecked(hDlg,IDC_AI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogPerInterface = IsDlgButtonChecked(hDlg,IDC_PI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogRDRAMInterface = IsDlgButtonChecked(hDlg,IDC_RI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
TempOptions.LogSerialInterface = IsDlgButtonChecked(hDlg,IDC_SI_REG) == BST_CHECKED?TRUE:FALSE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SaveLogSetting (HKEY hKey,char * String, BOOL Value)
|
||||
{
|
||||
DWORD StoreValue = Value;
|
||||
RegSetValueEx(hKey,String,0,REG_DWORD,(CONST BYTE *)&StoreValue,sizeof(DWORD));
|
||||
}
|
||||
|
||||
void SaveLogOptions (void)
|
||||
{
|
||||
long lResult;
|
||||
HKEY hKeyResults = 0;
|
||||
DWORD Disposition = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
|
||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);
|
||||
|
||||
SaveLogSetting(hKeyResults,"Log RDRAM",TempOptions.LogRDRamRegisters);
|
||||
SaveLogSetting(hKeyResults,"Log SP",TempOptions.LogSPRegisters);
|
||||
SaveLogSetting(hKeyResults,"Log DP Command",TempOptions.LogDPCRegisters);
|
||||
SaveLogSetting(hKeyResults,"Log DP Span",TempOptions.LogDPSRegisters);
|
||||
SaveLogSetting(hKeyResults,"Log MIPS Interface (MI)",TempOptions.LogMIPSInterface);
|
||||
SaveLogSetting(hKeyResults,"Log Video Interface (VI)",TempOptions.LogVideoInterface);
|
||||
SaveLogSetting(hKeyResults,"Log Audio Interface (AI)",TempOptions.LogAudioInterface);
|
||||
SaveLogSetting(hKeyResults,"Log Peripheral Interface (PI)",TempOptions.LogPerInterface);
|
||||
SaveLogSetting(hKeyResults,"Log RDRAM Interface (RI)",TempOptions.LogRDRAMInterface);
|
||||
SaveLogSetting(hKeyResults,"Log Serial Interface (SI)",TempOptions.LogSerialInterface);
|
||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Operations",TempOptions.LogPRDMAOperations);
|
||||
SaveLogSetting(hKeyResults,"Log PifRam Direct Memory Loads",TempOptions.LogPRDirectMemLoads);
|
||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Memory Loads",TempOptions.LogPRDMAMemLoads);
|
||||
SaveLogSetting(hKeyResults,"Log PifRam Direct Memory Stores",TempOptions.LogPRDirectMemStores);
|
||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Memory Stores",TempOptions.LogPRDMAMemStores);
|
||||
SaveLogSetting(hKeyResults,"Log Controller Pak",TempOptions.LogControllerPak);
|
||||
SaveLogSetting(hKeyResults,"Log CP0 changes",TempOptions.LogCP0changes);
|
||||
SaveLogSetting(hKeyResults,"Log CP0 reads",TempOptions.LogCP0reads);
|
||||
SaveLogSetting(hKeyResults,"Log Exceptions",TempOptions.LogExceptions);
|
||||
SaveLogSetting(hKeyResults,"No Interrupts",TempOptions.NoInterrupts);
|
||||
SaveLogSetting(hKeyResults,"Log TLB",TempOptions.LogTLB);
|
||||
SaveLogSetting(hKeyResults,"Log Cache Operations",TempOptions.LogCache);
|
||||
SaveLogSetting(hKeyResults,"Log Rom Header",TempOptions.LogRomHeader);
|
||||
SaveLogSetting(hKeyResults,"Log Unknown access",TempOptions.LogUnknown);
|
||||
|
||||
RegCloseKey(hKeyResults);
|
||||
}
|
||||
|
||||
void LogMessage (const char * Message, ...)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
if (!g_Settings->LoadBool(Debugger_Enabled))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (g_hLogFile == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
va_start( ap, Message );
|
||||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
|
||||
strcat(Msg,"\r\n");
|
||||
|
||||
WriteFile( g_hLogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||
}
|
||||
|
||||
void StartLog (void)
|
||||
{
|
||||
if (!g_LogOptions.GenerateLog)
|
||||
{
|
||||
StopLog();
|
||||
return;
|
||||
}
|
||||
if (g_hLogFile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CPath LogFile(CPath::MODULE_DIRECTORY);
|
||||
LogFile.AppendDirectory("Logs");
|
||||
LogFile.SetNameExtension("cpudebug.log");
|
||||
|
||||
g_hLogFile = CreateFile(LogFile,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(g_hLogFile,0,NULL,FILE_BEGIN);
|
||||
}
|
||||
|
||||
void StopLog (void)
|
||||
{
|
||||
if (g_hLogFile)
|
||||
{
|
||||
CloseHandle(g_hLogFile);
|
||||
}
|
||||
g_hLogFile = NULL;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,48 +9,20 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64\Settings\Logging Settings.h>
|
||||
#include <Common\File Class.h>
|
||||
|
||||
typedef struct
|
||||
class CLogging :
|
||||
public CLogSettings
|
||||
{
|
||||
bool GenerateLog;
|
||||
public:
|
||||
static void StartLog(void);
|
||||
static void StopLog(void);
|
||||
|
||||
/* Registers Log */
|
||||
bool LogRDRamRegisters;
|
||||
bool LogSPRegisters;
|
||||
bool LogDPCRegisters;
|
||||
bool LogDPSRegisters;
|
||||
bool LogMIPSInterface;
|
||||
bool LogVideoInterface;
|
||||
bool LogAudioInterface;
|
||||
bool LogPerInterface;
|
||||
bool LogRDRAMInterface;
|
||||
bool LogSerialInterface;
|
||||
static void Log_LW(uint32_t PC, uint32_t VAddr);
|
||||
static void Log_SW(uint32_t PC, uint32_t VAddr, uint32_t Value);
|
||||
static void LogMessage(const char * Message, ...);
|
||||
|
||||
/* Pif Ram Log */
|
||||
bool LogPRDMAOperations;
|
||||
bool LogPRDirectMemLoads;
|
||||
bool LogPRDMAMemLoads;
|
||||
bool LogPRDirectMemStores;
|
||||
bool LogPRDMAMemStores;
|
||||
bool LogControllerPak;
|
||||
|
||||
/* Special Log */
|
||||
bool LogCP0changes;
|
||||
bool LogCP0reads;
|
||||
bool LogTLB;
|
||||
bool LogExceptions;
|
||||
bool NoInterrupts;
|
||||
bool LogCache;
|
||||
bool LogRomHeader;
|
||||
bool LogUnknown;
|
||||
} LOG_OPTIONS;
|
||||
|
||||
extern LOG_OPTIONS g_LogOptions;
|
||||
|
||||
void EnterLogOptions ( HWND hwndOwner );
|
||||
void StartLog ( void );
|
||||
void StopLog ( void );
|
||||
void LoadLogOptions ( LOG_OPTIONS * LogOptions, bool AlwaysFill );
|
||||
void Log_LW ( uint32_t PC, uint32_t VAddr );
|
||||
void Log_SW ( uint32_t PC, uint32_t VAddr, uint32_t Value );
|
||||
void LogMessage ( const char * Message, ... );
|
||||
private:
|
||||
static CFile * m_hLogFile;
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -11,520 +11,521 @@
|
|||
#pragma once
|
||||
|
||||
enum LanguageStringID{
|
||||
EMPTY_STRING = 0,
|
||||
EMPTY_STRING = 0,
|
||||
|
||||
/*********************************************************************************
|
||||
* Meta Information *
|
||||
*********************************************************************************/
|
||||
//About DLL
|
||||
LANGUAGE_NAME = 1,
|
||||
LANGUAGE_AUTHOR =2,
|
||||
LANGUAGE_VERSION =3,
|
||||
LANGUAGE_DATE =4,
|
||||
/*********************************************************************************
|
||||
* Meta Information *
|
||||
*********************************************************************************/
|
||||
//About DLL
|
||||
LANGUAGE_NAME = 1,
|
||||
LANGUAGE_AUTHOR = 2,
|
||||
LANGUAGE_VERSION = 3,
|
||||
LANGUAGE_DATE = 4,
|
||||
|
||||
//About DLL Dialog
|
||||
INI_CURRENT_LANG =5,
|
||||
INI_AUTHOR =6,
|
||||
INI_VERSION =7,
|
||||
INI_DATE =8,
|
||||
INI_HOMEPAGE =9,
|
||||
INI_CURRENT_RDB =10,
|
||||
INI_CURRENT_CHT =11,
|
||||
INI_CURRENT_RDX =12,
|
||||
//About DLL Dialog
|
||||
INI_CURRENT_LANG = 5,
|
||||
INI_AUTHOR = 6,
|
||||
INI_VERSION = 7,
|
||||
INI_DATE = 8,
|
||||
INI_HOMEPAGE = 9,
|
||||
INI_CURRENT_RDB = 10,
|
||||
INI_CURRENT_CHT = 11,
|
||||
INI_CURRENT_RDX = 12,
|
||||
|
||||
//About INI title
|
||||
INI_TITLE =20,
|
||||
//About INI title
|
||||
INI_TITLE = 20,
|
||||
|
||||
/*********************************************************************************
|
||||
* Numbers *
|
||||
*********************************************************************************/
|
||||
NUMBER_0 =50,
|
||||
NUMBER_1 = 51,
|
||||
NUMBER_2 = 52,
|
||||
NUMBER_3 = 53,
|
||||
NUMBER_4 = 54,
|
||||
NUMBER_5 = 55,
|
||||
NUMBER_6 = 56,
|
||||
NUMBER_7 = 57,
|
||||
NUMBER_8 = 58,
|
||||
NUMBER_9 = 59,
|
||||
/*********************************************************************************
|
||||
* Numbers *
|
||||
*********************************************************************************/
|
||||
NUMBER_0 = 50,
|
||||
NUMBER_1 = 51,
|
||||
NUMBER_2 = 52,
|
||||
NUMBER_3 = 53,
|
||||
NUMBER_4 = 54,
|
||||
NUMBER_5 = 55,
|
||||
NUMBER_6 = 56,
|
||||
NUMBER_7 = 57,
|
||||
NUMBER_8 = 58,
|
||||
NUMBER_9 = 59,
|
||||
|
||||
/*********************************************************************************
|
||||
* Menu *
|
||||
*********************************************************************************/
|
||||
//File Menu
|
||||
MENU_FILE =100,
|
||||
MENU_OPEN =101,
|
||||
MENU_ROM_INFO =102,
|
||||
MENU_START =103,
|
||||
MENU_END =104,
|
||||
MENU_CHOOSE_ROM =105,
|
||||
MENU_REFRESH =106,
|
||||
MENU_RECENT_ROM =107,
|
||||
MENU_RECENT_DIR =108,
|
||||
MENU_EXIT =109,
|
||||
/*********************************************************************************
|
||||
* Menu *
|
||||
*********************************************************************************/
|
||||
//File Menu
|
||||
MENU_FILE = 100,
|
||||
MENU_OPEN = 101,
|
||||
MENU_ROM_INFO = 102,
|
||||
MENU_START = 103,
|
||||
MENU_END = 104,
|
||||
MENU_CHOOSE_ROM = 105,
|
||||
MENU_REFRESH = 106,
|
||||
MENU_RECENT_ROM = 107,
|
||||
MENU_RECENT_DIR = 108,
|
||||
MENU_EXIT = 109,
|
||||
|
||||
//System Menu
|
||||
MENU_SYSTEM =120,
|
||||
MENU_RESET =121,
|
||||
MENU_PAUSE =122,
|
||||
MENU_BITMAP =123,
|
||||
MENU_LIMIT_FPS =124,
|
||||
MENU_SAVE =125,
|
||||
MENU_SAVE_AS =126,
|
||||
MENU_RESTORE =127,
|
||||
MENU_LOAD =128,
|
||||
MENU_CURRENT_SAVE =129,
|
||||
MENU_CHEAT =130,
|
||||
MENU_GS_BUTTON =131,
|
||||
MENU_RESUME =132,
|
||||
MENU_RESET_SOFT =133, //added in build 1.7.50
|
||||
MENU_RESET_HARD =134, //added in build 1.7.50
|
||||
//System Menu
|
||||
MENU_SYSTEM = 120,
|
||||
MENU_RESET = 121,
|
||||
MENU_PAUSE = 122,
|
||||
MENU_BITMAP = 123,
|
||||
MENU_LIMIT_FPS = 124,
|
||||
MENU_SAVE = 125,
|
||||
MENU_SAVE_AS = 126,
|
||||
MENU_RESTORE = 127,
|
||||
MENU_LOAD = 128,
|
||||
MENU_CURRENT_SAVE = 129,
|
||||
MENU_CHEAT = 130,
|
||||
MENU_GS_BUTTON = 131,
|
||||
MENU_RESUME = 132,
|
||||
MENU_RESET_SOFT = 133, //added in build 1.7.50
|
||||
MENU_RESET_HARD = 134, //added in build 1.7.50
|
||||
|
||||
//Options Menu
|
||||
MENU_OPTIONS = 140,
|
||||
MENU_FULL_SCREEN= 141,
|
||||
MENU_ON_TOP = 142,
|
||||
MENU_CONFG_GFX = 143,
|
||||
MENU_CONFG_AUDIO= 144,
|
||||
MENU_CONFG_CTRL = 145,
|
||||
MENU_CONFG_RSP = 146,
|
||||
MENU_SHOW_CPU = 147,
|
||||
MENU_SETTINGS = 148,
|
||||
//Options Menu
|
||||
MENU_OPTIONS = 140,
|
||||
MENU_FULL_SCREEN = 141,
|
||||
MENU_ON_TOP = 142,
|
||||
MENU_CONFG_GFX = 143,
|
||||
MENU_CONFG_AUDIO = 144,
|
||||
MENU_CONFG_CTRL = 145,
|
||||
MENU_CONFG_RSP = 146,
|
||||
MENU_SHOW_CPU = 147,
|
||||
MENU_SETTINGS = 148,
|
||||
|
||||
//Debugger Menu
|
||||
MENU_DEBUGGER = 160,
|
||||
//Debugger Menu
|
||||
MENU_DEBUGGER = 160,
|
||||
|
||||
//Language Menu
|
||||
MENU_LANGUAGE = 175,
|
||||
//Language Menu
|
||||
MENU_LANGUAGE = 175,
|
||||
|
||||
//Help Menu
|
||||
MENU_HELP = 180,
|
||||
MENU_ABOUT_INI = 181,
|
||||
MENU_ABOUT_PJ64 = 182,
|
||||
MENU_FORUM = 183,
|
||||
MENU_HOMEPAGE = 184,
|
||||
//Help Menu
|
||||
MENU_HELP = 180,
|
||||
MENU_ABOUT_INI = 181,
|
||||
MENU_ABOUT_PJ64 = 182,
|
||||
MENU_FORUM = 183,
|
||||
MENU_HOMEPAGE = 184,
|
||||
|
||||
//Current Save Slot menu
|
||||
MENU_SLOT_DEFAULT = 190,
|
||||
MENU_SLOT_1 = 191,
|
||||
MENU_SLOT_2 = 192,
|
||||
MENU_SLOT_3 = 193,
|
||||
MENU_SLOT_4 = 194,
|
||||
MENU_SLOT_5 = 195,
|
||||
MENU_SLOT_6 = 196,
|
||||
MENU_SLOT_7 = 197,
|
||||
MENU_SLOT_8 = 198,
|
||||
MENU_SLOT_9 = 199,
|
||||
MENU_SLOT_10 = 200,
|
||||
//Current Save Slot menu
|
||||
MENU_SLOT_DEFAULT = 190,
|
||||
MENU_SLOT_1 = 191,
|
||||
MENU_SLOT_2 = 192,
|
||||
MENU_SLOT_3 = 193,
|
||||
MENU_SLOT_4 = 194,
|
||||
MENU_SLOT_5 = 195,
|
||||
MENU_SLOT_6 = 196,
|
||||
MENU_SLOT_7 = 197,
|
||||
MENU_SLOT_8 = 198,
|
||||
MENU_SLOT_9 = 199,
|
||||
MENU_SLOT_10 = 200,
|
||||
MENU_SLOT_SAVE = 201,
|
||||
|
||||
//Pop up Menu
|
||||
POPUP_PLAY = 210,
|
||||
POPUP_INFO = 211,
|
||||
POPUP_SETTINGS = 212,
|
||||
POPUP_CHEATS = 213,
|
||||
POPUP_GFX_PLUGIN = 214,
|
||||
//Pop up Menu
|
||||
POPUP_PLAY = 210,
|
||||
POPUP_INFO = 211,
|
||||
POPUP_SETTINGS = 212,
|
||||
POPUP_CHEATS = 213,
|
||||
POPUP_GFX_PLUGIN = 214,
|
||||
|
||||
//selecting save slot
|
||||
SAVE_SLOT_DEFAULT = 220,
|
||||
SAVE_SLOT_1 = 221,
|
||||
SAVE_SLOT_2 = 222,
|
||||
SAVE_SLOT_3 = 223,
|
||||
SAVE_SLOT_4 = 224,
|
||||
SAVE_SLOT_5 = 225,
|
||||
SAVE_SLOT_6 = 226,
|
||||
SAVE_SLOT_7 = 227,
|
||||
SAVE_SLOT_8 = 228,
|
||||
SAVE_SLOT_9 = 229,
|
||||
SAVE_SLOT_10 = 230,
|
||||
//selecting save slot
|
||||
SAVE_SLOT_DEFAULT = 220,
|
||||
SAVE_SLOT_1 = 221,
|
||||
SAVE_SLOT_2 = 222,
|
||||
SAVE_SLOT_3 = 223,
|
||||
SAVE_SLOT_4 = 224,
|
||||
SAVE_SLOT_5 = 225,
|
||||
SAVE_SLOT_6 = 226,
|
||||
SAVE_SLOT_7 = 227,
|
||||
SAVE_SLOT_8 = 228,
|
||||
SAVE_SLOT_9 = 229,
|
||||
SAVE_SLOT_10 = 230,
|
||||
|
||||
// Menu Descriptions (TODO: unused ? implement or remove)
|
||||
MENUDES_OPEN = 250,
|
||||
MENUDES_ROM_INFO = 251,
|
||||
MENUDES_START = 252,
|
||||
MENUDES_END = 253,
|
||||
MENUDES_CHOOSE_ROM = 254,
|
||||
MENUDES_REFRESH = 255,
|
||||
MENUDES_EXIT = 256,
|
||||
MENUDES_RESET = 257,
|
||||
MENUDES_PAUSE = 258,
|
||||
MENUDES_BITMAP = 259,
|
||||
MENUDES_LIMIT_FPS = 260,
|
||||
MENUDES_SAVE = 261,
|
||||
MENUDES_SAVE_AS = 262,
|
||||
MENUDES_RESTORE = 263,
|
||||
MENUDES_LOAD = 264,
|
||||
MENUDES_CHEAT = 265,
|
||||
MENUDES_GS_BUTTON = 266,
|
||||
MENUDES_FULL_SCREEN = 267,
|
||||
MENUDES_ON_TOP = 268,
|
||||
MENUDES_CONFG_GFX = 269,
|
||||
MENUDES_CONFG_AUDIO = 270,
|
||||
MENUDES_CONFG_CTRL = 271,
|
||||
MENUDES_CONFG_RSP = 272,
|
||||
MENUDES_SHOW_CPU = 273,
|
||||
MENUDES_SETTINGS = 274,
|
||||
MENUDES_USER_MAN = 275,
|
||||
MENUDES_GAME_FAQ = 276,
|
||||
MENUDES_ABOUT_INI = 277,
|
||||
MENUDES_ABOUT_PJ64 = 278,
|
||||
MENUDES_RECENT_ROM = 279,
|
||||
MENUDES_RECENT_DIR = 280,
|
||||
MENUDES_LANGUAGES = 281,
|
||||
MENUDES_GAME_SLOT = 282,
|
||||
MENUDES_PLAY_GAME = 283,
|
||||
MENUDES_GAME_INFO = 284,
|
||||
MENUDES_GAME_SETTINGS= 285,
|
||||
MENUDES_GAME_CHEATS = 286,
|
||||
// Menu Descriptions (TODO: unused ? implement or remove)
|
||||
MENUDES_OPEN = 250,
|
||||
MENUDES_ROM_INFO = 251,
|
||||
MENUDES_START = 252,
|
||||
MENUDES_END = 253,
|
||||
MENUDES_CHOOSE_ROM = 254,
|
||||
MENUDES_REFRESH = 255,
|
||||
MENUDES_EXIT = 256,
|
||||
MENUDES_RESET = 257,
|
||||
MENUDES_PAUSE = 258,
|
||||
MENUDES_BITMAP = 259,
|
||||
MENUDES_LIMIT_FPS = 260,
|
||||
MENUDES_SAVE = 261,
|
||||
MENUDES_SAVE_AS = 262,
|
||||
MENUDES_RESTORE = 263,
|
||||
MENUDES_LOAD = 264,
|
||||
MENUDES_CHEAT = 265,
|
||||
MENUDES_GS_BUTTON = 266,
|
||||
MENUDES_FULL_SCREEN = 267,
|
||||
MENUDES_ON_TOP = 268,
|
||||
MENUDES_CONFG_GFX = 269,
|
||||
MENUDES_CONFG_AUDIO = 270,
|
||||
MENUDES_CONFG_CTRL = 271,
|
||||
MENUDES_CONFG_RSP = 272,
|
||||
MENUDES_SHOW_CPU = 273,
|
||||
MENUDES_SETTINGS = 274,
|
||||
MENUDES_USER_MAN = 275,
|
||||
MENUDES_GAME_FAQ = 276,
|
||||
MENUDES_ABOUT_INI = 277,
|
||||
MENUDES_ABOUT_PJ64 = 278,
|
||||
MENUDES_RECENT_ROM = 279,
|
||||
MENUDES_RECENT_DIR = 280,
|
||||
MENUDES_LANGUAGES = 281,
|
||||
MENUDES_GAME_SLOT = 282,
|
||||
MENUDES_PLAY_GAME = 283,
|
||||
MENUDES_GAME_INFO = 284,
|
||||
MENUDES_GAME_SETTINGS = 285,
|
||||
MENUDES_GAME_CHEATS = 286,
|
||||
|
||||
/*********************************************************************************
|
||||
* Rom Browser *
|
||||
*********************************************************************************/
|
||||
//Rom Browser Fields
|
||||
RB_FILENAME = 300,
|
||||
RB_INTERNALNAME = 301,
|
||||
RB_GOODNAME = 302,
|
||||
RB_STATUS = 303,
|
||||
RB_ROMSIZE = 304,
|
||||
RB_NOTES_CORE = 305,
|
||||
RB_NOTES_PLUGIN = 306,
|
||||
RB_NOTES_USER = 307,
|
||||
RB_CART_ID = 308,
|
||||
RB_MANUFACTUER = 309,
|
||||
RB_COUNTRY = 310,
|
||||
RB_DEVELOPER = 311,
|
||||
RB_CRC1 = 312,
|
||||
RB_CRC2 = 313,
|
||||
RB_CICCHIP = 314,
|
||||
RB_RELEASE_DATE = 315,
|
||||
RB_GENRE = 316,
|
||||
RB_PLAYERS = 317,
|
||||
RB_FORCE_FEEDBACK = 318,
|
||||
RB_FILE_FORMAT = 319,
|
||||
/*********************************************************************************
|
||||
* Rom Browser *
|
||||
*********************************************************************************/
|
||||
//Rom Browser Fields
|
||||
RB_FILENAME = 300,
|
||||
RB_INTERNALNAME = 301,
|
||||
RB_GOODNAME = 302,
|
||||
RB_STATUS = 303,
|
||||
RB_ROMSIZE = 304,
|
||||
RB_NOTES_CORE = 305,
|
||||
RB_NOTES_PLUGIN = 306,
|
||||
RB_NOTES_USER = 307,
|
||||
RB_CART_ID = 308,
|
||||
RB_MANUFACTUER = 309,
|
||||
RB_COUNTRY = 310,
|
||||
RB_DEVELOPER = 311,
|
||||
RB_CRC1 = 312,
|
||||
RB_CRC2 = 313,
|
||||
RB_CICCHIP = 314,
|
||||
RB_RELEASE_DATE = 315,
|
||||
RB_GENRE = 316,
|
||||
RB_PLAYERS = 317,
|
||||
RB_FORCE_FEEDBACK = 318,
|
||||
RB_FILE_FORMAT = 319,
|
||||
|
||||
//Select Rom
|
||||
SELECT_ROM_DIR = 320,
|
||||
//Select Rom
|
||||
SELECT_ROM_DIR = 320,
|
||||
|
||||
//Messages
|
||||
RB_NOT_GOOD_FILE = 340,
|
||||
//Messages
|
||||
RB_NOT_GOOD_FILE = 340,
|
||||
|
||||
/*********************************************************************************
|
||||
* Options *
|
||||
*********************************************************************************/
|
||||
//Options Title
|
||||
OPTIONS_TITLE = 400,
|
||||
/*********************************************************************************
|
||||
* Options *
|
||||
*********************************************************************************/
|
||||
//Options Title
|
||||
OPTIONS_TITLE = 400,
|
||||
|
||||
//Tabs
|
||||
TAB_PLUGIN = 401,
|
||||
TAB_DIRECTORY = 402,
|
||||
TAB_OPTIONS = 403,
|
||||
TAB_ROMSELECTION = 404,
|
||||
TAB_ADVANCED = 405,
|
||||
TAB_ROMSETTINGS = 406,
|
||||
TAB_SHELLINTERGATION= 407,
|
||||
TAB_ROMNOTES = 408,
|
||||
TAB_SHORTCUTS = 409,
|
||||
TAB_ROMSTATUS = 410,
|
||||
TAB_RECOMPILER = 411, //Added in 1.7.0.50
|
||||
//Tabs
|
||||
TAB_PLUGIN = 401,
|
||||
TAB_DIRECTORY = 402,
|
||||
TAB_OPTIONS = 403,
|
||||
TAB_ROMSELECTION = 404,
|
||||
TAB_ADVANCED = 405,
|
||||
TAB_ROMSETTINGS = 406,
|
||||
TAB_SHELLINTERGATION = 407,
|
||||
TAB_ROMNOTES = 408,
|
||||
TAB_SHORTCUTS = 409,
|
||||
TAB_ROMSTATUS = 410,
|
||||
TAB_RECOMPILER = 411, //Added in 1.7.0.50
|
||||
|
||||
//Plugin Dialog
|
||||
PLUG_ABOUT = 420,
|
||||
PLUG_RSP = 421,
|
||||
PLUG_GFX = 422,
|
||||
PLUG_AUDIO = 423,
|
||||
PLUG_CTRL = 424,
|
||||
PLUG_HLE_GFX = 425,
|
||||
PLUG_HLE_AUDIO = 426,
|
||||
PLUG_DEFAULT = 427,
|
||||
//Plugin Dialog
|
||||
PLUG_ABOUT = 420,
|
||||
PLUG_RSP = 421,
|
||||
PLUG_GFX = 422,
|
||||
PLUG_AUDIO = 423,
|
||||
PLUG_CTRL = 424,
|
||||
PLUG_HLE_GFX = 425,
|
||||
PLUG_HLE_AUDIO = 426,
|
||||
PLUG_DEFAULT = 427,
|
||||
|
||||
//Directory Dialog
|
||||
DIR_PLUGIN = 440,
|
||||
DIR_ROM = 441,
|
||||
DIR_AUTO_SAVE = 442,
|
||||
DIR_INSTANT_SAVE = 443,
|
||||
DIR_SCREEN_SHOT = 444,
|
||||
DIR_ROM_DEFAULT = 445,
|
||||
DIR_SELECT_PLUGIN = 446,
|
||||
DIR_SELECT_ROM = 447,
|
||||
DIR_SELECT_AUTO = 448,
|
||||
DIR_SELECT_INSTANT = 449,
|
||||
DIR_SELECT_SCREEN = 450,
|
||||
DIR_TEXTURE = 451,
|
||||
DIR_SELECT_TEXTURE = 452,
|
||||
//Directory Dialog
|
||||
DIR_PLUGIN = 440,
|
||||
DIR_ROM = 441,
|
||||
DIR_AUTO_SAVE = 442,
|
||||
DIR_INSTANT_SAVE = 443,
|
||||
DIR_SCREEN_SHOT = 444,
|
||||
DIR_ROM_DEFAULT = 445,
|
||||
DIR_SELECT_PLUGIN = 446,
|
||||
DIR_SELECT_ROM = 447,
|
||||
DIR_SELECT_AUTO = 448,
|
||||
DIR_SELECT_INSTANT = 449,
|
||||
DIR_SELECT_SCREEN = 450,
|
||||
DIR_TEXTURE = 451,
|
||||
DIR_SELECT_TEXTURE = 452,
|
||||
|
||||
//Options (general) Tab
|
||||
OPTION_AUTO_SLEEP =460,
|
||||
OPTION_AUTO_FULLSCREEN =461,
|
||||
OPTION_BASIC_MODE =462,
|
||||
OPTION_REMEMBER_CHEAT =463,
|
||||
OPTION_DISABLE_SS =464,
|
||||
OPTION_DISPLAY_FR =465,
|
||||
OPTION_CHANGE_FR =466,
|
||||
OPTION_CHECK_RUNNING =467,
|
||||
//Options (general) Tab
|
||||
OPTION_AUTO_SLEEP = 460,
|
||||
OPTION_AUTO_FULLSCREEN = 461,
|
||||
OPTION_BASIC_MODE = 462,
|
||||
OPTION_REMEMBER_CHEAT = 463,
|
||||
OPTION_DISABLE_SS = 464,
|
||||
OPTION_DISPLAY_FR = 465,
|
||||
OPTION_CHANGE_FR = 466,
|
||||
OPTION_CHECK_RUNNING = 467,
|
||||
|
||||
//Rom Browser Tab
|
||||
RB_MAX_ROMS = 480,
|
||||
RB_ROMS = 481,
|
||||
RB_MAX_DIRS = 482,
|
||||
RB_DIRS = 483,
|
||||
RB_USE = 484,
|
||||
RB_DIR_RECURSION = 485,
|
||||
RB_AVALIABLE_FIELDS = 486,
|
||||
RB_SHOW_FIELDS = 487,
|
||||
RB_ADD = 488,
|
||||
RB_REMOVE = 489,
|
||||
RB_UP = 490,
|
||||
RB_DOWN = 491,
|
||||
RB_REFRESH = 492,
|
||||
//Rom Browser Tab
|
||||
RB_MAX_ROMS = 480,
|
||||
RB_ROMS = 481,
|
||||
RB_MAX_DIRS = 482,
|
||||
RB_DIRS = 483,
|
||||
RB_USE = 484,
|
||||
RB_DIR_RECURSION = 485,
|
||||
RB_AVALIABLE_FIELDS = 486,
|
||||
RB_SHOW_FIELDS = 487,
|
||||
RB_ADD = 488,
|
||||
RB_REMOVE = 489,
|
||||
RB_UP = 490,
|
||||
RB_DOWN = 491,
|
||||
RB_REFRESH = 492,
|
||||
|
||||
//Advanced Options
|
||||
ADVANCE_INFO = 500,
|
||||
ADVANCE_DEFAULTS = 501,
|
||||
ADVANCE_CPU_STYLE = 502,
|
||||
ADVANCE_SMCM = 503,
|
||||
ADVANCE_MEM_SIZE = 504,
|
||||
ADVANCE_ABL = 505,
|
||||
ADVANCE_AUTO_START = 506,
|
||||
ADVANCE_OVERWRITE = 507,
|
||||
ADVANCE_COMPRESS = 508,
|
||||
ADVANCE_DEBUGGER = 509,
|
||||
ADVANCE_SMM_CACHE = 510,
|
||||
ADVANCE_SMM_PIDMA = 511,
|
||||
ADVANCE_SMM_VALIDATE= 512,
|
||||
ADVANCE_SMM_PROTECT = 513,
|
||||
ADVANCE_SMM_TLB = 514,
|
||||
//Advanced Options
|
||||
ADVANCE_INFO = 500,
|
||||
ADVANCE_DEFAULTS = 501,
|
||||
ADVANCE_CPU_STYLE = 502,
|
||||
ADVANCE_SMCM = 503,
|
||||
ADVANCE_MEM_SIZE = 504,
|
||||
ADVANCE_ABL = 505,
|
||||
ADVANCE_AUTO_START = 506,
|
||||
ADVANCE_OVERWRITE = 507,
|
||||
ADVANCE_COMPRESS = 508,
|
||||
ADVANCE_DEBUGGER = 509,
|
||||
ADVANCE_SMM_CACHE = 510,
|
||||
ADVANCE_SMM_PIDMA = 511,
|
||||
ADVANCE_SMM_VALIDATE = 512,
|
||||
ADVANCE_SMM_PROTECT = 513,
|
||||
ADVANCE_SMM_TLB = 514,
|
||||
|
||||
//Rom Options
|
||||
ROM_CPU_STYLE = 520,
|
||||
ROM_VIREFRESH = 521,
|
||||
ROM_MEM_SIZE = 522,
|
||||
ROM_ABL = 523,
|
||||
ROM_SAVE_TYPE = 524,
|
||||
ROM_COUNTER_FACTOR = 525,
|
||||
ROM_LARGE_BUFFER = 526,
|
||||
ROM_USE_TLB = 527,
|
||||
ROM_REG_CACHE = 528,
|
||||
ROM_DELAY_SI = 529,
|
||||
ROM_FAST_SP = 530,
|
||||
ROM_DEFAULT = 531,
|
||||
ROM_AUDIO_SIGNAL = 532,
|
||||
ROM_FIXED_AUDIO = 533,
|
||||
ROM_FUNC_FIND = 534,
|
||||
ROM_CUSTOM_SMM = 535,
|
||||
ROM_SYNC_AUDIO = 536,
|
||||
ROM_COUNTPERBYTE = 537,
|
||||
ROM_32BIT = 538,
|
||||
ROM_DELAY_DP = 539,
|
||||
//Rom Options
|
||||
ROM_CPU_STYLE = 520,
|
||||
ROM_VIREFRESH = 521,
|
||||
ROM_MEM_SIZE = 522,
|
||||
ROM_ABL = 523,
|
||||
ROM_SAVE_TYPE = 524,
|
||||
ROM_COUNTER_FACTOR = 525,
|
||||
ROM_LARGE_BUFFER = 526,
|
||||
ROM_USE_TLB = 527,
|
||||
ROM_REG_CACHE = 528,
|
||||
ROM_DELAY_SI = 529,
|
||||
ROM_FAST_SP = 530,
|
||||
ROM_DEFAULT = 531,
|
||||
ROM_AUDIO_SIGNAL = 532,
|
||||
ROM_FIXED_AUDIO = 533,
|
||||
ROM_FUNC_FIND = 534,
|
||||
ROM_CUSTOM_SMM = 535,
|
||||
ROM_SYNC_AUDIO = 536,
|
||||
ROM_COUNTPERBYTE = 537,
|
||||
ROM_32BIT = 538,
|
||||
ROM_DELAY_DP = 539,
|
||||
|
||||
//Core Styles
|
||||
CORE_INTERPTER = 540,
|
||||
CORE_RECOMPILER = 541,
|
||||
CORE_SYNC = 542,
|
||||
//Core Styles
|
||||
CORE_INTERPTER = 540,
|
||||
CORE_RECOMPILER = 541,
|
||||
CORE_SYNC = 542,
|
||||
|
||||
//Self Mod Methods
|
||||
SMCM_NONE = 560,
|
||||
SMCM_CACHE = 561,
|
||||
SMCM_PROECTED = 562,
|
||||
SMCM_CHECK_MEM = 563,
|
||||
SMCM_CHANGE_MEM = 564,
|
||||
SMCM_CHECK_ADV = 565,
|
||||
SMCM_CACHE2 = 566,
|
||||
//Self Mod Methods
|
||||
SMCM_NONE = 560,
|
||||
SMCM_CACHE = 561,
|
||||
SMCM_PROECTED = 562,
|
||||
SMCM_CHECK_MEM = 563,
|
||||
SMCM_CHANGE_MEM = 564,
|
||||
SMCM_CHECK_ADV = 565,
|
||||
SMCM_CACHE2 = 566,
|
||||
|
||||
//Function Lookup memthod
|
||||
FLM_PLOOKUP = 570,
|
||||
FLM_VLOOKUP = 571,
|
||||
FLM_CHANGEMEM = 572,
|
||||
//Function Lookup memthod
|
||||
FLM_PLOOKUP = 570,
|
||||
FLM_VLOOKUP = 571,
|
||||
FLM_CHANGEMEM = 572,
|
||||
|
||||
//RDRAM Size
|
||||
RDRAM_4MB = 580,
|
||||
RDRAM_8MB = 581,
|
||||
//RDRAM Size
|
||||
RDRAM_4MB = 580,
|
||||
RDRAM_8MB = 581,
|
||||
|
||||
//Advanced Block Linking
|
||||
ABL_ON = 600,
|
||||
ABL_OFF = 601,
|
||||
//Advanced Block Linking
|
||||
ABL_ON = 600,
|
||||
ABL_OFF = 601,
|
||||
|
||||
//Save Type
|
||||
SAVE_FIRST_USED = 620,
|
||||
SAVE_4K_EEPROM = 621,
|
||||
SAVE_16K_EEPROM = 622,
|
||||
SAVE_SRAM = 623,
|
||||
SAVE_FLASHRAM = 624,
|
||||
//Save Type
|
||||
SAVE_FIRST_USED = 620,
|
||||
SAVE_4K_EEPROM = 621,
|
||||
SAVE_16K_EEPROM = 622,
|
||||
SAVE_SRAM = 623,
|
||||
SAVE_FLASHRAM = 624,
|
||||
|
||||
//Shell Integration Tab
|
||||
SHELL_TEXT = 640,
|
||||
//Shell Integration Tab
|
||||
SHELL_TEXT = 640,
|
||||
|
||||
//Rom Notes
|
||||
NOTE_STATUS = 660,
|
||||
NOTE_CORE = 661,
|
||||
NOTE_PLUGIN = 662,
|
||||
//Rom Notes
|
||||
NOTE_STATUS = 660,
|
||||
NOTE_CORE = 661,
|
||||
NOTE_PLUGIN = 662,
|
||||
|
||||
// Accelerator Selector
|
||||
ACCEL_CPUSTATE_TITLE = 680,
|
||||
ACCEL_MENUITEM_TITLE = 681,
|
||||
ACCEL_CURRENTKEYS_TITLE = 682,
|
||||
ACCEL_SELKEY_TITLE = 683,
|
||||
ACCEL_ASSIGNEDTO_TITLE = 684,
|
||||
ACCEL_ASSIGN_BTN = 685,
|
||||
ACCEL_REMOVE_BTN = 686,
|
||||
ACCEL_RESETALL_BTN = 687,
|
||||
ACCEL_CPUSTATE_1 = 688,
|
||||
ACCEL_CPUSTATE_2 = 689,
|
||||
ACCEL_CPUSTATE_3 = 690,
|
||||
ACCEL_CPUSTATE_4 = 691,
|
||||
ACCEL_DETECTKEY = 692,
|
||||
// Accelerator Selector
|
||||
ACCEL_CPUSTATE_TITLE = 680,
|
||||
ACCEL_MENUITEM_TITLE = 681,
|
||||
ACCEL_CURRENTKEYS_TITLE = 682,
|
||||
ACCEL_SELKEY_TITLE = 683,
|
||||
ACCEL_ASSIGNEDTO_TITLE = 684,
|
||||
ACCEL_ASSIGN_BTN = 685,
|
||||
ACCEL_REMOVE_BTN = 686,
|
||||
ACCEL_RESETALL_BTN = 687,
|
||||
ACCEL_CPUSTATE_1 = 688,
|
||||
ACCEL_CPUSTATE_2 = 689,
|
||||
ACCEL_CPUSTATE_3 = 690,
|
||||
ACCEL_CPUSTATE_4 = 691,
|
||||
ACCEL_DETECTKEY = 692,
|
||||
|
||||
// Frame Rate Option
|
||||
STR_FR_VIS = 700,
|
||||
STR_FR_DLS = 701,
|
||||
STR_FR_PERCENT = 702,
|
||||
// Frame Rate Option
|
||||
STR_FR_VIS = 700,
|
||||
STR_FR_DLS = 701,
|
||||
STR_FR_PERCENT = 702,
|
||||
|
||||
// Increase speed
|
||||
STR_INSREASE_SPEED = 710,
|
||||
STR_DECREASE_SPEED = 711,
|
||||
// Increase speed
|
||||
STR_INSREASE_SPEED = 710,
|
||||
STR_DECREASE_SPEED = 711,
|
||||
|
||||
//Bottom page buttons
|
||||
BOTTOM_RESET_PAGE = 720,
|
||||
BOTTOM_RESET_ALL = 721,
|
||||
BOTTOM_APPLY = 722,
|
||||
BOTTOM_CLOSE = 723,
|
||||
//Bottom page buttons
|
||||
BOTTOM_RESET_PAGE = 720,
|
||||
BOTTOM_RESET_ALL = 721,
|
||||
BOTTOM_APPLY = 722,
|
||||
BOTTOM_CLOSE = 723,
|
||||
|
||||
/*********************************************************************************
|
||||
* ROM Information *
|
||||
*********************************************************************************/
|
||||
//Rom Info Title Title
|
||||
INFO_TITLE = 800,
|
||||
/*********************************************************************************
|
||||
* ROM Information *
|
||||
*********************************************************************************/
|
||||
//Rom Info Title Title
|
||||
INFO_TITLE = 800,
|
||||
|
||||
//Rom Info Text
|
||||
INFO_ROM_NAME_TEXT = 801,
|
||||
INFO_FILE_NAME_TEXT = 802,
|
||||
INFO_LOCATION_TEXT = 803,
|
||||
INFO_SIZE_TEXT = 804,
|
||||
INFO_CART_ID_TEXT = 805,
|
||||
INFO_MANUFACTURER_TEXT= 806,
|
||||
INFO_COUNTRY_TEXT = 807,
|
||||
INFO_CRC1_TEXT = 808,
|
||||
INFO_CRC2_TEXT = 809,
|
||||
INFO_CIC_CHIP_TEXT = 810,
|
||||
INFO_MD5_TEXT = 811,
|
||||
//Rom Info Text
|
||||
INFO_ROM_NAME_TEXT = 801,
|
||||
INFO_FILE_NAME_TEXT = 802,
|
||||
INFO_LOCATION_TEXT = 803,
|
||||
INFO_SIZE_TEXT = 804,
|
||||
INFO_CART_ID_TEXT = 805,
|
||||
INFO_MANUFACTURER_TEXT = 806,
|
||||
INFO_COUNTRY_TEXT = 807,
|
||||
INFO_CRC1_TEXT = 808,
|
||||
INFO_CRC2_TEXT = 809,
|
||||
INFO_CIC_CHIP_TEXT = 810,
|
||||
INFO_MD5_TEXT = 811,
|
||||
|
||||
/*********************************************************************************
|
||||
* Cheats *
|
||||
*********************************************************************************/
|
||||
//Cheat List
|
||||
CHEAT_TITLE = 1000,
|
||||
CHEAT_LIST_FRAME = 1001,
|
||||
CHEAT_NOTES_FRAME = 1002,
|
||||
CHEAT_MARK_ALL = 1003,
|
||||
CHEAT_MARK_NONE = 1004,
|
||||
/*********************************************************************************
|
||||
* Cheats *
|
||||
*********************************************************************************/
|
||||
//Cheat List
|
||||
CHEAT_TITLE = 1000,
|
||||
CHEAT_LIST_FRAME = 1001,
|
||||
CHEAT_NOTES_FRAME = 1002,
|
||||
CHEAT_MARK_ALL = 1003,
|
||||
CHEAT_MARK_NONE = 1004,
|
||||
|
||||
//Add Cheat
|
||||
CHEAT_ADDCHEAT_FRAME =1005,
|
||||
CHEAT_ADDCHEAT_NAME =1006,
|
||||
CHEAT_ADDCHEAT_CODE = 1007,
|
||||
CHEAT_ADDCHEAT_INSERT= 1008,
|
||||
CHEAT_ADDCHEAT_CLEAR= 1009,
|
||||
CHEAT_ADDCHEAT_NOTES= 1010,
|
||||
CHEAT_ADD_TO_DB = 1011,
|
||||
//Add Cheat
|
||||
CHEAT_ADDCHEAT_FRAME = 1005,
|
||||
CHEAT_ADDCHEAT_NAME = 1006,
|
||||
CHEAT_ADDCHEAT_CODE = 1007,
|
||||
CHEAT_ADDCHEAT_INSERT = 1008,
|
||||
CHEAT_ADDCHEAT_CLEAR = 1009,
|
||||
CHEAT_ADDCHEAT_NOTES = 1010,
|
||||
CHEAT_ADD_TO_DB = 1011,
|
||||
|
||||
//Code extension
|
||||
CHEAT_CODE_EXT_TITLE =1012,
|
||||
CHEAT_CODE_EXT_TXT =1013,
|
||||
CHEAT_OK =1014,
|
||||
CHEAT_CANCEL =1015,
|
||||
//Code extension
|
||||
CHEAT_CODE_EXT_TITLE = 1012,
|
||||
CHEAT_CODE_EXT_TXT = 1013,
|
||||
CHEAT_OK = 1014,
|
||||
CHEAT_CANCEL = 1015,
|
||||
|
||||
//Digital Value
|
||||
CHEAT_QUANTITY_TITLE =1016,
|
||||
CHEAT_CHOOSE_VALUE =1017,
|
||||
CHEAT_VALUE =1018,
|
||||
CHEAT_FROM =1019,
|
||||
CHEAT_TO =1020,
|
||||
CHEAT_NOTES =1021,
|
||||
CHEAT_ADDCHEAT_ADD = 1022,
|
||||
CHEAT_ADDCHEAT_NEW = 1023,
|
||||
CHEAT_ADDCHEAT_CODEDES =1024,
|
||||
CHEAT_ADDCHEAT_OPT =1025,
|
||||
CHEAT_ADDCHEAT_OPTDES =1026,
|
||||
//Digital Value
|
||||
CHEAT_QUANTITY_TITLE = 1016,
|
||||
CHEAT_CHOOSE_VALUE = 1017,
|
||||
CHEAT_VALUE = 1018,
|
||||
CHEAT_FROM = 1019,
|
||||
CHEAT_TO = 1020,
|
||||
CHEAT_NOTES = 1021,
|
||||
CHEAT_ADDCHEAT_ADD = 1022,
|
||||
CHEAT_ADDCHEAT_NEW = 1023,
|
||||
CHEAT_ADDCHEAT_CODEDES = 1024,
|
||||
CHEAT_ADDCHEAT_OPT = 1025,
|
||||
CHEAT_ADDCHEAT_OPTDES = 1026,
|
||||
|
||||
//Edit Cheat
|
||||
CHEAT_EDITCHEAT_WINDOW =1027,
|
||||
CHEAT_EDITCHEAT_UPDATE =1028,
|
||||
CHEAT_CHANGED_MSG =1029,
|
||||
CHEAT_CHANGED_TITLE =1030,
|
||||
//Edit Cheat
|
||||
CHEAT_EDITCHEAT_WINDOW = 1027,
|
||||
CHEAT_EDITCHEAT_UPDATE = 1028,
|
||||
CHEAT_CHANGED_MSG = 1029,
|
||||
CHEAT_CHANGED_TITLE = 1030,
|
||||
|
||||
//Cheat Popup Menu
|
||||
CHEAT_ADDNEW =1040,
|
||||
CHEAT_EDIT = 1041,
|
||||
CHEAT_DELETE = 1042,
|
||||
//Cheat Popup Menu
|
||||
CHEAT_ADDNEW = 1040,
|
||||
CHEAT_EDIT = 1041,
|
||||
CHEAT_DELETE = 1042,
|
||||
|
||||
// short cut editor
|
||||
STR_SHORTCUT_RESET_TITLE = 1100,
|
||||
STR_SHORTCUT_RESET_TEXT = 1101,
|
||||
STR_SHORTCUT_FILEMENU = 1102,
|
||||
STR_SHORTCUT_SYSTEMMENU = 1103,
|
||||
STR_SHORTCUT_OPTIONS = 1104,
|
||||
STR_SHORTCUT_SAVESLOT = 1105,
|
||||
// short cut editor
|
||||
STR_SHORTCUT_RESET_TITLE = 1100,
|
||||
STR_SHORTCUT_RESET_TEXT = 1101,
|
||||
STR_SHORTCUT_FILEMENU = 1102,
|
||||
STR_SHORTCUT_SYSTEMMENU = 1103,
|
||||
STR_SHORTCUT_OPTIONS = 1104,
|
||||
STR_SHORTCUT_SAVESLOT = 1105,
|
||||
|
||||
/*********************************************************************************
|
||||
* Messages *
|
||||
*********************************************************************************/
|
||||
MSG_CPU_PAUSED = 2000,
|
||||
MSG_CPU_RESUMED = 2001,
|
||||
MSG_PERM_LOOP = 2002,
|
||||
MSG_MEM_ALLOC_ERROR = 2003,
|
||||
MSG_FAIL_INIT_GFX = 2004,
|
||||
MSG_FAIL_INIT_AUDIO = 2005,
|
||||
MSG_FAIL_INIT_RSP = 2006,
|
||||
MSG_FAIL_INIT_CONTROL = 2007,
|
||||
MSG_FAIL_LOAD_PLUGIN = 2008,
|
||||
MSG_FAIL_LOAD_WORD = 2009,
|
||||
MSG_FAIL_OPEN_SAVE = 2010,
|
||||
MSG_FAIL_OPEN_EEPROM = 2011,
|
||||
MSG_FAIL_OPEN_FLASH = 2012,
|
||||
MSG_FAIL_OPEN_MEMPAK = 2013,
|
||||
MSG_FAIL_OPEN_ZIP = 2014,
|
||||
MSG_FAIL_OPEN_IMAGE = 2015,
|
||||
MSG_FAIL_ZIP = 2016,
|
||||
MSG_FAIL_IMAGE = 2017,
|
||||
MSG_UNKNOWN_COUNTRY = 2018,
|
||||
MSG_UNKNOWN_CIC_CHIP = 2019,
|
||||
MSG_UNKNOWN_FILE_FORMAT= 2020,
|
||||
MSG_UNKNOWN_MEM_ACTION = 2021,
|
||||
MSG_UNHANDLED_OP = 2022,
|
||||
MSG_NONMAPPED_SPACE = 2023,
|
||||
MSG_SAVE_STATE_HEADER = 2024,
|
||||
MSG_MSGBOX_TITLE =2025,
|
||||
MSG_PIF2_ERROR = 2026,
|
||||
MSG_PIF2_TITLE = 2027,
|
||||
MSG_PLUGIN_CHANGE = 2028,
|
||||
MSG_PLUGIN_CHANGE_TITLE= 2029,
|
||||
MSG_EMULATION_ENDED = 2030,
|
||||
MSG_EMULATION_STARTED = 2031,
|
||||
MSG_UNABLED_LOAD_STATE = 2032,
|
||||
MSG_LOADED_STATE = 2033,
|
||||
MSG_SAVED_STATE = 2034,
|
||||
MSG_SAVE_SLOT = 2035,
|
||||
MSG_BYTESWAP =2036,
|
||||
MSG_CHOOSE_IMAGE = 2037,
|
||||
MSG_LOADED = 2038,
|
||||
MSG_LOADING = 2039,
|
||||
MSG_PLUGIN_NOT_INIT = 2040,
|
||||
MSG_DEL_SURE = 2041,
|
||||
MSG_DEL_TITLE = 2042,
|
||||
MSG_CHEAT_NAME_IN_USE = 2043,
|
||||
MSG_MAX_CHEATS = 2044,
|
||||
MSG_PLUGIN_INIT = 2045, //Added in pj64 1.6
|
||||
MSG_NO_SHORTCUT_SEL = 2046, //Added in pj64 1.6
|
||||
MSG_NO_MENUITEM_SEL = 2047, //Added in pj64 1.6
|
||||
MSG_MENUITEM_ASSIGNED = 2048, //Added in pj64 1.6
|
||||
MSG_NO_SEL_SHORTCUT = 2049, //Added in pj64 1.6
|
||||
MSG_WAITING_FOR_START = 2050, //Added in pj64 1.7
|
||||
MSG_INVALID_EXE = 2051, //Added in pj64 1.7
|
||||
MSG_INVALID_EXE_TITLE = 2052, //Added in pj64 1.7
|
||||
MSG_7Z_FILE_NOT_FOUND = 2053, //Added in pj64 1.7
|
||||
MSG_SET_LLE_GFX_TITLE = 2054, //Added in pj64 1.7
|
||||
MSG_SET_LLE_GFX_MSG = 2055, //Added in pj64 1.7
|
||||
MSG_SET_HLE_AUD_TITLE = 2056, //Added in pj64 1.7
|
||||
MSG_SET_HLE_AUD_MSG = 2057, //Added in pj64 1.7
|
||||
/*********************************************************************************
|
||||
* Messages *
|
||||
*********************************************************************************/
|
||||
MSG_CPU_PAUSED = 2000,
|
||||
MSG_CPU_RESUMED = 2001,
|
||||
MSG_PERM_LOOP = 2002,
|
||||
MSG_MEM_ALLOC_ERROR = 2003,
|
||||
MSG_FAIL_INIT_GFX = 2004,
|
||||
MSG_FAIL_INIT_AUDIO = 2005,
|
||||
MSG_FAIL_INIT_RSP = 2006,
|
||||
MSG_FAIL_INIT_CONTROL = 2007,
|
||||
MSG_FAIL_LOAD_PLUGIN = 2008,
|
||||
MSG_FAIL_LOAD_WORD = 2009,
|
||||
MSG_FAIL_OPEN_SAVE = 2010,
|
||||
MSG_FAIL_OPEN_EEPROM = 2011,
|
||||
MSG_FAIL_OPEN_FLASH = 2012,
|
||||
MSG_FAIL_OPEN_MEMPAK = 2013,
|
||||
MSG_FAIL_OPEN_ZIP = 2014,
|
||||
MSG_FAIL_OPEN_IMAGE = 2015,
|
||||
MSG_FAIL_ZIP = 2016,
|
||||
MSG_FAIL_IMAGE = 2017,
|
||||
MSG_UNKNOWN_COUNTRY = 2018,
|
||||
MSG_UNKNOWN_CIC_CHIP = 2019,
|
||||
MSG_UNKNOWN_FILE_FORMAT = 2020,
|
||||
MSG_UNKNOWN_MEM_ACTION = 2021,
|
||||
MSG_UNHANDLED_OP = 2022,
|
||||
MSG_NONMAPPED_SPACE = 2023,
|
||||
MSG_SAVE_STATE_HEADER = 2024,
|
||||
MSG_MSGBOX_TITLE = 2025,
|
||||
MSG_PIF2_ERROR = 2026,
|
||||
MSG_PIF2_TITLE = 2027,
|
||||
MSG_PLUGIN_CHANGE = 2028,
|
||||
MSG_PLUGIN_CHANGE_TITLE = 2029,
|
||||
MSG_EMULATION_ENDED = 2030,
|
||||
MSG_EMULATION_STARTED = 2031,
|
||||
MSG_UNABLED_LOAD_STATE = 2032,
|
||||
MSG_LOADED_STATE = 2033,
|
||||
MSG_SAVED_STATE = 2034,
|
||||
MSG_SAVE_SLOT = 2035,
|
||||
MSG_BYTESWAP = 2036,
|
||||
MSG_CHOOSE_IMAGE = 2037,
|
||||
MSG_LOADED = 2038,
|
||||
MSG_LOADING = 2039,
|
||||
MSG_PLUGIN_NOT_INIT = 2040,
|
||||
MSG_DEL_SURE = 2041,
|
||||
MSG_DEL_TITLE = 2042,
|
||||
MSG_CHEAT_NAME_IN_USE = 2043,
|
||||
MSG_MAX_CHEATS = 2044,
|
||||
MSG_PLUGIN_INIT = 2045, //Added in pj64 1.6
|
||||
MSG_NO_SHORTCUT_SEL = 2046, //Added in pj64 1.6
|
||||
MSG_NO_MENUITEM_SEL = 2047, //Added in pj64 1.6
|
||||
MSG_MENUITEM_ASSIGNED = 2048, //Added in pj64 1.6
|
||||
MSG_NO_SEL_SHORTCUT = 2049, //Added in pj64 1.6
|
||||
MSG_WAITING_FOR_START = 2050, //Added in pj64 1.7
|
||||
MSG_INVALID_EXE = 2051, //Added in pj64 1.7
|
||||
MSG_INVALID_EXE_TITLE = 2052, //Added in pj64 1.7
|
||||
MSG_7Z_FILE_NOT_FOUND = 2053, //Added in pj64 1.7
|
||||
MSG_SET_LLE_GFX_TITLE = 2054, //Added in pj64 1.7
|
||||
MSG_SET_LLE_GFX_MSG = 2055, //Added in pj64 1.7
|
||||
MSG_SET_HLE_AUD_TITLE = 2056, //Added in pj64 1.7
|
||||
MSG_SET_HLE_AUD_MSG = 2057, //Added in pj64 1.7
|
||||
};
|
||||
|
||||
#include ".\\Multilanguage\Language Class.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -14,8 +14,9 @@
|
|||
#include <string> //stl string
|
||||
#include <map> //stl map
|
||||
#include <list> //stl list
|
||||
#include <common/stdtypes.h>
|
||||
|
||||
typedef std::map<int, std::wstring, std::less<int> > LANG_STRINGS;
|
||||
typedef std::map<int32_t, std::wstring, std::less<int32_t> > LANG_STRINGS;
|
||||
typedef LANG_STRINGS::value_type LANG_STR;
|
||||
|
||||
struct LanguageFile
|
||||
|
@ -29,14 +30,14 @@ typedef std::list<LanguageFile> LanguageList;
|
|||
class CLanguage
|
||||
{
|
||||
public:
|
||||
CLanguage ();
|
||||
CLanguage();
|
||||
|
||||
const std::wstring & GetString ( LanguageStringID StringID );
|
||||
LanguageList & GetLangList ( void );
|
||||
void SetLanguage ( const wchar_t * LanguageName );
|
||||
bool LoadCurrentStrings ( void );
|
||||
bool IsCurrentLang ( LanguageFile & File );
|
||||
bool IsLanguageLoaded ( void ) const { return m_LanguageLoaded; }
|
||||
const std::wstring & GetString(LanguageStringID StringID);
|
||||
LanguageList & GetLangList(void);
|
||||
void SetLanguage(const wchar_t * LanguageName);
|
||||
bool LoadCurrentStrings(void);
|
||||
bool IsCurrentLang(LanguageFile & File);
|
||||
bool IsLanguageLoaded(void) const { return m_LanguageLoaded; }
|
||||
|
||||
private:
|
||||
CLanguage(const CLanguage&); // Disable copy constructor
|
||||
|
@ -48,16 +49,16 @@ private:
|
|||
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
|
||||
LanguageList m_LanguageList;
|
||||
|
||||
std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
|
||||
LANG_STR GetNextLangString ( void * OpenFile );
|
||||
void LoadDefaultStrings ( void );
|
||||
std::wstring GetLangString(const char * FileName, LanguageStringID ID);
|
||||
LANG_STR GetNextLangString(void * OpenFile);
|
||||
void LoadDefaultStrings(void);
|
||||
|
||||
bool m_LanguageLoaded;
|
||||
bool m_LanguageLoaded;
|
||||
};
|
||||
|
||||
extern CLanguage * g_Lang;
|
||||
|
||||
inline const wchar_t * GS (LanguageStringID StringID)
|
||||
inline const wchar_t * GS(LanguageStringID StringID)
|
||||
{
|
||||
return g_Lang->GetString(StringID).c_str();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -15,299 +15,114 @@ CLanguageSelector::CLanguageSelector()
|
|||
{
|
||||
}
|
||||
|
||||
void CLanguageSelector::Select ( void )
|
||||
void CLanguageSelector::Select(void)
|
||||
{
|
||||
DialogBoxParam(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_Lang_Select),NULL,(DLGPROC)LangSelectProc, (LPARAM)this);
|
||||
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Lang_Select), NULL, (DLGPROC)LangSelectProc, (LPARAM)this);
|
||||
}
|
||||
|
||||
static WNDPROC pfnWndLangSelectOkProc = NULL;
|
||||
static HBITMAP hOkButton = NULL;
|
||||
|
||||
DWORD CALLBACK LangSelectOkProc (HWND hWnd, DWORD uMsg, DWORD wParam, DWORD lParam)
|
||||
{
|
||||
static bool m_fPressed = false;
|
||||
static HBITMAP hOkButtonDown = NULL;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
if (BeginPaint(hWnd,&ps))
|
||||
{
|
||||
if (m_fPressed)
|
||||
{
|
||||
if (hOkButtonDown == NULL)
|
||||
{
|
||||
hOkButtonDown = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_LANG_OK_DOWN));
|
||||
}
|
||||
if (hOkButtonDown)
|
||||
{
|
||||
RECT rcClient;
|
||||
GetClientRect(hWnd, &rcClient);
|
||||
|
||||
BITMAP bmTL1;
|
||||
GetObject(hOkButtonDown, sizeof(BITMAP), &bmTL1);
|
||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
||||
HGDIOBJ save = SelectObject(memdc, hOkButtonDown);
|
||||
BitBlt(ps.hdc, 0, 0, bmTL1.bmWidth, bmTL1.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hOkButton)
|
||||
{
|
||||
RECT rcClient;
|
||||
GetClientRect(hWnd, &rcClient);
|
||||
|
||||
BITMAP bmTL1;
|
||||
GetObject(hOkButton, sizeof(BITMAP), &bmTL1);
|
||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
||||
HGDIOBJ save = SelectObject(memdc, hOkButton);
|
||||
BitBlt(ps.hdc, 0, 0, bmTL1.bmWidth, bmTL1.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
}
|
||||
}
|
||||
EndPaint(hWnd,&ps);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if (::GetCapture() == hWnd)
|
||||
{
|
||||
POINT ptCursor = { ((int)(short)LOWORD(lParam)), ((int)(short)HIWORD(lParam)) };
|
||||
ClientToScreen(hWnd, &ptCursor);
|
||||
RECT rect;
|
||||
GetWindowRect(hWnd, &rect);
|
||||
bool uPressed = ::PtInRect(&rect, ptCursor)==TRUE;
|
||||
if ( m_fPressed != uPressed )
|
||||
{
|
||||
m_fPressed = uPressed;
|
||||
::InvalidateRect(hWnd, NULL, TRUE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
LRESULT lRet = 0;
|
||||
lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
SetCapture(hWnd);
|
||||
if ( ::GetCapture()==hWnd )
|
||||
{
|
||||
m_fPressed = true;
|
||||
|
||||
if (m_fPressed)
|
||||
{
|
||||
::InvalidateRect(hWnd, NULL, TRUE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
}
|
||||
return lRet;
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
LRESULT lRet = 0;
|
||||
lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
if ( ::GetCapture() == hWnd )
|
||||
{
|
||||
::ReleaseCapture();
|
||||
if ( m_fPressed )
|
||||
{
|
||||
::SendMessage(GetParent(hWnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hWnd), BN_CLICKED), (LPARAM)hWnd);
|
||||
}
|
||||
}
|
||||
m_fPressed = false;
|
||||
|
||||
return lRet;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(pfnWndLangSelectOkProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT CALLBACK CLanguageSelector::LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmpBackgroundTop = NULL;
|
||||
static HBITMAP hbmpBackgroundBottom = NULL;
|
||||
static HBITMAP hbmpBackgroundMiddle = NULL;
|
||||
static HFONT hTextFont = NULL;
|
||||
static CLanguageSelector * lngClass;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetWindowPos(hDlg,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOREPOSITION|SWP_NOSIZE);
|
||||
{
|
||||
lngClass = (CLanguageSelector *)lParam;
|
||||
|
||||
LanguageList LangList = g_Lang->GetLangList();
|
||||
if (LangList.size() == 0)
|
||||
{
|
||||
lngClass = (CLanguageSelector *)lParam;
|
||||
|
||||
LanguageList LangList = g_Lang->GetLangList();
|
||||
if (LangList.size() == 0)
|
||||
EndDialog(hDlg, 0);
|
||||
}
|
||||
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
|
||||
{
|
||||
int index = SendMessageW(GetDlgItem(hDlg, IDC_LANG_SEL), CB_ADDSTRING, 0, (WPARAM)Language->LanguageName.c_str());
|
||||
if (_wcsicmp(Language->LanguageName.c_str(), L"English") == 0)
|
||||
{
|
||||
EndDialog(hDlg,0);
|
||||
SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_SETCURSEL, index, 0);
|
||||
}
|
||||
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
|
||||
{
|
||||
int index = SendMessageW(GetDlgItem(hDlg,IDC_LANG_SEL),CB_ADDSTRING,0,(WPARAM)Language->LanguageName.c_str());
|
||||
if (_wcsicmp(Language->LanguageName.c_str(),L"English") == 0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_SETCURSEL,index,0);
|
||||
}
|
||||
}
|
||||
|
||||
int Index = SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETCURSEL,0,0);
|
||||
if (Index < 0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_SETCURSEL,0,0);
|
||||
}
|
||||
|
||||
enum { ROUND_EDGE = 15 };
|
||||
|
||||
DWORD dwStyle = GetWindowLong(hDlg, GWL_STYLE);
|
||||
dwStyle &= ~(WS_CAPTION|WS_SIZEBOX);
|
||||
SetWindowLong(hDlg, GWL_STYLE, dwStyle);
|
||||
|
||||
// Use the size of the image
|
||||
hbmpBackgroundTop = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_TOP));
|
||||
hbmpBackgroundBottom = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_BOTTOM));
|
||||
hbmpBackgroundMiddle = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_MIDDLE));
|
||||
BITMAP bmTL;
|
||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
|
||||
|
||||
if (hbmpBackgroundTop)
|
||||
{
|
||||
// int iHeight = bmTL.bmHeight;
|
||||
int iWidth = bmTL.bmWidth;
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(hDlg, &rect);
|
||||
rect.left -= rect.left;
|
||||
rect.bottom -= rect.top;
|
||||
rect.top -= rect.top;
|
||||
|
||||
// Tweaked
|
||||
HRGN hWindowRegion= CreateRoundRectRgn
|
||||
(
|
||||
rect.left,
|
||||
rect.top,
|
||||
rect.left+iWidth+GetSystemMetrics(SM_CXEDGE)-1,
|
||||
rect.bottom+GetSystemMetrics(SM_CYEDGE)-1,
|
||||
ROUND_EDGE,
|
||||
ROUND_EDGE
|
||||
);
|
||||
|
||||
if (hWindowRegion)
|
||||
{
|
||||
SetWindowRgn(hDlg, hWindowRegion, TRUE);
|
||||
DeleteObject(hWindowRegion);
|
||||
}
|
||||
}
|
||||
hTextFont = ::CreateFont
|
||||
(
|
||||
18,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
FW_NORMAL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
PROOF_QUALITY,
|
||||
DEFAULT_PITCH|FF_DONTCARE,
|
||||
"Arial"
|
||||
);
|
||||
SendDlgItemMessage(hDlg,IDC_SELECT_LANG,WM_SETFONT,(WPARAM)hTextFont,TRUE);
|
||||
}
|
||||
|
||||
hOkButton = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_LANG_OK));
|
||||
pfnWndLangSelectOkProc = (WNDPROC)::GetWindowLongPtr(GetDlgItem(hDlg,IDOK), GWLP_WNDPROC);
|
||||
::SetWindowLongPtr(GetDlgItem(hDlg,IDOK), GWLP_WNDPROC,(LONG_PTR)LangSelectOkProc);
|
||||
break;
|
||||
case WM_NCHITTEST:
|
||||
int Index = SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETCURSEL, 0, 0);
|
||||
if (Index < 0)
|
||||
{
|
||||
int xPos = LOWORD(lParam);
|
||||
int yPos = HIWORD(lParam);
|
||||
RECT client, a;
|
||||
GetClientRect(hDlg,&a);
|
||||
GetClientRect(hDlg,&client);
|
||||
ClientToScreen(hDlg,(LPPOINT)&client);
|
||||
client.right += client.left;
|
||||
client.bottom += client.top;
|
||||
|
||||
int nCaption = GetSystemMetrics(SM_CYCAPTION)*4;
|
||||
|
||||
LRESULT lResult = HTCLIENT;
|
||||
|
||||
//check caption
|
||||
if (xPos <= client.right && xPos >= client.left &&
|
||||
(yPos >= client.top+ 0)&& (yPos <= client.top + 0+nCaption))
|
||||
{
|
||||
lResult = HTCAPTION;
|
||||
}
|
||||
SetWindowLong(hDlg, DWLP_MSGRESULT, lResult);
|
||||
return TRUE;
|
||||
SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
// Use the size of the image
|
||||
hbmpBackgroundTop = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_ABOUT_LOGO));
|
||||
BITMAP bmTL;
|
||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
|
||||
|
||||
hTextFont = ::CreateFont
|
||||
(
|
||||
18,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
FW_NORMAL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS,
|
||||
CLIP_DEFAULT_PRECIS,
|
||||
PROOF_QUALITY,
|
||||
DEFAULT_PITCH | FF_DONTCARE,
|
||||
"Arial"
|
||||
);
|
||||
SendDlgItemMessage(hDlg, IDC_SELECT_LANG, WM_SETFONT, (WPARAM)hTextFont, TRUE);
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
HDC hdcStatic = (HDC)wParam;
|
||||
SetTextColor(hdcStatic, RGB(0, 0, 0));
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
|
||||
}
|
||||
break;
|
||||
{
|
||||
HDC hdcStatic = (HDC)wParam;
|
||||
SetTextColor(hdcStatic, RGB(0, 0, 0));
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
|
||||
}
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
HPEN outline;
|
||||
HBRUSH fill;
|
||||
RECT rect;
|
||||
|
||||
outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
|
||||
fill = CreateSolidBrush(0x00FFFFFF);
|
||||
SelectObject((HDC)wParam, outline);
|
||||
SelectObject((HDC)wParam, fill);
|
||||
|
||||
GetClientRect(hDlg, &rect);
|
||||
|
||||
Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom);
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
if (BeginPaint(hDlg, &ps))
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rcClient;
|
||||
GetClientRect(hDlg, &rcClient);
|
||||
|
||||
if (BeginPaint(hDlg,&ps))
|
||||
{
|
||||
RECT rcClient;
|
||||
GetClientRect(hDlg, &rcClient);
|
||||
BITMAP bmTL_top;
|
||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL_top);
|
||||
|
||||
BITMAP bmTL_top, bmTL_bottom, bmTL_Middle;
|
||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL_top);
|
||||
GetObject(hbmpBackgroundBottom, sizeof(BITMAP), &bmTL_bottom);
|
||||
GetObject(hbmpBackgroundMiddle, sizeof(BITMAP), &bmTL_Middle);
|
||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
||||
HGDIOBJ save = SelectObject(memdc, hbmpBackgroundTop);
|
||||
BitBlt(ps.hdc, 0, 0, bmTL_top.bmWidth, bmTL_top.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
|
||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
||||
HGDIOBJ save = SelectObject(memdc, hbmpBackgroundTop);
|
||||
BitBlt(ps.hdc, 0, 0, bmTL_top.bmWidth, bmTL_top.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
|
||||
memdc = CreateCompatibleDC(ps.hdc);
|
||||
save = SelectObject(memdc, hbmpBackgroundMiddle);
|
||||
for (int x = bmTL_top.bmHeight; x < rcClient.bottom; x += bmTL_Middle.bmHeight)
|
||||
{
|
||||
//BitBlt(ps.hdc, 0, bmTL_top.bmHeight, bmTL_Middle.bmWidth, rcClient.bottom - (bmTL_bottom.bmHeight + bmTL_top.bmHeight), memdc, 0, 0, SRCCOPY);
|
||||
BitBlt(ps.hdc, 0, x, bmTL_Middle.bmWidth, bmTL_Middle.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
}
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
|
||||
BITMAP ;
|
||||
memdc = CreateCompatibleDC(ps.hdc);
|
||||
save = SelectObject(memdc, hbmpBackgroundBottom);
|
||||
BitBlt(ps.hdc, 0, rcClient.bottom - bmTL_bottom.bmHeight, bmTL_bottom.bmWidth, bmTL_bottom.bmHeight, memdc, 0, 0, SRCCOPY);
|
||||
SelectObject(memdc, save);
|
||||
DeleteDC(memdc);
|
||||
|
||||
BITMAP ;
|
||||
|
||||
EndPaint(hDlg,&ps);
|
||||
}
|
||||
EndPaint(hDlg, &ps);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
|
@ -316,14 +131,6 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
|||
{
|
||||
DeleteObject(hbmpBackgroundTop);
|
||||
}
|
||||
if (hbmpBackgroundBottom)
|
||||
{
|
||||
DeleteObject(hbmpBackgroundBottom);
|
||||
}
|
||||
if (hbmpBackgroundMiddle)
|
||||
{
|
||||
DeleteObject(hbmpBackgroundMiddle);
|
||||
}
|
||||
|
||||
if (hTextFont)
|
||||
{
|
||||
|
@ -331,17 +138,17 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
|||
}
|
||||
|
||||
{
|
||||
int Index = SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETCURSEL,0,0);
|
||||
int Index = SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (Index >= 0)
|
||||
{
|
||||
wchar_t String[255];
|
||||
SendMessageW(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETLBTEXT,Index,(LPARAM)String);
|
||||
SendMessageW(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETLBTEXT, Index, (LPARAM)String);
|
||||
g_Lang->SetLanguage(String);
|
||||
}
|
||||
}
|
||||
|
||||
EndDialog(hDlg,0);
|
||||
EndDialog(hDlg, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -13,13 +13,13 @@
|
|||
class CLanguageSelector
|
||||
{
|
||||
public:
|
||||
CLanguageSelector ();
|
||||
CLanguageSelector();
|
||||
|
||||
void Select ( void );
|
||||
void Select(void);
|
||||
|
||||
private:
|
||||
CLanguageSelector(const CLanguageSelector&); // Disable copy constructor
|
||||
CLanguageSelector& operator=(const CLanguageSelector&); // Disable assignment
|
||||
|
||||
static LRESULT CALLBACK LangSelectProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT CALLBACK LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* 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 <Project64\N64 System\N64 Class.h>
|
||||
#include <common/Util.h>
|
||||
#include <Windows.h>
|
||||
#include <Objbase.h>
|
||||
|
||||
void CN64System::StartEmulationThead()
|
||||
{
|
||||
ThreadInfo * Info = new ThreadInfo;
|
||||
HANDLE * hThread = new HANDLE;
|
||||
*hThread = NULL;
|
||||
|
||||
//create the needed info into a structure to pass as one parameter
|
||||
//for creating a thread
|
||||
Info->ThreadHandle = hThread;
|
||||
|
||||
*hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)StartEmulationThread, Info, 0, (LPDWORD)&Info->ThreadID);
|
||||
}
|
||||
|
||||
void CN64System::StartEmulationThread(ThreadInfo * Info)
|
||||
{
|
||||
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
}
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
EmulationStarting(Info->ThreadHandle, Info->ThreadID);
|
||||
delete ((HANDLE *)Info->ThreadHandle);
|
||||
delete Info;
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
void CN64System::CloseCpu()
|
||||
{
|
||||
if (m_CPU_Handle == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_EndEmulation = true;
|
||||
if (g_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
m_hPauseEvent.Trigger();
|
||||
}
|
||||
|
||||
if (GetCurrentThreadId() == m_CPU_ThreadID)
|
||||
{
|
||||
ExternalEvent(SysEvent_CloseCPU);
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE hThread = m_CPU_Handle;
|
||||
m_CPU_Handle = NULL;
|
||||
for (int count = 0; count < 200; count++)
|
||||
{
|
||||
pjutil::Sleep(100);
|
||||
if (g_Notify->ProcessGuiMessages())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD ExitCode;
|
||||
if (GetExitCodeThread(hThread, &ExitCode))
|
||||
{
|
||||
if (ExitCode != STILL_ACTIVE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hThread)
|
||||
{
|
||||
DWORD ExitCode;
|
||||
GetExitCodeThread(hThread, &ExitCode);
|
||||
if (ExitCode == STILL_ACTIVE)
|
||||
{
|
||||
TerminateThread(hThread, 0);
|
||||
}
|
||||
}
|
||||
CloseHandle(hThread);
|
||||
CpuStopped();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -272,7 +272,7 @@ void CInterpreterCPU::ExecuteCPU()
|
|||
uint32_t CountPerOp = g_System->CountPerOp();
|
||||
int32_t & NextTimer = *g_NextTimer;
|
||||
|
||||
__try
|
||||
__try
|
||||
{
|
||||
while (!Done)
|
||||
{
|
||||
|
@ -301,24 +301,24 @@ void CInterpreterCPU::ExecuteCPU()
|
|||
PROGRAM_COUNTER += 4;
|
||||
break;
|
||||
case JUMP:
|
||||
{
|
||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
if (CheckTimer)
|
||||
{
|
||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
if (CheckTimer)
|
||||
TestTimer = false;
|
||||
if (NextTimer < 0)
|
||||
{
|
||||
TestTimer = false;
|
||||
if (NextTimer < 0)
|
||||
{
|
||||
g_SystemTimer->TimerDone();
|
||||
}
|
||||
if (bDoSomething)
|
||||
{
|
||||
g_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
g_SystemTimer->TimerDone();
|
||||
}
|
||||
if (bDoSomething)
|
||||
{
|
||||
g_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PERMLOOP_DELAY_DONE:
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
|
@ -339,7 +339,8 @@ void CInterpreterCPU::ExecuteCPU()
|
|||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
}
|
||||
}
|
||||
} __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
|
||||
}
|
||||
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
|
||||
{
|
||||
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
|||
const int32_t & DoSomething = g_SystemEvents->DoSomething();
|
||||
uint32_t CountPerOp = g_System->CountPerOp();
|
||||
|
||||
__try
|
||||
__try
|
||||
{
|
||||
while (!Done)
|
||||
{
|
||||
|
@ -409,24 +410,24 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
|||
PROGRAM_COUNTER += 4;
|
||||
break;
|
||||
case JUMP:
|
||||
{
|
||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
if (CheckTimer)
|
||||
{
|
||||
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
if (CheckTimer)
|
||||
TestTimer = false;
|
||||
if (*g_NextTimer < 0)
|
||||
{
|
||||
TestTimer = false;
|
||||
if (*g_NextTimer < 0)
|
||||
{
|
||||
g_SystemTimer->TimerDone();
|
||||
}
|
||||
if (DoSomething)
|
||||
{
|
||||
g_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
g_SystemTimer->TimerDone();
|
||||
}
|
||||
if (DoSomething)
|
||||
{
|
||||
g_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PERMLOOP_DELAY_DONE:
|
||||
PROGRAM_COUNTER = JumpToLocation;
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
|
@ -448,7 +449,7 @@ void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
|||
}
|
||||
}
|
||||
}
|
||||
__except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
|
||||
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
|
||||
{
|
||||
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,19 +10,21 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64\N64 System\Interpreter\Interpreter Ops.h>
|
||||
|
||||
class CInterpreterCPU :
|
||||
private R4300iOp
|
||||
private R4300iOp
|
||||
{
|
||||
public:
|
||||
static void BuildCPU();
|
||||
static void ExecuteCPU();
|
||||
static void ExecuteOps(int Cycles);
|
||||
static void InPermLoop();
|
||||
static void BuildCPU();
|
||||
static void ExecuteCPU();
|
||||
static void ExecuteOps(int32_t Cycles);
|
||||
static void InPermLoop();
|
||||
|
||||
private:
|
||||
CInterpreterCPU(); // Disable default constructor
|
||||
CInterpreterCPU(const CInterpreterCPU&); // Disable copy constructor
|
||||
CInterpreterCPU& operator=(const CInterpreterCPU&); // Disable assignment
|
||||
CInterpreterCPU(); // Disable default constructor
|
||||
CInterpreterCPU(const CInterpreterCPU&); // Disable copy constructor
|
||||
CInterpreterCPU& operator=(const CInterpreterCPU&); // Disable assignment
|
||||
|
||||
static R4300iOp::Func * m_R4300i_Opcode;
|
||||
static R4300iOp::Func * m_R4300i_Opcode;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,8 +9,9 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64\Logging.h>
|
||||
|
||||
bool DelaySlotEffectsCompare ( uint32_t PC, uint32_t Reg1, uint32_t Reg2 );
|
||||
bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
|
@ -35,16 +36,16 @@ bool DelaySlotEffectsCompare ( uint32_t PC, uint32_t Reg1, uint32_t Reg2 );
|
|||
|
||||
R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||
{
|
||||
Jump_Opcode[ 0] = SPECIAL;
|
||||
Jump_Opcode[ 1] = REGIMM;
|
||||
Jump_Opcode[ 2] = R4300iOp::J;
|
||||
Jump_Opcode[ 3] = JAL;
|
||||
Jump_Opcode[ 4] = BEQ;
|
||||
Jump_Opcode[ 5] = BNE;
|
||||
Jump_Opcode[ 6] = BLEZ;
|
||||
Jump_Opcode[ 7] = BGTZ;
|
||||
Jump_Opcode[ 8] = ADDI;
|
||||
Jump_Opcode[ 9] = ADDIU;
|
||||
Jump_Opcode[0] = SPECIAL;
|
||||
Jump_Opcode[1] = REGIMM;
|
||||
Jump_Opcode[2] = R4300iOp::J;
|
||||
Jump_Opcode[3] = JAL;
|
||||
Jump_Opcode[4] = BEQ;
|
||||
Jump_Opcode[5] = BNE;
|
||||
Jump_Opcode[6] = BLEZ;
|
||||
Jump_Opcode[7] = BGTZ;
|
||||
Jump_Opcode[8] = ADDI;
|
||||
Jump_Opcode[9] = ADDIU;
|
||||
Jump_Opcode[10] = SLTI;
|
||||
Jump_Opcode[11] = SLTIU;
|
||||
Jump_Opcode[12] = ANDI;
|
||||
|
@ -100,16 +101,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_Opcode[62] = R4300iOp::UnknownOpcode;
|
||||
Jump_Opcode[63] = R4300iOp::SD;
|
||||
|
||||
Jump_Special[ 0] = SPECIAL_SLL;
|
||||
Jump_Special[ 1] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[ 2] = SPECIAL_SRL;
|
||||
Jump_Special[ 3] = SPECIAL_SRA;
|
||||
Jump_Special[ 4] = SPECIAL_SLLV;
|
||||
Jump_Special[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[ 6] = SPECIAL_SRLV;
|
||||
Jump_Special[ 7] = SPECIAL_SRAV;
|
||||
Jump_Special[ 8] = SPECIAL_JR;
|
||||
Jump_Special[ 9] = SPECIAL_JALR;
|
||||
Jump_Special[0] = SPECIAL_SLL;
|
||||
Jump_Special[1] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[2] = SPECIAL_SRL;
|
||||
Jump_Special[3] = SPECIAL_SRA;
|
||||
Jump_Special[4] = SPECIAL_SLLV;
|
||||
Jump_Special[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[6] = SPECIAL_SRLV;
|
||||
Jump_Special[7] = SPECIAL_SRAV;
|
||||
Jump_Special[8] = SPECIAL_JR;
|
||||
Jump_Special[9] = SPECIAL_JALR;
|
||||
Jump_Special[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_Special[12] = R4300iOp::SPECIAL_SYSCALL;
|
||||
|
@ -165,16 +166,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_Special[62] = R4300iOp::SPECIAL_DSRL32;
|
||||
Jump_Special[63] = R4300iOp::SPECIAL_DSRA32;
|
||||
|
||||
Jump_Regimm[ 0] = REGIMM_BLTZ;
|
||||
Jump_Regimm[ 1] = REGIMM_BGEZ;
|
||||
Jump_Regimm[ 2] = REGIMM_BLTZL;
|
||||
Jump_Regimm[ 3] = REGIMM_BGEZL;
|
||||
Jump_Regimm[ 4] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[ 6] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[0] = REGIMM_BLTZ;
|
||||
Jump_Regimm[1] = REGIMM_BGEZ;
|
||||
Jump_Regimm[2] = REGIMM_BLTZL;
|
||||
Jump_Regimm[3] = REGIMM_BGEZL;
|
||||
Jump_Regimm[4] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[6] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -198,16 +199,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_Regimm[30] = R4300iOp::UnknownOpcode;
|
||||
Jump_Regimm[31] = R4300iOp::UnknownOpcode;
|
||||
|
||||
Jump_CoP0[ 0] = COP0_MF;
|
||||
Jump_CoP0[ 1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 4] = COP0_MT;
|
||||
Jump_CoP0[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[0] = COP0_MF;
|
||||
Jump_CoP0[1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[4] = COP0_MT;
|
||||
Jump_CoP0[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -231,16 +232,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP0[30] = R4300iOp::COP0_CO;
|
||||
Jump_CoP0[31] = R4300iOp::COP0_CO;
|
||||
|
||||
Jump_CoP0_Function[ 0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[ 1] = R4300iOp::COP0_CO_TLBR;
|
||||
Jump_CoP0_Function[ 2] = R4300iOp::COP0_CO_TLBWI;
|
||||
Jump_CoP0_Function[ 3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[ 4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[ 6] = R4300iOp::COP0_CO_TLBWR;
|
||||
Jump_CoP0_Function[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[ 8] = R4300iOp::COP0_CO_TLBP;
|
||||
Jump_CoP0_Function[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[1] = R4300iOp::COP0_CO_TLBR;
|
||||
Jump_CoP0_Function[2] = R4300iOp::COP0_CO_TLBWI;
|
||||
Jump_CoP0_Function[3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[6] = R4300iOp::COP0_CO_TLBWR;
|
||||
Jump_CoP0_Function[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[8] = R4300iOp::COP0_CO_TLBP;
|
||||
Jump_CoP0_Function[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -296,16 +297,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP0_Function[62] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP0_Function[63] = R4300iOp::UnknownOpcode;
|
||||
|
||||
Jump_CoP1[ 0] = COP1_MF;
|
||||
Jump_CoP1[ 1] = R4300iOp::COP1_DMF;
|
||||
Jump_CoP1[ 2] = COP1_CF;
|
||||
Jump_CoP1[ 3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[ 4] = R4300iOp::COP1_MT;
|
||||
Jump_CoP1[ 5] = COP1_DMT;
|
||||
Jump_CoP1[ 6] = R4300iOp::COP1_CT;
|
||||
Jump_CoP1[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[ 8] = R4300iOp::COP1_BC;
|
||||
Jump_CoP1[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[0] = COP1_MF;
|
||||
Jump_CoP1[1] = R4300iOp::COP1_DMF;
|
||||
Jump_CoP1[2] = COP1_CF;
|
||||
Jump_CoP1[3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[4] = R4300iOp::COP1_MT;
|
||||
Jump_CoP1[5] = COP1_DMT;
|
||||
Jump_CoP1[6] = R4300iOp::COP1_CT;
|
||||
Jump_CoP1[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[8] = R4300iOp::COP1_BC;
|
||||
Jump_CoP1[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -329,16 +330,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP1[30] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1[31] = R4300iOp::UnknownOpcode;
|
||||
|
||||
Jump_CoP1_BC[ 0] = R4300iOp::COP1_BCF;
|
||||
Jump_CoP1_BC[ 1] = R4300iOp::COP1_BCT;
|
||||
Jump_CoP1_BC[ 2] = R4300iOp::COP1_BCFL;
|
||||
Jump_CoP1_BC[ 3] = R4300iOp::COP1_BCTL;
|
||||
Jump_CoP1_BC[ 4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[ 6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[0] = R4300iOp::COP1_BCF;
|
||||
Jump_CoP1_BC[1] = R4300iOp::COP1_BCT;
|
||||
Jump_CoP1_BC[2] = R4300iOp::COP1_BCFL;
|
||||
Jump_CoP1_BC[3] = R4300iOp::COP1_BCTL;
|
||||
Jump_CoP1_BC[4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -362,16 +363,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP1_BC[30] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_BC[31] = R4300iOp::UnknownOpcode;
|
||||
|
||||
Jump_CoP1_S[ 0] = R4300iOp::COP1_S_ADD;
|
||||
Jump_CoP1_S[ 1] = R4300iOp::COP1_S_SUB;
|
||||
Jump_CoP1_S[ 2] = R4300iOp::COP1_S_MUL;
|
||||
Jump_CoP1_S[ 3] = R4300iOp::COP1_S_DIV;
|
||||
Jump_CoP1_S[ 4] = R4300iOp::COP1_S_SQRT;
|
||||
Jump_CoP1_S[ 5] = R4300iOp::COP1_S_ABS;
|
||||
Jump_CoP1_S[ 6] = R4300iOp::COP1_S_MOV;
|
||||
Jump_CoP1_S[ 7] = R4300iOp::COP1_S_NEG;
|
||||
Jump_CoP1_S[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_S[ 9] = R4300iOp::COP1_S_TRUNC_L;
|
||||
Jump_CoP1_S[0] = R4300iOp::COP1_S_ADD;
|
||||
Jump_CoP1_S[1] = R4300iOp::COP1_S_SUB;
|
||||
Jump_CoP1_S[2] = R4300iOp::COP1_S_MUL;
|
||||
Jump_CoP1_S[3] = R4300iOp::COP1_S_DIV;
|
||||
Jump_CoP1_S[4] = R4300iOp::COP1_S_SQRT;
|
||||
Jump_CoP1_S[5] = R4300iOp::COP1_S_ABS;
|
||||
Jump_CoP1_S[6] = R4300iOp::COP1_S_MOV;
|
||||
Jump_CoP1_S[7] = R4300iOp::COP1_S_NEG;
|
||||
Jump_CoP1_S[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_S[9] = R4300iOp::COP1_S_TRUNC_L;
|
||||
Jump_CoP1_S[10] = R4300iOp::COP1_S_CEIL_L; //added by Witten
|
||||
Jump_CoP1_S[11] = R4300iOp::COP1_S_FLOOR_L; //added by Witten
|
||||
Jump_CoP1_S[12] = R4300iOp::COP1_S_ROUND_W;
|
||||
|
@ -427,16 +428,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP1_S[62] = R4300iOp::COP1_S_CMP;
|
||||
Jump_CoP1_S[63] = R4300iOp::COP1_S_CMP;
|
||||
|
||||
Jump_CoP1_D[ 0] = R4300iOp::COP1_D_ADD;
|
||||
Jump_CoP1_D[ 1] = R4300iOp::COP1_D_SUB;
|
||||
Jump_CoP1_D[ 2] = R4300iOp::COP1_D_MUL;
|
||||
Jump_CoP1_D[ 3] = R4300iOp::COP1_D_DIV;
|
||||
Jump_CoP1_D[ 4] = R4300iOp::COP1_D_SQRT;
|
||||
Jump_CoP1_D[ 5] = R4300iOp::COP1_D_ABS;
|
||||
Jump_CoP1_D[ 6] = R4300iOp::COP1_D_MOV;
|
||||
Jump_CoP1_D[ 7] = R4300iOp::COP1_D_NEG;
|
||||
Jump_CoP1_D[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_D[ 9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten
|
||||
Jump_CoP1_D[0] = R4300iOp::COP1_D_ADD;
|
||||
Jump_CoP1_D[1] = R4300iOp::COP1_D_SUB;
|
||||
Jump_CoP1_D[2] = R4300iOp::COP1_D_MUL;
|
||||
Jump_CoP1_D[3] = R4300iOp::COP1_D_DIV;
|
||||
Jump_CoP1_D[4] = R4300iOp::COP1_D_SQRT;
|
||||
Jump_CoP1_D[5] = R4300iOp::COP1_D_ABS;
|
||||
Jump_CoP1_D[6] = R4300iOp::COP1_D_MOV;
|
||||
Jump_CoP1_D[7] = R4300iOp::COP1_D_NEG;
|
||||
Jump_CoP1_D[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_D[9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten
|
||||
Jump_CoP1_D[10] = R4300iOp::COP1_D_CEIL_L; //added by Witten
|
||||
Jump_CoP1_D[11] = R4300iOp::COP1_D_FLOOR_L; //added by Witten
|
||||
Jump_CoP1_D[12] = R4300iOp::COP1_D_ROUND_W;
|
||||
|
@ -492,16 +493,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP1_D[62] = R4300iOp::COP1_D_CMP;
|
||||
Jump_CoP1_D[63] = R4300iOp::COP1_D_CMP;
|
||||
|
||||
Jump_CoP1_W[ 0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -557,16 +558,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
|||
Jump_CoP1_W[62] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_W[63] = R4300iOp::UnknownOpcode;
|
||||
|
||||
Jump_CoP1_L[ 0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[ 9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[0] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[1] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[2] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[3] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[4] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[5] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[6] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[7] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[8] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[9] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[10] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[11] = R4300iOp::UnknownOpcode;
|
||||
Jump_CoP1_L[12] = R4300iOp::UnknownOpcode;
|
||||
|
@ -646,7 +647,7 @@ void R4300iOp32::BEQ()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -666,7 +667,7 @@ void R4300iOp32::BNE()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -685,7 +686,7 @@ void R4300iOp32::BLEZ() {
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -705,7 +706,7 @@ void R4300iOp32::BGTZ()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -769,7 +770,7 @@ void R4300iOp32::SLTIU()
|
|||
int64_t imm64;
|
||||
|
||||
imm64 = imm32;
|
||||
_GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (uint64_t)imm64?1:0;
|
||||
_GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (uint64_t)imm64 ? 1 : 0;
|
||||
}
|
||||
|
||||
void R4300iOp32::ANDI()
|
||||
|
@ -806,7 +807,7 @@ void R4300iOp32::BEQL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -827,7 +828,7 @@ void R4300iOp32::BNEL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -848,7 +849,7 @@ void R4300iOp32::BLEZL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -869,7 +870,7 @@ void R4300iOp32::BGTZL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||
{
|
||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||
}
|
||||
|
@ -884,8 +885,8 @@ void R4300iOp32::BGTZL()
|
|||
|
||||
void R4300iOp32::LB()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0]))
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -901,12 +902,12 @@ void R4300iOp32::LB()
|
|||
|
||||
void R4300iOp32::LH()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if ((Address & 1) != 0)
|
||||
{
|
||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||
}
|
||||
if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0]))
|
||||
if (!g_MMU->LH_VAddr(Address, _GPR[m_Opcode.rt].UHW[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -925,9 +926,9 @@ void R4300iOp32::LWL()
|
|||
uint32_t Offset, Address, Value;
|
||||
|
||||
Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
Offset = Address & 3;
|
||||
Offset = Address & 3;
|
||||
|
||||
if (!g_MMU->LW_VAddr((Address & ~3),Value))
|
||||
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -943,18 +944,18 @@ void R4300iOp32::LWL()
|
|||
|
||||
void R4300iOp32::LW()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if ((Address & 3) != 0)
|
||||
{
|
||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||
}
|
||||
|
||||
if (g_LogOptions.GenerateLog)
|
||||
if (GenerateLog())
|
||||
{
|
||||
Log_LW((*_PROGRAM_COUNTER),Address);
|
||||
Log_LW((*_PROGRAM_COUNTER), Address);
|
||||
}
|
||||
|
||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
||||
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -970,8 +971,8 @@ void R4300iOp32::LW()
|
|||
|
||||
void R4300iOp32::LBU()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0]))
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -987,12 +988,12 @@ void R4300iOp32::LBU()
|
|||
|
||||
void R4300iOp32::LHU()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if ((Address & 1) != 0)
|
||||
{
|
||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||
}
|
||||
if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0]))
|
||||
if (!g_MMU->LH_VAddr(Address, _GPR[m_Opcode.rt].UHW[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -1011,11 +1012,11 @@ void R4300iOp32::LWR()
|
|||
uint32_t Offset, Address, Value;
|
||||
|
||||
Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
Offset = Address & 3;
|
||||
Offset = Address & 3;
|
||||
|
||||
if (!g_MMU->LW_VAddr((Address & ~3),Value))
|
||||
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str());
|
||||
|
@ -1029,13 +1030,13 @@ void R4300iOp32::LWR()
|
|||
|
||||
void R4300iOp32::LWU()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if ((Address & 3) != 0)
|
||||
{
|
||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||
}
|
||||
|
||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
||||
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -1051,13 +1052,13 @@ void R4300iOp32::LWU()
|
|||
|
||||
void R4300iOp32::LL()
|
||||
{
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||
if ((Address & 3) != 0)
|
||||
{
|
||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||
}
|
||||
|
||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
||||
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||
{
|
||||
if (bShowTLBMisses())
|
||||
{
|
||||
|
@ -1203,7 +1204,7 @@ void R4300iOp32::REGIMM_BLTZ()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1223,7 +1224,7 @@ void R4300iOp32::REGIMM_BGEZ()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1243,7 +1244,7 @@ void R4300iOp32::REGIMM_BLTZL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1264,7 +1265,7 @@ void R4300iOp32::REGIMM_BGEZL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1285,7 +1286,7 @@ void R4300iOp32::REGIMM_BLTZAL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1295,7 +1296,7 @@ void R4300iOp32::REGIMM_BLTZAL()
|
|||
{
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
||||
}
|
||||
_GPR[31].W[0]= (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||
_GPR[31].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||
}
|
||||
|
||||
void R4300iOp32::REGIMM_BGEZAL()
|
||||
|
@ -1306,7 +1307,7 @@ void R4300iOp32::REGIMM_BGEZAL()
|
|||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||
{
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0))
|
||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||
{
|
||||
CInterpreterCPU::InPermLoop();
|
||||
}
|
||||
|
@ -1322,7 +1323,7 @@ void R4300iOp32::REGIMM_BGEZAL()
|
|||
/************************** COP0 functions **************************/
|
||||
void R4300iOp32::COP0_MF()
|
||||
{
|
||||
if (g_LogOptions.LogCP0reads)
|
||||
if (LogCP0reads())
|
||||
{
|
||||
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
}
|
||||
|
@ -1336,12 +1337,12 @@ void R4300iOp32::COP0_MF()
|
|||
|
||||
void R4300iOp32::COP0_MT()
|
||||
{
|
||||
if (g_LogOptions.LogCP0changes)
|
||||
if (LogCP0changes())
|
||||
{
|
||||
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) //Compare
|
||||
{
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X", (*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1397,7 +1398,7 @@ void R4300iOp32::COP0_MT()
|
|||
break;
|
||||
case 13: //cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled) )
|
||||
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled))
|
||||
{
|
||||
g_Notify->DisplayError(L"Set IP0 or IP1");
|
||||
}
|
||||
|
@ -1422,7 +1423,7 @@ void R4300iOp32::COP1_CF()
|
|||
if (g_Settings->LoadBool(Debugger_Enabled)) { g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); }
|
||||
return;
|
||||
}
|
||||
_GPR[m_Opcode.rt].W[0] = (int32_t)_FPCR[m_Opcode.fs];
|
||||
_GPR[m_Opcode.rt].W[0] = (int32_t)_FPCR[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_DMT()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,75 +10,77 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "Interpreter Ops.h"
|
||||
|
||||
class R4300iOp32 :
|
||||
public R4300iOp
|
||||
public R4300iOp
|
||||
{
|
||||
public:
|
||||
/************************* OpCode functions *************************/
|
||||
static void JAL();
|
||||
static void BEQ();
|
||||
static void BNE();
|
||||
static void BLEZ();
|
||||
static void BGTZ();
|
||||
static void ADDI();
|
||||
static void ADDIU();
|
||||
static void SLTI();
|
||||
static void SLTIU();
|
||||
static void ANDI();
|
||||
static void ORI();
|
||||
static void XORI();
|
||||
static void LUI();
|
||||
static void BEQL();
|
||||
static void BNEL();
|
||||
static void BLEZL();
|
||||
static void BGTZL();
|
||||
static void LB();
|
||||
static void LH();
|
||||
static void LWL();
|
||||
static void LW();
|
||||
static void LBU();
|
||||
static void LHU();
|
||||
static void LWR();
|
||||
static void LWU();
|
||||
static void LL();
|
||||
/************************* OpCode functions *************************/
|
||||
static void JAL();
|
||||
static void BEQ();
|
||||
static void BNE();
|
||||
static void BLEZ();
|
||||
static void BGTZ();
|
||||
static void ADDI();
|
||||
static void ADDIU();
|
||||
static void SLTI();
|
||||
static void SLTIU();
|
||||
static void ANDI();
|
||||
static void ORI();
|
||||
static void XORI();
|
||||
static void LUI();
|
||||
static void BEQL();
|
||||
static void BNEL();
|
||||
static void BLEZL();
|
||||
static void BGTZL();
|
||||
static void LB();
|
||||
static void LH();
|
||||
static void LWL();
|
||||
static void LW();
|
||||
static void LBU();
|
||||
static void LHU();
|
||||
static void LWR();
|
||||
static void LWU();
|
||||
static void LL();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
static void SPECIAL_SLL();
|
||||
static void SPECIAL_SRL();
|
||||
static void SPECIAL_SRA();
|
||||
static void SPECIAL_SLLV();
|
||||
static void SPECIAL_SRLV();
|
||||
static void SPECIAL_SRAV();
|
||||
static void SPECIAL_JALR();
|
||||
static void SPECIAL_ADD();
|
||||
static void SPECIAL_ADDU();
|
||||
static void SPECIAL_SUB();
|
||||
static void SPECIAL_SUBU();
|
||||
static void SPECIAL_AND();
|
||||
static void SPECIAL_OR();
|
||||
static void SPECIAL_NOR();
|
||||
static void SPECIAL_SLT();
|
||||
static void SPECIAL_SLTU();
|
||||
static void SPECIAL_TEQ();
|
||||
static void SPECIAL_DSRL32();
|
||||
static void SPECIAL_DSRA32();
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
static void SPECIAL_SLL();
|
||||
static void SPECIAL_SRL();
|
||||
static void SPECIAL_SRA();
|
||||
static void SPECIAL_SLLV();
|
||||
static void SPECIAL_SRLV();
|
||||
static void SPECIAL_SRAV();
|
||||
static void SPECIAL_JALR();
|
||||
static void SPECIAL_ADD();
|
||||
static void SPECIAL_ADDU();
|
||||
static void SPECIAL_SUB();
|
||||
static void SPECIAL_SUBU();
|
||||
static void SPECIAL_AND();
|
||||
static void SPECIAL_OR();
|
||||
static void SPECIAL_NOR();
|
||||
static void SPECIAL_SLT();
|
||||
static void SPECIAL_SLTU();
|
||||
static void SPECIAL_TEQ();
|
||||
static void SPECIAL_DSRL32();
|
||||
static void SPECIAL_DSRA32();
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
static void REGIMM_BLTZ();
|
||||
static void REGIMM_BGEZ();
|
||||
static void REGIMM_BLTZL();
|
||||
static void REGIMM_BGEZL();
|
||||
static void REGIMM_BLTZAL();
|
||||
static void REGIMM_BGEZAL();
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
static void REGIMM_BLTZ();
|
||||
static void REGIMM_BGEZ();
|
||||
static void REGIMM_BLTZL();
|
||||
static void REGIMM_BGEZL();
|
||||
static void REGIMM_BLTZAL();
|
||||
static void REGIMM_BGEZAL();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
static void COP0_MF();
|
||||
static void COP0_MT();
|
||||
/************************** COP0 functions **************************/
|
||||
static void COP0_MF();
|
||||
static void COP0_MT();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
static void COP1_MF();
|
||||
static void COP1_CF();
|
||||
static void COP1_DMT();
|
||||
/************************** COP1 functions **************************/
|
||||
static void COP1_MF();
|
||||
static void COP1_CF();
|
||||
static void COP1_DMT();
|
||||
|
||||
static Func* BuildInterpreter();
|
||||
static Func* BuildInterpreter();
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,7 +10,12 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64\Settings\Debug Settings.h>
|
||||
#include <Project64\N64 System\Mips\Register Class.h>
|
||||
#include <Project64\N64 System\Mips\OpCode.h>
|
||||
|
||||
class R4300iOp :
|
||||
public CLogging,
|
||||
protected CDebugSettings,
|
||||
protected CSystemRegisters
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,147 +9,150 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "Audio.h"
|
||||
#include <Project64\N64 System\System Globals.h>
|
||||
#include <Project64\N64 System\N64 Class.h>
|
||||
|
||||
CAudio::CAudio()
|
||||
{
|
||||
Reset();
|
||||
Reset();
|
||||
}
|
||||
|
||||
CAudio::~CAudio()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CAudio::Reset()
|
||||
{
|
||||
m_SecondBuff = 0;
|
||||
m_Status = 0;
|
||||
m_BytesPerSecond = 0;
|
||||
m_CountsPerByte = g_System->AiCountPerBytes(); // should be calculated ... see below, instead allow from user settings
|
||||
if (m_CountsPerByte == 0) m_CountsPerByte = 500; // If the user has no defined value, grant a default and we will calculate
|
||||
m_FramesPerSecond = 60;
|
||||
m_SecondBuff = 0;
|
||||
m_Status = 0;
|
||||
m_BytesPerSecond = 0;
|
||||
m_CountsPerByte = g_System->AiCountPerBytes(); // should be calculated ... see below, instead allow from user settings
|
||||
if (m_CountsPerByte == 0) m_CountsPerByte = 500; // If the user has no defined value, grant a default and we will calculate
|
||||
m_FramesPerSecond = 60;
|
||||
}
|
||||
|
||||
DWORD CAudio::GetLength()
|
||||
uint32_t CAudio::GetLength()
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
||||
DWORD TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
||||
if (TimeLeft > 0)
|
||||
{
|
||||
Res = (TimeLeft / m_CountsPerByte);
|
||||
}
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done (res = %d, TimeLeft = %d)",Res, TimeLeft);
|
||||
return (Res+3)&~3;
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||
uint32_t TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
||||
if (TimeLeft > 0)
|
||||
{
|
||||
Res = (TimeLeft / m_CountsPerByte);
|
||||
}
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Done (res = %d, TimeLeft = %d)", Res, TimeLeft);
|
||||
return (Res + 3)&~3;
|
||||
}
|
||||
|
||||
DWORD CAudio::GetStatus()
|
||||
uint32_t CAudio::GetStatus()
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": m_Status = %X",m_Status);
|
||||
return m_Status;
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": m_Status = %X", m_Status);
|
||||
return m_Status;
|
||||
}
|
||||
|
||||
void CAudio::LenChanged()
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)",g_Reg->AI_LEN_REG);
|
||||
if (g_Reg->AI_LEN_REG != 0)
|
||||
{
|
||||
if (g_Reg->AI_LEN_REG >= 0x40000)
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Ignoring Write, To Large (%X)",g_Reg->AI_LEN_REG);
|
||||
} else {
|
||||
m_Status |= ai_busy;
|
||||
DWORD AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
||||
if (m_SecondBuff == 0)
|
||||
{
|
||||
if (AudioLeft == 0)
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Set Timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte);
|
||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, g_Reg->AI_LEN_REG * m_CountsPerByte, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Increasing Second Buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG);
|
||||
m_SecondBuff += g_Reg->AI_LEN_REG;
|
||||
m_Status |= ai_full;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Reset Timer to 0");
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
||||
m_SecondBuff = 0;
|
||||
m_Status = 0;
|
||||
}
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)", g_Reg->AI_LEN_REG);
|
||||
if (g_Reg->AI_LEN_REG != 0)
|
||||
{
|
||||
if (g_Reg->AI_LEN_REG >= 0x40000)
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Status |= ai_busy;
|
||||
uint32_t AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
||||
if (m_SecondBuff == 0)
|
||||
{
|
||||
if (AudioLeft == 0)
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Set Timer AI_LEN_REG: %d m_CountsPerByte: %d", g_Reg->AI_LEN_REG, m_CountsPerByte);
|
||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, g_Reg->AI_LEN_REG * m_CountsPerByte, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Increasing Second Buffer (m_SecondBuff %d Increase: %d)", m_SecondBuff, g_Reg->AI_LEN_REG);
|
||||
m_SecondBuff += g_Reg->AI_LEN_REG;
|
||||
m_Status |= ai_full;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Reset Timer to 0");
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
||||
m_SecondBuff = 0;
|
||||
m_Status = 0;
|
||||
}
|
||||
|
||||
if (g_Plugins->Audio()->AiLenChanged != NULL)
|
||||
{
|
||||
g_Plugins->Audio()->AiLenChanged();
|
||||
}
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done");
|
||||
if (g_Plugins->Audio()->AiLenChanged != NULL)
|
||||
{
|
||||
g_Plugins->Audio()->AiLenChanged();
|
||||
}
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Done");
|
||||
}
|
||||
|
||||
void CAudio::InterruptTimerDone()
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
||||
m_Status &= ~ai_full;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
g_Reg->CheckInterrupts();
|
||||
if (m_SecondBuff != 0)
|
||||
{
|
||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt,m_SecondBuff * m_CountsPerByte,false);
|
||||
m_SecondBuff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Status &= ~ai_busy;
|
||||
}
|
||||
if (g_Reg->m_AudioIntrReg == 0)
|
||||
{
|
||||
g_System->SyncToAudio();
|
||||
}
|
||||
WriteTrace(TraceAudio,__FUNCTION__ ": Done");
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||
m_Status &= ~ai_full;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
g_Reg->CheckInterrupts();
|
||||
if (m_SecondBuff != 0)
|
||||
{
|
||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, m_SecondBuff * m_CountsPerByte, false);
|
||||
m_SecondBuff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Status &= ~ai_busy;
|
||||
}
|
||||
if (g_Reg->m_AudioIntrReg == 0)
|
||||
{
|
||||
g_System->SyncToAudio();
|
||||
}
|
||||
WriteTrace(TraceAudio, __FUNCTION__ ": Done");
|
||||
}
|
||||
|
||||
void CAudio::BusyTimerDone()
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
m_Status &= ~ai_busy;
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
m_Status &= ~ai_busy;
|
||||
}
|
||||
|
||||
void CAudio::SetViIntr ( DWORD VI_INTR_TIME )
|
||||
void CAudio::SetViIntr(uint32_t VI_INTR_TIME)
|
||||
{
|
||||
double CountsPerSecond = (DWORD)((double)VI_INTR_TIME * m_FramesPerSecond);
|
||||
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
||||
{
|
||||
m_CountsPerByte = (int)((double)CountsPerSecond / (double)m_BytesPerSecond);
|
||||
}
|
||||
double CountsPerSecond = (uint32_t)((double)VI_INTR_TIME * m_FramesPerSecond);
|
||||
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
||||
{
|
||||
m_CountsPerByte = (int32_t)((double)CountsPerSecond / (double)m_BytesPerSecond);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CAudio::SetFrequency (DWORD Dacrate, DWORD System)
|
||||
void CAudio::SetFrequency(uint32_t Dacrate, uint32_t System)
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X",Dacrate,System,g_Reg->AI_BITRATE_REG);
|
||||
DWORD Frequency;
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG);
|
||||
uint32_t Frequency;
|
||||
|
||||
switch (System)
|
||||
{
|
||||
case SYSTEM_PAL: Frequency = 49656530 / (Dacrate + 1); break;
|
||||
case SYSTEM_MPAL: Frequency = 48628316 / (Dacrate + 1); break;
|
||||
default: Frequency = 48681812 / (Dacrate + 1); break;
|
||||
}
|
||||
switch (System)
|
||||
{
|
||||
case SYSTEM_PAL: Frequency = 49656530 / (Dacrate + 1); break;
|
||||
case SYSTEM_MPAL: Frequency = 48628316 / (Dacrate + 1); break;
|
||||
default: Frequency = 48681812 / (Dacrate + 1); break;
|
||||
}
|
||||
|
||||
//nBlockAlign = 16 / 8 * 2;
|
||||
m_BytesPerSecond = Frequency * 4;
|
||||
//m_BytesPerSecond = 194532;
|
||||
//m_BytesPerSecond = 128024;
|
||||
//nBlockAlign = 16 / 8 * 2;
|
||||
m_BytesPerSecond = Frequency * 4;
|
||||
//m_BytesPerSecond = 194532;
|
||||
//m_BytesPerSecond = 128024;
|
||||
|
||||
m_FramesPerSecond = System == SYSTEM_PAL ? 50 : 60;
|
||||
m_FramesPerSecond = System == SYSTEM_PAL ? 50 : 60;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -12,28 +12,31 @@
|
|||
|
||||
class CAudio
|
||||
{
|
||||
enum
|
||||
{
|
||||
ai_full = 0x80000000,
|
||||
ai_busy = 0x40000000,
|
||||
};
|
||||
enum
|
||||
{
|
||||
ai_full = 0x80000000,
|
||||
ai_busy = 0x40000000,
|
||||
};
|
||||
public:
|
||||
CAudio();
|
||||
~CAudio();
|
||||
CAudio();
|
||||
~CAudio();
|
||||
|
||||
DWORD GetLength ();
|
||||
DWORD GetStatus ();
|
||||
void LenChanged ();
|
||||
void InterruptTimerDone();
|
||||
void BusyTimerDone ();
|
||||
void Reset ();
|
||||
void SetViIntr ( DWORD VI_INTR_TIME );
|
||||
void SetFrequency ( DWORD Dacrate, DWORD System );
|
||||
uint32_t GetLength ();
|
||||
uint32_t GetStatus ();
|
||||
void LenChanged ();
|
||||
void InterruptTimerDone();
|
||||
void BusyTimerDone ();
|
||||
void Reset ();
|
||||
void SetViIntr ( uint32_t VI_INTR_TIME );
|
||||
void SetFrequency ( uint32_t Dacrate, uint32_t System );
|
||||
|
||||
private:
|
||||
DWORD m_SecondBuff;
|
||||
DWORD m_Status;
|
||||
DWORD m_BytesPerSecond;
|
||||
int m_CountsPerByte;
|
||||
int m_FramesPerSecond;
|
||||
CAudio(const CAudio&); // Disable copy constructor
|
||||
CAudio& operator=(const CAudio&); // Disable assignment
|
||||
|
||||
uint32_t m_SecondBuff;
|
||||
uint32_t m_Status;
|
||||
uint32_t m_BytesPerSecond;
|
||||
int32_t m_CountsPerByte;
|
||||
int32_t m_FramesPerSecond;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -11,355 +11,362 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
CDMA::CDMA(CFlashram & FlashRam, CSram & Sram) :
|
||||
m_FlashRam(FlashRam),
|
||||
m_Sram(Sram)
|
||||
m_FlashRam(FlashRam),
|
||||
m_Sram(Sram)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CDMA::OnFirstDMA()
|
||||
{
|
||||
switch (g_Rom->CicChipID())
|
||||
{
|
||||
case CIC_NUS_6101: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
||||
case CIC_NUS_5167: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
||||
case CIC_UNKNOWN:
|
||||
case CIC_NUS_6102: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
||||
case CIC_NUS_6103: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
||||
case CIC_NUS_6105: *(DWORD *)&((g_MMU->Rdram())[0x3F0]) = g_MMU->RdramSize(); break;
|
||||
case CIC_NUS_6106: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
||||
default: g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA",g_Rom->CicChipID()).ToUTF16().c_str());
|
||||
}
|
||||
int16_t offset;
|
||||
const uint32_t base = 0x00000000;
|
||||
const uint32_t rt = g_MMU->RdramSize();
|
||||
|
||||
switch (g_Rom->CicChipID())
|
||||
{
|
||||
case CIC_NUS_6101: offset = +0x0318; break;
|
||||
case CIC_NUS_5167: offset = +0x0318; break;
|
||||
case CIC_UNKNOWN:
|
||||
case CIC_NUS_6102: offset = +0x0318; break;
|
||||
case CIC_NUS_6103: offset = +0x0318; break;
|
||||
case CIC_NUS_6105: offset = +0x03F0; break;
|
||||
case CIC_NUS_6106: offset = +0x0318; break;
|
||||
default:
|
||||
g_Notify->DisplayError(
|
||||
stdstr_f("Unhandled CicChip(%d) in first DMA", g_Rom->CicChipID()).ToUTF16().c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
g_MMU->SW_PAddr(base + offset, rt);
|
||||
}
|
||||
|
||||
void CDMA::PI_DMA_READ()
|
||||
{
|
||||
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
DWORD PI_RD_LEN_REG = ((g_Reg->PI_RD_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
uint32_t PI_RD_LEN_REG = ((g_Reg->PI_RD_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||
|
||||
if ((PI_RD_LEN_REG & 1) != 0)
|
||||
{
|
||||
PI_RD_LEN_REG += 1;
|
||||
}
|
||||
if ((PI_RD_LEN_REG & 1) != 0)
|
||||
{
|
||||
PI_RD_LEN_REG += 1;
|
||||
}
|
||||
|
||||
if ( g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
//Write ROM Area (for 64DD Convert)
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
|
||||
{
|
||||
DWORD i;
|
||||
BYTE * ROM = g_Rom->GetRomAddress();
|
||||
BYTE * RDRAM = g_MMU->Rdram();
|
||||
//Write ROM Area (for 64DD Convert)
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t * ROM = g_Rom->GetRomAddress();
|
||||
uint8_t * RDRAM = g_MMU->Rdram();
|
||||
|
||||
DWORD OldProtect;
|
||||
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READWRITE, &OldProtect);
|
||||
DWORD OldProtect;
|
||||
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READWRITE, &OldProtect);
|
||||
|
||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (g_Reg->PI_CART_ADDR_REG + PI_RD_LEN_REG < g_Rom->GetRomSize())
|
||||
{
|
||||
for (i = 0; i < PI_RD_LEN_REG; i++)
|
||||
{
|
||||
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD Len;
|
||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i++)
|
||||
{
|
||||
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (g_Reg->PI_CART_ADDR_REG + PI_RD_LEN_REG < g_Rom->GetRomSize())
|
||||
{
|
||||
for (i = 0; i < PI_RD_LEN_REG; i++)
|
||||
{
|
||||
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t Len;
|
||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i++)
|
||||
{
|
||||
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
|
||||
if (!g_System->DmaUsed())
|
||||
{
|
||||
g_System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (g_Recompiler && g_System->bSMM_PIDMA())
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA);
|
||||
}
|
||||
if (!g_System->DmaUsed())
|
||||
{
|
||||
g_System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (g_Recompiler && g_System->bSMM_PIDMA())
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA);
|
||||
}
|
||||
|
||||
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READONLY, &OldProtect);
|
||||
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READONLY, &OldProtect);
|
||||
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08088000)
|
||||
{
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Sram;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||
{
|
||||
m_Sram.DmaToSram(
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_RD_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
m_FlashRam.DmaToFlashram(
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_RD_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %08X *****",g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000)
|
||||
{
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Sram;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||
{
|
||||
m_Sram.DmaToSram(
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_RD_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
m_FlashRam.DmaToFlashram(
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_RD_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %08X *****", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
void CDMA::PI_DMA_WRITE()
|
||||
{
|
||||
DWORD PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||
uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||
|
||||
if ((PI_WR_LEN_REG & 1) != 0)
|
||||
{
|
||||
PI_WR_LEN_REG += 1; /* fixes AI Shougi 3, Doraemon 3, etc. */
|
||||
}
|
||||
if ((PI_WR_LEN_REG & 1) != 0)
|
||||
{
|
||||
PI_WR_LEN_REG += 1; /* fixes AI Shougi 3, Doraemon 3, etc. */
|
||||
}
|
||||
|
||||
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if ( g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).ToUTF16().c_str()); }
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).ToUTF16().c_str()); }
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08088000)
|
||||
{
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Sram;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||
{
|
||||
m_Sram.DmaFromSram(
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_WR_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
m_FlashRam.DmaFromFlashram(
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_WR_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08088000)
|
||||
{
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Sram;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||
{
|
||||
m_Sram.DmaFromSram(
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_WR_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
m_FlashRam.DmaFromFlashram(
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
PI_WR_LEN_REG
|
||||
);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FFFFFFF)
|
||||
{
|
||||
DWORD i;
|
||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FFFFFFF)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
#ifdef tofix
|
||||
#ifdef ROM_IN_MAPSPACE
|
||||
if (WrittenToRom)
|
||||
{
|
||||
DWORD OldProtect;
|
||||
VirtualProtect(ROM,m_RomFileSize,PAGE_READONLY, &OldProtect);
|
||||
}
|
||||
if (WrittenToRom)
|
||||
{
|
||||
uint32_t OldProtect;
|
||||
VirtualProtect(ROM,m_RomFileSize,PAGE_READONLY, &OldProtect);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
BYTE * ROM = g_Rom->GetRomAddress();
|
||||
BYTE * RDRAM = g_MMU->Rdram();
|
||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (g_Reg->PI_CART_ADDR_REG + PI_WR_LEN_REG < g_Rom->GetRomSize())
|
||||
{
|
||||
for (i = 0; i < PI_WR_LEN_REG; i ++)
|
||||
{
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize())
|
||||
{
|
||||
DWORD cart = g_Reg->PI_CART_ADDR_REG - g_Rom->GetRomSize();
|
||||
while (cart >= g_Rom->GetRomSize())
|
||||
{
|
||||
cart -= g_Rom->GetRomSize();
|
||||
}
|
||||
for (i = 0; i < PI_WR_LEN_REG; i++)
|
||||
{
|
||||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((cart + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD Len;
|
||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i ++)
|
||||
{
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
for (i = Len; i < PI_WR_LEN_REG - Len; i ++)
|
||||
{
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||
}
|
||||
}
|
||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
uint8_t * ROM = g_Rom->GetRomAddress();
|
||||
uint8_t * RDRAM = g_MMU->Rdram();
|
||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (g_Reg->PI_CART_ADDR_REG + PI_WR_LEN_REG < g_Rom->GetRomSize())
|
||||
{
|
||||
for (i = 0; i < PI_WR_LEN_REG; i++)
|
||||
{
|
||||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize())
|
||||
{
|
||||
uint32_t cart = g_Reg->PI_CART_ADDR_REG - g_Rom->GetRomSize();
|
||||
while (cart >= g_Rom->GetRomSize())
|
||||
{
|
||||
cart -= g_Rom->GetRomSize();
|
||||
}
|
||||
for (i = 0; i < PI_WR_LEN_REG; i++)
|
||||
{
|
||||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((cart + i) ^ 3));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t Len;
|
||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i++)
|
||||
{
|
||||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
for (i = Len; i < PI_WR_LEN_REG - Len; i++)
|
||||
{
|
||||
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||
}
|
||||
}
|
||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
|
||||
if (!g_System->DmaUsed())
|
||||
{
|
||||
g_System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (g_Recompiler && g_System->bSMM_PIDMA())
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9) + 50);
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9));
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in ROM: %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
if (!g_System->DmaUsed())
|
||||
{
|
||||
g_System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (g_Recompiler && g_System->bSMM_PIDMA())
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA);
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
//ChangeTimer(PiTimer,(int32_t)(PI_WR_LEN_REG * 8.9) + 50);
|
||||
//ChangeTimer(PiTimer,(int32_t)(PI_WR_LEN_REG * 8.9));
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in ROM: %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
|
||||
void CDMA::SP_DMA_READ()
|
||||
{
|
||||
g_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
|
||||
g_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
|
||||
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
return;
|
||||
}
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Reg->SP_RD_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(__FUNCTIONW__ L"\nCould not fit copy in memory segment");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (g_Reg->SP_RD_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(__FUNCTIONW__ L"\nCould not fit copy in memory segment");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if (((g_Reg->SP_RD_LEN_REG + 1) & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
if (((g_Reg->SP_RD_LEN_REG + 1) & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
|
||||
memcpy( g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG,
|
||||
g_Reg->SP_RD_LEN_REG + 1 );
|
||||
memcpy(g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG,
|
||||
g_Reg->SP_RD_LEN_REG + 1);
|
||||
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
||||
void CDMA::SP_DMA_WRITE()
|
||||
{
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize())
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ "\nSP_DRAM_ADDR_REG not in RDRam space : % 08X", g_Reg->SP_DRAM_ADDR_REG).ToUTF16().c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Reg->SP_WR_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"SP DMA WRITE\ncould not fit copy in memory segement");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (g_Reg->SP_WR_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"SP DMA WRITE\ncould not fit copy in memory segement");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if (((g_Reg->SP_WR_LEN_REG + 1) & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
||||
}
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
if (((g_Reg->SP_WR_LEN_REG + 1) & 3) != 0)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||
}
|
||||
|
||||
memcpy( g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
||||
g_Reg->SP_WR_LEN_REG + 1);
|
||||
memcpy(g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
||||
g_Reg->SP_WR_LEN_REG + 1);
|
||||
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,27 +9,30 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64\Settings\Debug Settings.h>
|
||||
#include <Project64\N64 System\Mips\FlashRam.h>
|
||||
#include <Project64\N64 System\Mips\Sram.h>
|
||||
|
||||
class CDMA :
|
||||
private CDebugSettings
|
||||
private CDebugSettings
|
||||
{
|
||||
CDMA();
|
||||
CDMA();
|
||||
|
||||
public:
|
||||
void SP_DMA_READ();
|
||||
void SP_DMA_WRITE();
|
||||
void PI_DMA_READ();
|
||||
void PI_DMA_WRITE();
|
||||
void SP_DMA_READ();
|
||||
void SP_DMA_WRITE();
|
||||
void PI_DMA_READ();
|
||||
void PI_DMA_WRITE();
|
||||
|
||||
protected:
|
||||
CDMA (CFlashram & FlashRam, CSram & Sram);
|
||||
|
||||
//void SI_DMA_READ();
|
||||
//void SI_DMA_WRITE();
|
||||
CDMA(CFlashram & FlashRam, CSram & Sram);
|
||||
|
||||
private:
|
||||
CFlashram & m_FlashRam;
|
||||
CSram & m_Sram;
|
||||
CDMA(const CDMA&); // Disable copy constructor
|
||||
CDMA& operator=(const CDMA&); // Disable assignment
|
||||
|
||||
void OnFirstDMA();
|
||||
CFlashram & m_FlashRam;
|
||||
CSram & m_Sram;
|
||||
|
||||
void OnFirstDMA();
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,190 +9,193 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "Eeprom.h"
|
||||
#include <Project64\N64 System\System Globals.h>
|
||||
#include <Project64\N64 System\N64 Class.h>
|
||||
#include <time.h>
|
||||
|
||||
CEeprom::CEeprom(bool ReadOnly):
|
||||
m_ReadOnly(ReadOnly),
|
||||
m_hFile(NULL)
|
||||
CEeprom::CEeprom(bool ReadOnly) :
|
||||
m_ReadOnly(ReadOnly),
|
||||
m_hFile(NULL)
|
||||
{
|
||||
memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
|
||||
memset(m_EEPROM, 0xFF, sizeof(m_EEPROM));
|
||||
}
|
||||
|
||||
CEeprom::~CEeprom()
|
||||
{
|
||||
if (m_hFile)
|
||||
{
|
||||
CloseHandle(m_hFile);
|
||||
m_hFile = NULL;
|
||||
}
|
||||
if (m_hFile)
|
||||
{
|
||||
CloseHandle(m_hFile);
|
||||
m_hFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char byte2bcd(int n)
|
||||
uint8_t byte2bcd(int32_t n)
|
||||
{
|
||||
n %= 100;
|
||||
return (unsigned char)(((n / 10) << 4) | (n % 10));
|
||||
n %= 100;
|
||||
return (uint8_t)(((n / 10) << 4) | (n % 10));
|
||||
}
|
||||
|
||||
void CEeprom::EepromCommand ( BYTE * Command)
|
||||
void CEeprom::EepromCommand(uint8_t * Command)
|
||||
{
|
||||
time_t curtime_time;
|
||||
struct tm curtime;
|
||||
time_t curtime_time;
|
||||
struct tm curtime;
|
||||
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Eeprom_4K;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||
{
|
||||
g_System->m_SaveUsing = SaveChip_Eeprom_4K;
|
||||
}
|
||||
|
||||
switch (Command[2])
|
||||
{
|
||||
case 0: // check
|
||||
if (g_System->m_SaveUsing != SaveChip_Eeprom_4K && g_System->m_SaveUsing != SaveChip_Eeprom_16K)
|
||||
{
|
||||
Command[1] |= 0x80;
|
||||
break;
|
||||
}
|
||||
if (Command[1] != 3)
|
||||
{
|
||||
Command[1] |= 0x40;
|
||||
if ((Command[1] & 3) > 0)
|
||||
Command[3] = 0x00;
|
||||
if ((Command[1] & 3) > 1)
|
||||
Command[4] = (g_System->m_SaveUsing == SaveChip_Eeprom_4K) ? 0x80 : 0xC0;
|
||||
if ((Command[1] & 3) > 2)
|
||||
Command[5] = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command[3] = 0x00;
|
||||
Command[4] = g_System->m_SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
|
||||
Command[5] = 0x00;
|
||||
}
|
||||
break;
|
||||
case 4: // Read from Eeprom
|
||||
if (Command[0] != 2 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
if (Command[1] != 8 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
ReadFrom(&Command[4],Command[3]);
|
||||
break;
|
||||
case 5: //Write to Eeprom
|
||||
if (Command[0] != 10 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
if (Command[1] != 1 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
WriteTo(&Command[4],Command[3]);
|
||||
break;
|
||||
case 6: //RTC Status query
|
||||
Command[3] = 0x00;
|
||||
Command[4] = 0x10;
|
||||
Command[5] = 0x00;
|
||||
break;
|
||||
case 7: //Read RTC block
|
||||
switch (Command[3])
|
||||
{
|
||||
case 0: //Block number
|
||||
Command[4] = 0x00;
|
||||
Command[5] = 0x02;
|
||||
Command[12] = 0x00;
|
||||
break;
|
||||
case 1:
|
||||
//read block, Command[2], Unimplemented
|
||||
break;
|
||||
case 2: //Set RTC Time
|
||||
time(&curtime_time);
|
||||
memcpy(&curtime, localtime(&curtime_time), sizeof(curtime)); // fd's fix
|
||||
Command[4] = byte2bcd(curtime.tm_sec);
|
||||
Command[5] = byte2bcd(curtime.tm_min);
|
||||
Command[6] = 0x80 + byte2bcd(curtime.tm_hour);
|
||||
Command[7] = byte2bcd(curtime.tm_mday);
|
||||
Command[8] = byte2bcd(curtime.tm_wday);
|
||||
Command[9] = byte2bcd(curtime.tm_mon + 1);
|
||||
Command[10] = byte2bcd(curtime.tm_year);
|
||||
Command[11] = byte2bcd(curtime.tm_year / 100);
|
||||
Command[12] = 0x00; // status
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
//Write RTC, unimplemented
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
{
|
||||
g_Notify->DisplayError(L"Write RTC, unimplemented");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d",Command[2]).ToUTF16().c_str());
|
||||
}
|
||||
}
|
||||
switch (Command[2])
|
||||
{
|
||||
case 0: // check
|
||||
if (g_System->m_SaveUsing != SaveChip_Eeprom_4K && g_System->m_SaveUsing != SaveChip_Eeprom_16K)
|
||||
{
|
||||
Command[1] |= 0x80;
|
||||
break;
|
||||
}
|
||||
if (Command[1] != 3)
|
||||
{
|
||||
Command[1] |= 0x40;
|
||||
if ((Command[1] & 3) > 0)
|
||||
Command[3] = 0x00;
|
||||
if ((Command[1] & 3) > 1)
|
||||
Command[4] = (g_System->m_SaveUsing == SaveChip_Eeprom_4K) ? 0x80 : 0xC0;
|
||||
if ((Command[1] & 3) > 2)
|
||||
Command[5] = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command[3] = 0x00;
|
||||
Command[4] = g_System->m_SaveUsing == SaveChip_Eeprom_4K ? 0x80 : 0xC0;
|
||||
Command[5] = 0x00;
|
||||
}
|
||||
break;
|
||||
case 4: // Read from Eeprom
|
||||
if (Command[0] != 2 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
if (Command[1] != 8 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
ReadFrom(&Command[4], Command[3]);
|
||||
break;
|
||||
case 5: //Write to Eeprom
|
||||
if (Command[0] != 10 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
if (Command[1] != 1 && bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||
}
|
||||
WriteTo(&Command[4], Command[3]);
|
||||
break;
|
||||
case 6: //RTC Status query
|
||||
Command[3] = 0x00;
|
||||
Command[4] = 0x10;
|
||||
Command[5] = 0x00;
|
||||
break;
|
||||
case 7: //Read RTC block
|
||||
switch (Command[3])
|
||||
{
|
||||
case 0: //Block number
|
||||
Command[4] = 0x00;
|
||||
Command[5] = 0x02;
|
||||
Command[12] = 0x00;
|
||||
break;
|
||||
case 1:
|
||||
//read block, Command[2], Unimplemented
|
||||
break;
|
||||
case 2: //Set RTC Time
|
||||
time(&curtime_time);
|
||||
memcpy(&curtime, localtime(&curtime_time), sizeof(curtime)); // fd's fix
|
||||
Command[4] = byte2bcd(curtime.tm_sec);
|
||||
Command[5] = byte2bcd(curtime.tm_min);
|
||||
Command[6] = 0x80 + byte2bcd(curtime.tm_hour);
|
||||
Command[7] = byte2bcd(curtime.tm_mday);
|
||||
Command[8] = byte2bcd(curtime.tm_wday);
|
||||
Command[9] = byte2bcd(curtime.tm_mon + 1);
|
||||
Command[10] = byte2bcd(curtime.tm_year);
|
||||
Command[11] = byte2bcd(curtime.tm_year / 100);
|
||||
Command[12] = 0x00; // status
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
//Write RTC, unimplemented
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
{
|
||||
g_Notify->DisplayError(L"Write RTC, unimplemented");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d", Command[2]).ToUTF16().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEeprom::LoadEeprom()
|
||||
{
|
||||
CPath FileName;
|
||||
DWORD dwRead;
|
||||
CPath FileName;
|
||||
DWORD dwRead;
|
||||
|
||||
memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
|
||||
memset(m_EEPROM, 0xFF, sizeof(m_EEPROM));
|
||||
|
||||
FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
|
||||
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
|
||||
FileName.SetExtension("eep");
|
||||
FileName.SetDriveDirectory(g_Settings->LoadStringVal(Directory_NativeSave).c_str());
|
||||
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
|
||||
FileName.SetExtension("eep");
|
||||
|
||||
if (!FileName.DirectoryExists())
|
||||
{
|
||||
FileName.DirectoryCreate();
|
||||
}
|
||||
if (!FileName.DirectoryExists())
|
||||
{
|
||||
FileName.DirectoryCreate();
|
||||
}
|
||||
|
||||
m_hFile = CreateFile(FileName,m_ReadOnly ? GENERIC_READ : GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
if (m_hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WriteTraceF(TraceError,__FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X",(LPCTSTR)FileName, m_ReadOnly, GetLastError());
|
||||
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM));
|
||||
return;
|
||||
}
|
||||
SetFilePointer(m_hFile,0,NULL,FILE_BEGIN);
|
||||
ReadFile(m_hFile,m_EEPROM,sizeof(m_EEPROM),&dwRead,NULL);
|
||||
m_hFile = CreateFile(FileName, m_ReadOnly ? GENERIC_READ : GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
if (m_hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
|
||||
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM));
|
||||
return;
|
||||
}
|
||||
SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
|
||||
ReadFile(m_hFile, m_EEPROM, sizeof(m_EEPROM), &dwRead, NULL);
|
||||
}
|
||||
|
||||
void CEeprom::ReadFrom(BYTE * Buffer, int line)
|
||||
void CEeprom::ReadFrom(uint8_t * Buffer, int32_t line)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (m_hFile == NULL)
|
||||
{
|
||||
LoadEeprom();
|
||||
}
|
||||
if (m_hFile == NULL)
|
||||
{
|
||||
LoadEeprom();
|
||||
}
|
||||
|
||||
for (i=0; i < 8; i++)
|
||||
{
|
||||
Buffer[i] = m_EEPROM[line*8+i];
|
||||
}
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
Buffer[i] = m_EEPROM[line * 8 + i];
|
||||
}
|
||||
}
|
||||
|
||||
void CEeprom::WriteTo(BYTE * Buffer, int line)
|
||||
void CEeprom::WriteTo(uint8_t * Buffer, int32_t line)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
int i;
|
||||
DWORD dwWritten;
|
||||
int32_t i;
|
||||
|
||||
if (m_hFile == NULL)
|
||||
{
|
||||
LoadEeprom();
|
||||
}
|
||||
for (i=0;i<8;i++)
|
||||
{
|
||||
m_EEPROM[line*8+i]=Buffer[i];
|
||||
}
|
||||
SetFilePointer(m_hFile,line*8,NULL,FILE_BEGIN);
|
||||
WriteFile( m_hFile,Buffer,8,&dwWritten,NULL );
|
||||
FlushFileBuffers(m_hFile);
|
||||
if (m_hFile == NULL)
|
||||
{
|
||||
LoadEeprom();
|
||||
}
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
m_EEPROM[line * 8 + i] = Buffer[i];
|
||||
}
|
||||
SetFilePointer(m_hFile, line * 8, NULL, FILE_BEGIN);
|
||||
WriteFile(m_hFile, Buffer, 8, &dwWritten, NULL);
|
||||
FlushFileBuffers(m_hFile);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -11,20 +11,24 @@
|
|||
#pragma once
|
||||
|
||||
class CEeprom :
|
||||
private CDebugSettings
|
||||
private CDebugSettings
|
||||
{
|
||||
public:
|
||||
CEeprom ( bool ReadOnly );
|
||||
~CEeprom();
|
||||
CEeprom(bool ReadOnly);
|
||||
~CEeprom();
|
||||
|
||||
void EepromCommand ( BYTE * Command );
|
||||
void EepromCommand(uint8_t * Command);
|
||||
|
||||
private:
|
||||
void LoadEeprom ();
|
||||
void ReadFrom ( BYTE * Buffer, int line );
|
||||
void WriteTo ( BYTE * Buffer, int line );
|
||||
CEeprom(void); // Disable default constructor
|
||||
CEeprom(const CEeprom&); // Disable copy constructor
|
||||
CEeprom& operator=(const CEeprom&); // Disable assignment
|
||||
|
||||
BYTE m_EEPROM[0x800];
|
||||
bool m_ReadOnly;
|
||||
HANDLE m_hFile;
|
||||
void LoadEeprom();
|
||||
void ReadFrom(uint8_t * Buffer, int32_t line);
|
||||
void WriteTo(uint8_t * Buffer, int32_t line);
|
||||
|
||||
uint8_t m_EEPROM[0x800];
|
||||
bool m_ReadOnly;
|
||||
void * m_hFile;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,6 +10,7 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64\Logging.h>
|
||||
class CPifRamSettings
|
||||
{
|
||||
protected:
|
||||
|
@ -31,6 +32,7 @@ private:
|
|||
};
|
||||
|
||||
class CPifRam :
|
||||
public CLogging,
|
||||
private CPifRamSettings,
|
||||
private CEeprom
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,42 +9,43 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64\User Interface\LoggingUI.h>
|
||||
|
||||
const char * CRegName::GPR[32] = {"r0","at","v0","v1","a0","a1","a2","a3",
|
||||
"t0","t1","t2","t3","t4","t5","t6","t7",
|
||||
"s0","s1","s2","s3","s4","s5","s6","s7",
|
||||
"t8","t9","k0","k1","gp","sp","s8","ra"};
|
||||
const char * CRegName::GPR[32] = { "r0", "at", "v0", "v1", "a0", "a1", "a2", "a3",
|
||||
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
|
||||
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
|
||||
"t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" };
|
||||
|
||||
const char *CRegName::GPR_Hi[32] = {"r0.HI","at.HI","v0.HI","v1.HI","a0.HI","a1.HI",
|
||||
"a2.HI","a3.HI","t0.HI","t1.HI","t2.HI","t3.HI",
|
||||
"t4.HI","t5.HI","t6.HI","t7.HI","s0.HI","s1.HI",
|
||||
"s2.HI","s3.HI","s4.HI","s5.HI","s6.HI","s7.HI",
|
||||
"t8.HI","t9.HI","k0.HI","k1.HI","gp.HI","sp.HI",
|
||||
"s8.HI","ra.HI"};
|
||||
const char *CRegName::GPR_Hi[32] = { "r0.HI", "at.HI", "v0.HI", "v1.HI", "a0.HI", "a1.HI",
|
||||
"a2.HI", "a3.HI", "t0.HI", "t1.HI", "t2.HI", "t3.HI",
|
||||
"t4.HI", "t5.HI", "t6.HI", "t7.HI", "s0.HI", "s1.HI",
|
||||
"s2.HI", "s3.HI", "s4.HI", "s5.HI", "s6.HI", "s7.HI",
|
||||
"t8.HI", "t9.HI", "k0.HI", "k1.HI", "gp.HI", "sp.HI",
|
||||
"s8.HI", "ra.HI" };
|
||||
|
||||
const char *CRegName::GPR_Lo[32] = {"r0.LO","at.LO","v0.LO","v1.LO","a0.LO","a1.LO",
|
||||
"a2.LO","a3.LO","t0.LO","t1.LO","t2.LO","t3.LO",
|
||||
"t4.LO","t5.LO","t6.LO","t7.LO","s0.LO","s1.LO",
|
||||
"s2.LO","s3.LO","s4.LO","s5.LO","s6.LO","s7.LO",
|
||||
"t8.LO","t9.LO","k0.LO","k1.LO","gp.LO","sp.LO",
|
||||
"s8.LO","ra.LO"};
|
||||
const char *CRegName::GPR_Lo[32] = { "r0.LO", "at.LO", "v0.LO", "v1.LO", "a0.LO", "a1.LO",
|
||||
"a2.LO", "a3.LO", "t0.LO", "t1.LO", "t2.LO", "t3.LO",
|
||||
"t4.LO", "t5.LO", "t6.LO", "t7.LO", "s0.LO", "s1.LO",
|
||||
"s2.LO", "s3.LO", "s4.LO", "s5.LO", "s6.LO", "s7.LO",
|
||||
"t8.LO", "t9.LO", "k0.LO", "k1.LO", "gp.LO", "sp.LO",
|
||||
"s8.LO", "ra.LO" };
|
||||
|
||||
const char * CRegName::Cop0[32] = {"Index","Random","EntryLo0","EntryLo1","Context","PageMask","Wired","",
|
||||
"BadVAddr","Count","EntryHi","Compare","Status","Cause","EPC","PRId",
|
||||
"Config","LLAddr","WatchLo","WatchHi","XContext","","","",
|
||||
"","","ECC","CacheErr","TagLo","TagHi","ErrEPC",""};
|
||||
const char * CRegName::Cop0[32] = { "Index", "Random", "EntryLo0", "EntryLo1", "Context", "PageMask", "Wired", "",
|
||||
"BadVAddr", "Count", "EntryHi", "Compare", "Status", "Cause", "EPC", "PRId",
|
||||
"Config", "LLAddr", "WatchLo", "WatchHi", "XContext", "", "", "",
|
||||
"", "", "ECC", "CacheErr", "TagLo", "TagHi", "ErrEPC", "" };
|
||||
|
||||
const char * CRegName::FPR[32] = {"f0","f1","f2","f3","f4","f5","f6","f7",
|
||||
"f8","f9","f10","f11","f12","f13","f14","f15",
|
||||
"f16","f17","f18","f19","f20","f21","f22","f23",
|
||||
"f24","f25","f26","f27","f28","f29","f30","f31"};
|
||||
const char * CRegName::FPR[32] = { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
|
||||
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
|
||||
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
|
||||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" };
|
||||
|
||||
const char * CRegName::FPR_Ctrl[32] = {"Revision","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","FCSR"};
|
||||
const char * CRegName::FPR_Ctrl[32] = { "Revision", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||
"Unknown", "Unknown", "FCSR" };
|
||||
|
||||
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = NULL;
|
||||
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
|
||||
|
@ -59,169 +60,169 @@ uint32_t * CSystemRegisters::_LLBit = NULL;
|
|||
ROUNDING_MODE * CSystemRegisters::_RoundingModel = NULL;
|
||||
|
||||
CP0registers::CP0registers(uint32_t * _CP0) :
|
||||
INDEX_REGISTER(_CP0[0]),
|
||||
RANDOM_REGISTER(_CP0[1]),
|
||||
ENTRYLO0_REGISTER(_CP0[2]),
|
||||
ENTRYLO1_REGISTER(_CP0[3]),
|
||||
CONTEXT_REGISTER(_CP0[4]),
|
||||
PAGE_MASK_REGISTER(_CP0[5]),
|
||||
WIRED_REGISTER(_CP0[6]),
|
||||
BAD_VADDR_REGISTER(_CP0[8]),
|
||||
COUNT_REGISTER(_CP0[9]),
|
||||
ENTRYHI_REGISTER(_CP0[10]),
|
||||
COMPARE_REGISTER(_CP0[11]),
|
||||
STATUS_REGISTER(_CP0[12]),
|
||||
CAUSE_REGISTER(_CP0[13]),
|
||||
EPC_REGISTER(_CP0[14]),
|
||||
CONFIG_REGISTER(_CP0[16]),
|
||||
TAGLO_REGISTER(_CP0[28]),
|
||||
TAGHI_REGISTER(_CP0[29]),
|
||||
ERROREPC_REGISTER(_CP0[30]),
|
||||
FAKE_CAUSE_REGISTER(_CP0[32])
|
||||
INDEX_REGISTER(_CP0[0]),
|
||||
RANDOM_REGISTER(_CP0[1]),
|
||||
ENTRYLO0_REGISTER(_CP0[2]),
|
||||
ENTRYLO1_REGISTER(_CP0[3]),
|
||||
CONTEXT_REGISTER(_CP0[4]),
|
||||
PAGE_MASK_REGISTER(_CP0[5]),
|
||||
WIRED_REGISTER(_CP0[6]),
|
||||
BAD_VADDR_REGISTER(_CP0[8]),
|
||||
COUNT_REGISTER(_CP0[9]),
|
||||
ENTRYHI_REGISTER(_CP0[10]),
|
||||
COMPARE_REGISTER(_CP0[11]),
|
||||
STATUS_REGISTER(_CP0[12]),
|
||||
CAUSE_REGISTER(_CP0[13]),
|
||||
EPC_REGISTER(_CP0[14]),
|
||||
CONFIG_REGISTER(_CP0[16]),
|
||||
TAGLO_REGISTER(_CP0[28]),
|
||||
TAGHI_REGISTER(_CP0[29]),
|
||||
ERROREPC_REGISTER(_CP0[30]),
|
||||
FAKE_CAUSE_REGISTER(_CP0[32])
|
||||
{
|
||||
}
|
||||
|
||||
Rdram_InterfaceReg::Rdram_InterfaceReg(uint32_t * _RdramInterface) :
|
||||
RDRAM_CONFIG_REG(_RdramInterface[0]),
|
||||
RDRAM_DEVICE_TYPE_REG(_RdramInterface[0]),
|
||||
RDRAM_DEVICE_ID_REG(_RdramInterface[1]),
|
||||
RDRAM_DELAY_REG(_RdramInterface[2]),
|
||||
RDRAM_MODE_REG(_RdramInterface[3]),
|
||||
RDRAM_REF_INTERVAL_REG(_RdramInterface[4]),
|
||||
RDRAM_REF_ROW_REG(_RdramInterface[5]),
|
||||
RDRAM_RAS_INTERVAL_REG(_RdramInterface[6]),
|
||||
RDRAM_MIN_INTERVAL_REG(_RdramInterface[7]),
|
||||
RDRAM_ADDR_SELECT_REG(_RdramInterface[8]),
|
||||
RDRAM_DEVICE_MANUF_REG(_RdramInterface[9])
|
||||
RDRAM_CONFIG_REG(_RdramInterface[0]),
|
||||
RDRAM_DEVICE_TYPE_REG(_RdramInterface[0]),
|
||||
RDRAM_DEVICE_ID_REG(_RdramInterface[1]),
|
||||
RDRAM_DELAY_REG(_RdramInterface[2]),
|
||||
RDRAM_MODE_REG(_RdramInterface[3]),
|
||||
RDRAM_REF_INTERVAL_REG(_RdramInterface[4]),
|
||||
RDRAM_REF_ROW_REG(_RdramInterface[5]),
|
||||
RDRAM_RAS_INTERVAL_REG(_RdramInterface[6]),
|
||||
RDRAM_MIN_INTERVAL_REG(_RdramInterface[7]),
|
||||
RDRAM_ADDR_SELECT_REG(_RdramInterface[8]),
|
||||
RDRAM_DEVICE_MANUF_REG(_RdramInterface[9])
|
||||
{
|
||||
}
|
||||
|
||||
Mips_InterfaceReg::Mips_InterfaceReg(uint32_t * _MipsInterface) :
|
||||
MI_INIT_MODE_REG(_MipsInterface[0]),
|
||||
MI_MODE_REG(_MipsInterface[0]),
|
||||
MI_VERSION_REG(_MipsInterface[1]),
|
||||
MI_NOOP_REG(_MipsInterface[1]),
|
||||
MI_INTR_REG(_MipsInterface[2]),
|
||||
MI_INTR_MASK_REG(_MipsInterface[3])
|
||||
MI_INIT_MODE_REG(_MipsInterface[0]),
|
||||
MI_MODE_REG(_MipsInterface[0]),
|
||||
MI_VERSION_REG(_MipsInterface[1]),
|
||||
MI_NOOP_REG(_MipsInterface[1]),
|
||||
MI_INTR_REG(_MipsInterface[2]),
|
||||
MI_INTR_MASK_REG(_MipsInterface[3])
|
||||
{
|
||||
}
|
||||
|
||||
Video_InterfaceReg::Video_InterfaceReg(uint32_t * _VideoInterface) :
|
||||
VI_STATUS_REG(_VideoInterface[0]),
|
||||
VI_CONTROL_REG(_VideoInterface[0]),
|
||||
VI_ORIGIN_REG(_VideoInterface[1]),
|
||||
VI_DRAM_ADDR_REG(_VideoInterface[1]),
|
||||
VI_WIDTH_REG(_VideoInterface[2]),
|
||||
VI_H_WIDTH_REG(_VideoInterface[2]),
|
||||
VI_INTR_REG(_VideoInterface[3]),
|
||||
VI_V_INTR_REG(_VideoInterface[3]),
|
||||
VI_CURRENT_REG(_VideoInterface[4]),
|
||||
VI_V_CURRENT_LINE_REG(_VideoInterface[4]),
|
||||
VI_BURST_REG(_VideoInterface[5]),
|
||||
VI_TIMING_REG(_VideoInterface[5]),
|
||||
VI_V_SYNC_REG(_VideoInterface[6]),
|
||||
VI_H_SYNC_REG(_VideoInterface[7]),
|
||||
VI_LEAP_REG(_VideoInterface[8]),
|
||||
VI_H_SYNC_LEAP_REG(_VideoInterface[8]),
|
||||
VI_H_START_REG(_VideoInterface[9]),
|
||||
VI_H_VIDEO_REG(_VideoInterface[9]),
|
||||
VI_V_START_REG(_VideoInterface[10]),
|
||||
VI_V_VIDEO_REG(_VideoInterface[10]),
|
||||
VI_V_BURST_REG(_VideoInterface[11]),
|
||||
VI_X_SCALE_REG(_VideoInterface[12]),
|
||||
VI_Y_SCALE_REG(_VideoInterface[13])
|
||||
VI_STATUS_REG(_VideoInterface[0]),
|
||||
VI_CONTROL_REG(_VideoInterface[0]),
|
||||
VI_ORIGIN_REG(_VideoInterface[1]),
|
||||
VI_DRAM_ADDR_REG(_VideoInterface[1]),
|
||||
VI_WIDTH_REG(_VideoInterface[2]),
|
||||
VI_H_WIDTH_REG(_VideoInterface[2]),
|
||||
VI_INTR_REG(_VideoInterface[3]),
|
||||
VI_V_INTR_REG(_VideoInterface[3]),
|
||||
VI_CURRENT_REG(_VideoInterface[4]),
|
||||
VI_V_CURRENT_LINE_REG(_VideoInterface[4]),
|
||||
VI_BURST_REG(_VideoInterface[5]),
|
||||
VI_TIMING_REG(_VideoInterface[5]),
|
||||
VI_V_SYNC_REG(_VideoInterface[6]),
|
||||
VI_H_SYNC_REG(_VideoInterface[7]),
|
||||
VI_LEAP_REG(_VideoInterface[8]),
|
||||
VI_H_SYNC_LEAP_REG(_VideoInterface[8]),
|
||||
VI_H_START_REG(_VideoInterface[9]),
|
||||
VI_H_VIDEO_REG(_VideoInterface[9]),
|
||||
VI_V_START_REG(_VideoInterface[10]),
|
||||
VI_V_VIDEO_REG(_VideoInterface[10]),
|
||||
VI_V_BURST_REG(_VideoInterface[11]),
|
||||
VI_X_SCALE_REG(_VideoInterface[12]),
|
||||
VI_Y_SCALE_REG(_VideoInterface[13])
|
||||
{
|
||||
}
|
||||
|
||||
AudioInterfaceReg::AudioInterfaceReg(uint32_t * _AudioInterface) :
|
||||
AI_DRAM_ADDR_REG(_AudioInterface[0]),
|
||||
AI_LEN_REG(_AudioInterface[1]),
|
||||
AI_CONTROL_REG(_AudioInterface[2]),
|
||||
AI_STATUS_REG(_AudioInterface[3]),
|
||||
AI_DACRATE_REG(_AudioInterface[4]),
|
||||
AI_BITRATE_REG(_AudioInterface[5])
|
||||
AI_DRAM_ADDR_REG(_AudioInterface[0]),
|
||||
AI_LEN_REG(_AudioInterface[1]),
|
||||
AI_CONTROL_REG(_AudioInterface[2]),
|
||||
AI_STATUS_REG(_AudioInterface[3]),
|
||||
AI_DACRATE_REG(_AudioInterface[4]),
|
||||
AI_BITRATE_REG(_AudioInterface[5])
|
||||
{
|
||||
}
|
||||
|
||||
PeripheralInterfaceReg::PeripheralInterfaceReg(uint32_t * PeripheralInterface) :
|
||||
PI_DRAM_ADDR_REG(PeripheralInterface[0]),
|
||||
PI_CART_ADDR_REG(PeripheralInterface[1]),
|
||||
PI_RD_LEN_REG(PeripheralInterface[2]),
|
||||
PI_WR_LEN_REG(PeripheralInterface[3]),
|
||||
PI_STATUS_REG(PeripheralInterface[4]),
|
||||
PI_BSD_DOM1_LAT_REG(PeripheralInterface[5]),
|
||||
PI_DOMAIN1_REG(PeripheralInterface[5]),
|
||||
PI_BSD_DOM1_PWD_REG(PeripheralInterface[6]),
|
||||
PI_BSD_DOM1_PGS_REG(PeripheralInterface[7]),
|
||||
PI_BSD_DOM1_RLS_REG(PeripheralInterface[8]),
|
||||
PI_BSD_DOM2_LAT_REG(PeripheralInterface[9]),
|
||||
PI_DOMAIN2_REG(PeripheralInterface[9]),
|
||||
PI_BSD_DOM2_PWD_REG(PeripheralInterface[10]),
|
||||
PI_BSD_DOM2_PGS_REG(PeripheralInterface[11]),
|
||||
PI_BSD_DOM2_RLS_REG(PeripheralInterface[12])
|
||||
PI_DRAM_ADDR_REG(PeripheralInterface[0]),
|
||||
PI_CART_ADDR_REG(PeripheralInterface[1]),
|
||||
PI_RD_LEN_REG(PeripheralInterface[2]),
|
||||
PI_WR_LEN_REG(PeripheralInterface[3]),
|
||||
PI_STATUS_REG(PeripheralInterface[4]),
|
||||
PI_BSD_DOM1_LAT_REG(PeripheralInterface[5]),
|
||||
PI_DOMAIN1_REG(PeripheralInterface[5]),
|
||||
PI_BSD_DOM1_PWD_REG(PeripheralInterface[6]),
|
||||
PI_BSD_DOM1_PGS_REG(PeripheralInterface[7]),
|
||||
PI_BSD_DOM1_RLS_REG(PeripheralInterface[8]),
|
||||
PI_BSD_DOM2_LAT_REG(PeripheralInterface[9]),
|
||||
PI_DOMAIN2_REG(PeripheralInterface[9]),
|
||||
PI_BSD_DOM2_PWD_REG(PeripheralInterface[10]),
|
||||
PI_BSD_DOM2_PGS_REG(PeripheralInterface[11]),
|
||||
PI_BSD_DOM2_RLS_REG(PeripheralInterface[12])
|
||||
{
|
||||
}
|
||||
|
||||
RDRAMInt_InterfaceReg::RDRAMInt_InterfaceReg(uint32_t * RdramInterface) :
|
||||
RI_MODE_REG(RdramInterface[0]),
|
||||
RI_CONFIG_REG(RdramInterface[1]),
|
||||
RI_CURRENT_LOAD_REG(RdramInterface[2]),
|
||||
RI_SELECT_REG(RdramInterface[3]),
|
||||
RI_COUNT_REG(RdramInterface[4]),
|
||||
RI_REFRESH_REG(RdramInterface[4]),
|
||||
RI_LATENCY_REG(RdramInterface[5]),
|
||||
RI_RERROR_REG(RdramInterface[6]),
|
||||
RI_WERROR_REG(RdramInterface[7])
|
||||
RI_MODE_REG(RdramInterface[0]),
|
||||
RI_CONFIG_REG(RdramInterface[1]),
|
||||
RI_CURRENT_LOAD_REG(RdramInterface[2]),
|
||||
RI_SELECT_REG(RdramInterface[3]),
|
||||
RI_COUNT_REG(RdramInterface[4]),
|
||||
RI_REFRESH_REG(RdramInterface[4]),
|
||||
RI_LATENCY_REG(RdramInterface[5]),
|
||||
RI_RERROR_REG(RdramInterface[6]),
|
||||
RI_WERROR_REG(RdramInterface[7])
|
||||
{
|
||||
}
|
||||
|
||||
DisplayControlReg::DisplayControlReg(uint32_t * _DisplayProcessor) :
|
||||
DPC_START_REG(_DisplayProcessor[0]),
|
||||
DPC_END_REG(_DisplayProcessor[1]),
|
||||
DPC_CURRENT_REG(_DisplayProcessor[2]),
|
||||
DPC_STATUS_REG(_DisplayProcessor[3]),
|
||||
DPC_CLOCK_REG(_DisplayProcessor[4]),
|
||||
DPC_BUFBUSY_REG(_DisplayProcessor[5]),
|
||||
DPC_PIPEBUSY_REG(_DisplayProcessor[6]),
|
||||
DPC_TMEM_REG(_DisplayProcessor[7])
|
||||
DPC_START_REG(_DisplayProcessor[0]),
|
||||
DPC_END_REG(_DisplayProcessor[1]),
|
||||
DPC_CURRENT_REG(_DisplayProcessor[2]),
|
||||
DPC_STATUS_REG(_DisplayProcessor[3]),
|
||||
DPC_CLOCK_REG(_DisplayProcessor[4]),
|
||||
DPC_BUFBUSY_REG(_DisplayProcessor[5]),
|
||||
DPC_PIPEBUSY_REG(_DisplayProcessor[6]),
|
||||
DPC_TMEM_REG(_DisplayProcessor[7])
|
||||
{
|
||||
}
|
||||
|
||||
SigProcessor_InterfaceReg::SigProcessor_InterfaceReg(uint32_t * _SignalProcessorInterface) :
|
||||
SP_MEM_ADDR_REG(_SignalProcessorInterface[0]),
|
||||
SP_DRAM_ADDR_REG(_SignalProcessorInterface[1]),
|
||||
SP_RD_LEN_REG(_SignalProcessorInterface[2]),
|
||||
SP_WR_LEN_REG(_SignalProcessorInterface[3]),
|
||||
SP_STATUS_REG(_SignalProcessorInterface[4]),
|
||||
SP_DMA_FULL_REG(_SignalProcessorInterface[5]),
|
||||
SP_DMA_BUSY_REG(_SignalProcessorInterface[6]),
|
||||
SP_SEMAPHORE_REG(_SignalProcessorInterface[7]),
|
||||
SP_PC_REG(_SignalProcessorInterface[8]),
|
||||
SP_IBIST_REG(_SignalProcessorInterface[9])
|
||||
SP_MEM_ADDR_REG(_SignalProcessorInterface[0]),
|
||||
SP_DRAM_ADDR_REG(_SignalProcessorInterface[1]),
|
||||
SP_RD_LEN_REG(_SignalProcessorInterface[2]),
|
||||
SP_WR_LEN_REG(_SignalProcessorInterface[3]),
|
||||
SP_STATUS_REG(_SignalProcessorInterface[4]),
|
||||
SP_DMA_FULL_REG(_SignalProcessorInterface[5]),
|
||||
SP_DMA_BUSY_REG(_SignalProcessorInterface[6]),
|
||||
SP_SEMAPHORE_REG(_SignalProcessorInterface[7]),
|
||||
SP_PC_REG(_SignalProcessorInterface[8]),
|
||||
SP_IBIST_REG(_SignalProcessorInterface[9])
|
||||
{
|
||||
}
|
||||
|
||||
Serial_InterfaceReg::Serial_InterfaceReg(uint32_t * SerialInterface) :
|
||||
SI_DRAM_ADDR_REG(SerialInterface[0]),
|
||||
SI_PIF_ADDR_RD64B_REG(SerialInterface[1]),
|
||||
SI_PIF_ADDR_WR64B_REG(SerialInterface[2]),
|
||||
SI_STATUS_REG(SerialInterface[3])
|
||||
SI_DRAM_ADDR_REG(SerialInterface[0]),
|
||||
SI_PIF_ADDR_RD64B_REG(SerialInterface[1]),
|
||||
SI_PIF_ADDR_WR64B_REG(SerialInterface[2]),
|
||||
SI_STATUS_REG(SerialInterface[3])
|
||||
{
|
||||
}
|
||||
|
||||
CRegisters::CRegisters(CN64System * System, CSystemEvents * SystemEvents) :
|
||||
CP0registers(m_CP0),
|
||||
Rdram_InterfaceReg(m_RDRAM_Registers),
|
||||
Mips_InterfaceReg(m_Mips_Interface),
|
||||
Video_InterfaceReg(m_Video_Interface),
|
||||
AudioInterfaceReg(m_Audio_Interface),
|
||||
PeripheralInterfaceReg(m_Peripheral_Interface),
|
||||
RDRAMInt_InterfaceReg(m_RDRAM_Interface),
|
||||
SigProcessor_InterfaceReg(m_SigProcessor_Interface),
|
||||
DisplayControlReg(m_Display_ControlReg),
|
||||
Serial_InterfaceReg(m_SerialInterface),
|
||||
m_System(System),
|
||||
m_SystemEvents(SystemEvents)
|
||||
CP0registers(m_CP0),
|
||||
Rdram_InterfaceReg(m_RDRAM_Registers),
|
||||
Mips_InterfaceReg(m_Mips_Interface),
|
||||
Video_InterfaceReg(m_Video_Interface),
|
||||
AudioInterfaceReg(m_Audio_Interface),
|
||||
PeripheralInterfaceReg(m_Peripheral_Interface),
|
||||
RDRAMInt_InterfaceReg(m_RDRAM_Interface),
|
||||
SigProcessor_InterfaceReg(m_SigProcessor_Interface),
|
||||
DisplayControlReg(m_Display_ControlReg),
|
||||
Serial_InterfaceReg(m_SerialInterface),
|
||||
m_System(System),
|
||||
m_SystemEvents(SystemEvents)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
@ -230,26 +231,26 @@ void CRegisters::Reset()
|
|||
{
|
||||
m_FirstInterupt = true;
|
||||
|
||||
memset(m_GPR,0,sizeof(m_GPR));
|
||||
memset(m_CP0,0,sizeof(m_CP0));
|
||||
memset(m_FPR,0,sizeof(m_FPR));
|
||||
memset(m_FPCR,0,sizeof(m_FPCR));
|
||||
m_HI.DW = 0;
|
||||
m_LO.DW = 0;
|
||||
memset(m_GPR, 0, sizeof(m_GPR));
|
||||
memset(m_CP0, 0, sizeof(m_CP0));
|
||||
memset(m_FPR, 0, sizeof(m_FPR));
|
||||
memset(m_FPCR, 0, sizeof(m_FPCR));
|
||||
m_HI.DW = 0;
|
||||
m_LO.DW = 0;
|
||||
m_RoundingModel = ROUND_NEAR;
|
||||
|
||||
m_LLBit = 0;
|
||||
m_LLBit = 0;
|
||||
|
||||
//Reset System Registers
|
||||
memset(m_RDRAM_Interface,0,sizeof(m_RDRAM_Interface));
|
||||
memset(m_RDRAM_Registers,0,sizeof(m_RDRAM_Registers));
|
||||
memset(m_Mips_Interface,0,sizeof(m_Mips_Interface));
|
||||
memset(m_Video_Interface,0,sizeof(m_Video_Interface));
|
||||
memset(m_Display_ControlReg,0,sizeof(m_Display_ControlReg));
|
||||
memset(m_Audio_Interface,0,sizeof(m_Audio_Interface));
|
||||
memset(m_SigProcessor_Interface,0,sizeof(m_SigProcessor_Interface));
|
||||
memset(m_Peripheral_Interface,0,sizeof(m_Peripheral_Interface));
|
||||
memset(m_SerialInterface,0,sizeof(m_SerialInterface));
|
||||
memset(m_RDRAM_Interface, 0, sizeof(m_RDRAM_Interface));
|
||||
memset(m_RDRAM_Registers, 0, sizeof(m_RDRAM_Registers));
|
||||
memset(m_Mips_Interface, 0, sizeof(m_Mips_Interface));
|
||||
memset(m_Video_Interface, 0, sizeof(m_Video_Interface));
|
||||
memset(m_Display_ControlReg, 0, sizeof(m_Display_ControlReg));
|
||||
memset(m_Audio_Interface, 0, sizeof(m_Audio_Interface));
|
||||
memset(m_SigProcessor_Interface, 0, sizeof(m_SigProcessor_Interface));
|
||||
memset(m_Peripheral_Interface, 0, sizeof(m_Peripheral_Interface));
|
||||
memset(m_SerialInterface, 0, sizeof(m_SerialInterface));
|
||||
|
||||
m_AudioIntrReg = 0;
|
||||
m_GfxIntrReg = 0;
|
||||
|
@ -291,27 +292,27 @@ void CRegisters::CheckInterrupts()
|
|||
FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
|
||||
}
|
||||
|
||||
if (( STATUS_REGISTER & STATUS_IE ) == 0 )
|
||||
if ((STATUS_REGISTER & STATUS_IE) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (( STATUS_REGISTER & FAKE_CAUSE_REGISTER & 0xFF00) != 0)
|
||||
if ((STATUS_REGISTER & FAKE_CAUSE_REGISTER & 0xFF00) != 0)
|
||||
{
|
||||
if (m_FirstInterupt)
|
||||
{
|
||||
m_FirstInterupt = false;
|
||||
if (g_Recompiler)
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Virt(0x80000000,0x200,CRecompiler::Remove_InitialCode);
|
||||
g_Recompiler->ClearRecompCode_Virt(0x80000000, 0x200, CRecompiler::Remove_InitialCode);
|
||||
}
|
||||
}
|
||||
m_SystemEvents->QueueEvent(SysEvent_ExecuteInterrupt);
|
||||
|
@ -323,11 +324,11 @@ void CRegisters::DoAddressError(bool DelaySlot, uint32_t BadVaddr, bool FromRead
|
|||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(L"AddressError");
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"EXL set in AddressError Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"ERL set in AddressError Exception");
|
||||
}
|
||||
|
@ -359,7 +360,7 @@ void CRegisters::FixFpuLocations()
|
|||
{
|
||||
if ((STATUS_REGISTER & STATUS_FR) == 0)
|
||||
{
|
||||
for (int count = 0; count < 32; count ++)
|
||||
for (int count = 0; count < 32; count++)
|
||||
{
|
||||
m_FPR_S[count] = &m_FPR[count >> 1].F[count & 1];
|
||||
m_FPR_D[count] = &m_FPR[count >> 1].D;
|
||||
|
@ -367,7 +368,7 @@ void CRegisters::FixFpuLocations()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (int count = 0; count < 32; count ++) {
|
||||
for (int count = 0; count < 32; count++) {
|
||||
m_FPR_S[count] = &m_FPR[count].F[1];
|
||||
m_FPR_D[count] = &m_FPR[count].D;
|
||||
}
|
||||
|
@ -378,11 +379,11 @@ void CRegisters::DoBreakException(bool DelaySlot)
|
|||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"EXL set in Break Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"ERL set in Break Exception");
|
||||
}
|
||||
|
@ -406,11 +407,11 @@ void CRegisters::DoCopUnusableException(bool DelaySlot, int Coprocessor)
|
|||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"EXL set in Break Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"ERL set in Break Exception");
|
||||
}
|
||||
|
@ -451,7 +452,7 @@ bool CRegisters::DoIntrException(bool DelaySlot)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (g_LogOptions.GenerateLog && g_LogOptions.LogExceptions && !g_LogOptions.NoInterrupts)
|
||||
if (GenerateLog() && LogExceptions() && !LogNoInterrupts())
|
||||
{
|
||||
LogMessage("%08X: Interrupt Generated", m_PROGRAM_COUNTER);
|
||||
}
|
||||
|
@ -506,7 +507,7 @@ void CRegisters::DoTLBReadMiss(bool DelaySlot, uint32_t BadVaddr)
|
|||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,g_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE").ToUTF16().c_str());
|
||||
g_Notify->DisplayError(stdstr_f("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s", BadVaddr, g_TLB->AddressDefined(BadVaddr) ? "TRUE" : "FALSE").ToUTF16().c_str());
|
||||
}
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
@ -516,11 +517,11 @@ void CRegisters::DoSysCallException(bool DelaySlot)
|
|||
{
|
||||
if (bHaveDebugger())
|
||||
{
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_EXL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"EXL set in SysCall Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 )
|
||||
if ((STATUS_REGISTER & STATUS_ERL) != 0)
|
||||
{
|
||||
g_Notify->DisplayError(L"ERL set in SysCall Exception");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,6 +10,9 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64\Settings\Game Settings.h>
|
||||
#include <Project64\Logging.h>
|
||||
|
||||
//CPO registers by name
|
||||
class CP0registers
|
||||
{
|
||||
|
@ -515,6 +518,7 @@ class CN64System;
|
|||
class CSystemEvents;
|
||||
|
||||
class CRegisters :
|
||||
public CLogging,
|
||||
private CDebugSettings,
|
||||
private CGameSettings,
|
||||
protected CSystemRegisters,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,9 +10,12 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/SyncEvent.h>
|
||||
#include <Project64\Logging.h>
|
||||
|
||||
typedef std::list<SystemEvent> EVENT_LIST;
|
||||
|
||||
typedef std::map<DWORD, DWORD> FUNC_CALLS;
|
||||
typedef std::map<uint32_t, uint32_t> FUNC_CALLS;
|
||||
|
||||
class CPlugins;
|
||||
class CRSP_Plugin;
|
||||
|
@ -21,6 +24,7 @@ class CRecompiler;
|
|||
//#define TEST_SP_TRACKING //track the SP to make sure all ops pick it up fine
|
||||
|
||||
class CN64System :
|
||||
public CLogging,
|
||||
public CMipsMemory_CallBack,
|
||||
public CTLB_CB,
|
||||
private CSystemEvents,
|
||||
|
@ -32,11 +36,6 @@ public:
|
|||
CN64System(CPlugins * Plugins, bool SavesReadOnly);
|
||||
virtual ~CN64System(void);
|
||||
|
||||
struct ThreadInfo {
|
||||
HANDLE * ThreadHandle;
|
||||
DWORD ThreadID;
|
||||
};
|
||||
|
||||
CProfiling m_Profile;
|
||||
CCheats m_Cheats;
|
||||
bool m_EndEmulation;
|
||||
|
@ -46,120 +45,124 @@ public:
|
|||
static bool RunFileImage(const char * FileLoc);
|
||||
static void CloseSystem(void);
|
||||
|
||||
void CloseCpu ();
|
||||
void ExternalEvent ( SystemEvent action ); //covers gui interacting and timers etc..
|
||||
stdstr ChooseFileToOpen ( HWND hParent );
|
||||
void DisplayRomInfo ( HWND hParent );
|
||||
void StartEmulation ( bool NewThread );
|
||||
void SyncToAudio ();
|
||||
void IncreaseSpeed () { m_Limitor.IncreaseSpeed(); }
|
||||
void DecreaseSpeed () { m_Limitor.DecreaseSpeed(); }
|
||||
void Reset ( bool bInitReg, bool ClearMenory );
|
||||
void GameReset ();
|
||||
void PluginReset ();
|
||||
void CloseCpu();
|
||||
void ExternalEvent(SystemEvent action); //covers gui interacting and timers etc..
|
||||
void StartEmulation(bool NewThread);
|
||||
void SyncToAudio();
|
||||
void IncreaseSpeed() { m_Limitor.IncreaseSpeed(); }
|
||||
void DecreaseSpeed() { m_Limitor.DecreaseSpeed(); }
|
||||
void Reset(bool bInitReg, bool ClearMenory);
|
||||
void GameReset();
|
||||
void PluginReset();
|
||||
|
||||
void Pause ();
|
||||
void RunRSP ();
|
||||
bool SaveState ();
|
||||
bool LoadState ( LPCSTR FileName );
|
||||
bool LoadState ();
|
||||
void Pause();
|
||||
void RunRSP();
|
||||
bool SaveState();
|
||||
bool LoadState(const char * FileName);
|
||||
bool LoadState();
|
||||
|
||||
bool DmaUsed() const { return m_DMAUsed; }
|
||||
void SetDmaUsed(bool DMAUsed) { m_DMAUsed = DMAUsed; }
|
||||
bool DmaUsed() const { return m_DMAUsed; }
|
||||
void SetDmaUsed(bool DMAUsed) { m_DMAUsed = DMAUsed; }
|
||||
void SetCheatsSlectionChanged(bool changed) { m_CheatsSlectionChanged = changed; }
|
||||
bool HasCheatsSlectionChanged(void) const { return m_CheatsSlectionChanged; }
|
||||
DWORD GetButtons(int Control) const { return m_Buttons[Control]; }
|
||||
uint32_t GetButtons(int32_t Control) const { return m_Buttons[Control]; }
|
||||
|
||||
//Variable used to track that the SP is being handled and stays the same as the real SP in sync core
|
||||
//Variable used to track that the SP is being handled and stays the same as the real SP in sync core
|
||||
#ifdef TEST_SP_TRACKING
|
||||
DWORD m_CurrentSP;
|
||||
uint32_t m_CurrentSP;
|
||||
#endif
|
||||
//For Sync CPU
|
||||
void UpdateSyncCPU ( CN64System * const SecondCPU, DWORD const Cycles );
|
||||
void SyncCPU ( CN64System * const SecondCPU );
|
||||
void SyncCPUPC ( CN64System * const SecondCPU );
|
||||
void SyncSystem ();
|
||||
void SyncSystemPC ();
|
||||
//For Sync CPU
|
||||
void UpdateSyncCPU(CN64System * const SecondCPU, uint32_t const Cycles);
|
||||
void SyncCPU(CN64System * const SecondCPU);
|
||||
void SyncCPUPC(CN64System * const SecondCPU);
|
||||
void SyncSystem();
|
||||
void SyncSystemPC();
|
||||
private:
|
||||
//Make sure plugins can directly access this information
|
||||
friend CGfxPlugin;
|
||||
friend CAudioPlugin;
|
||||
friend CRSP_Plugin;
|
||||
friend CControl_Plugin;
|
||||
//Make sure plugins can directly access this information
|
||||
friend CGfxPlugin;
|
||||
friend CAudioPlugin;
|
||||
friend CRSP_Plugin;
|
||||
friend CControl_Plugin;
|
||||
|
||||
//Recompiler has access to manipulate and call functions
|
||||
friend CSystemTimer;
|
||||
//Recompiler has access to manipulate and call functions
|
||||
friend CSystemTimer;
|
||||
|
||||
//Used for loading and potentially executing the CPU in its own thread.
|
||||
static void StartEmulationThread ( ThreadInfo * Info );
|
||||
static bool EmulationStarting ( HANDLE hThread, DWORD ThreadId );
|
||||
//Used for loading and potentially executing the CPU in its own thread.
|
||||
struct ThreadInfo
|
||||
{
|
||||
void * ThreadHandle;
|
||||
uint32_t ThreadID;
|
||||
};
|
||||
|
||||
void ExecuteCPU ();
|
||||
void RefreshScreen ();
|
||||
void DumpSyncErrors ( CN64System * SecondCPU );
|
||||
void StartEmulation2 ( bool NewThread );
|
||||
bool SetActiveSystem ( bool bActive = true );
|
||||
void InitRegisters ( bool bPostPif, CMipsMemory & MMU );
|
||||
void DisplayRSPListCount();
|
||||
static void StartEmulationThread(ThreadInfo * Info);
|
||||
static bool EmulationStarting(void * hThread, uint32_t ThreadId);
|
||||
static void StartEmulationThead();
|
||||
|
||||
//CPU Methods
|
||||
void ExecuteRecompiler();
|
||||
void ExecuteInterpret();
|
||||
void ExecuteSyncCPU();
|
||||
void ExecuteCPU();
|
||||
void RefreshScreen();
|
||||
void DumpSyncErrors(CN64System * SecondCPU);
|
||||
void StartEmulation2(bool NewThread);
|
||||
bool SetActiveSystem(bool bActive = true);
|
||||
void InitRegisters(bool bPostPif, CMipsMemory & MMU);
|
||||
void DisplayRSPListCount();
|
||||
|
||||
//Mark information saying that the CPU has stopped
|
||||
void CpuStopped();
|
||||
//CPU Methods
|
||||
void ExecuteRecompiler();
|
||||
void ExecuteInterpret();
|
||||
void ExecuteSyncCPU();
|
||||
|
||||
//Function in CMipsMemory_CallBack
|
||||
virtual bool WriteToProtectedMemory(uint32_t Address, int length);
|
||||
//Mark information saying that the CPU has stopped
|
||||
void CpuStopped();
|
||||
|
||||
//Functions in CTLB_CB
|
||||
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||
void TLB_Unmaped(uint32_t VAddr, uint32_t Len);
|
||||
void TLB_Changed();
|
||||
//Function in CMipsMemory_CallBack
|
||||
virtual bool WriteToProtectedMemory(uint32_t Address, int32_t length);
|
||||
|
||||
//Functions in CTLB_CB
|
||||
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||
void TLB_Unmaped(uint32_t VAddr, uint32_t Len);
|
||||
void TLB_Changed();
|
||||
|
||||
CPlugins * const m_Plugins; //The plugin container
|
||||
CN64System * m_SyncCPU;
|
||||
CPlugins * m_SyncPlugins;
|
||||
CMainGui * m_SyncWindow;
|
||||
CMipsMemoryVM m_MMU_VM; //Memory of the n64
|
||||
CTLB m_TLB;
|
||||
CRegisters m_Reg;
|
||||
CFramePerSecond m_FPS;
|
||||
CProfiling m_CPU_Usage; //used to track the cpu usage
|
||||
CRecompiler * m_Recomp;
|
||||
CAudio m_Audio;
|
||||
CSpeedLimitor m_Limitor;
|
||||
bool m_InReset;
|
||||
int m_NextTimer;
|
||||
CSystemTimer m_SystemTimer;
|
||||
bool m_bCleanFrameBox;
|
||||
bool m_bInitialized;
|
||||
bool m_RspBroke;
|
||||
bool m_DMAUsed;
|
||||
DWORD m_Buttons[4];
|
||||
bool m_TestTimer;
|
||||
DWORD m_NextInstruction;
|
||||
DWORD m_JumpToLocation;
|
||||
CN64System * m_SyncCPU;
|
||||
CPlugins * m_SyncPlugins;
|
||||
CMipsMemoryVM m_MMU_VM; //Memory of the n64
|
||||
CTLB m_TLB;
|
||||
CRegisters m_Reg;
|
||||
CFramePerSecond m_FPS;
|
||||
CProfiling m_CPU_Usage; //used to track the cpu usage
|
||||
CRecompiler * m_Recomp;
|
||||
CAudio m_Audio;
|
||||
CSpeedLimitor m_Limitor;
|
||||
bool m_InReset;
|
||||
int32_t m_NextTimer;
|
||||
CSystemTimer m_SystemTimer;
|
||||
bool m_bCleanFrameBox;
|
||||
bool m_bInitialized;
|
||||
bool m_RspBroke;
|
||||
bool m_DMAUsed;
|
||||
uint32_t m_Buttons[4];
|
||||
bool m_TestTimer;
|
||||
uint32_t m_NextInstruction;
|
||||
uint32_t m_JumpToLocation;
|
||||
uint32_t m_TLBLoadAddress;
|
||||
uint32_t m_TLBStoreAddress;
|
||||
DWORD m_SyncCount;
|
||||
uint32_t m_SyncCount;
|
||||
bool m_CheatsSlectionChanged;
|
||||
|
||||
//When Syncing cores this is the PC where it last Sync'ed correctly
|
||||
DWORD m_LastSuccessSyncPC[10];
|
||||
int m_CyclesToSkip;
|
||||
//When Syncing cores this is the PC where it last Sync'ed correctly
|
||||
uint32_t m_LastSuccessSyncPC[10];
|
||||
int32_t m_CyclesToSkip;
|
||||
|
||||
//Handle to the cpu thread
|
||||
HANDLE m_CPU_Handle;
|
||||
DWORD m_CPU_ThreadID;
|
||||
//Handle to the cpu thread
|
||||
void * m_CPU_Handle;
|
||||
uint32_t m_CPU_ThreadID;
|
||||
|
||||
//Handle to pause mutex
|
||||
void * m_hPauseEvent;
|
||||
//Handle to pause mutex
|
||||
SyncEvent m_hPauseEvent;
|
||||
|
||||
//No of Alist and Dlist sent to the RSP
|
||||
DWORD m_AlistCount, m_DlistCount, m_UnknownCount;
|
||||
//No of Alist and Dlist sent to the RSP
|
||||
uint32_t m_AlistCount, m_DlistCount, m_UnknownCount;
|
||||
|
||||
//list of function that have been called .. used in profiling
|
||||
FUNC_CALLS m_FunctionCalls;
|
||||
//list of function that have been called .. used in profiling
|
||||
FUNC_CALLS m_FunctionCalls;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -13,45 +13,45 @@
|
|||
#include "N64 Types.h"
|
||||
|
||||
class CN64Rom :
|
||||
protected CDebugSettings
|
||||
protected CDebugSettings
|
||||
{
|
||||
//constant values
|
||||
enum { ReadFromRomSection = 0x400000 };
|
||||
//constant values
|
||||
enum { ReadFromRomSection = 0x400000 };
|
||||
|
||||
//class variables
|
||||
HANDLE m_hRomFile, m_hRomFileMapping;
|
||||
BYTE * m_ROMImage;
|
||||
DWORD m_RomFileSize;
|
||||
Country m_Country;
|
||||
CICChip m_CicChip;
|
||||
LanguageStringID m_ErrorMsg;
|
||||
stdstr m_RomName, m_FileName, m_MD5, m_RomIdent;
|
||||
//class variables
|
||||
void * m_hRomFile, *m_hRomFileMapping;
|
||||
uint8_t * m_ROMImage;
|
||||
uint32_t m_RomFileSize;
|
||||
Country m_Country;
|
||||
CICChip m_CicChip;
|
||||
LanguageStringID m_ErrorMsg;
|
||||
stdstr m_RomName, m_FileName, m_MD5, m_RomIdent;
|
||||
|
||||
bool AllocateAndLoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly );
|
||||
bool AllocateAndLoadZipImage ( const char * FileLoc, bool LoadBootCodeOnly );
|
||||
void ByteSwapRom ();
|
||||
void SetError ( LanguageStringID ErrorMsg );
|
||||
static void __stdcall NotificationCB ( LPCWSTR Status, CN64Rom * _this );
|
||||
void CalculateCicChip ();
|
||||
void CalculateRomCrc ();
|
||||
bool AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnly);
|
||||
bool AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnly);
|
||||
void ByteSwapRom();
|
||||
void SetError(LanguageStringID ErrorMsg);
|
||||
static void __stdcall NotificationCB(const wchar_t * Status, CN64Rom * _this);
|
||||
void CalculateCicChip();
|
||||
void CalculateRomCrc();
|
||||
|
||||
public:
|
||||
CN64Rom();
|
||||
~CN64Rom();
|
||||
CN64Rom();
|
||||
~CN64Rom();
|
||||
|
||||
bool LoadN64Image ( const char * FileLoc, bool LoadBootCodeOnly = false );
|
||||
static bool IsValidRomImage( BYTE Test[4] );
|
||||
void SaveRomSettingID ( bool temp );
|
||||
void ClearRomSettingID ();
|
||||
CICChip CicChipID ();
|
||||
BYTE * GetRomAddress () { return m_ROMImage; }
|
||||
DWORD GetRomSize () const { return m_RomFileSize; }
|
||||
stdstr GetRomMD5 () const { return m_MD5; }
|
||||
stdstr GetRomName () const { return m_RomName; }
|
||||
stdstr GetFileName () const { return m_FileName; }
|
||||
Country GetCountry () const { return m_Country; }
|
||||
void UnallocateRomImage ();
|
||||
bool LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly = false);
|
||||
static bool IsValidRomImage(uint8_t Test[4]);
|
||||
void SaveRomSettingID(bool temp);
|
||||
void ClearRomSettingID();
|
||||
CICChip CicChipID();
|
||||
uint8_t * GetRomAddress() { return m_ROMImage; }
|
||||
uint32_t GetRomSize() const { return m_RomFileSize; }
|
||||
stdstr GetRomMD5() const { return m_MD5; }
|
||||
stdstr GetRomName() const { return m_RomName; }
|
||||
stdstr GetFileName() const { return m_FileName; }
|
||||
Country GetCountry() const { return m_Country; }
|
||||
void UnallocateRomImage();
|
||||
|
||||
//Get a message id for the reason that you failed to load the rom
|
||||
LanguageStringID GetError () const { return m_ErrorMsg; }
|
||||
//Get a message id for the reason that you failed to load the rom
|
||||
LanguageStringID GetError() const { return m_ErrorMsg; }
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -9,6 +9,7 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include "N64 Types.h"
|
||||
|
||||
typedef std::map<SPECIAL_TIMERS, __int64 > PROFILE_ENRTIES;
|
||||
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -13,64 +13,64 @@
|
|||
class CCodeBlock;
|
||||
|
||||
class CCodeSection :
|
||||
private CRecompilerOps
|
||||
private CRecompilerOps
|
||||
{
|
||||
public:
|
||||
typedef std::list<CCodeSection *> SECTION_LIST;
|
||||
typedef std::list<CCodeSection *> SECTION_LIST;
|
||||
|
||||
CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
|
||||
~CCodeSection();
|
||||
CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
|
||||
~CCodeSection();
|
||||
|
||||
void SetDelaySlot();
|
||||
void SetJumpAddress(uint32_t JumpPC, uint32_t TargetPC, bool PermLoop);
|
||||
void SetContinueAddress(uint32_t JumpPC, uint32_t TargetPC);
|
||||
void CompileCop1Test();
|
||||
bool GenerateX86Code(uint32_t Test);
|
||||
void GenerateSectionLinkage();
|
||||
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value));
|
||||
void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID);
|
||||
bool FixConstants(uint32_t Test);
|
||||
CCodeSection * ExistingSection(uint32_t Addr, uint32_t Test);
|
||||
bool SectionAccessible(uint32_t SectionId, uint32_t Test);
|
||||
bool DisplaySectionInformation(uint32_t ID, uint32_t Test);
|
||||
void DisplaySectionInformation();
|
||||
void AddParent(CCodeSection * Parent);
|
||||
void SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent);
|
||||
void SetDelaySlot();
|
||||
void SetJumpAddress(uint32_t JumpPC, uint32_t TargetPC, bool PermLoop);
|
||||
void SetContinueAddress(uint32_t JumpPC, uint32_t TargetPC);
|
||||
void CompileCop1Test();
|
||||
bool GenerateX86Code(uint32_t Test);
|
||||
void GenerateSectionLinkage();
|
||||
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value));
|
||||
void DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID);
|
||||
bool FixConstants(uint32_t Test);
|
||||
CCodeSection * ExistingSection(uint32_t Addr, uint32_t Test);
|
||||
bool SectionAccessible(uint32_t SectionId, uint32_t Test);
|
||||
bool DisplaySectionInformation(uint32_t ID, uint32_t Test);
|
||||
void DisplaySectionInformation();
|
||||
void AddParent(CCodeSection * Parent);
|
||||
void SwitchParent(CCodeSection * OldParent, CCodeSection * NewParent);
|
||||
|
||||
/* Block Connection info */
|
||||
SECTION_LIST m_ParentSection;
|
||||
CCodeBlock * const m_BlockInfo;
|
||||
const uint32_t m_SectionID;
|
||||
const uint32_t m_EnterPC;
|
||||
uint32_t m_EndPC;
|
||||
CCodeSection * m_ContinueSection;
|
||||
CCodeSection * m_JumpSection;
|
||||
bool m_EndSection; // if this section does not link
|
||||
bool m_LinkAllowed; // are other sections allowed to find block to link to it
|
||||
uint32_t m_Test;
|
||||
uint32_t m_Test2;
|
||||
uint8_t * m_CompiledLocation;
|
||||
bool m_InLoop;
|
||||
bool m_DelaySlot;
|
||||
/* Block Connection info */
|
||||
SECTION_LIST m_ParentSection;
|
||||
CCodeBlock * const m_BlockInfo;
|
||||
const uint32_t m_SectionID;
|
||||
const uint32_t m_EnterPC;
|
||||
uint32_t m_EndPC;
|
||||
CCodeSection * m_ContinueSection;
|
||||
CCodeSection * m_JumpSection;
|
||||
bool m_EndSection; // if this section does not link
|
||||
bool m_LinkAllowed; // are other sections allowed to find block to link to it
|
||||
uint32_t m_Test;
|
||||
uint32_t m_Test2;
|
||||
uint8_t * m_CompiledLocation;
|
||||
bool m_InLoop;
|
||||
bool m_DelaySlot;
|
||||
|
||||
/* Register Info */
|
||||
CRegInfo m_RegEnter;
|
||||
/* Register Info */
|
||||
CRegInfo m_RegEnter;
|
||||
|
||||
/* Jump Info */
|
||||
CJumpInfo m_Jump;
|
||||
CJumpInfo m_Cont;
|
||||
/* Jump Info */
|
||||
CJumpInfo m_Jump;
|
||||
CJumpInfo m_Cont;
|
||||
|
||||
private:
|
||||
CCodeSection(void); // Disable default constructor
|
||||
CCodeSection(const CCodeSection&); // Disable copy constructor
|
||||
CCodeSection& operator=(const CCodeSection&); // Disable assignment
|
||||
CCodeSection(void); // Disable default constructor
|
||||
CCodeSection(const CCodeSection&); // Disable copy constructor
|
||||
CCodeSection& operator=(const CCodeSection&); // Disable assignment
|
||||
|
||||
void UnlinkParent(CCodeSection * Parent, bool ContinueSection);
|
||||
void InheritConstants();
|
||||
void TestRegConstantStates(CRegInfo & Base, CRegInfo & Reg);
|
||||
void SyncRegState(const CRegInfo & SyncTo);
|
||||
bool IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test);
|
||||
bool ParentContinue();
|
||||
bool InheritParentInfo();
|
||||
bool SetupRegisterForLoop();
|
||||
void UnlinkParent(CCodeSection * Parent, bool ContinueSection);
|
||||
void InheritConstants();
|
||||
void TestRegConstantStates(CRegInfo & Base, CRegInfo & Reg);
|
||||
void SyncRegState(const CRegInfo & SyncTo);
|
||||
bool IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test);
|
||||
bool ParentContinue();
|
||||
bool InheritParentInfo();
|
||||
bool SetupRegisterForLoop();
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
|
@ -10,6 +10,8 @@
|
|||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64\Settings\N64System Settings.h>
|
||||
#include <Project64\Settings\Recompiler Settings.h>
|
||||
|
||||
class CCodeSection;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue