"""D3D retracer generator."""
+import sys
from dllretrace import DllRetracer as Retracer
-import specs.stdapi as stdapi
+from specs.stdapi import API
+from specs.dxgi import dxgi
+from specs.d3d10 import d3d10
+from specs.d3d10_1 import d3d10_1
+from specs.d3d11 import d3d11
class D3DRetracer(Retracer):
print 'static std::map<void *, void *> _maps;'
print
- self.table_name = 'd3dretrace::d3d_callbacks'
+ self.table_name = 'd3dretrace::d3d10_callbacks'
Retracer.retraceApi(self, api)
if function.name in ('D3D10CreateDeviceAndSwapChain', 'D3D10CreateDeviceAndSwapChain1', 'D3D11CreateDeviceAndSwapChain'):
print r' pSwapChainDesc->OutputWindow = d3dretrace::createWindow(512, 512);'
+ if 'Software' in function.argNames():
+ print r' if (Software) {'
+ print r' retrace::warning(call) << "software device\n";'
+ print r' Software = LoadLibraryA("d3d10warp");'
+ print r' }'
+
Retracer.invokeFunction(self, function)
+
def invokeInterfaceMethod(self, interface, method):
# keep track of the last used device for state dumping
#if interface.name in ('IDirect3DDevice9', 'IDirect3DDevice9Ex'):
print ' if (_pbData) {'
print ' retrace::delRegionByPointer(_pbData);'
print ' }'
+
+
+def main():
+ print r'''#include <string.h>'''
+ print
+ print r'#include <iostream>'
+ print
+ print r'#include "d3dretrace.hpp"'
+ print
+
+ moduleNames = sys.argv[1:]
+
+ api = API()
+ if moduleNames:
+ api.addModule(dxgi)
+ if 'd3d10' in moduleNames:
+ if 'd3d10_1' in moduleNames:
+ print r'#include "d3d10_1imports.hpp"'
+ # D3D10CreateBlob is duplicated in d3d10 and d3d10_1
+ d3d10_1.functions = [function for function in d3d10_1.functions if function.name != 'D3D10CreateBlob']
+ api.addModule(d3d10_1)
+ else:
+ print r'#include "d3d10imports.hpp"'
+ print r'#include "d3d10size.hpp"'
+ api.addModule(d3d10)
+ if 'd3d11' in moduleNames:
+ print r'#include "d3d11imports.hpp"'
+ if 'd3d11_1' in moduleNames:
+ print '#include <d3d11_1.h>'
+ import specs.d3d11_1
+ print r'#include "d3d11size.hpp"'
+ api.addModule(d3d11)
+
+ retracer = D3DRetracer()
+ retracer.retraceApi(api)
+
+
+if __name__ == '__main__':
+ main()