[Plugins] Give access to notify class

This commit is contained in:
zilmar 2017-04-18 21:32:43 +10:00
parent 59a51e2c71
commit 0c1c5e39af
10 changed files with 355 additions and 293 deletions

View File

@ -47,6 +47,7 @@
#include <png/png.h> #include <png/png.h>
#include <memory> #include <memory>
#include <Common/SmartPointer.h> #include <Common/SmartPointer.h>
#include <Settings/Settings.h>
#include "Config.h" #include "Config.h"
#include "Util.h" #include "Util.h"
@ -84,7 +85,6 @@ int ev_fullscreen = 0;
extern int g_viewport_offset; extern int g_viewport_offset;
extern int g_width, g_height; extern int g_width, g_height;
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hinstDLL = NULL; HINSTANCE hinstDLL = NULL;
#endif #endif
@ -520,11 +520,7 @@ int InitGfx()
gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1); gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!gfx_context) if (!gfx_context)
{ {
#ifdef _WIN32 g_Notify->DisplayError("Error setting display mode");
MessageBox(gfx.hWnd, "Error setting display mode", "Error", MB_OK | MB_ICONEXCLAMATION);
#else
fprintf(stderr, "Error setting display mode\n");
#endif
grGlideShutdown(); grGlideShutdown();
return FALSE; return FALSE;
} }

View File

@ -52,6 +52,7 @@
#include <Common/StdString.h> #include <Common/StdString.h>
#include "trace.h" #include "trace.h"
#include "SettingsID.h" #include "SettingsID.h"
#include <Settings/Settings.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Common/CriticalSection.h> #include <Common/CriticalSection.h>
@ -324,9 +325,7 @@ void microcheck()
{ {
ReleaseGfx(); ReleaseGfx();
WriteTrace(TraceGlide64, TraceError, "uCode crc not found in INI, using currently selected uCode %08lx", (unsigned long)uc_crc); WriteTrace(TraceGlide64, TraceError, "uCode crc not found in INI, using currently selected uCode %08lx", (unsigned long)uc_crc);
#ifdef _WIN32 g_Notify->DisplayError(stdstr_f("Error: uCode crc not found in INI, using currently selected uCode\n\n%08lx", uc_crc).c_str());
MessageBox(gfx.hWnd, stdstr_f("Error: uCode crc not found in INI, using currently selected uCode\n\n%08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION);
#endif
g_ucode_error_report = false; // don't report any more ucode errors from this game g_ucode_error_report = false; // don't report any more ucode errors from this game
} }
} }
@ -336,9 +335,7 @@ void microcheck()
{ {
ReleaseGfx(); ReleaseGfx();
WriteTrace(TraceGlide64, TraceError, "Unsupported uCode! crc: %08lx", (unsigned long)uc_crc); WriteTrace(TraceGlide64, TraceError, "Unsupported uCode! crc: %08lx", (unsigned long)uc_crc);
#ifdef _WIN32 g_Notify->DisplayError(stdstr_f("Error: Unsupported uCode!\n\ncrc: %08lx", uc_crc).c_str());
MessageBox(gfx.hWnd, stdstr_f("Error: Unsupported uCode!\n\ncrc: %08lx", uc_crc).c_str(), "Error", MB_OK | MB_ICONEXCLAMATION);
#endif
g_ucode_error_report = FALSE; // don't report any more ucode errors from this game g_ucode_error_report = FALSE; // don't report any more ucode errors from this game
} }
} }
@ -743,14 +740,8 @@ EXPORT void CALL ProcessDList(void)
g_ghq_use = false; g_ghq_use = false;
} }
} }
if (MessageBox(gfx.hWnd, "The GFX plugin caused an exception and has been disabled.\nWould you like to turn it back on and attempt to continue?","Glide64 Exception", MB_YESNO|MB_ICONEXCLAMATION) == MB_NO) DisplayError("The GFX plugin caused an exception and has been disabled");
{
exception = TRUE;
}
else
{
to_fullscreen = TRUE; to_fullscreen = TRUE;
}
return; return;
} }
#endif #endif

View File

@ -216,34 +216,6 @@ void display_warning(const char *text, ...)
} }
} }
#ifdef _WIN32
void display_error()
{
LPVOID lpMsgBuf;
if (!FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR)&lpMsgBuf,
0,
NULL))
{
// Handle the error.
return;
}
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION);
// Free the buffer.
LocalFree(lpMsgBuf);
}
#endif // _WIN32
FX_ENTRY void FX_CALL FX_ENTRY void FX_CALL
grSstOrigin(GrOriginLocation_t origin) grSstOrigin(GrOriginLocation_t origin)
{ {

View File

@ -24,7 +24,7 @@
/* /*
* `GetSystemSetting` and `FindSystemSettingId` from Project64 debugger * `GetSystemSetting` and `FindSystemSettingId` from Project64 debugger
* used only in DisplayError when OpenGL extension loading fails on WGL * used only in g_Notify->DisplayError when OpenGL extension loading fails on WGL
*/ */
#include <Settings/Settings.h> #include <Settings/Settings.h>
@ -78,39 +78,31 @@ static inline void opt_glCopyTexImage2D(GLenum target,
* displaying error information showing the missing OpenGL support. * displaying error information showing the missing OpenGL support.
*/ */
void DisplayError(const char * message)
{
if (GetSystemSetting(FindSystemSettingId("Debugger")) == 0)
return;
MessageBoxA(NULL, message, NULL, MB_ICONERROR);
return;
}
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT; PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB; PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
PFNGLFOGCOORDFPROC glFogCoordfEXT; PFNGLFOGCOORDFPROC glFogCoordfEXT;
void APIENTRY dummy_glActiveTexture(GLenum/*texture*/) void APIENTRY dummy_glActiveTexture(GLenum/*texture*/)
{ /* GLX render opcode 197, req. OpenGL 1.3 (1.2 w/ ARB_multitexture) */ { /* GLX render opcode 197, req. OpenGL 1.3 (1.2 w/ ARB_multitexture) */
DisplayError("glActiveTexture"); g_Notify->DisplayError("glActiveTexture");
} }
void APIENTRY dummy_glMultiTexCoord2f(GLenum/*target*/, GLfloat/*s*/, GLfloat/*t*/) void APIENTRY dummy_glMultiTexCoord2f(GLenum/*target*/, GLfloat/*s*/, GLfloat/*t*/)
{ /* GLX render opcode 203, req. OpenGL 1.3 (1.2 w/ ARB_multitexture) */ { /* GLX render opcode 203, req. OpenGL 1.3 (1.2 w/ ARB_multitexture) */
DisplayError("glMultiTexCoord2f"); g_Notify->DisplayError("glMultiTexCoord2f");
} }
void APIENTRY dummy_glFogCoordf(GLfloat/*coord*/) void APIENTRY dummy_glFogCoordf(GLfloat/*coord*/)
{ /* GLX render opcode 4124, req. OpenGL 1.4 (1.1 w/ EXT_fog_coord) */ { /* GLX render opcode 4124, req. OpenGL 1.4 (1.1 w/ EXT_fog_coord) */
DisplayError("glFogCoordf"); g_Notify->DisplayError("glFogCoordf");
} }
void APIENTRY dummy_glBlendFuncSeparate(GLenum, GLenum, GLenum, GLenum) void APIENTRY dummy_glBlendFuncSeparate(GLenum, GLenum, GLenum, GLenum)
{ /* GLX render opcode 4134, req. OpenGL 1.0 w/ EXT_blend_func_separate */ { /* GLX render opcode 4134, req. OpenGL 1.0 w/ EXT_blend_func_separate */
DisplayError("glBlendFuncSeparate"); g_Notify->DisplayError("glBlendFuncSeparate");
} }
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB; PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
const char * APIENTRY dummy_wglGetExtensionsString(HDC) const char * APIENTRY dummy_wglGetExtensionsString(HDC)
{ {
DisplayError("wglGetExtensionsString"); g_Notify->DisplayError("wglGetExtensionsString");
return NULL; return NULL;
} }
@ -126,44 +118,44 @@ PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
void APIENTRY dummy_glGenRenderbuffers(GLsizei/*n*/, GLuint* /*renderbuffers*/) void APIENTRY dummy_glGenRenderbuffers(GLsizei/*n*/, GLuint* /*renderbuffers*/)
{ /* GLX vendor opcode 1423, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX vendor opcode 1423, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glGenRenderbuffers"); g_Notify->DisplayError("glGenRenderbuffers");
} }
void APIENTRY dummy_glGenFramebuffers(GLsizei/*n*/, GLuint* /*framebuffers*/) void APIENTRY dummy_glGenFramebuffers(GLsizei/*n*/, GLuint* /*framebuffers*/)
{ /* GLX vendor opcode 1426, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX vendor opcode 1426, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glGenFramebuffers"); g_Notify->DisplayError("glGenFramebuffers");
} }
GLenum APIENTRY dummy_glCheckFramebufferStatus(GLenum/*target*/) GLenum APIENTRY dummy_glCheckFramebufferStatus(GLenum/*target*/)
{ /* GLX vendor opcode 1427, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX vendor opcode 1427, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glCheckFramebufferStatus"); g_Notify->DisplayError("glCheckFramebufferStatus");
return 0x00008CDD; /* GL_FRAMEBUFFER_UNSUPPORTED */ return 0x00008CDD; /* GL_FRAMEBUFFER_UNSUPPORTED */
} }
void APIENTRY dummy_glBindRenderbuffer(GLenum/*target*/, GLuint/*renderbuffer*/) void APIENTRY dummy_glBindRenderbuffer(GLenum/*target*/, GLuint/*renderbuffer*/)
{ /* GLX render opcode 4316, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4316, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glBindRenderbuffer"); g_Notify->DisplayError("glBindRenderbuffer");
} }
void APIENTRY dummy_glDeleteRenderbuffers(GLsizei/*n*/, const GLuint* /*renderbuffers*/) void APIENTRY dummy_glDeleteRenderbuffers(GLsizei/*n*/, const GLuint* /*renderbuffers*/)
{ /* GLX render opcode 4317, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4317, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glDeleteRenderbuffers"); g_Notify->DisplayError("glDeleteRenderbuffers");
} }
void APIENTRY dummy_glRenderbufferStorage(GLenum, GLenum, GLsizei, GLsizei) void APIENTRY dummy_glRenderbufferStorage(GLenum, GLenum, GLsizei, GLsizei)
{ /* GLX render opcode 4318, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4318, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glRenderbufferStorage"); g_Notify->DisplayError("glRenderbufferStorage");
} }
void APIENTRY dummy_glBindFramebuffer(GLenum/*target*/, GLuint/*framebuffer*/) void APIENTRY dummy_glBindFramebuffer(GLenum/*target*/, GLuint/*framebuffer*/)
{ /* GLX render opcode 4319, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4319, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glBindFramebuffer"); g_Notify->DisplayError("glBindFramebuffer");
} }
void APIENTRY dummy_glDeleteFramebuffers(GLsizei/*n*/, const GLuint* /*framebuffers*/) void APIENTRY dummy_glDeleteFramebuffers(GLsizei/*n*/, const GLuint* /*framebuffers*/)
{ /* GLX render opcode 4320, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4320, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glDeleteFramebuffers"); g_Notify->DisplayError("glDeleteFramebuffers");
} }
void APIENTRY dummy_glFramebufferTexture2D(GLenum, GLenum, GLenum, GLuint, GLint) void APIENTRY dummy_glFramebufferTexture2D(GLenum, GLenum, GLenum, GLuint, GLint)
{ /* GLX render opcode 4322, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4322, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glFramebufferTexture2D"); g_Notify->DisplayError("glFramebufferTexture2D");
} }
void APIENTRY dummy_glFramebufferRenderbuffer(GLenum, GLenum, GLenum, GLuint) void APIENTRY dummy_glFramebufferRenderbuffer(GLenum, GLenum, GLenum, GLuint)
{ /* GLX render opcode 4324, req. OpenGL 1.2 w/ EXT_framebuffer_object */ { /* GLX render opcode 4324, req. OpenGL 1.2 w/ EXT_framebuffer_object */
DisplayError("glFramebufferRenderbuffer"); g_Notify->DisplayError("glFramebufferRenderbuffer");
} }
PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
@ -184,70 +176,70 @@ PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
PFNGLSECONDARYCOLOR3FPROC glSecondaryColor3f; PFNGLSECONDARYCOLOR3FPROC glSecondaryColor3f;
void APIENTRY dummy_glSecondaryColor3f(GLfloat/*red*/, GLfloat/*green*/, GLfloat/*blue*/) void APIENTRY dummy_glSecondaryColor3f(GLfloat/*red*/, GLfloat/*green*/, GLfloat/*blue*/)
{ /* GLX render opcode 4129, req. OpenGL 1.4 (1.1 w/ EXT_secondary_color) */ { /* GLX render opcode 4129, req. OpenGL 1.4 (1.1 w/ EXT_secondary_color) */
DisplayError("glSecondaryColor3f"); g_Notify->DisplayError("glSecondaryColor3f");
} }
GLuint APIENTRY dummy_glCreateShader(GLenum/*type*/) GLuint APIENTRY dummy_glCreateShader(GLenum/*type*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glCreateShader"); g_Notify->DisplayError("glCreateShader");
return ((GLuint)(NULL)); return ((GLuint)(NULL));
} }
void APIENTRY dummy_glShaderSource(GLuint, GLsizei, const GLchar **, GLint *) void APIENTRY dummy_glShaderSource(GLuint, GLsizei, const GLchar **, GLint *)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glShaderSource"); g_Notify->DisplayError("glShaderSource");
} }
void APIENTRY dummy_glCompileShader(GLuint/*shader*/) void APIENTRY dummy_glCompileShader(GLuint/*shader*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glCompileShader"); g_Notify->DisplayError("glCompileShader");
} }
GLuint APIENTRY dummy_glCreateProgram(void) GLuint APIENTRY dummy_glCreateProgram(void)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glCreateProgram"); g_Notify->DisplayError("glCreateProgram");
return ((GLuint)(NULL)); return ((GLuint)(NULL));
} }
void APIENTRY dummy_glAttachObject(GLhandleARB, GLhandleARB) void APIENTRY dummy_glAttachObject(GLhandleARB, GLhandleARB)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glAttachObject"); g_Notify->DisplayError("glAttachObject");
} }
void APIENTRY dummy_glLinkProgram(GLuint/*program*/) void APIENTRY dummy_glLinkProgram(GLuint/*program*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glLinkProgram"); g_Notify->DisplayError("glLinkProgram");
} }
void APIENTRY dummy_glUseProgram(GLuint/*program*/) void APIENTRY dummy_glUseProgram(GLuint/*program*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glUseProgram"); g_Notify->DisplayError("glUseProgram");
} }
GLint APIENTRY dummy_glGetUniformLocation(GLuint/*program*/, GLchar* /*name*/) GLint APIENTRY dummy_glGetUniformLocation(GLuint/*program*/, GLchar* /*name*/)
{ /* GLX single opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX single opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glGetUniformLocation"); g_Notify->DisplayError("glGetUniformLocation");
return -1; return -1;
} }
void APIENTRY dummy_glUniform1i(GLint/*location*/, GLint/*v0*/) void APIENTRY dummy_glUniform1i(GLint/*location*/, GLint/*v0*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glUniform1i"); g_Notify->DisplayError("glUniform1i");
} }
void APIENTRY dummy_glUniform4i(GLint/*location*/, GLint, GLint, GLint, GLint) void APIENTRY dummy_glUniform4i(GLint/*location*/, GLint, GLint, GLint, GLint)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glUniform4i"); g_Notify->DisplayError("glUniform4i");
} }
void APIENTRY dummy_glUniform1f(GLint/*location*/, GLfloat/*v0*/) void APIENTRY dummy_glUniform1f(GLint/*location*/, GLfloat/*v0*/)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glUniform1f"); g_Notify->DisplayError("glUniform1f");
} }
void APIENTRY dummy_glUniform4f(GLint/*location*/, GLfloat, GLfloat, GLfloat, GLfloat) void APIENTRY dummy_glUniform4f(GLint/*location*/, GLfloat, GLfloat, GLfloat, GLfloat)
{ /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */ { /* GLX render opcode ?, req. OpenGL 2.0 (1.2 w/ ARB_shader_objects) */
DisplayError("glUniform4f"); g_Notify->DisplayError("glUniform4f");
} }
void APIENTRY dummy_glDeleteObject(GLhandleARB/*obj*/) void APIENTRY dummy_glDeleteObject(GLhandleARB/*obj*/)
{ /* GLX render opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */ { /* GLX render opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */
DisplayError("glDeleteObject"); g_Notify->DisplayError("glDeleteObject");
} }
void APIENTRY dummy_glGetInfoLog(GLhandleARB, GLsizei, GLsizei *, GLcharARB *) void APIENTRY dummy_glGetInfoLog(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)
{ /* GLX single opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */ { /* GLX single opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */
DisplayError("glGetInfoLog"); g_Notify->DisplayError("glGetInfoLog");
} }
void APIENTRY dummy_glGetObjectParameteriv(GLhandleARB, GLenum, GLint *) void APIENTRY dummy_glGetObjectParameteriv(GLhandleARB, GLenum, GLint *)
{ /* GLX single opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */ { /* GLX single opcode ?, req. OpenGL 1.2 w/ ARB_shader_objects */
DisplayError("glGetObjectParameteriv"); g_Notify->DisplayError("glGetObjectParameteriv");
} }
// FXT1,DXT1,DXT5 support - Hiroshi Morii <koolsmoky(at)users.sourceforge.net> // FXT1,DXT1,DXT5 support - Hiroshi Morii <koolsmoky(at)users.sourceforge.net>
@ -259,7 +251,7 @@ void APIENTRY dummy_glGetObjectParameteriv(GLhandleARB, GLenum, GLint *)
PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2DARB; PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2DARB;
void APIENTRY dummy_glCompressedTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) void APIENTRY dummy_glCompressedTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)
{ /* GLX render opcode 215, req. OpenGL 1.3 (1.2 w/ ARB_texture_compression) */ { /* GLX render opcode 215, req. OpenGL 1.3 (1.2 w/ ARB_texture_compression) */
DisplayError("glCompressedTexImage2D"); g_Notify->DisplayError("glCompressedTexImage2D");
} }
#endif // _WIN32 #endif // _WIN32
@ -332,19 +324,6 @@ unsigned short depthBuffer[2048 * 2048];
//#define VOODOO1 //#define VOODOO1
#ifdef _WIN32
void display_error()
{
LPVOID lpMsgBuf;
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL))
{
return;
}
MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION);
LocalFree(lpMsgBuf);
}
#endif // _WIN32
FX_ENTRY void FX_CALL FX_ENTRY void FX_CALL
grSstOrigin(GrOriginLocation_t origin) grSstOrigin(GrOriginLocation_t origin)
{ {
@ -2131,7 +2110,6 @@ FxI32 src_stride, void *src_data)
return FXTRUE; return FXTRUE;
} }
/* wrapper-specific glide extensions */ /* wrapper-specific glide extensions */
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key) FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)

View File

@ -72,6 +72,19 @@ bool CPlugin::Load(const char * FileName)
LoadFunction(DllConfig); LoadFunction(DllConfig);
LoadFunction(DllAbout); LoadFunction(DllAbout);
LoadFunction(SetPluginNotification);
if (SetPluginNotification)
{
WriteTrace(PluginTraceType(), TraceDebug, "Found SetPluginNotification");
PLUGIN_NOTIFICATION info;
info.DisplayError = DisplayError;
info.FatalError = FatalError;
info.DisplayMessage = DisplayMessage;
info.DisplayMessage2 = DisplayMessage2;
info.BreakPoint = BreakPoint;
SetPluginNotification(&info);
}
LoadFunction(SetSettingNotificationInfo); LoadFunction(SetSettingNotificationInfo);
if (SetSettingNotificationInfo) if (SetSettingNotificationInfo)
{ {
@ -306,3 +319,28 @@ bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)
} }
return false; return false;
} }
void CPlugin::DisplayError(const char * Message)
{
g_Notify->DisplayError(Message);
}
void CPlugin::FatalError(const char * Message)
{
g_Notify->FatalError(Message);
}
void CPlugin::DisplayMessage(int DisplayTime, const char * Message)
{
g_Notify->DisplayMessage(DisplayTime, Message);
}
void CPlugin::DisplayMessage2(const char * Message)
{
g_Notify->DisplayMessage2(Message);
}
void CPlugin::BreakPoint(const char * FileName, int32_t LineNumber)
{
g_Notify->BreakPoint(FileName, LineNumber);
}

View File

@ -61,6 +61,7 @@ protected:
void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *); void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *);
void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *); void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *);
void(CALL *SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *); void(CALL *SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *);
void(CALL *SetPluginNotification)(PLUGIN_NOTIFICATION *);
pjutil::DynLibHandle m_LibHandle; pjutil::DynLibHandle m_LibHandle;
bool m_Initialized, m_RomOpen; bool m_Initialized, m_RomOpen;
@ -76,4 +77,11 @@ protected:
// i.e. _LoadFunction("CloseDLL", CloseDLL); // i.e. _LoadFunction("CloseDLL", CloseDLL);
#define LoadFunction(functionName) _LoadFunctionVoid(#functionName, (void **)&functionName) #define LoadFunction(functionName) _LoadFunctionVoid(#functionName, (void **)&functionName)
#define _LoadFunction(functionName,function) _LoadFunctionVoid(functionName, (void **)&function) #define _LoadFunction(functionName,function) _LoadFunctionVoid(functionName, (void **)&function)
private:
static void DisplayError(const char * Message);
static void FatalError(const char * Message);
static void DisplayMessage(int DisplayTime, const char * Message);
static void DisplayMessage2(const char * Message);
static void BreakPoint(const char * FileName, int32_t LineNumber);
}; };

View File

