PeterTh / gedosato

The Generic DownSampling Tool
GNU General Public License v3.0
464 stars 166 forks source link

Redistributable\portable proxy dll please? #294

Open v00d00m4n opened 9 years ago

v00d00m4n commented 9 years ago

I found Gedosato a good universal tool for texture modding and fixing pixelated unfiltered textures, but the way it injected via appinit does not always works (especially with paranoid AVs), and having dll that injects itself into every process that loads user32.dll is not good idea just for single game, plus having injector to sit in tray means - forget to launch it or quit it = mod does not work when you load game, plus despite my love to gedosato - they way injector\configurator works is quite annoying, especially because it cant properly sit in system tray and tend to minimize behind transparent taksbar and always remains active during alt tab, but thats not main point,. main point is that its would be useful to inject gedosato into games as stand alone library that only works in single game and can be distiributed with rest of mod files for simple installation just like DPfix and DSfix.

I suppose hooking code does not need any changes, but game would not load library on itself so exports for most common dlls needed. I suggest not to use d3d or dsount or any other input\output dlls to avoid collision with other injectors such as reshade\sweetfx 2 or game specific fixes such as dpfix, asi loader, xinput plus x360ce etc, and instead use user32.dll since its actually same dll that loads Appinit dll registry and since about 99% of programs are linked to it, so all we have to do is rename gedosato.dll to user32.dll, allow it to re-reroute to real user32.dll and inject code.

There are few things that should be solved to avoid collision with possibly installed global gedosato. Most simple way would be to read HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Durante\GeDoSaTo and compare path to path from where proxy gedosato.dll is loaded. if none of registry record present (ie no global gedosato installed) or path is different, than gedosato should fallback to portable mode with alternate route for its files and use path ".\gedosato" relative to dll, same way dpfix used dpfix folder which was pretty much equal to root content of gedosato folder now, where all configs, textures, shaders and stuff should sit. And i suppose in such mode it should ignore settings from global version like UseBlacklist and instead seek for same value in gedosato.ini.

Thing like this does not need to be separate version, compiling main gedosato.dll with exports for standing as user32.dll proxy and simple fallback to alternate route and ini settings instead of registry is best option. Can you do it please?

OrdinaryMagician commented 9 years ago

It's a shame Windows doesn't have something like LD_PRELOAD, which would make things like these much better.