Thursday, December 13, 2012

Darksiders (2010)

Fix by Eincrou
Updated December 18, 2012


Created using Steam version. Game version 1.1.

Description:

Darksiders is rated "Excllent" in NVIDIA's compatibility list, and despite my skepticism of their "Excellent" ratings after the stereoscopic disaster that is Dark Messiah of Might and Magic, I actually agree with them for once.

The game looks incredible in S3D and has few problems with anomalies.  The anomalies are either intermittent or not too bothersome.  Look at the "Problems not fixed" section for my report on the anomalies.

The biggest problem is the 100% 2D UI, especially the targeting reticles for War's various ranged weapons.  I've had nothing but failure for the past five or six games I've tried to fix, but I was finally able to make something happen with Darksiders.  I tried to address the 2D UI, though my success remains incomplete.

This fix:

  1. Menus render with depth. I gave the text slightly less depth than the menu art.  Why?  Because it looks awesome.  That's why.
  2. Depth for texts, including subtitles, can be turned off with the comma key ( , ) and turned back on with period key ( . ).  These keys can be changed in DX9Settings.ini.  Use this webpage for the key code numbers (middle column).
  3. HUD, including crosshairs, have depth.
  4. Mini-map has depth.

Problems not fixed:

  1. The HUD renders strangely, but I got around this by finding the texture elements of each crosshair. They are given as much depth as possible before the edges start clipping. One element, a pulsing circle, was left alone because that texture is reused many times.
  2. Skyboxes render too shallow. No acceptable solution has been found yet.
  3. Various effects do not render identically in both eyes - for example, the swirls around the rim of portals, the swirl around Void Walker on War's arm, fire on flaming skeletons, the chain around War's hand when Abyssal Chain is equipped, and several more.
  4. Portals have a rim effect, which renders in only the left eye.
  5. Portals show you what is on the other side when you look into them, but the world beyond the portal renders at the wrong depth.

Change Log:

  • v4: (12/16/2012)
    • Fixed crosshair for Angel-blaster-gun-thing. There's one other ranged weapon in the game, a demon-explosive-spike-throwing-thing, but it appears in only one brief part of the game.  I have no save game to get back there, so it remains unfixed.
  • v3: (12/15/2012)
    • Increased depth of crosshairs for five ranged weapons. Depth fix for crosshair of final ranged weapon coming soon. There isn't as much depth as I would like, but the textures start clipping if I go any higher.  If you have any suggestions for correcting this, let me know.
    • Increased depth of enemy target indicators
    • Changed default secondary depth setting for text (pressing the , key) from 2D to a slight bit of pop-out.
  • v2: (12/14/2012)
    • Add ability to set text to 2D. Useful for prerendered 2D cutscenes.
  • v1: (12/10/2012)
    • Initial Fix 

How to get it working:

  1. Extract the fix into the same location as DarksidersPC.exe.  For me, this is: [...]\Steam\steamapps\common\Darksiders
  2. Four of the fixed vertex shaders are personal to each system.  You will have to download the debug version of d3d9.dll to dump them.
  3. Rename the release version of d3d9.dll that you extracted from the fix zip to something temporary.  I like to use d3d9r.dll.
  4. Extract the debug version to the same directory as DarksidersPC.exe.
  5. Boot the game, and you should see red text at the top of your screen.  If not, ensure that the d3d9.dll in your Darksiders folder is the debug version.
  6. Load into the game, and enter the equipment menu.
  7. Now, use the debugger's hotkeys to search for the shaders we need.  Use NUM5 to advance and NUM4 to decrease.  I recommend going to about VS#100 and if you don't find the element, go backwards and you should hopefully find it in the 400s.
  8. Look for the following elements to turn off: [1] texts, [2] menu art, [3] sword XP progress bar, and [4] green part of the health bar.
  9. Each time you select a VS that turns off one of these elements, write a note with what that element is, and the eight-digit CRC.  The CRC is the characters after the "0x" part.
  10. When you find all four, exit the game and go into the ShaderOverride/VertexShaders directory and find the following text files: [1] 826E8EA7, [2] F516508B, [3] DA3DFC7A, [4] E3832F4F.
  11. Rename each of these filenames to the corresponding CRC you wrote down.  If you need to be extra sure of what the fixed CRCs do, you can open up the text files see my comments.
  12. Now, when you relaunch the game you should find that these four interface elements render with depth.  If not, double check that you have properly located each of your personal CRCs and matched them to the fixed CRCs.
  13. When all is working, delete or rename the debugging d3d9.dll, and rename the release version to d3d9.dll.