@ -326,7 +326,6 @@ bool CPlugins::Reset(CN64System * System)
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
if (g_Settings->LoadBool(Plugin_ForceGfxReset)) if (g_Settings->LoadBool(Plugin_ForceGfxReset))
{ {
//this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround //this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround

View File

@ -80,6 +80,15 @@ typedef struct
void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func); void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
} PLUGIN_SETTINGS_NOTIFICATION; } PLUGIN_SETTINGS_NOTIFICATION;
typedef struct
{
void(*DisplayError)(const char * Message);
void(*FatalError)(const char * Message);
void(*DisplayMessage)(int DisplayTime, const char * Message);
void(*DisplayMessage2)(const char * Message);
void(*BreakPoint)(const char * FileName, int32_t LineNumber);
} PLUGIN_NOTIFICATION;
enum PLUGIN_TYPE enum PLUGIN_TYPE
{ {
PLUGIN_TYPE_NONE = 0, PLUGIN_TYPE_NONE = 0,

View File

@ -12,6 +12,9 @@
#define CALL #define CALL
#endif #endif
CNotification g_NotifyLocal;
CNotification * g_Notify = &g_NotifyLocal;
enum SettingLocation enum SettingLocation
{ {
SettingType_ConstString = 0, SettingType_ConstString = 0,
@ -72,16 +75,27 @@ typedef struct
void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func); void(*UnregisterChangeCB)(void * handle, int ID, void * Data, SettingChangedFunc Func);
} PLUGIN_SETTINGS_NOTIFICATION; } PLUGIN_SETTINGS_NOTIFICATION;
typedef struct
{
void (*DisplayError)(const char * Message);
void (*FatalError)(const char * Message);
void (*DisplayMessage)(int DisplayTime, const char * Message);
void (*DisplayMessage2)(const char * Message);
void (*BreakPoint)(const char * FileName, int32_t LineNumber);
} PLUGIN_NOTIFICATION;
static PLUGIN_SETTINGS g_PluginSettings; static PLUGIN_SETTINGS g_PluginSettings;
static PLUGIN_SETTINGS2 g_PluginSettings2; static PLUGIN_SETTINGS2 g_PluginSettings2;
static PLUGIN_SETTINGS3 g_PluginSettings3; static PLUGIN_SETTINGS3 g_PluginSettings3;
static PLUGIN_SETTINGS_NOTIFICATION g_PluginSettingsNotification; static PLUGIN_SETTINGS_NOTIFICATION g_PluginSettingsNotification;
static PLUGIN_NOTIFICATION g_PluginNotification;
static bool g_PluginInitilized = false; static bool g_PluginInitilized = false;
static char g_PluginSettingName[300]; static char g_PluginSettingName[300];
EXPORT void SetSettingInfo(PLUGIN_SETTINGS * info); EXPORT void SetSettingInfo(PLUGIN_SETTINGS * info);
EXPORT void SetSettingInfo2(PLUGIN_SETTINGS2 * info); EXPORT void SetSettingInfo2(PLUGIN_SETTINGS2 * info);
EXPORT void SetSettingInfo3(PLUGIN_SETTINGS3 * info); EXPORT void SetSettingInfo3(PLUGIN_SETTINGS3 * info);
EXPORT void SetPluginNotification(PLUGIN_NOTIFICATION * info);
EXPORT void SetSettingInfo(PLUGIN_SETTINGS * info) EXPORT void SetSettingInfo(PLUGIN_SETTINGS * info)
{ {
@ -105,6 +119,11 @@ EXPORT void SetSettingNotificationInfo(PLUGIN_SETTINGS_NOTIFICATION * info)
g_PluginSettingsNotification = *info; g_PluginSettingsNotification = *info;
} }
EXPORT void SetPluginNotification(PLUGIN_NOTIFICATION * info)
{
g_PluginNotification = *info;
}
int32_t SettingsInitilized(void) int32_t SettingsInitilized(void)
{ {
return g_PluginInitilized; return g_PluginInitilized;
@ -316,3 +335,43 @@ void SettingsUnregisterChange(bool SystemSetting, int SettingID, void * Data, Se
g_PluginSettingsNotification.UnregisterChangeCB(g_PluginSettings.handle, SettingID + (SystemSetting ? 0 : g_PluginSettings.SettingStartRange), Data, Func); g_PluginSettingsNotification.UnregisterChangeCB(g_PluginSettings.handle, SettingID + (SystemSetting ? 0 : g_PluginSettings.SettingStartRange), Data, Func);
} }
} }
void CNotification::DisplayError(const char * Message)
{
if (g_PluginNotification.BreakPoint != NULL)
{
g_PluginNotification.DisplayError(Message);
}
}
void CNotification::FatalError(const char * Message)
{
if (g_PluginNotification.BreakPoint != NULL)
{
g_PluginNotification.FatalError(Message);
}
}
void CNotification::DisplayMessage(int DisplayTime, const char * Message)
{
if (g_PluginNotification.BreakPoint != NULL)
{
g_PluginNotification.DisplayMessage(DisplayTime, Message);
}
}
void CNotification::DisplayMessage2(const char * Message)
{
if (g_PluginNotification.BreakPoint != NULL)
{
g_PluginNotification.DisplayMessage2(Message);
}
}
void CNotification::BreakPoint(const char * FileName, int LineNumber)
{
if (g_PluginNotification.BreakPoint != NULL)
{
g_PluginNotification.BreakPoint(FileName, LineNumber);
}
}

View File

@ -48,3 +48,15 @@ extern "C" {
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
class CNotification
{
public:
static void DisplayError(const char * Message);
static void FatalError(const char * Message);
static void DisplayMessage(int DisplayTime, const char * Message);
static void DisplayMessage2(const char * Message);
static void BreakPoint(const char * FileName, int LineNumber);
};
extern CNotification * g_Notify;