Trying to make a button that disable panic alerts popups please test
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2680 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
da288c5780
commit
dc9a4860b9
|
@ -1,6 +1,5 @@
|
|||
#include "LogManager.h"
|
||||
#include "Timer.h"
|
||||
#include "../../Core/Src/PowerPC/PowerPC.h" // Core
|
||||
|
||||
LogManager *LogManager::m_logManager = NULL;
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include and declarations
|
||||
// ¯¯¯¯¯¯¯¯¯
|
||||
#include <stdio.h> // System
|
||||
|
||||
#include "Common.h" // Local
|
||||
|
@ -26,20 +23,22 @@
|
|||
|
||||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style);
|
||||
static MsgAlertHandler msg_handler = DefaultMsgHandler;
|
||||
/////////////////////////////
|
||||
static bool AlertEnabled = true;
|
||||
|
||||
|
||||
/* Select which of these functions that are used for message boxes. If wxWidgets is enabled
|
||||
we will use wxMsgAlert() that is defined in main.cpp */
|
||||
/* Select which of these functions that are used for message boxes. If
|
||||
wxWidgets is enabled we will use wxMsgAlert() that is defined in main.cpp */
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler)
|
||||
{
|
||||
msg_handler = handler;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
/* This is the first stop for messages where the log is updated and the correct windows
|
||||
is shown */
|
||||
// ¯¯¯¯¯¯¯¯¯
|
||||
// enable/disable the alert handler
|
||||
void SetEnableAlert(bool enable) {
|
||||
AlertEnabled = enable;
|
||||
}
|
||||
|
||||
/* This is the first stop for gui alerts where the log is updated and the
|
||||
correct windows is shown */
|
||||
bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...)
|
||||
{
|
||||
// ---------------------------------
|
||||
|
@ -54,17 +53,14 @@ bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, .
|
|||
va_end(args);
|
||||
|
||||
ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer);
|
||||
// -----------
|
||||
|
||||
if (msg_handler) {
|
||||
if (msg_handler && AlertEnabled) {
|
||||
ret = msg_handler(caption, buffer, yes_no, Style);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
/* This is used in the No-GUI build */
|
||||
// ¯¯¯¯¯¯¯¯¯
|
||||
// Default non library depended panic alert
|
||||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
|||
bool yes_no, int Style);
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler);
|
||||
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...);
|
||||
void SetEnableAlert(bool enable);
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
|
||||
|
@ -36,10 +37,10 @@ extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* fo
|
|||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert("SUCCESS", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("PANIC", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("PANIC", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("ASK", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif //MSGHANDLER
|
||||
|
|
|
@ -68,6 +68,7 @@ void SConfig::SaveSettings()
|
|||
{
|
||||
// Interface
|
||||
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
|
||||
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
|
||||
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
|
||||
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
|
||||
ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
|
||||
|
@ -168,6 +169,7 @@ void SConfig::LoadSettings()
|
|||
{
|
||||
// Interface
|
||||
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, false);
|
||||
ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
|
||||
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
|
||||
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
|
||||
ini.Get("Interface", "Theme", &m_LocalCoreStartupParameter.iTheme, 0);
|
||||
|
|
|
@ -74,7 +74,7 @@ struct SCoreStartupParameter
|
|||
bool bWidescreen, bProgressiveScan;
|
||||
|
||||
// Interface settings
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor;
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;
|
||||
int iTheme;
|
||||
|
||||
enum EBootBios
|
||||
|
|
|
@ -38,6 +38,7 @@ EVT_CLOSE(CConfigMain::OnClose)
|
|||
EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick)
|
||||
|
||||
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
|
||||
|
@ -199,6 +200,11 @@ void CConfigMain::CreateGUIControls()
|
|||
// Confirm on stop
|
||||
ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
|
||||
|
||||
// Use Panic Handlers
|
||||
UsePanicHandlers = new wxCheckBox(GeneralPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
|
||||
|
||||
// Hide Cursor
|
||||
wxStaticText *HideCursorText = new wxStaticText(GeneralPage, ID_INTERFACE_HIDECURSOR_TEXT, wxT("Hide Cursor:"), wxDefaultPosition, wxDefaultSize);
|
||||
AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto"));
|
||||
|
@ -234,6 +240,7 @@ void CConfigMain::CreateGUIControls()
|
|||
UseDynaRec->SetToolTip(wxT("Disabling this will cause Dolphin to run in interpreter mode,"
|
||||
"\nwhich can be more accurate, but is MUCH slower"));
|
||||
ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game."));
|
||||
UsePanicHandlers->SetToolTip(wxT("Show Panic Alerts Popups"));
|
||||
AutoHideCursor->SetToolTip(wxT("This will auto hide the cursor in fullscreen mode."));
|
||||
HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window."
|
||||
"\nIt can be convenient in a Wii game that already has a cursor."));
|
||||
|
@ -265,6 +272,7 @@ void CConfigMain::CreateGUIControls()
|
|||
|
||||
sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings"));
|
||||
sbInterface->Add(ConfirmStop, 0, wxALL, 5);
|
||||
sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
|
||||
wxBoxSizer *sHideCursor = new wxBoxSizer(wxHORIZONTAL);
|
||||
sHideCursor->Add(HideCursorText);
|
||||
sHideCursor->Add(AutoHideCursor, 0, wxLEFT, 5);
|
||||
|
@ -570,6 +578,10 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
|||
case ID_INTERFACE_CONFIRMSTOP: // Interface
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked();
|
||||
break;
|
||||
case ID_INTERFACE_USEPANICHANDLERS: // Interface
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
|
||||
SetEnableAlert(UsePanicHandlers->IsChecked());
|
||||
break;
|
||||
case ID_INTERFACE_AUTOHIDECURSOR:
|
||||
if (AutoHideCursor->IsChecked()) HideCursor->SetValue(!AutoHideCursor->IsChecked()); // Update the other one
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor = AutoHideCursor->IsChecked();
|
||||
|
|
|
@ -49,7 +49,8 @@ class CConfigMain
|
|||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxBoxSizer* sGeneralPage; // General Settings
|
||||
wxCheckBox* ConfirmStop, * AutoHideCursor, *HideCursor;
|
||||
wxCheckBox* ConfirmStop, *AutoHideCursor;
|
||||
wxCheckBox* HideCursor, *UsePanicHandlers;
|
||||
wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers;
|
||||
|
||||
wxArrayString arrayStringFor_InterfaceLang;
|
||||
|
@ -217,6 +218,7 @@ class CConfigMain
|
|||
ID_ENABLECHEATS,
|
||||
|
||||
ID_INTERFACE_CONFIRMSTOP, // Interface settings
|
||||
ID_INTERFACE_USEPANICHANDLERS,
|
||||
ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
|
||||
ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS,
|
||||
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "LogWindow.h"
|
||||
#include "Console.h"
|
||||
|
||||
#define UPDATETIME 1000
|
||||
#define UPDATETIME 100
|
||||
|
||||
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
|
||||
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
|
||||
|
|
|
@ -128,30 +128,18 @@ bool DolphinApp::OnInit()
|
|||
#ifdef _WIN32
|
||||
EXTENDEDTRACEINITIALIZE(".");
|
||||
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
||||
#endif
|
||||
|
||||
// TODO: if First Boot
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
PanicAlert("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
|
||||
"Sayonara!\n");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
printf("%s", "Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n");
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
// ---------------
|
||||
|
||||
|
||||
// ------------------------------------------
|
||||
// Parse command lines
|
||||
// ---------------
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
|
@ -221,17 +209,19 @@ bool DolphinApp::OnInit()
|
|||
// ============
|
||||
#endif
|
||||
|
||||
// Load CONFIG_FILE settings
|
||||
// Load CONFIG_FILE settings
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
|
||||
// Enable the PNG image handler
|
||||
wxInitAllImageHandlers();
|
||||
// Enable the PNG image handler
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
SetEnableAlert(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
|
||||
|
||||
// Create the window title
|
||||
#ifdef _DEBUG
|
||||
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
|
||||
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
|
||||
#else
|
||||
const char *title = "Dolphin SVN R " SVN_REV_STR;
|
||||
const char *title = "Dolphin SVN R " SVN_REV_STR;
|
||||
#endif
|
||||
|
||||
// If we are debugging let use save the main window position and size
|
||||
|
|
Loading…
Reference in New Issue