Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not seem to work for me #3

Open
vlad54rus opened this issue Jul 28, 2020 · 58 comments
Open

Does not seem to work for me #3

vlad54rus opened this issue Jul 28, 2020 · 58 comments

Comments

@vlad54rus
Copy link

vlad54rus commented Jul 28, 2020

Running Steam version of Mass Effect on FX-4170. Installed your dll and it seems to be loaded according to Process Explorer, but black blob glitch still occurs. Setting DisableD3DXPSGP or DisablePSGP in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Direct3D\ also didn't help.
Any thoughts?

@CookiePLMonster
Copy link
Owner

Can you provide a screenshot from the game?

@vlad54rus
Copy link
Author

MassEffect_2020_07_28_19_27_35_641

@mirh
Copy link

mirh commented Jul 28, 2020

Are you running 32-bit windows?

@adolfintel
Copy link

Where did you place the DLL? Make sure it's in the Binaries folder with MassEffect.exe and not where the launcher is.

@vlad54rus
Copy link
Author

Im running 64-bit Windows 10.
DLL file is in Binaries folder.

@adolfintel
Copy link

That is so strange. Can you send me your binaries folder so I can test it? I have ME1 installed, I can do it right away. Send it to info@fdossena.com if you don't want to post it publicly.

@vlad54rus
Copy link
Author

Binaries.zip

@adolfintel
Copy link

What happens if you rename MassEffect.exe to ut3.exe? Some games won't load certain DLLs when they're run as administrator.

@riverar
Copy link
Contributor

riverar commented Jul 29, 2020

Hi @vlad54rus, it may seem redundant but we have to verify a few things before we can move forward.

  1. Can you provide a screenshot of your registry values in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Direct3D?

  2. Can you provide a screenshot of Process Explorer showing Mass Effect loading d3dx9_31.dll from the application folder?

Thanks!

@vlad54rus
Copy link
Author

vlad54rus commented Jul 29, 2020

@riverar
Desktop_2020_07_29_15_04_28_486
Desktop_2020_07_29_15_11_45_954

@CookiePLMonster
Copy link
Owner

That's very concerning, because everything looks valid.

To clarify - when you tested DisableD3DXPSGP, did you test this with or without the fixed DLL installed? It should be tested without one.

Also, you seem to be using a BINK hook - can you list all the other mods you have?

@vlad54rus
Copy link
Author

I tested both - same results.
Other installed mods are ME1:Recalibrated and Russian Translation.

@adolfintel
Copy link

Just my 2 cents: can you try this on a clean install on ME1? ME1 recalibrated has caused several glitches for me even on intel. Not this one though

@vlad54rus
Copy link
Author

Tried on clean install - issue still occurs.

@mirh
Copy link

mirh commented Jul 29, 2020

If you have 64-bit windows..
What is trying to load 1252 National Language Support from system32?

Also, when ordering by name modded d3dx9_31.dll is above the system one, at least on my W7.
..Can you, I dunno, try this fix?

@vlad54rus
Copy link
Author

C_1252.NLS? Many apps load it.
I already have this fix installed because elevation pop-up annoys me. Although it doesn't matter if i run game as admin or not.

@mirh
Copy link

mirh commented Jul 30, 2020

I see.
I cannot think to anything less stupid, so.. Could you try the game in a VM (with english windows because whatever)?

@adolfintel
Copy link

I doubt ME1 will run in a VM

@adolfintel
Copy link

@vlad54rus can you try this DLL?
d3dx9_31.zip

It's the original d3dx9_31.dll, except I modified a jump so that it will always think that DisableD3DXPSGP is set regardless of what's in the registry.

@vlad54rus
Copy link
Author

@adolfintel Sadly, this also didn't work. I made sure it is loaded instead of system one, but glitch still occurs.

@mirh
Copy link

mirh commented Jul 30, 2020

Why shouldn't it run in a VM?
Everybody and their cousin can accelerate dx9 and anyway AMD supports IOMMU virtualization since ages.

@adolfintel
Copy link

Why shouldn't it run in a VM?
Everybody and their cousin can accelerate dx9 and anyway AMD supports IOMMU virtualization since ages.

Because unless he's doing a proper GPU passthrough, the 3D acceleration inside virtualbox and vmware is pretty shitty and makes most modern-ish games crash.

@mirh
Copy link

mirh commented Jul 30, 2020

Thankfully ME isn't a modern game.
In fact, I seem to remember it was working for me inside workstation (for as much even more painfully slow than usual on my laptop).

@adolfintel
Copy link

Really? It never worked for me on virtualbox

@riverar
Copy link
Contributor

riverar commented Jul 30, 2020

@vlad54rus What GPU are you using? Looks NVIDIA based.

@riverar
Copy link
Contributor

riverar commented Jul 30, 2020

If everyone could reach out to their AMD FX-series friends and see if they can reproduce the issue, that would be greatly appreciated. That'll drive whether or not I purchase some hardware to assist with debugging efforts.

@vlad54rus
Copy link
Author

@riverar NVIDIA GTX 660, driver 391.35.

@adolfintel
Copy link

I only have a ryzen and an i7 unfortunately, no old bulldozers :(
You should update that driver though.

@mirh
Copy link

mirh commented Aug 3, 2020

Bobcat is even older and works just fine with the fix (though that has probably way different potato registers).
Try a clean VM anyway please.. I scavenged the net but it was already hard enough to find two people with ryzen commenting their experience.

p.s. people criticized the fix here

@riverar
Copy link
Contributor

riverar commented Aug 3, 2020

@vlad54rus I'm going to buy some parts to test this. Can you provide a CPUZ screenshot/dump of your processor so I can be extra sure I'm getting the right parts? Thanks!

@mirh
Copy link

mirh commented Aug 3, 2020

And DisablePSGP in the registry doesn't do anything?

@riverar
Copy link
Contributor

riverar commented Aug 3, 2020

@zTorden Thanks very much for reaching out. Can you try @adolfintel's DLL above? #3 (comment) That'll verify it's broken.

@zTorden
Copy link

zTorden commented Aug 3, 2020

neither DisablePSGP nor DLL from comment 3 made any difference

@riverar
Copy link
Contributor

riverar commented Aug 3, 2020

OK, thanks. Purchased hardware to reproduce this. Will need about a week of patience from everyone to get the machine. 😅

@vlad54rus
Copy link
Author

@riverar
CPUZ
At least i am not only one with this problem, hope you can fix it.

@adolfintel
Copy link

So this only happens on FX chips, not Ryzen?
A capture with Pix could help @CookiePLMonster figure out what's broken this time.

@CookiePLMonster
Copy link
Owner

It would only help figuring out if it's again the same data being broken - with the bug we've fixed it "persisted" on captures, but even if the same inputs are still broken then we'd need to restart the investigation anyway.

@adolfintel
Copy link

@CookiePLMonster Just for curiosity, have you tried reverse engineering FPS counter? How did it fix ME1?

@CookiePLMonster
Copy link
Owner

I haven't because the FPS Counter author showed up out of nowhere under my blog post and explained the way he fixed the bug - and by the sounds of it, his approach was a workaround similar to our early attempts with "replacing broken data with correct data", which resulted in not broken yet too dark visuals.

@adolfintel
Copy link

This sucks, I hope you can figure out what's wrong with it this time

@CookiePLMonster
Copy link
Owner

For reference, that's where FPS Counter author described his approach:
https://cookieplmonster.github.io/2020/07/19/silentpatch-mass-effect/#comment-4999297511

@adolfintel
Copy link

adolfintel commented Aug 4, 2020

I agree with your replies, it doesn't look the same as it does on Intel.
Better than nothing I guess

@riverar
Copy link
Contributor

riverar commented Aug 12, 2020

I can reproduce this issue with an AMD FX chip. Investigating.

Screenshot 2020-08-11 171946

@mirh
Copy link

mirh commented Aug 23, 2020

Any progress?

@riverar
Copy link
Contributor

riverar commented Aug 23, 2020

@mirh Nothing yet, sadly.

@mirh
Copy link

mirh commented Aug 28, 2020

Maybe bulldozer has an actually non-compliant FPU?
A guy on HN made a tool to check.

Or perhaps slashed instructions are what "saved" Zen.

@GHaass
Copy link

GHaass commented Sep 14, 2020

Does not work for me either. I'm running it on AMD FX-8320 and Geforce GTX 970 on 64-bit WIndows 7. I used the binary DLL and then built it from source messing around with the code to make sure it was running. I also used the glm library to invert the matrix with both single and double precision, same result. Even running on Linux using WINE the bug happens identically.

@zTorden
Copy link

zTorden commented Oct 3, 2020

any luck so far?

@Tucker1011
Copy link

Tucker1011 commented Oct 17, 2020

Confirmed reproduced on Bulldozer/Piledriver (FX6300 "Vishera", same as pictured above). I reached out to Silent on Twitter, but this is probably a more productive place to try and chip in. I followed the advice around it executing as admin and stuff with no success, so I'm guessing we're all in the same crummy-CPU boat on this one.

I'll try to check up on this thread and am more than happy to provide a second (or third or w/e) test-point for any successful leads found during this follow-up investigation. I may not be a software engineer, but I'm very good at flipping switches inside Windows =D

@PMunkes
Copy link

PMunkes commented Nov 24, 2020

Hi, I currently cannot access my copy of Mass Effect, but could you test if DXVK has an influence on the problem?
https://github.com/doitsujin/dxvk

@minino299
Copy link

Same issue here with an AMD A8-5500M Based-laptop

@frabert
Copy link

frabert commented Dec 1, 2020

@PMunkes I tested using DXVK (with and without this patch, same result). CPU: FX6350
2020-12-01 18_48_47-Mass Effect

There are no "blobs", but the characters are still rendered flat black except for some highlights. Overall, this is much better than before and is "semi-acceptable" for me.

@unic0rn
Copy link

unic0rn commented Dec 4, 2020

@frabert Try winetricks vcrun2005, the runtime that comes with the game seems to not be enough. I had similar problem (identically black characters, but just on equipment/level up screen, and in character creator), installing vcrun2005 fixed it. Granted, I also had some geometry glitches that also got fixed, and I didn't have a problem like this in that mission (I had regular pixelated blobs there, which SilentPatch fixed), but the exact nature of "side effects" caused by lack of proper vcrun2005 install may depend on the CPU, I've got A8-7600.

Unless I got confused and you're running DXVK under Windows, in which case... just install that runtime under Windows without using winetricks.

@mirh
Copy link

mirh commented Dec 4, 2020

For some devilish reason, the game doesn't actually crash without vcrun2005, and it will have instead a fuckton of little but annoying glitches from geometry to total lack of lights in the inventory and whatnot.
Wine does ship its own msvcrt, but it can end up having all kinds of bugs (and boy isn't this game sensitive)
But that's tangential to the problem here.

I would rather check the terminal for D3DXLoadSurfaceFromMemory errors.
If you did not install d3dx9_31 you get gimped effects and lighting (including our very special one arguably, but then at this point you could as well just install Mgamerz's great mod which is more specific).


Anyway, as said above and according to other testing of mine, it seems like excavator and steamroller cpus are all good with silentpatch.
Jaguar and puma are still eluding me (though I could check on my PS4 one day /s), but my blind guess is that it's only affects bulldozer and piledriver cores then.

@mirh
Copy link

mirh commented Jul 30, 2021

No chance for that FX-6300 to make some new discovery?

@mirh
Copy link

mirh commented Jan 20, 2022

So.. ME3Tweaks/LegendaryExplorer#71 still didn't get much far
But after some casual googling, I found out it should be possible to extract HLSL at runtime
p.s. specialK may do the trick too (EDIT: ok well, it does show you the decompiled loaded shaders, and it's cool to be able to play with the AmbientColorAndSkyFactor parameters, but it doesn't exactly help tracking down the culprit)

@mirh
Copy link

mirh commented Mar 4, 2023

Is it normal that my cheap ass ghidra disassembly has branches in a pretty different fashion from the one reported in the writeup?

x86_D3DXInitFastTable((D3DXFASTTABLE *)&g_D3DXFastTable);
ret = GetD3DRegValue(REG_DWORD,"DisablePSGP",&value,4);
if (ret == 0) {
  value = 0;
}
ret = GetD3DRegValue(REG_DWORD,"DisableD3DXPSGP",&valueD3DX,4);
if (ret != 0) {
  value = valueD3DX;
}
if (value != 1) {
  if ((value == 2) || (ret = D3DIsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE), ret == 0)) {
    ret = D3DIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
    if (ret == 0) {
      ret = D3DIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE);
      if (ret != 0) {
        intelsse_D3DXInitFastTable((D3DXFASTTABLE *)&g_D3DXFastTable);
        g_CpuOptimization = 3;
      }
    }
    else {
      intelsse2_D3DXInitFastTable((D3DXFASTTABLE *)&g_D3DXFastTable);
      g_CpuOptimization = 2;
    }
  }
  else {
    amd_D3DXInitFastTable((D3DXFASTTABLE *)&g_D3DXFastTable);
    g_CpuOptimization = 1;
  }
}

Also of note that even the SSE2 optimizations still call for the intelsse_D3DXMatrixInverse function, I couldn't find any intelsse2_D3DXMatrixInverse as suggested somewhere (which I guess makes sense given the suspected instruction is RCPSS).

Anyhow, I feel like very trivially there's only two main possibilities left here:

  • it's still one of those infamous SSE reciprocals (pretending it's not d3d9 or the game itself, I could see other RCPSS between D3DXQuaternionInverse and D3DXPlaneIntersectLine, RCPPS in the D3DXVec#TransformCoord* functions and RSQRTSS in D3DXVec#Normalize, D3DMatrixReflect, D3DMatrixShadow and D3DXPlaneFromPoints)
  • it's something else entirely that could affect other related-but-separe instructions (x87 namely.. whose assemblies I could indeed surprisingly find even in the patched d3dx9_31, and that some super cherry-picking revealed to be somewhat different after steamroller)

In the first scenario, besides the obvious trying to also shim all the other functions, maybe playing with a VM and cpuid masking could be already enough (if dx9 has all the right checks in place that should be enough to avoid 100% of the shaky codepaths)
If it had to be the later case instead.. Idk really, maybe you could try forcing the compiler to use SSE2 (or ideally, precision could be tested, with and without Bulldozer Conditioner).
Btw both qemu and 86Box could spice some understanding up given they should support 3DNow! emulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests