Monday, March 5, 2012

DLL's Update.

DLL's updated !

Rewrote big part of the code for smart shader management. Some games recreate shaders at level loading that can cause duplication of shaders in the lists. with new version shades list will be reduced in some games. New version delete shaders from lists properly.

Added ability to bind shader with used texture it helps to use shader only with required textures or split code in the shader for different logic. I.e. now possible to split game HUD , cursor/ effects which draws by the same shader to different code.

Example of using can be found in MassEffect 3 fix. It fixes only croshair and borders around an enemy and leaves HUD and menu untouched.
Here example of the config made for ME3.
 CheckTexCRC parameter let DLL know that this shader will use textures CRC list.
 DefinedTexturesVS  parameter define textures crc with stereo texture should work(in other cases it will pas zero to stereo texture and all offsets calculates with it also will be zero). Each element of the list should be separated by ";" sign (even last !).

CheckTexCRC = true
DefinedTexturesVS = 5DCBE194;954ADD3B;3606D4F3;91C86B9C;9CD760E4;

CheckTexCRC = true
DefinedTexturesVS = C335EB77;

How to check textures CRC'S ?
Create "DX9Settings.ini" in the game directory and add shaders you wold like to handle:
CheckTexCRC = true
This code will handle vertical shader with  44D42C54 CRC.
After you added all shaders to the config, run a game with debug dll.
Go to the place where required shader using and press F12 key(by default).
Wait for 5 sec.
This action will make "TEXTURESLOG.txt" log in the game directory. This log contain calls of shaders you described before. The Log will contain something like this:
Shader CRC: 0x44D42C54 Last texture CRC: 0x7E11A26D

Shader CRC: 0x44D42C54 Last texture CRC: 0x2F33D52

Shader CRC: 0x44D42C54 Last texture CRC: 0x954ADD3B

Shader CRC: 0x44D42C54 Last texture CRC: 0x954ADD3B
Now you can see what texture using for shader call.
The only one problem is find out appropriate texture, fortunately you don't need to restart game every time after you're editing textures list. Open  "DX9Settings.ini" and add   DefinedTexturesVS  parameter and fill textures CRC's. Return to the game (alt + tab) and reload textures list by using F8 key(by default).
Repeat until you find required textures. Textures defined in the list doesn't show up when you capture  "TEXTURESLOG.txt"  again !

If you want use different values or different code for every texture you should define "TexCounterReg"  for thhis texture (in shader each section you want to use). This parameter determines the register which will be used for passing index of the current texture defined in the list.

CheckTexCRC = true 
TexCounterReg  = 251
DefinedTexturesVS = 5DCBE194;954ADD3B;3606D4F3;91C86B9C;9CD760E4;

It means that shader will revive index of the current texture in c251 register in x component.
For texture with  5DCBE194  it will be "0" , for  954ADD3B - "1", for  3606D4F3 - "2"  and etc.
Now you can use "if" instruction in the shader with this value and make difference calculations for each texture!

Added ability to save presets.
You can define up to 9 presets and switching between them by hot keys.
Presets can store values for convergence/separation and addition parameter which will be passed to the shader. Constant parameters can be used as flags to turn on/off some effects.

Example from ME3 config
DefVSConst1 = 250 
Preset1Key = 79//o key
Preset2Key = 80// p key

Const2 = 0x3f800000// 1.0 in hex

Const2 = 0x00000000// 0 in hex

Here  DefVSConst1 parameter defines register which will be used for passing first 4 constants ( Const1-  Const4,  c 250 .x -  c250.w).  Const2  in presets settings defines  y component. In game shaders use c 250 .y value in "if" instruction.

mov r14.x, c250.y
if_eq r14.x, c245.x// if  Const2  = 0 turn effect on, else turn it off
texldl r11, c245.z, s0
add r11.y, r0.w, -r11.y
mul r11.x, r11.x, r11.y
add r0.x, r0.x, r11.x
mov o5, r0
So by pressing "O" key you can turn self shadows effects off in ME3 and by pressing "P" turn it on.
Also you can assign convergence/separation values like this:
Convergence = 0x42ec701f
Separation = 0x42940000
UseSepSettings = true
You can use this online converter for float to HEX conversion.

Some games use same binary shader to create different in game shaders, i.e. basically it will be different shader in tha game , but has same crc. In this case you can override each of those shaders by different  shader code. For this you should add index to the end of the shader file as extension. For example we have 0F602182.txt in ShaderOverride folder. And game engine creates two shaders from this one (you can see this kind of shaders in LOG.txt). So if you want override only first shader you should use "0F602182.txt.1" as its file name and "0F602182.txt.2" for second shader.

