2016-01-27 09:11:59 +00:00
|
|
|
#include "stdafx.h"
|
2022-09-21 05:16:07 +00:00
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
#include <Project64-core/Logging.h>
|
|
|
|
#include <Project64-core/Settings/LoggingSettings.h>
|
|
|
|
#include <prsht.h>
|
|
|
|
|
|
|
|
LRESULT CALLBACK LogGeneralProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
LRESULT CALLBACK LogPifProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
LRESULT CALLBACK LogRegProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
void EnterLogOptions(HWND hwndOwner)
|
|
|
|
{
|
|
|
|
PROPSHEETPAGE psp[3];
|
|
|
|
PROPSHEETHEADER psh;
|
|
|
|
CLogSettings logSettings;
|
|
|
|
|
|
|
|
psp[0].dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
psp[0].dwFlags = PSP_USETITLE;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[0].hInstance = GetModuleHandle(nullptr);
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers);
|
|
|
|
psp[0].pfnDlgProc = (DLGPROC)LogRegProc;
|
2020-05-12 12:19:05 +00:00
|
|
|
psp[0].pszTitle = L"Registers";
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[0].lParam = (LPARAM)&logSettings;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[0].pfnCallback = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
psp[1].dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
psp[1].dwFlags = PSP_USETITLE;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[1].hInstance = GetModuleHandle(nullptr);
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam);
|
|
|
|
psp[1].pfnDlgProc = (DLGPROC)LogPifProc;
|
2020-05-12 12:19:05 +00:00
|
|
|
psp[1].pszTitle = L"Pif Ram";
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[1].lParam = (LPARAM)&logSettings;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[1].pfnCallback = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
psp[2].dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
psp[2].dwFlags = PSP_USETITLE;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[2].hInstance = GetModuleHandle(nullptr);
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General);
|
|
|
|
psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc;
|
2020-05-12 12:19:05 +00:00
|
|
|
psp[2].pszTitle = L"General";
|
2016-01-27 09:11:59 +00:00
|
|
|
psp[2].lParam = (LPARAM)&logSettings;
|
2021-04-12 11:35:39 +00:00
|
|
|
psp[2].pfnCallback = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
|
|
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
|
|
|
psh.hwndParent = hwndOwner;
|
2021-04-12 11:35:39 +00:00
|
|
|
psh.hInstance = GetModuleHandle(nullptr);
|
2020-05-12 12:19:05 +00:00
|
|
|
psh.pszCaption = (LPTSTR)L"Log Options";
|
2016-01-27 09:11:59 +00:00
|
|
|
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
|
|
|
psh.nStartPage = 0;
|
|
|
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp;
|
2021-04-12 11:35:39 +00:00
|
|
|
psh.pfnCallback = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
PropertySheet(&psh);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CALLBACK LogGeneralProc(HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
2022-09-26 02:31:54 +00:00
|
|
|
if (CLogSettings::LogCP0changes())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_CP0_WRITE, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogCP0reads())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_CP0_READ, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogCache())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_CACHE, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogExceptions())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_EXCEPTIONS, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogNoInterrupts())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_INTERRUPTS, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogTLB())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_TLB, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogRomHeader())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_ROM_HEADER, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogUnknown())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_UNKOWN, BST_CHECKED);
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
2022-09-26 02:31:54 +00:00
|
|
|
if (((NMHDR FAR *)lParam)->code != PSN_APPLY)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
g_Settings->SaveBool(Logging_LogCP0changes, IsDlgButtonChecked(hDlg, IDC_CP0_WRITE) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogCP0reads, IsDlgButtonChecked(hDlg, IDC_CP0_READ) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogCache, IsDlgButtonChecked(hDlg, IDC_CACHE) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogExceptions, IsDlgButtonChecked(hDlg, IDC_EXCEPTIONS) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_NoInterrupts, IsDlgButtonChecked(hDlg, IDC_INTERRUPTS) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogTLB, IsDlgButtonChecked(hDlg, IDC_TLB) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogRomHeader, IsDlgButtonChecked(hDlg, IDC_ROM_HEADER) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogUnknown, IsDlgButtonChecked(hDlg, IDC_UNKOWN) == BST_CHECKED ? true : false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CALLBACK LogPifProc(HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
2022-09-26 02:31:54 +00:00
|
|
|
if (CLogSettings::LogPRDMAOperations())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_SI_DMA, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogPRDirectMemLoads())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DIRECT_WRITE, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogPRDMAMemLoads())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DMA_WRITE, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogPRDirectMemStores())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DIRECT_READ, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogPRDMAMemStores())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DMA_READ, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogControllerPak())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_CONT_PAK, BST_CHECKED);
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
2022-09-21 05:16:07 +00:00
|
|
|
if (((NMHDR FAR *)lParam)->code != PSN_APPLY)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_Settings->SaveBool(Logging_LogPRDMAOperations, IsDlgButtonChecked(hDlg, IDC_SI_DMA) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogPRDirectMemLoads, IsDlgButtonChecked(hDlg, IDC_DIRECT_WRITE) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogPRDMAMemLoads, IsDlgButtonChecked(hDlg, IDC_DMA_WRITE) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogPRDirectMemStores, IsDlgButtonChecked(hDlg, IDC_DIRECT_READ) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogPRDMAMemStores, IsDlgButtonChecked(hDlg, IDC_DMA_READ) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_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:
|
|
|
|
{
|
2022-09-26 02:31:54 +00:00
|
|
|
if (CLogSettings::LogRDRamRegisters())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_RDRAM, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogSPRegisters())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_SP_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogDPCRegisters())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DPC_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogDPSRegisters())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_DPS_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogMIPSInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_MI_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogVideoInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_VI_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogAudioInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_AI_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogPerInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_PI_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogRDRAMInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_RI_REG, BST_CHECKED);
|
|
|
|
}
|
|
|
|
if (CLogSettings::LogSerialInterface())
|
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_SI_REG, BST_CHECKED);
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_NOTIFY:
|
2022-09-21 05:16:07 +00:00
|
|
|
if (((NMHDR FAR *)lParam)->code != PSN_APPLY)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_Settings->SaveBool(Logging_LogRDRamRegisters, IsDlgButtonChecked(hDlg, IDC_RDRAM) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogSPRegisters, IsDlgButtonChecked(hDlg, IDC_SP_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogDPCRegisters, IsDlgButtonChecked(hDlg, IDC_DPC_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogDPSRegisters, IsDlgButtonChecked(hDlg, IDC_DPS_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogMIPSInterface, IsDlgButtonChecked(hDlg, IDC_MI_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogVideoInterface, IsDlgButtonChecked(hDlg, IDC_VI_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogAudioInterface, IsDlgButtonChecked(hDlg, IDC_AI_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogPerInterface, IsDlgButtonChecked(hDlg, IDC_PI_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogRDRAMInterface, IsDlgButtonChecked(hDlg, IDC_RI_REG) == BST_CHECKED ? true : false);
|
|
|
|
g_Settings->SaveBool(Logging_LogSerialInterface, IsDlgButtonChecked(hDlg, IDC_SI_REG) == BST_CHECKED ? true : false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2021-03-17 08:28:59 +00:00
|
|
|
}
|