add testcase popup option
This commit is contained in:
parent
f1d09aff15
commit
9bee8ea17b
|
@ -102,6 +102,7 @@ const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)] = {
|
||||||
"XE ",
|
"XE ",
|
||||||
};
|
};
|
||||||
std::atomic_int g_CurrentLogLevel = to_underlying(LOG_LEVEL::INFO);
|
std::atomic_int g_CurrentLogLevel = to_underlying(LOG_LEVEL::INFO);
|
||||||
|
std::atomic_bool g_CurrentLogPopupTestcase = true;
|
||||||
|
|
||||||
const char log_debug[] = "DEBUG: ";
|
const char log_debug[] = "DEBUG: ";
|
||||||
const char log_info[] = "INFO : ";
|
const char log_info[] = "INFO : ";
|
||||||
|
@ -186,19 +187,21 @@ void NTAPI EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...)
|
||||||
// Set up the logging variables for the GUI process
|
// Set up the logging variables for the GUI process
|
||||||
inline void log_get_settings()
|
inline void log_get_settings()
|
||||||
{
|
{
|
||||||
log_set_config(g_Settings->m_core.LogLevel, g_Settings->m_core.LoggedModules);
|
log_set_config(g_Settings->m_core.LogLevel, g_Settings->m_core.LoggedModules, g_Settings->m_core.bLogPopupTestcase);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void log_sync_config()
|
inline void log_sync_config()
|
||||||
{
|
{
|
||||||
int LogLevel;
|
int LogLevel;
|
||||||
unsigned int LoggedModules[NUM_INTEGERS_LOG];
|
unsigned int LoggedModules[NUM_INTEGERS_LOG];
|
||||||
|
bool LogPopupTestcase;
|
||||||
g_EmuShared->GetLogLv(&LogLevel);
|
g_EmuShared->GetLogLv(&LogLevel);
|
||||||
g_EmuShared->GetLogModules(LoggedModules);
|
g_EmuShared->GetLogModules(LoggedModules);
|
||||||
log_set_config(LogLevel, LoggedModules);
|
g_EmuShared->GetLogPopupTestcase(&LogPopupTestcase);
|
||||||
|
log_set_config(LogLevel, LoggedModules, LogPopupTestcase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_set_config(int LogLevel, unsigned int* LoggedModules)
|
void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTestcase)
|
||||||
{
|
{
|
||||||
g_CurrentLogLevel = LogLevel;
|
g_CurrentLogLevel = LogLevel;
|
||||||
for (unsigned int index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::MAX); index++) {
|
for (unsigned int index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::MAX); index++) {
|
||||||
|
@ -209,6 +212,7 @@ void log_set_config(int LogLevel, unsigned int* LoggedModules)
|
||||||
g_EnabledModules[index] = false;
|
g_EnabledModules[index] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_CurrentLogPopupTestcase = LogPopupTestcase;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate active log filter output.
|
// Generate active log filter output.
|
||||||
|
|
|
@ -116,6 +116,7 @@ typedef enum class _CXBXR_MODULE: unsigned int {
|
||||||
extern std::atomic_bool g_EnabledModules[to_underlying(CXBXR_MODULE::MAX)];
|
extern std::atomic_bool g_EnabledModules[to_underlying(CXBXR_MODULE::MAX)];
|
||||||
extern const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)];
|
extern const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)];
|
||||||
extern std::atomic_int g_CurrentLogLevel;
|
extern std::atomic_int g_CurrentLogLevel;
|
||||||
|
extern std::atomic_bool g_CurrentLogPopupTestcase;
|
||||||
|
|
||||||
// print out a log message to the console or kernel debug log file if level is high enough
|
// print out a log message to the console or kernel debug log file if level is high enough
|
||||||
void NTAPI EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...);
|
void NTAPI EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...);
|
||||||
|
@ -127,7 +128,7 @@ extern inline void log_get_settings();
|
||||||
|
|
||||||
extern inline void log_sync_config();
|
extern inline void log_sync_config();
|
||||||
|
|
||||||
void log_set_config(int LogLevel, unsigned int* LoggedModules);
|
void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTestcase);
|
||||||
|
|
||||||
void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
|
void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ static struct {
|
||||||
const char* LoggedModules = "LoggedModules";
|
const char* LoggedModules = "LoggedModules";
|
||||||
const char* LogLevel = "LogLevel";
|
const char* LogLevel = "LogLevel";
|
||||||
const char* LoaderExecutable = "LoaderExecutable";
|
const char* LoaderExecutable = "LoaderExecutable";
|
||||||
|
const char* LogPopupTestcase = "LogPopupTestcase";
|
||||||
} sect_core_keys;
|
} sect_core_keys;
|
||||||
|
|
||||||
static const char* section_video = "video";
|
static const char* section_video = "video";
|
||||||
|
@ -355,6 +356,7 @@ bool Settings::LoadConfig()
|
||||||
m_core.LoggedModules[index] = 0;
|
m_core.LoggedModules[index] = 0;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
m_core.bLogPopupTestcase = m_si.GetBoolValue(section_core, sect_core_keys.LogPopupTestcase, /*Default=*/true);
|
||||||
|
|
||||||
m_core.bUseLoaderExec = m_si.GetBoolValue(section_core, sect_core_keys.LoaderExecutable, /*Default=*/true);
|
m_core.bUseLoaderExec = m_si.GetBoolValue(section_core, sect_core_keys.LoaderExecutable, /*Default=*/true);
|
||||||
|
|
||||||
|
@ -534,6 +536,7 @@ bool Settings::Save(std::string file_path)
|
||||||
stream << "0x" << std::hex << m_core.LoggedModules[i];
|
stream << "0x" << std::hex << m_core.LoggedModules[i];
|
||||||
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
|
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
|
||||||
}
|
}
|
||||||
|
m_si.SetBoolValue(section_core, sect_core_keys.LogPopupTestcase, m_core.bLogPopupTestcase, nullptr, true);
|
||||||
|
|
||||||
m_si.SetBoolValue(section_core, sect_core_keys.LoaderExecutable, m_core.bUseLoaderExec, nullptr, true);
|
m_si.SetBoolValue(section_core, sect_core_keys.LoaderExecutable, m_core.bUseLoaderExec, nullptr, true);
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public:
|
||||||
int LogLevel = 1;
|
int LogLevel = 1;
|
||||||
bool bUseLoaderExec;
|
bool bUseLoaderExec;
|
||||||
bool allowAdminPrivilege;
|
bool allowAdminPrivilege;
|
||||||
bool Reserved3 = 0;
|
bool bLogPopupTestcase;
|
||||||
bool Reserved4 = 0;
|
bool Reserved4 = 0;
|
||||||
int Reserved99[10] = { 0 };
|
int Reserved99[10] = { 0 };
|
||||||
} m_core;
|
} m_core;
|
||||||
|
|
|
@ -224,6 +224,12 @@ class EmuShared : public Mutex
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * Log Level value Accessors
|
||||||
|
// ******************************************************************
|
||||||
|
void GetLogPopupTestcase(bool *value) { Lock(); *value = m_core.bLogPopupTestcase; Unlock(); }
|
||||||
|
void SetLogPopupTestcase(bool value) { Lock(); m_core.bLogPopupTestcase = value; Unlock(); }
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * File storage location
|
// * File storage location
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
|
@ -151,10 +151,12 @@ void CxbxPopupMessageEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, CxbxMsgDlgIc
|
||||||
#define CxbxPopupMessage(level, icon, fmt, ...) CxbxPopupMessageEx(LOG_PREFIX, level, icon, fmt, ##__VA_ARGS__)
|
#define CxbxPopupMessage(level, icon, fmt, ...) CxbxPopupMessageEx(LOG_PREFIX, level, icon, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define LOG_TEST_CASE(message) do { static bool bTestCaseLogged = false; \
|
#define LOG_TEST_CASE(message) do { static bool bTestCaseLogged = false; \
|
||||||
if (!bTestCaseLogged) { bTestCaseLogged = true; \
|
if (bTestCaseLogged) break; \
|
||||||
|
bTestCaseLogged = true; \
|
||||||
|
if (!g_CurrentLogPopupTestcase) break;\
|
||||||
LOG_CHECK_ENABLED(LOG_LEVEL::INFO) { \
|
LOG_CHECK_ENABLED(LOG_LEVEL::INFO) { \
|
||||||
CxbxPopupMessage(LOG_LEVEL::INFO, CxbxMsgDlgIcon_Info, "Please report that %s shows the following message:\nLOG_TEST_CASE: %s\nIn %s (%s line %d)", \
|
CxbxPopupMessage(LOG_LEVEL::INFO, CxbxMsgDlgIcon_Info, "Please report that %s shows the following message:\nLOG_TEST_CASE: %s\nIn %s (%s line %d)", \
|
||||||
CxbxKrnl_Xbe->m_szAsciiTitle, message, __func__, __FILE__, __LINE__); } } } while (0)
|
CxbxKrnl_Xbe->m_szAsciiTitle, message, __func__, __FILE__, __LINE__); } } while (0)
|
||||||
// was g_pCertificate->wszTitleName
|
// was g_pCertificate->wszTitleName
|
||||||
|
|
||||||
extern Xbe::Certificate *g_pCertificate;
|
extern Xbe::Certificate *g_pCertificate;
|
||||||
|
|
|
@ -121,6 +121,7 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
int TempLevel;
|
int TempLevel;
|
||||||
unsigned int LoggedModules[NUM_INTEGERS_LOG];
|
unsigned int LoggedModules[NUM_INTEGERS_LOG];
|
||||||
int LogLevel;
|
int LogLevel;
|
||||||
|
bool LogPopupTestcase;
|
||||||
|
|
||||||
// Set window icon
|
// Set window icon
|
||||||
SetClassLong(hWndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_CXBX)));
|
SetClassLong(hWndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_CXBX)));
|
||||||
|
@ -128,6 +129,7 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
LoggedModules[0] = g_Settings->m_core.LoggedModules[0];
|
LoggedModules[0] = g_Settings->m_core.LoggedModules[0];
|
||||||
LoggedModules[1] = g_Settings->m_core.LoggedModules[1];
|
LoggedModules[1] = g_Settings->m_core.LoggedModules[1];
|
||||||
LogLevel = g_Settings->m_core.LogLevel;
|
LogLevel = g_Settings->m_core.LogLevel;
|
||||||
|
LogPopupTestcase = g_Settings->m_core.bLogPopupTestcase;
|
||||||
|
|
||||||
hHandle = GetDlgItem(hWndDlg, IDC_EVENT_LV);
|
hHandle = GetDlgItem(hWndDlg, IDC_EVENT_LV);
|
||||||
TempLevel = to_underlying(LOG_LEVEL::DEBUG);
|
TempLevel = to_underlying(LOG_LEVEL::DEBUG);
|
||||||
|
@ -144,6 +146,10 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LogPopupTestcase) {
|
||||||
|
SendMessage(GetDlgItem(hWndDlg, IDC_LOG_POPUP_TESTCASE), BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
for (index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::KRNL); index++) {
|
for (index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::KRNL); index++) {
|
||||||
if (LoggedModules[index / 32] & (1 << (index % 32))) {
|
if (LoggedModules[index / 32] & (1 << (index % 32))) {
|
||||||
|
@ -233,12 +239,18 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LogPopupTestcase = false;
|
||||||
|
if (SendMessage(GetDlgItem(hWndDlg, IDC_LOG_POPUP_TESTCASE), BM_GETCHECK, 0, 0) == BST_CHECKED) {
|
||||||
|
LogPopupTestcase = true;
|
||||||
|
}
|
||||||
|
|
||||||
g_Settings->m_core.LoggedModules[0] = LoggedModules[0];
|
g_Settings->m_core.LoggedModules[0] = LoggedModules[0];
|
||||||
g_Settings->m_core.LoggedModules[1] = LoggedModules[1];
|
g_Settings->m_core.LoggedModules[1] = LoggedModules[1];
|
||||||
g_Settings->m_core.LogLevel = LogLevel;
|
g_Settings->m_core.LogLevel = LogLevel;
|
||||||
|
g_Settings->m_core.bLogPopupTestcase = LogPopupTestcase;
|
||||||
|
|
||||||
// Update the logging variables for the GUI process
|
// Update the logging variables for the GUI process
|
||||||
log_set_config(LogLevel, LoggedModules);
|
log_set_config(LogLevel, LoggedModules, LogPopupTestcase);
|
||||||
log_generate_active_filter_output(CXBXR_MODULE::GUI);
|
log_generate_active_filter_output(CXBXR_MODULE::GUI);
|
||||||
|
|
||||||
// Also inform the kernel process if it exists
|
// Also inform the kernel process if it exists
|
||||||
|
@ -246,6 +258,7 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
// Sync updated log to kernel process to use run-time settings.
|
// Sync updated log to kernel process to use run-time settings.
|
||||||
g_EmuShared->SetLogLv(&LogLevel);
|
g_EmuShared->SetLogLv(&LogLevel);
|
||||||
g_EmuShared->SetLogModules(LoggedModules);
|
g_EmuShared->SetLogModules(LoggedModules);
|
||||||
|
g_EmuShared->SetLogPopupTestcase(LogPopupTestcase);
|
||||||
ipc_send_kernel_update(IPC_UPDATE_KERNEL::CONFIG_LOGGING_SYNC, 0, reinterpret_cast<std::uintptr_t>(g_ChildWnd));
|
ipc_send_kernel_update(IPC_UPDATE_KERNEL::CONFIG_LOGGING_SYNC, 0, reinterpret_cast<std::uintptr_t>(g_ChildWnd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,6 +272,12 @@ INT_PTR CALLBACK DlgLogConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_LOG_POPUP_TESTCASE:
|
||||||
|
if (HIWORD(wParam) == BN_CLICKED) {
|
||||||
|
g_bHasChanges = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDC_LOG_ENABLE_GENERAL: {
|
case IDC_LOG_ENABLE_GENERAL: {
|
||||||
if (HIWORD(wParam) == BN_CLICKED) {
|
if (HIWORD(wParam) == BN_CLICKED) {
|
||||||
for (index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::KRNL);
|
for (index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::KRNL);
|
||||||
|
|
|
@ -401,6 +401,7 @@ FONT 8, "Verdana", 0, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
COMBOBOX IDC_EVENT_LV,57,9,50,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_EVENT_LV,57,9,50,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
CTEXT "Event Level",IDC_STATIC,10,11,40,10,0,WS_EX_RIGHT
|
CTEXT "Event Level",IDC_STATIC,10,11,40,10,0,WS_EX_RIGHT
|
||||||
|
CONTROL "Popup Testcase",IDC_LOG_POPUP_TESTCASE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,121,11,64,10
|
||||||
GROUPBOX "Emulator Event",IDC_CXBXR_EVENTS,12,26,234,186,WS_GROUP,WS_EX_CLIENTEDGE
|
GROUPBOX "Emulator Event",IDC_CXBXR_EVENTS,12,26,234,186,WS_GROUP,WS_EX_CLIENTEDGE
|
||||||
CONTROL "Enable all",IDC_LOG_ENABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,39,47,10
|
CONTROL "Enable all",IDC_LOG_ENABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,39,47,10
|
||||||
CONTROL "Disable all",IDC_LOG_DISABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,39,50,10
|
CONTROL "Disable all",IDC_LOG_DISABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,39,50,10
|
||||||
|
|
|
@ -303,6 +303,7 @@
|
||||||
#define IDC_RUMBLE_LIST 1301
|
#define IDC_RUMBLE_LIST 1301
|
||||||
#define IDC_RUMBLE_TEST 1302
|
#define IDC_RUMBLE_TEST 1302
|
||||||
#define IDC_NETWORK_ADAPTER 1303
|
#define IDC_NETWORK_ADAPTER 1303
|
||||||
|
#define IDC_LOG_POPUP_TESTCASE 1304
|
||||||
#define ID_FILE_EXIT 40005
|
#define ID_FILE_EXIT 40005
|
||||||
#define ID_HELP_ABOUT 40008
|
#define ID_HELP_ABOUT 40008
|
||||||
#define ID_EMULATION_START 40009
|
#define ID_EMULATION_START 40009
|
||||||
|
@ -372,7 +373,7 @@
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 136
|
#define _APS_NEXT_RESOURCE_VALUE 136
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40116
|
#define _APS_NEXT_COMMAND_VALUE 40116
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1304
|
#define _APS_NEXT_CONTROL_VALUE 1305
|
||||||
#define _APS_NEXT_SYMED_VALUE 109
|
#define _APS_NEXT_SYMED_VALUE 109
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue