This PR refactors the d3d9 hook module to enhance maintainability and flexibility (in the future).
Description
It introduces a new base hook/d3d9 module which takes care of infrastructure related setup (IAT patching, handling of d3d9 COM objects) and establishes an IRP handler abstraction layer. The iidxhook-util/d3d9 module implements a IRP handler to dispatch the hooked d3d9 function calls as operations. All previously available features were ported.
Furthermore, up-/downscaling was refactored to work with all IIDX versions now.
In favor of this, the d3d8 module was removed to improve maintainability. With the d3d8to9 wrapper lib, there is no actual value for this anymore. Furthermore, the d3d8to9 lib also solves various odd issues when running d3d8 on newer Windows versions.
Add test/d3d9hook to test the hook/d3d9 base module with a basic d3d9 setup and rendering loop
Tested with IIDX 9, 11 and 25
_Merges refactor-iidx-d3d9-module -> master_
## Summary
This PR refactors the d3d9 hook module to enhance maintainability and flexibility (in the future).
## Description
It introduces a new base hook/d3d9 module which takes care of infrastructure related setup (IAT patching, handling of d3d9 COM objects) and establishes an IRP handler abstraction layer. The iidxhook-util/d3d9 module implements a IRP handler to dispatch the hooked d3d9 function calls as operations. All previously available features were ported.
Furthermore, up-/downscaling was refactored to work with all IIDX versions now.
In favor of this, the d3d8 module was removed to improve maintainability. With the d3d8to9 wrapper lib, there is no actual value for this anymore. Furthermore, the d3d8to9 lib also solves various odd issues when running d3d8 on newer Windows versions.
## Related Issue
Fixes #25
## How Has This Been Tested?
* Add test/d3d9hook to test the hook/d3d9 base module with a basic d3d9 setup and rendering loop
* Tested with IIDX 9, 11 and 25
Moving this here instead of being in DllMain may cause issues.
iirc. the hooks were all initialized there for a reason.
In GitLab by @xyen on Oct 7, 2019, 05:09
Commented on [src/main/iidxhook8/dllmain.c line 73](https://github.com/djhackersdev/bemanitools/compare/3436838b8517f042e9874b17c876061e75101873..b83033587fb470a0b7899a7b307b259c433f8e34#diff-2652fef86a3a811b7b9013de2364403dR73)
Moving this here instead of being in DllMain may cause issues.
iirc. the hooks were all initialized there for a reason.
I am not entirely sure but to the best of my recollection, this was depending on libraries and functions you were IAT hooking. Some of them might already get executed before the main hook function which does all the config reading and configuring the hooks. This could mean that you missed detouring a call that might have been important...or not.
For the ezusb hooks, we must delay the iohooking to allow implementations of iidxio, e.g. iidxio-ezusb and iidxio-ezusb2, to setup real devices without getting in conflict with the hooks that want to detour these calls:
/* Set up IO emulation hooks _after_ IO API setup to allow
API implementations with real IO devices */
iohook_init(iidxhook_handlers, lengthof(iidxhook_handlers));
Back to the d3d9 hooking: The iohook implementations execute the hook_d3d9_init still before any gfx context is created. Either when OpenProcess for older IIDX games is called which happens very early after main is called or in my_dll_entry_init which is still before the entry point of the dlls is called on newer versions.
I am not entirely sure but to the best of my recollection, this was depending on libraries and functions you were IAT hooking. Some of them might already get executed before the main hook function which does all the config reading and configuring the hooks. This could mean that you missed detouring a call that might have been important...or not.
For the ezusb hooks, we must delay the iohooking to allow implementations of iidxio, e.g. iidxio-ezusb and iidxio-ezusb2, to setup real devices without getting in conflict with the hooks that want to detour these calls:
```
/* Set up IO emulation hooks _after_ IO API setup to allow
API implementations with real IO devices */
iohook_init(iidxhook_handlers, lengthof(iidxhook_handlers));
```
Back to the d3d9 hooking: The iohook implementations execute the hook_d3d9_init still before any gfx context is created. Either when OpenProcess for older IIDX games is called which happens very early after main is called or in my_dll_entry_init which is still before the entry point of the dlls is called on newer versions.
added 23 commits
<ul><li>bbdb6890...3436838b - 5 commits from branch <code>master</code></li><li>60050d0d - hook: Add d3d9 hook module</li><li>d169ee84 - test/hook: Add tests for d3d9 hook module</li><li>c5d39d82 - iidxhook-util: Major refactoring of d3d9 module</li><li>77906205 - test/check: Add check_failed func</li><li>3e603002 - iidxhook-util: Adapt enum name of upscaling filter names</li><li>e0d7596f - iidxhook1: Refactor to use new d3d9 module</li><li>f201bff9 - iidxhook2: Refactor to use new d3d9 module</li><li>53d61dcb - iidxhook3: Refactor to use new d3d9 module</li><li>5183547b - iidxhook4: Refactor to use new d3d9 module</li><li>a626e9e6 - iidxhook5: Refactor to use new d3d9 module</li><li>b1871a47 - iidxhook6: Refactor to use new d3d9 module</li><li>f4c0810e - iidxhook7: Refactor to use new d3d9 module</li><li>d9cc873e - iidxhook8: Refactor to use new d3d9 module</li><li>a10132f6 - dist/iidx: Fix default values for override window size</li><li>8c998f64 - Add inject.exe to test package</li><li>d64f8b2d - iidxhook-util: Remove d3d8 module</li><li>ff6bad24 - iidxhook1/2 config: Remove deprecated use_d3d9_hooks param</li><li>b8303358 - doc/iidxhook: Update doc for iidxhook1/2</li></ul>
[Compare with previous version](/djhackers/bemanitools/merge_requests/3/diffs?diff_id=1045&start_sha=bbdb68909a6ab79a0cb3603090d990307a34de56)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Merges refactor-iidx-d3d9-module -> master
Summary
This PR refactors the d3d9 hook module to enhance maintainability and flexibility (in the future).
Description
It introduces a new base hook/d3d9 module which takes care of infrastructure related setup (IAT patching, handling of d3d9 COM objects) and establishes an IRP handler abstraction layer. The iidxhook-util/d3d9 module implements a IRP handler to dispatch the hooked d3d9 function calls as operations. All previously available features were ported.
Furthermore, up-/downscaling was refactored to work with all IIDX versions now.
In favor of this, the d3d8 module was removed to improve maintainability. With the d3d8to9 wrapper lib, there is no actual value for this anymore. Furthermore, the d3d8to9 lib also solves various odd issues when running d3d8 on newer Windows versions.
Related Issue
Fixes #25
How Has This Been Tested?
In GitLab by @xyen on Oct 7, 2019, 05:09
Commented on src/main/iidxhook8/dllmain.c line 73
Moving this here instead of being in DllMain may cause issues.
iirc. the hooks were all initialized there for a reason.
I am not entirely sure but to the best of my recollection, this was depending on libraries and functions you were IAT hooking. Some of them might already get executed before the main hook function which does all the config reading and configuring the hooks. This could mean that you missed detouring a call that might have been important...or not.
For the ezusb hooks, we must delay the iohooking to allow implementations of iidxio, e.g. iidxio-ezusb and iidxio-ezusb2, to setup real devices without getting in conflict with the hooks that want to detour these calls:
Back to the d3d9 hooking: The iohook implementations execute the hook_d3d9_init still before any gfx context is created. Either when OpenProcess for older IIDX games is called which happens very early after main is called or in my_dll_entry_init which is still before the entry point of the dlls is called on newer versions.
resolved all threads
@willxinc approved of this via PM.
added 23 commits
master60050d0d- hook: Add d3d9 hook moduled169ee84- test/hook: Add tests for d3d9 hook modulec5d39d82- iidxhook-util: Major refactoring of d3d9 module77906205- test/check: Add check_failed func3e603002- iidxhook-util: Adapt enum name of upscaling filter namese0d7596f- iidxhook1: Refactor to use new d3d9 modulef201bff9- iidxhook2: Refactor to use new d3d9 module53d61dcb- iidxhook3: Refactor to use new d3d9 module5183547b- iidxhook4: Refactor to use new d3d9 modulea626e9e6- iidxhook5: Refactor to use new d3d9 moduleb1871a47- iidxhook6: Refactor to use new d3d9 modulef4c0810e- iidxhook7: Refactor to use new d3d9 moduled9cc873e- iidxhook8: Refactor to use new d3d9 modulea10132f6- dist/iidx: Fix default values for override window size8c998f64- Add inject.exe to test packaged64f8b2d- iidxhook-util: Remove d3d8 moduleff6bad24- iidxhook1/2 config: Remove deprecated use_d3d9_hooks paramb8303358- doc/iidxhook: Update doc for iidxhook1/2Compare with previous version
merged