IMPORTANT! I need feedback on the following:
  1. I created this fix while running my graphics card in dual-GPU mode.  I tried running the fix while in single-GPU mode, and the fix caused the game's graphics to become corrupted when 3D was enabled.  I need to know if this affects people running with one GPU.  I'd also like to know if it doesn't affect SLI users.  In short, TESTERS NEEDED!

Download:

HelixMod-Darksiders_v4.zip (Release and debugging DLLs included)

34 comments:

  1. 826E8EA7, F516508B, DA3DFC7A, E3832F4F

    These four files are different for each person. They are unique CRC's. Like yours is 826E8EA7 but mine is 9999999(example). The install directory line doesnt matter but a person needs to match them up.
    Like they need to dump the file for health bars and match to yours. Its only way it will work for other people.

    ReplyDelete
    Replies
    1. Let me clarify.
      They need to find the shader for like enemy target pointer for example.
      Dump it and change the name to match yours. Then it should work.

      If you find the shaders for the other issues I can probably fix them.

      Delete
    2. Thanks for the info, EQ. I'll add what you've said about those unique shaders to the post.

      I have the three VSs for the skybox that I was trying to fix. I'll find the shaders for the other effects later today.

      I still have no idea why the game breaks in 3D in single-GPU mode. I played around with it some more and found that the game is fine with the DLL loaded without any shaders being overriden. But when I put a shader in, even if it's completely unmodified from the dump, the game blows up in 3D mode.

      I took a quick video of this. http://youtu.be/YB3PVx7pqsw The video is in 2D, but that's just because I was too lazy to edit the video to 3D HSBS format for Youtube. The graphics are fine in 2D.

      Delete
  2. Thank you for the fix , i waited for it since a long time.

    ReplyDelete
    Replies
    1. Thanks for your interest. It's still very much a work in progress. I fixed everything I knew how to fix, and I'm hoping to learn how to fix the rest.

      If you try playing the game with the fix, let me know if it worked, or if you had problems. And also check back again soon. There will be some updates with improvements.

      Delete
  3. Thanks for this fix! ...I was trying to fix it too little time ago, but I had graphics corruptions like you described... and yes I've got a single gpu. I'll try again starting the game with your fix and make you know what happens... I hope I can help you with this.

    ReplyDelete
    Replies
    1. Hi, Mana. I'm kind of glad that you had the problem, too. I'd hate for it to be because my hardware is going bad!

      Let me know what happens if you try it. I managed to figure out how to increase the depth of the crosshairs that render with a strangely low amount of depth. Now I really need some help fixing the skybox. If you want to take a look at them, the original skybox vertex shaders are included in the latest version of the fix.

      Delete
    2. Certain games have that wierd issues in Single GPU mode. I tried to figure it out but couldnt.
      Darksiders, Devil May cry 4, Kingdoms of amalur, a few others I cant remember.
      Ive had it happen then had trouble replicating it in a few instances.

      Setting Maximum pre-rendered frames to 1 in nvidia control panel MAY fix it. It helps, Im not sure if it will fix it or not since its tied to convergence/depth.

      Delete
    3. I've just tested your fix but I still had the issue... and I don't have a second gfx card to test with. Even forcing pre-rendered frames to 1 like eqzitara suggested don't work for me.
      Anyway I've looked at your skybox files and they seems to contain depth information into r0.z.. I believe this ones should work: https://s3.amazonaws.com/Mana84/Skybox.zip
      If it doesn't make me know that I'll give it another try... sorry but I can't test personally becouse of the shaders corruption thing :(

      Delete
    4. Sorry this game doesn't work with Helix Mod on one GPU. It's weird.

      I tried your skybox shaders and it works. The skybox elements get pushed back. Too far back, actually. How can I change their depth? Thanks for helping.

      Delete
    5. renaming the exe to Masseffect.exe worked!! o.O
      that's strange becouse I believe I had already given a go to renaming the exe before but believe to remember it didn't work... although eqzitara has right about the fact this game has unique CRC's for some shaders, for example minimap does work with my game (steam version) but HUD and crosshair doesn't.
      I'll dump my hud shaders and make you know.. how did they generate random names for shaders? Would my shader names help some other peoples to make their game version to work too? ..if we could know that their names are related to region/version/gfx card/something else, we could do different versions of the fix...

      Delete
    6. CRC names are generated based on install directory I believe.

      Helix found/wrote a solution in his newest debugger (alternate crcs?). I do not have/understand his newest debugger so it doesnt matter regardless. The same issue is in darksiders 2 and he was able to resolve it.

      Delete
    7. my code didn't work becouse depth information isn't correct in skybox shaders.. so a simple rescale can do the job... I've updated Skybox.zip and it seems to work for me now, redownload it and make me know ;)

      Delete
    8. @eqzitara oh thanks I missed that... I'll look at darksiders 2 page and I'll try to see to understand how he used the new debugger... maybe we'd need a new helix guide on how it works though :/

      @Eincrou I forgot to mention meantime I found and inserted in the zip archive another vertex shader for the background (26759442.txt) since in the level I'm testing with, there was a "dark" tower on the background at the same "wrong depth" of the skybox. I've added 26759442.txt (fixed) to the zip.

      Delete
    9. LOL, Mana. I added your original fix code to that same shader 26759442 a few hours ago. It had some weird results in the place where I was looking at the tower, but I trust that your new code improves it. I'll let you know.

      Delete
    10. http://photos.3dvisionlive.com/Eincrou/image/50ce6817a3e0678041000000/
      http://photos.3dvisionlive.com/Eincrou/image/50ce6863a3e067fe3f000007/
      http://photos.3dvisionlive.com/Eincrou/image/50ce688da3e0678041000001/

      The first two are of the tower on VS-26759442. It seems like the developers got lazy and cheated on it, because you shouldn't be able to tell differences in depth on the tower from that far away. It should appear completely flat at that distance from the camera.

      The third screenshot is the best place to see the skybox, in a Serpent Hole. Skybox elements are too close again with the new fix code.

      Delete
    11. wow sorry I didn't know you could reach that tower in the game :) ..I'm not playing many games lately and I haven't played this game yet becouse I'm really busy lately (since months). So we can't definitely fix the tower with a simple rescaling and we'd need to put it at right depth. Anyway you "should" be able to fix skybox increasing the "3000" I've put into c220.x... usually skyboxes should be put at "infinity" distance... although I don't really know how skyboxes looks in this game... maybe they used the same shaders to draw some sky "special effects"... I'd probably need a savegame to be able of help you more..

      Delete
    12. https://s3.amazonaws.com/eincrou/ds2/dssave1.dsav

      Here's a save I made a few days ago at the base of the giant tower. In the cave where you'll start is a path leading to Vulgrim where you can enter the Serpent Hole. The skybox is very easy to see in the Serpent Hole.

      Delete
    13. Oh, I guess I should add that the save goes in C:\Users\[...]\Documents\my games\Darksiders\24864679.
      The game uses Steam Cloud for save games, so you might have to disable that to import the save. I'm not sure if it will overwrite it when it syncs with the cloud.

      Delete
    14. uhm... you've right it uses steam cloud, I'll try to put steam in offline mode or to disable steam cloud this evening/night (Central European Time UTC+1) and I'll keep you updated!

      Delete
    15. unfortunately your savegame don't work with my game, it appears in the game loading menu but it can't load because the game thinks its corrupted. I'll try to advance in the game to see if I can see more of the tower/skybox thing.. I'll make you know when/if I'll get into something good.

      Delete
    16. renaming to masseffect.exe seems to messup some shaders (flames, smoke effects and others) :( ...the game looked perfectly (apart from skybox and hud) with original exe name. I've tried to fix them (fastly though) but they seems to be unfixable without editing pixel shaders too... I'm sorry but its too much work for me in this period. I'll see to do what I can...

      Delete
    17. Thanks for trying, Mana. The fix is in a good state for those who can play with SLI or a 590, 690, etc.

      There are some other issues that I don't know how to fix, like the world beyond portals. Maybe I'll try your skybox code and see what happens. These problems are pretty minor. Fixing the UI was the most important thing to make it comfortable to play.

      There are probably answers for how to fix that stuff in the mammoth Helix Mod thread on the NVIDIA forums, but that thing is completely unreadable. If I can better learn how all of this stuff works, I will create tutorials to help people trying to learn.

      Right now it's very difficult to learn how to create fixes. I learned a lot (relative to what little I knew before) working on Darksiders, but I had to look at code from other people's fixes to see how to do certain things. People don't comment their shit, so it was tough to tell what was going on. LOL I took a couple months of Java in high school 8 years ago. I'm no coding wizard.

      It's a waste of time for someone to have to learn like that. So, I'm going to create some video tutorials on the basics. As I learn more, I can create more and more tutorials on how to do specific things.

      Delete
    18. I'm at the beginning of the game so I haven't seen a portal yet... but I like this game so I could try to fix portal as soon as I see them and eventually tell you how I fixed them.

      Create a tutorial would be a huge work for me becouse I'm going to take academic degree, plus the fact that I'm not english... I'm italian and I take a while to try writing something that does make a sense in english :/
      Another problem is that there's always something I have to learn too.. I've not much experience with shaders in general, I'm still in the learning phase..
      However I like to help peoples who want to learn something about this, make me know what are your doubts I'll try to teach you what I've learned about.
      Although I see often peoples don't even try to just disable problematic shaders (there's a tutorial for that).

      Delete
    19. I've just defeated Tiamat but I haven't seen a portal yet... I'm sorry but I'm a bit slow becouse I haven't much time to play. Anyway I'm playing with the standard profile becouse with masseffect.exe particle effects, fog and some lights are causing an annoying ghosting. Unfortunately they seems to be impossible to fix only by vertex shaders and it seems to be a lot of work find and fix related pixel shaders too. Maybe another profile could do the trick but I tried prototype and ofdr without good results. I'll continue to play untill I can see the tower nearby and untill I can see a portal... I just want to help you for now... meantime I'm enjoying the game too ;)

      Delete
    20. Yeah, try to enjoy your game. You won't get the portal gun until about 12 hours in; near the end of the game.

      Sorry this game doesn't work like it should with the Helix Mod. I had no idea there was a problem until I accidentally started playing in single-GPU mode.

      Delete
  4. Renaming to Aion.exe seems to work like a charm with a single gpu! :)
    It's not like masseffect.exe, so effects aren't messed up!
    Could you try that code with the tower at wrong depth? I'm still to far from it to test, I'm fighting with the "Griever" now..

    vs_3_0
    def c220, 0, 0, 0.0625, 0
    dcl_2d s0
    dcl_position v0
    dcl_normal v1
    dcl_texcoord v2
    dcl_texcoord o0.xy
    dcl_texcoord1 o1.xyz
    dcl_position o2
    dp3 o1.x, v1, c0
    dp3 o1.y, v1, c1
    dp3 o1.z, v1, c2
    mov o0.xy, v2
    dp4 r0.x, v0, c8
    dp4 r0.y, v0, c9
    dp4 r0.z, v0, c11
    texldl r11, c220.z, s0
    add r11.y, c220.w, -r11.y
    mul r11.x, r11.x, r11.y
    add r0.x, r0.x, -r11.x
    mov o2, r0.xyzz

    ReplyDelete
    Replies
    1. http://photos.3dvisionlive.com/Eincrou/image/50dbddd5a3e067ef0a000006/

      You have done it. I'll study this code and try to figure out what you did. Hopefully a similar thing can be done to the rest of the skybox.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. I'm glad it works!
    The formula we use to correct objects at wrong depth is that:

    Xnew = Xold - separation * (W - convergence)

    where:
    -'Xold' is the x coordinate of the position output register
    -'W' is the w coordinate of the position output register and it gives information about object's depth
    -'separation' is the value of the 3d vision depth we are using, we can store it into a temporary register (i.e. r11.x) using texldl instruction with a stereo sampler (i.e. s0) and passing a constant of '0.0625'
    -'convergence' is the value of the 3d vision convergence we are using, we can store it into a temporary register (i.e. r11.y) in the same way we did with 'separation'.

    moving an object's x coordinate using the stereo texture make it appear further into the screen becouse you are moving the left eye image to the left and the right eye image to the right (separation is increased). The offset we use to move the object's x coordinate is given by that fourmula becouse we need to rescale the stereo separation by the distance of the object from the convergence plane.

    The issue with this shader is that we can't use the w coordinate of the position output register becouse the information about object's depth isn't 'correct' the tower's depth is "tricked", so I tried to offset the stereo separation by the distance of a constant (in that case is zero) from the convergence plane.

    A useful way to know if the shader can access at the necessary depth information is to search for a viewprojection matrix. Objects coordinates are not absolute... they are always relative to something, they can be relative to 'world', to 'camera' or something else coordinates...
    3d vision adds a second camera to the side of the original one, some effects are coded with a single camera in mind so we can see ghosting artifacts in stereo3d becouse their coordinates are related to the original camera. Basically we have to search for registers containing vertices that are relative to the viewprojection matrix, becouse we want to move object's coordinate that are relative to the vertices projected to the screen from the view space of the camera.

    I hope I've clarified something about it and to be of help for someone else... I'm sorry for eventual imprecisions or mistakes but I'm doing my best...

    ReplyDelete
  7. too bad i've just finished it without using the mod, by the way the game was totally enjoyable even without fixes, the most annoying things was the sky and war's hand after having acquired one of the latest items, and i've read that has not been fixed by this mod.
    thanks anyway, i'm going to start darksiders 2 soon, just got from steam sales.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Mana, thanks for the explanation for how you fixed the tower. It helps a lot. After I finish with a video project I'm working on, I will create some video tutorials on the basics of creating fixes. You put a lot of work into that explanation, but nobody will see it except those who look at this page. We need an better way to put info like this in a way people can find. A tutorial series is a good way to do this, so I'm going to work on that.

      Wow, so even the crosshair texture CRCs are unique? Well, that's what I thought was the most important part of this fix! I guess the fix is not too useful for most people who don't know how to find textures. Well, at least I learned A LOT from working on this game. I'm still going to release another version that has skybox fix soon.

      Thanks for your help with this fix.

      Delete
    2. OPS I deleted my previous comment by mistake... I'll copy-paste it below this post... sorry :)

      I'd like to possibility of edit comments but I can't, I wanted to delete only the part related to unique texture crcs... nevermind I'm in late becouse you already read it... I actually wanted to say that texture crcs are NOT unique! I had your first version of the fix that didn't contain my actual weapon's crossair crc and I believed it was unique for my game so I searched for its texture and added it in my dx9settings.ini.. but it was NOT neccessary since the crcs I've foud are exactly the same of your latest version of the fix... sorry for the wrong post, I just compared my dx9settings.ini after I had already posted the comment.

      Previous removed comment:
      --------
      @tigermaster: This game deserved to be fixed a lot earlier, but I believe we leaved this game "unfixed" so long becouse of per user different crcs and becouse of shader corruption with a single gpu. I got the sequel from steam sales too ;)

      @eincrou: I can't remember if I already told you or if you are already aware of it... hud shaders are "per user" unique even in their texture crcs.. I used your code for vertex shaders but I had to search for crosshair textures to make crosshair fix to work. Anyway I want to say you've done a great work and I like your precision and your care about naming and commenting each file!

      Delete