L4D2Fix icon indicating copy to clipboard operation
L4D2Fix copied to clipboard

Questions regarding L4D2Fix

Open kabyidon opened this issue 7 months ago • 6 comments

Thank you for replying to my email! Just following up on that through Github Issues and without the barrier of translation. (Repeating some things to help other English readers)

  1. In my original question, I meant to ask if this patch made the game "4GB Aware", which machine translated to "4GB 内存支持" in Chinese. From your response, it seems that yes, L4D2Fix make the game "4GB Aware", the same as for example the FNV 4GB Patcher by setting a large address-aware flag to True, which allows 32-bit applications like L4D2 to use 4 GB of RAM.

In addition, L4D2Fix comes with fixes that allows the game to bypass some hard-coded array limits (e.g., 32,765 for the index buffer and 65,536 for the dynamic vertex buffer), which occur when running lots of HD models/texture mods. This is separate from setting the flag to allow 4 GB of RAM to be used.

  1. For the newest version, if users can want to play online without being at risk for VAC ban, they can launch the game normally through Steam (or through the original l4d2.exe), which will run without L4D2Fix. For running with L4D2Fix and the new dlls, just put -insecure on the l4d2_fix.exe launch options and make sure not to connect to VAC servers.

I guess another question if you have time (feel free not to answer): would a 64-bit patch like the ones that came out for DoD and TF2 render this obsolete?

Let me know if I got anything wrong, I would like to make a video on this for the English speaking L4D2 community. Thanks for reading!

kabyidon avatar Apr 09 '25 04:04 kabyidon

  1. L4D2Fix will not set the "4GB aware" flag; you should use the 4gb_patch.exe to achieve this. I think I have bundled the exe inside the release archive. If not, you can download it here https://ntcore.com/4gb-patch/

However, AFAIK, left4dead2.exe is already 4gb awarded, so there is no need to patch it. Image

  1. You are right. This is why I created the launcher (allowing people to choose from the original and modded versions).

Maybe I can enforce the -insecure option in the launcher in case someone forgets about it.

A tip for your video: The hardcoded limits have been patched, but the 4GB memory constraint for 32-bit executables still remains. As a result, certain extreme mods may still cause the game to crash. To mitigate this, I recommend adjusting the -heapsize launch option from 512MiB (524288) to 2GiB (2097152), then fine-tuning it based on your specific mod configuration for optimal stability. I use the map 广州增城 and darkwoods to test: https://steamcommunity.com/sharedfiles/filedetails/?id=2396847377 https://steamcommunity.com/sharedfiles/filedetails/?id=575658578

kurikomoe avatar Apr 10 '25 08:04 kurikomoe

As for DoD and TF2.

If I understand correctly, both Team Fortress 2 (TF2) and Day of Defeat (DoD) are online games. In that case, VAC (Valve Anti-Cheat) might not approve of this kind of patch.

From a technical standpoint, the patch works by scanning for specific memory patterns to locate and modify the target memory. Since both games run on the Source engine, I guess the same pattern-matching approach should theoretically apply to them as well.

I'm curious though — why would DoD and TF2 need this kind of patch? (I'm not very familiar with these two games). The 64-bit versions of these games shouldn't have had problems in the first place.

kurikomoe avatar Apr 10 '25 08:04 kurikomoe

Thanks for explaining!

  1. I see, I had a misunderstanding and thought that 4gb_patch.exe was part of L4D2Fix when in reality it's just bundled with it. If I understand what you said correctly: there shouldn't even be a need to run 4gb_patch.exe since Steam's L4D2 is already 4GB Aware. L4D2Fix (by itself) just increases the hard-coded array limits.
  2. That's a good idea imo. I guess the consensus is that these game patches are in a grey area. Apparently a lot of people use custom .dlls for Vulkan, which you already know about, and have no trouble with VAC so far. Image (Tsuey worked on TLS Update) If VAC doesn't monitor that dll I doubt it can catch this one. Not sure though, like you said modified memory is always a little bit dangerous for VAC. So I think -insecure by default would be great if possible. Thanks for the tip on heapsize.

For DoD and TF2, I wrote an unclear message. I meant that Valve patched the games to be 64-bit in the recent update, so L4D2Fix would not be needed. If L4D2 got a similar update from Valve, I think that should solve the problems that L4D2Fix is trying to fix.

kabyidon avatar Apr 11 '25 14:04 kabyidon

Yes. If valve updates the L4D2 to 64bits, there is no need to use L4D2Fix like patches.

kurikomoe avatar Apr 11 '25 14:04 kurikomoe

Hey sorry to bother again, just wanted to ask some more questions regarding Vulkan and L4D2Fix.

So I'm using dxvk by directly putting d3d9.dll and dxgi.dll in to the folder with left4dead2_fix.exe, as recommended. I know dxvk is working properly since I can make the fps hud come up and it is making a left4dead2_d3d9.log. However, I see this in L4D2Fix.log:

[2025-04-14 02:24:18.261] [L4D2Fix] [info] Detected DirectX9: using shaderapidx9.dll

  1. Is L4D2Fix working properly?
  2. Why don't you recommend using the -vulkan launch parameter?

kabyidon avatar Apr 15 '25 07:04 kabyidon

Hey sorry to bother again, just wanted to ask some more questions regarding Vulkan and L4D2Fix.

So I'm using dxvk by directly putting d3d9.dll and dxgi.dll in to the folder with left4dead2_fix.exe, as recommended. I know dxvk is working properly since I can make the fps hud come up and it is making a left4dead2_d3d9.log. However, I see this in L4D2Fix.log:

[2025-04-14 02:24:18.261] [L4D2Fix] [info] Detected DirectX9: using shaderapidx9.dll

  1. Is L4D2Fix working properly?
  2. Why don't you recommend using the -vulkan launch parameter?

Yes, it works as designs, I have made a special if-else in the code to load dxvk related dlls, so the L4D2fix is compatible with the dxvk.

Some details: dxvk uses a method called dll proxy to hijack the dx9 calls to the vulkan ones.

The whole procedure works like this:

  1. The game uses the shaderapidx9.dll to call directx9 apis, which are located in the d3d9.dll. This is the normal behavior of a dx9 game.
  2. However, if a dxvk d3d9.dll is placed beside the main exe, rather than the system d3d9.dll, the dxvk d3d9.dll will be used by the application. This is the dll proxy method.
  3. Then, dxvk gets the chance, using the dxvk d3d9.dll to hijack the dx9 calls from the game, and translate them into vulkan calls.
  4. So the game still uses the dx9 apis, but actually it is served by the vulkan.

To check this, you can use afterburner to show the currently used graphics api on hud, which I think you have already done.


So the answers are:

  1. Yes, this is desiged. game still uses dx9 and dxvk translates the dx9 to vulkan.
  2. -vulkan makes the game using the official vulkan implementations, which is actually a very old version dxvk. This time, dxvk dlls won't work since the game is no longer using the d3d9.dll. (Actually it is using the dxvk_d3d9.dll inside the bin folder, which is a renamed old version dxvk).

Also, Gamers from China report that the latest dxvk is much more better than the old one.

You can see in the pic, the shaderapivk.dll uses the dxvk_d3d9.dll. So, why not use the latest dvxk if you are already using the dxvk, XD. Image

kurikomoe avatar Apr 15 '25 18:04 kurikomoe

Hi, I want to ask since this fix cannot be launched from steam, does that meant this is only meant for singleplayer and cannot play local host with friends

Pemarces273 avatar Sep 08 '25 01:09 Pemarces273

Hi, I want to ask since this fix cannot be launched from steam, does that meant this is only meant for singleplayer and cannot play local host with friends

I think it's possible. Let me find a new way to do dll hijack more stably.

kurikomoe avatar Sep 08 '25 05:09 kurikomoe

Hi, I want to ask since this fix cannot be launched from steam, does that meant this is only meant for singleplayer and cannot play local host with friends

Hi, could you test if this patch works?

test_patch.zip

kurikomoe avatar Sep 08 '25 07:09 kurikomoe

@kurikomoe hello, apologize for the late response. Currently, I encountered some error of shaderdx9.dll with the v1.4.0, re-rolling back to v1.3.0 works as normal

Pemarces273 avatar Sep 09 '25 08:09 Pemarces273

I'm sorry, but what is the "some error of shaderdx9.dll". Is there anything I can do to fix that?

kurikomoe avatar Sep 09 '25 11:09 kurikomoe

My apologies for not responding for nearly a month , got busy with life. btw , its the shaderapidx9.dll . Unfortunately , I regret to say that I have no idea on the things that can be done to resolve this issue

Image

Pemarces273 avatar Sep 29 '25 15:09 Pemarces273

My apologies for not responding for nearly a month , got busy with life. btw , its the shaderapidx9.dll . Unfortunately , I regret to say that I have no idea on the things that can be done to resolve this issue

You can set the kpatch.ini with

[System]
debug = true

to start the debug output, then there will be a console showing the reason why shaderapidx9.dll is not loaded.

kurikomoe avatar Oct 03 '25 06:10 kurikomoe