diff --git a/Module.mk b/Module.mk index 6308b7f..ee6bd6a 100644 --- a/Module.mk +++ b/Module.mk @@ -100,6 +100,7 @@ include src/main/bstio/Module.mk include src/main/camhook/Module.mk include src/main/cconfig/Module.mk include src/main/config/Module.mk +include src/main/d3d9-frame-graph-hook/Module.mk include src/main/d3d9-util/Module.mk include src/main/d3d9exhook/Module.mk include src/main/ddrhook-util/Module.mk @@ -235,6 +236,8 @@ $(zipdir)/tools.zip: \ build/bin/indep-32/ezusb2-dbg-hook.dll \ build/bin/indep-32/ezusb2-tool.exe \ build/bin/indep-32/ezusb-tool.exe \ + build/bin/indep-32/nvgpu.exe \ + build/bin/indep-32/d3d9-frame-graph-hook.dll \ | $(zipdir)/ $(V)echo ... $@ $(V)zip -j $@ $^ @@ -249,6 +252,8 @@ $(zipdir)/tools-x64.zip: \ build/bin/indep-64/iidx-ezusb2-exit-hook.dll \ build/bin/indep-64/jbiotest.exe \ build/bin/indep-64/mempatch-hook.dll \ + build/bin/indep-64/nvgpu.exe \ + build/bin/indep-64/d3d9-frame-graph-hook.dll \ | $(zipdir)/ $(V)echo ... $@ $(V)zip -j $@ $^ diff --git a/src/main/d3d9-frame-graph-hook/Module.mk b/src/main/d3d9-frame-graph-hook/Module.mk new file mode 100644 index 0000000..53fd61f --- /dev/null +++ b/src/main/d3d9-frame-graph-hook/Module.mk @@ -0,0 +1,16 @@ +dlls += d3d9-frame-graph-hook + +ldflags_d3d9-frame-graph-hook := \ + -ld3d9 \ + -ldwmapi\ + -lgdi32 \ + +libs_d3d9-frame-graph-hook := \ + hook \ + imgui-bt \ + imgui-debug \ + imgui \ + util \ + +src_d3d9-frame-graph-hook := \ + main.c \ diff --git a/src/main/d3d9-frame-graph-hook/d3d9-frame-graph-hook.def b/src/main/d3d9-frame-graph-hook/d3d9-frame-graph-hook.def new file mode 100644 index 0000000..ede7cd5 --- /dev/null +++ b/src/main/d3d9-frame-graph-hook/d3d9-frame-graph-hook.def @@ -0,0 +1,4 @@ +LIBRARY d3d9-frame-graph-hook + +EXPORTS + DllMain@12 @1 NONAME diff --git a/src/main/d3d9-frame-graph-hook/main.c b/src/main/d3d9-frame-graph-hook/main.c new file mode 100644 index 0000000..702c6ff --- /dev/null +++ b/src/main/d3d9-frame-graph-hook/main.c @@ -0,0 +1,32 @@ +#include + +#include "hook/d3d9.h" +#include "hook/table.h" + +#include "imgui-bt/imgui-d3d9-hook.h" + +#include "imgui-debug/frame-perf-graph.h" + +#include "util/defs.h" +#include "util/log.h" + +static const hook_d3d9_irp_handler_t d3d9_frame_graph_hook_handlers[] = { + imgui_hook_d3d9_irp_handler +}; + +BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx) +{ + imgui_bt_component_t debug_frame_graph_component; + + if (reason == DLL_PROCESS_ATTACH) { + log_to_writer(log_writer_null, NULL); + + imgui_debug_frame_perf_graph_init(60.0f, &debug_frame_graph_component); + + imgui_d3d9_hook_init(&debug_frame_graph_component, 1); + + hook_d3d9_init(d3d9_frame_graph_hook_handlers, lengthof(d3d9_frame_graph_hook_handlers)); + } + + return TRUE; +} \ No newline at end of file