Moved SysMessage() from the video plugin into the main app, so the GUI and non-GUI executable can handle it in a different way. This fixes a crash in DolphinNoGUI when SysMessage() was called and tried to use a non-initialized wxWidgets.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@489 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
38ff37539d
commit
54c2a07de5
|
@ -22,6 +22,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "CPUDetect.h"
|
#include "CPUDetect.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
#include "Host.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
|
@ -274,3 +275,16 @@ void Host_UpdateStatusBar(const char* _pText)
|
||||||
|
|
||||||
wxPostEvent(main_frame, event);
|
wxPostEvent(main_frame, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Host_SysMessage(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsprintf(msg, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||||
|
wxMessageBox(wxString::FromAscii(msg));
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
#include "Host.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "ISOFile.h"
|
#include "ISOFile.h"
|
||||||
#include "CPUDetect.h"
|
#include "CPUDetect.h"
|
||||||
|
@ -59,6 +60,23 @@ void Host_SetWaitCursor(bool enable){}
|
||||||
|
|
||||||
void Host_UpdateStatusBar(const char* _pText){}
|
void Host_UpdateStatusBar(const char* _pText){}
|
||||||
|
|
||||||
|
void Host_SysMessage(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
char msg[512];
|
||||||
|
|
||||||
|
va_start(list, fmt);
|
||||||
|
vsprintf(msg, fmt, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
size_t len = strlen(msg);
|
||||||
|
if (msg[len - 1] != '\n') {
|
||||||
|
msg[len - 1] = '\n';
|
||||||
|
msg[len] = '\0';
|
||||||
|
}
|
||||||
|
fprintf(stderr, msg);
|
||||||
|
}
|
||||||
|
|
||||||
// Include SDL header so it can hijack main().
|
// Include SDL header so it can hijack main().
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenA
|
||||||
typedef void (*TSetPEFinish)(void);
|
typedef void (*TSetPEFinish)(void);
|
||||||
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress);
|
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress);
|
||||||
typedef void (*TVideoLog)(const char* _pMessage, BOOL _bBreak);
|
typedef void (*TVideoLog)(const char* _pMessage, BOOL _bBreak);
|
||||||
|
typedef void (*TSysMessage)(const char *fmt, ...);
|
||||||
typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, BOOL _bFullscreen);
|
typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, BOOL _bFullscreen);
|
||||||
typedef void (*TCopiedToXFB)(void);
|
typedef void (*TCopiedToXFB)(void);
|
||||||
typedef BOOL (*TPeekMessages)(void);
|
typedef BOOL (*TPeekMessages)(void);
|
||||||
|
@ -50,6 +51,7 @@ typedef struct
|
||||||
TSetPEFinish pSetPEFinish;
|
TSetPEFinish pSetPEFinish;
|
||||||
TGetMemoryPointer pGetMemoryPointer;
|
TGetMemoryPointer pGetMemoryPointer;
|
||||||
TVideoLog pLog;
|
TVideoLog pLog;
|
||||||
|
TSysMessage pSysMessage;
|
||||||
TRequestWindowSize pRequestWindowSize;
|
TRequestWindowSize pRequestWindowSize;
|
||||||
TCopiedToXFB pCopiedToXFB;
|
TCopiedToXFB pCopiedToXFB;
|
||||||
TPeekMessages pPeekMessages;
|
TPeekMessages pPeekMessages;
|
||||||
|
|
|
@ -217,7 +217,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
|
|
||||||
if (g_VideoInitialize.pWindowHandle == NULL)
|
if (g_VideoInitialize.pWindowHandle == NULL)
|
||||||
{
|
{
|
||||||
SysMessage("failed to create window");
|
g_VideoInitialize.pSysMessage("failed to create window");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,16 +252,3 @@ void __Log(int type, const char *fmt, ...)
|
||||||
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysMessage(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list list;
|
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
va_start(list, fmt);
|
|
||||||
vsprintf(msg, fmt, list);
|
|
||||||
va_end(list);
|
|
||||||
|
|
||||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
|
||||||
wxMessageBox(wxString::FromAscii(msg));
|
|
||||||
}
|
|
||||||
|
|
|
@ -221,7 +221,6 @@ extern Statistics stats;
|
||||||
void DebugLog(const char* _fmt, ...);
|
void DebugLog(const char* _fmt, ...);
|
||||||
void __Log(const char *format, ...);
|
void __Log(const char *format, ...);
|
||||||
void __Log(int type, const char *format, ...);
|
void __Log(int type, const char *format, ...);
|
||||||
void SysMessage(const char *fmt, ...);
|
|
||||||
void HandleGLError();
|
void HandleGLError();
|
||||||
|
|
||||||
void InitLUTs();
|
void InitLUTs();
|
||||||
|
|
|
@ -181,10 +181,10 @@ bool FifoCommandRunnable(void)
|
||||||
"This means one of the following:\n"
|
"This means one of the following:\n"
|
||||||
"* The emulated GPU got desynced, disabling dual core can help\n"
|
"* The emulated GPU got desynced, disabling dual core can help\n"
|
||||||
"* Command stream corrupted by some spurious memory bug\n"
|
"* Command stream corrupted by some spurious memory bug\n"
|
||||||
"* This really is an unknown opcode (unlikely)\n\n"
|
"* This really is an unknown opcode (unlikely)\n"
|
||||||
"* Some other sort of bug\n\n"
|
"* Some other sort of bug\n\n"
|
||||||
"Dolphin will now likely crash or hang. Enjoy.", Cmd);
|
"Dolphin will now likely crash or hang. Enjoy.", Cmd);
|
||||||
SysMessage(szTemp);
|
g_VideoInitialize.pSysMessage(szTemp);
|
||||||
g_VideoInitialize.pLog(szTemp, TRUE);
|
g_VideoInitialize.pLog(szTemp, TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -424,7 +424,7 @@ void Renderer::ReinitView(int nNewWidth, int nNewHeight)
|
||||||
if (!OpenGL_Create(g_VideoInitialize, nNewWidth, nNewHeight)) {//nNewWidth&~7, nNewHeight&~7) ) {
|
if (!OpenGL_Create(g_VideoInitialize, nNewWidth, nNewHeight)) {//nNewWidth&~7, nNewHeight&~7) ) {
|
||||||
ERROR_LOG("Failed to recreate, reverting to old settings\n");
|
ERROR_LOG("Failed to recreate, reverting to old settings\n");
|
||||||
if (!OpenGL_Create(g_VideoInitialize, oldwidth, oldheight)) {
|
if (!OpenGL_Create(g_VideoInitialize, oldwidth, oldheight)) {
|
||||||
SysMessage("Failed to revert, exiting...\n");
|
g_VideoInitialize.pSysMessage("Failed to revert, exiting...\n");
|
||||||
// TODO - don't takedown the entire emu
|
// TODO - don't takedown the entire emu
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,7 +392,7 @@ void VertexLoader::ProcessFormat()
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
sprintf(temp,"%i %i %i", m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements);
|
sprintf(temp,"%i %i %i", m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements);
|
||||||
SysMessage("VertexLoader_Normal::GetFunction returned zero!");
|
g_VideoInitialize.pSysMessage("VertexLoader_Normal::GetFunction returned zero!");
|
||||||
}
|
}
|
||||||
WriteCall(pFunc);
|
WriteCall(pFunc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue