X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=wgltrace.py;h=4dfd0f4e32d2b865a43207a7abf7ac4dd242e0d5;hb=788a7cb792894d40c7cf37a3d2b9eaa6edaaa3dd;hp=480ebcb66fd73398d434719150c0b7e78e0851bc;hpb=8f6be5674e4288af0db0c8bda008acffc2650afa;p=apitrace diff --git a/wgltrace.py b/wgltrace.py index 480ebcb..4dfd0f4 100644 --- a/wgltrace.py +++ b/wgltrace.py @@ -27,9 +27,9 @@ """WGL tracing code generator.""" -from stdapi import API -from glapi import glapi -from wglapi import wglapi +from specs.stdapi import API +from specs.glapi import glapi +from specs.wglapi import wglapi from dispatch import function_pointer_type, function_pointer_value from gltrace import GlTracer from codegen import * @@ -37,10 +37,9 @@ from codegen import * class WglTracer(GlTracer): - def get_function_address(self, function): - return '__%s' % (function.name,) + def wrapRet(self, function, instance): + GlTracer.wrapRet(self, function, instance) - def wrap_ret(self, function, instance): if function.name == "wglGetProcAddress": print ' if (%s) {' % instance @@ -54,7 +53,7 @@ class WglTracer(GlTracer): print ' %s = (%s)&%s;' % (instance, function.type, f.name); def handle_default(): - print ' OS::DebugMessage("apitrace: unknown function \\"%s\\"\\n", lpszProc);' + print ' os::log("apitrace: warning: unknown function \\"%s\\"\\n", lpszProc);' string_switch('lpszProc', func_dict.keys(), handle_case, handle_default) print ' }' @@ -67,39 +66,18 @@ if __name__ == '__main__': print '#include ' print '#include ' print - print '#include "trace_write.hpp"' + print '#include "trace_writer_local.hpp"' print '#include "os.hpp"' print - print ''' -static HINSTANCE g_hDll = NULL; - -static PROC -__getPublicProcAddress(LPCSTR lpProcName) -{ - if (!g_hDll) { - char szDll[MAX_PATH] = {0}; - - if (!GetSystemDirectoryA(szDll, MAX_PATH)) { - return NULL; - } - - strcat(szDll, "\\\\opengl32.dll"); - - g_hDll = LoadLibraryA(szDll); - if (!g_hDll) { - return NULL; - } - } - - return GetProcAddress(g_hDll, lpProcName); -} - - ''' + print '// To validate our prototypes' + print '#define GL_GLEXT_PROTOTYPES' + print '#define WGL_GLXEXT_PROTOTYPES' + print print '#include "glproc.hpp"' print '#include "glsize.hpp"' print api = API() - api.add_api(glapi) - api.add_api(wglapi) + api.addApi(glapi) + api.addApi(wglapi) tracer = WglTracer() tracer.trace_api(api)