Also you can insert vertex shader before pixel shader, it's very useful when game doesn't have vertex shader and you need to move vertex position. I will explain this later with X3 fix as example.

Release DLL.

Debug DLL


Use debug log only if you game crashes to get detailed log.

I will post more info later.


  1. Awesome thanks as usual HeliX! :D

  2. I love you man ! Awesome! Finally X3 will work !

  3. Contact eqzitara on nvidia forums if you get it to work dorkirt.

  4. Hmmm, F12 do nothing for me... Textures log only says "Start logging.." and my dx9Settings.ini says

    CheckTexCRC = true

    Am i doing anything wrong ?

  5. @Dorkirt:
    I already did a fix for X3, but can't split texture for HUD and text under crosshair.

  6. @HeliX:
    Could you release whatever X3 fix you have, with appropriate caveats? I have been trying to look at this myself (identified problem shaders but no luck fixing them) so it would be good to see what you have done.
    Awesome work on Skyrim (water) and ME3 (everything) by the way, great job.

  7. Thanks Helix. Will wait for your fix then ! God Bless you !

  8. I'm attempting to try this to remove the crosshair in the game Hawken. I've located the vertex shader for the HUD is 45AC79A6, so I've tried creating a DX9Settings.ini file that just has these lines in it:

    CheckTexCRC = true

    When I'm in the game, and press F12, it does create the TEXTURESLOG.txt file, however rather than containing any useful info, it just contains:

    Start logging..





    (and keeps repeating BeginScene/EndScene like 100 times)

    Now, what I'm not clear on is whether I should have anything in my Shaderoverride folder at this point. I'm assuming no, and I currently don't, but perhaps this is where I'm doing something wrong.

    I'm really trying to wrap my head around all this stuff, but even though I do have some programming experience (I did take some C/C++ and courses in school, and was very proficient when I was studying, but that's been about 10 years ago) it's pretty hard to follow a lot of the tut's that have been put up because I feel like there are certain details that are a bit too vague in most. I'm sure they are great for those that are quite well versed in this stuff, but if it's all going over my head I think I can confidently say that the average person definitely isn't gonna be able to pick this stuff up from the info currently available. Not to say I'm ungrateful, I just wish I could become self-sufficient on the basics, and perhaps even contribute a little of my own here and there. ;)

    Anyways, any assistance would be greatly appreciated.

  9. add 45AC79A6 to override.

    change dx9settings to..

    CheckTexCRC = true
    VBOffsetList = 0;
    ValForDefined = 0
    ValNotDefined = 1
    TexCounterReg = 251
    UseDefinedOnly = false
    DefinedTexturesVS =

    PointsList = 554;

  10. Thanks eqzitara! That's gotten the TEXTURESLOG.txt file to output the data... turned out to 65535 pages long! Fortunately it was just repeating the same 2 texture CRCs: BC5F6336 (mostly) & 634A7D94, so each time I added one to the DefiniedTexturesVS line, the log got significantly smaller... however now I have no clue what to do with these.

    I thought the idea would be to change 'UseDefinedOnly = false' to 'UseDefinedOnly = true' and then only the CRC's I have in the 'DefinedTexturesVS =' line would be drawn and any omitted would not, but that doesn't seem to be the case (at least as far as I can tell). Since there were so many elements handled by this shader, including the entire HUD as well as some non-HUD elements (such as certain reflections), that there only being 2 textures means that I wouldn't be able to separate just the crosshair from the rest of the HUD, and I've probably reached as far as I can go with this. Good learning experience so far, though, so thanks again for helping me get past that last roadblock.

  11. I have a problem with dll.
    I can't make debug library to show on-screen text info in some games. Most recent example is FF XIII. Mod works fine, all hotkeys work fine, but were is no on-screen info about shaders, so it's very frustrating to search for shaders (it feels like being lost in the woods, if you understand me). I've tried to fix hud depth, but was not even able to find offending shaders. So, for the time being, I've just made hotkey for zero separation - not the best solution, but it helps with the worst looking artifacts.
    If were is some workaround to get shader info (like version of dll with RivaTunerStatisticSever integration, or some other OD-service), I'll be really glad to know it.

    1. I plan to look at FF XIII however...
      Your software thats displaying on OC/temps/whatever [rivatuner] is preventing text from showing.

    2. Alt-tabing fixes it. It happens occasionally.

    3. Thanks. I've tried to alt+tab earlier with no result. But after reading your reply I've tried alt+tab in fullscreen mode and it worked.