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

Just Cause II is very unstable #567

Closed
legluondunet opened this issue Aug 15, 2018 · 34 comments
Closed

Just Cause II is very unstable #567

legluondunet opened this issue Aug 15, 2018 · 34 comments

Comments

@legluondunet
Copy link

legluondunet commented Aug 15, 2018

Hello,
I tested Just Cause II Steam version and, even if its compatibility state is in progress, it is yet too unstable to be playable.

My config:

  • Ubuntu 18.04
  • DXVK (15 august 2018 version)
  • Wine 3.13-staging
  • Nvidia drivers 396.51
  • Vulkan 1.1.70
  1. Firstly, this game crash at start if Steam overlay is enable. You can hope to join the aim game menu when Steam overlay is disabled.
  2. in the menu you have several tests performance. I can launch two of this three performance tests: "dark tower" and "desert". The third performance test named "urban jungle" always crash the game
  3. the game could crash at start or at exit

I joined the log when the game crashes with test performance named "urban jungle" :

JustCause2_d3d11.log
JustCause2_dxgi.log
just_cause_2.log

Thank you for your help.

@doitsujin
Copy link
Owner

doitsujin commented Aug 15, 2018

Please disable the Steam Overlay when testing.

I'm aware it's unstable, but it's probably just hitting the 32-bit memory limitations. A few people who own the game already tried to debug it and hit an error condition that is impossible to hit if memory allocations work correctly, which indicates that this may indeed be the issue.

This is a common issue with DXVK and not easy or even impossible to resolve.

@doitsujin doitsujin changed the title Just Cause II state: very unstable and crash with Steam Overlay Just Cause II is very unstable Aug 15, 2018
@misyltoad
Copy link
Collaborator

Back when I was testing DXUP and DXVK separately a month or so ago, I never had any issues running this.

@pchome
Copy link
Contributor

pchome commented Aug 22, 2018

I know one point where it always crashing for me -- Roaches base. Every time I tried to start initial mission, after several cutscenes.

Other factions are also affected, but randomly.
This missions are usually mean "you flying to a new location to do a job", so game probably loading new bunch of data at this time.

@legluondunet
Copy link
Author

I upgraded my Nvidia drivers to 396.54 and Wine to 3-14-staging, most of the time the game crashes before showing his aim menu. If I reach the menu, when I choose "urban jungle" test performance, the game crashes. But I can launch a new game.
Do you know how to read dump from the game? I joined you some.

justcause2_crash_dump.zip
JustCause2_d3d11.log
JustCause2_dxgi.log

Do you need an apitrace?

@mozo78
Copy link

mozo78 commented Sep 19, 2018

Hello, I can't start the game at all. This is my first d3d10 game setup so it's possible my fault.
There are the steps I make:
Copy all of the DXVK libraries in the game's exe directory.
winetricks d3dcompiler_43
Set:
dxgi - native
d3d11- native
d3d10 native
Install DirectX End-User Runtimes (August 2009).
The game won't start with this setup complaining with "d3dcompiler:compile_shader HLSL shader parsing failed" error. I have to install d3dx10 and d3dx10_43 and the game starts but it freezes at the initial screen, right here:
1
The d3d10.log is empty.
d3d11 log:
https://pastebin.com/TKZeEHev
dxgi log:
https://pastebin.com/9SdZjhAP
Wine log:
https://pastebin.com/5Hcpgmva
Here you are an apitrace after this screen, recorded to the main menu:
https://my.pcloud.com/publink/show?code=XZXPN17ZqQWNGJKkPgpn9IROX0GUtSwL1asV

@doitsujin
Copy link
Owner

@mozo78 You need native d3dcompiler DLLs.

@mozo78
Copy link

mozo78 commented Sep 19, 2018

Thank you doitsujin :) How to obtain them? I installed d3dcompiler_43, isn't this enough?

@legluondunet
Copy link
Author

@mozo78 try winetricks d3dcompiler directx10 directx11

@bobwya
Copy link

bobwya commented Sep 19, 2018

@mozo78

Is it not easier to use:

winetricks d3dcompiler_43 dxvk72

(with winetricks master)??
Takes the guess work out of doing things manually...

@mozo78
Copy link

mozo78 commented Sep 19, 2018

@bobwya
I'm already with dxvk 0.72 and d3dcompiler_43 installed.

@legluondunet
Unfortunately this doesn't work:
Unknown arg d3dcompiler
Unknown arg directx10
And so on.

d3dcompiler_43 is installed via "winetricks d3dcompiler_43" and is set to native.

@doitsujin
Copy link
Owner

doitsujin commented Sep 19, 2018

Not sure which version the game needs, might be d3dcompiler_42. Your error message indicates that it is still trying to use wine's d3dcompiler.

@mozo78
Copy link

mozo78 commented Sep 19, 2018

But as I said in my previous posts, I got this library installed via:
winetricks d3dcompiler_43
In the mean time I can't find a way to install d3dcompiler_42:

Unknown arg d3dcompiler_42

I tried to set all DirectX libraries to native to no avail :(

@doitsujin
Copy link
Owner

There are multiple versions of the d3dcompiler DLLs, and you installed 43 but not the others.

@mozo78
Copy link

mozo78 commented Sep 19, 2018

I'll try with the latest winetricks.

@legluondunet
Copy link
Author

legluondunet commented Sep 19, 2018

@mozo78
launch this command:
WINEPREFIX=path/to/your/pfx/game winetricks --gui
click on "install" applications", valid, escape, click on "install a windows DLL", valid,
check all d3dx10, d3dx11 and D3Dcompiler.
Even if you launch this game, it is too unstable, not playable.
And if you want more help for Wine and Winetricks use, I think it is better to ask on the Wine forum:
https://forum.winehq.org/

@mozo78
Copy link

mozo78 commented Sep 19, 2018

I have installed all d3dx10 and d3dx11 already. There isn't d3dcompiler sections in the winetricks. There are DXVK versions form 0.54 to 0.72, but there aren't any d3dcompiler options. Anyway, thank you and I'm sorry for the inconvenience caused.

@ryao
Copy link
Contributor

ryao commented Sep 24, 2018

I'm aware it's unstable, but it's probably just hitting the 32-bit memory limitations. A few people who own the game already tried to debug it and hit an error condition that is impossible to hit if memory allocations work correctly, which indicates that this may indeed be the issue.

This is a common issue with DXVK and not easy or even impossible to resolve.

I disagree. Here is a possible fix:

ValveSoftware/wine#22

@doitsujin
Copy link
Owner

@ryao I hope you are aware that this "fix" breaks compatibility?

@TheChosenEvilOne
Copy link

TheChosenEvilOne commented Oct 12, 2018

huh, I am not even able to get it to launch.
Getting this:
Unhandled privileged instruction at address 0x449000

System information:
Wine build: wine-3.17 (Staging)
Platform: i386
Version: Windows 7
Host system: Linux
Host version: 4.18.11-arch1-1-ARCH

I got latest nVidia driver (410.57-4) and got the latest commit of dxvk (8172d34)

@ghost
Copy link

ghost commented Nov 2, 2018

I am having similar issues and found some strange behaviour which I hope can be of use to someone.

Launching the game with the '/failsafe' parameter seems to increase the chance of getting past the loading screen, avoiding the crash detailed by mozo78. After the launch you are able to change the settings and resolution back to a pre /failsafe state, so it's sort of a workaround. The game will crash ~10 minutes afterwards though.

Failsafe mode ignores settings, placing the game in windowed mode at a much lower resolution than it would otherwise launch at. My hypothesis is that because of the lower amount of memory consumed as a result occasionally it's able to beat the initial loading process and deallocate enough memory for playing, although eventually crashing again. Just Cause 2 is a 32 bit application. (so to my knowledge they can't consume much more than 3gb of memory?)

Regardless I doubt this this an issue with dxvk rather JustCause2's general bugginess. Even on windows there are issues similar to this one, and the dxvk overhead might just be a bit too demanding for it.

@legluondunet
Copy link
Author

wine-staging 3.21: without DXVK the game launched, I can play all the three tests and launch the aim game. Color are sometimes not correct and game is not fluid.
With DXVK: the game crashed at the first picture.

@ghost
Copy link

ghost commented Dec 5, 2018

Not sure if this is of any help to anyone, or if I did it correctly, but here is my apitrace.
https://pastebin.com/ebG7MdcY

@K0bin
Copy link
Collaborator

K0bin commented Dec 5, 2018

That's not an apitrace.

@ghost
Copy link

ghost commented Dec 5, 2018

How's this?

@doitsujin
Copy link
Owner

An apitrace is the file generated by apitrace. Not the console output.

@ghost
Copy link

ghost commented Dec 5, 2018

Sorry for the wait. Link

K0bin added a commit to K0bin/dxvk that referenced this issue Dec 28, 2018
This prevents multiple threads from accessing the ImmediateContext
at the same time.

Fixes doitsujin#567.
K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
@K0bin
Copy link
Collaborator

K0bin commented Dec 30, 2018

Sorry for the mess with those commits. But with that PR the game works for me. Performance is completely terrible (around 10 fps, so unplayable on my i7 6700 + GTX 1070) and turning on SSAO will make it crash.

@mozo78
Copy link

mozo78 commented Dec 30, 2018

It's sad. I had hopes this game will be finally playable. Thumbs up for your effort though :)

K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
K0bin added a commit to K0bin/dxvk that referenced this issue Dec 30, 2018
This prevents fixes threading issues with D3D10 games when
Present() gets called.

Fixes doitsujin#567.
@mozo78
Copy link

mozo78 commented Dec 30, 2018

Can you give me a build to test it? Thank you :)

@pchome
Copy link
Contributor

pchome commented Jan 2, 2019

BTW, SSAO crash:

wine: Unhandled page fault on read access to 0x00000038 at address 0xf2545802 (thread 003c), starting debugger...
Unhandled exception: page fault on read access to 0x00000038 in 32-bit code (0xf2545802).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:f2545802 ESP:0346ee28 EBP:0346ee28 EFLAGS:00010296(  R- --  I S -A-P- )
 EAX:00000030 EBX:f272d000 ECX:0346ee78 EDX:00000030
 ESI:0346ee78 EDI:0346eee0
Stack dump:
0x0346ee28:  0346ee68 f252d3fc 00000030 f254439a
0x0346ee38:  0346ee60 f252d3dc 7cdc9530 0118ef60
0x0346ee48:  00000030 f252db06 7cdb8270 cbefd810
0x0346ee58:  cbec9b88 0346ee78 cbecaff4 7cdc9530
0x0346ee68:  00000000 00c3bb99 cbecaff4 00c3bb99
0x0346ee78:  7cdc9530 00000030 00000000 0118ef60
Backtrace:
=>0 0xf2545802 _ZN4dxvk10D3D10Query13GetD3D11IfaceEv+0x10() in d3d11 (0x0346ee28)
  1 0xf252d3fc _ZN4dxvk11D3D10Device14SetPredicationEP15ID3D10Predicatei+0x37() in d3d11 (0x0346ee68)
0xf2545802 _ZN4dxvk10D3D10Query13GetD3D11IfaceEv+0x10 in d3d11: movl    0x8(%eax),%eax

src/d3d10/d3d10_device.cpp#L740

@doitsujin
Copy link
Owner

doitsujin commented Jan 2, 2019

As usual with JC2 backtraces, this doesn't make any sense. That piece of code simply cannot crash unless the game passes an invalid pointer to the function, which should also crash on Windows.

Does the game run when commenting out the entire function?

@K0bin
Copy link
Collaborator

K0bin commented Jan 2, 2019

Nope, still crashes when SetPredication does nothing.

@pchome
Copy link
Contributor

pchome commented Jan 2, 2019

@doitsujin

Does the game run when commenting out the entire function?

When I tried to do this recently -- It crashes with similar GetD3D11Iface() call in IASetInputLayout() (or so)
src/d3d10/d3d10_device.cpp#L896.
I gave up to check further.

P.S. the game acts like this:
D3D10Device::SetPredication(0, 0) -- ok
D3D10Device::SetPredication(0x30, 0) -- crash

After forcing D3D11Query* d3d11Predicate = nullptr;:
D3D10Device::IASetInputLayout(0x30) -- crash
...

@K0bin
Copy link
Collaborator

K0bin commented Jan 2, 2019

The issue is that the D3D10Device calls GetPredicate on the D3D11Context and doesn't account for the fact that that could set a nullptr.

ID3D11Predicate* d3d11Predicate = nullptr;
m_context->GetPredication(
  ppPredicate ? &d3d11Predicate : nullptr,
  pPredicateValue);
*ppPredicate = static_cast<D3D11Query*>(d3d11Predicate)->GetD3D10Iface();

So what we end up with:

*ppPredicate = static_cast<D3D11Query*>(nullptr)->GetD3D10Iface();

That then returns something like 0x00000034 which crashes when the game calls SetPredication with that pointer.

The same issue also happens with IAGetInputLayout which is why the game still crashed after I commented out everything in SetPredication. It affects a couple of GetXYZ methods in the D3D10Device.

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

No branches or pull requests

9 participants