Skip to content

Instantly share code, notes, and snippets.

@berenm
Last active October 12, 2023 02:45
Show Gist options
  • Save berenm/3e67cd273c2a530849e52218a1f2e70c to your computer and use it in GitHub Desktop.
Save berenm/3e67cd273c2a530849e52218a1f2e70c to your computer and use it in GitHub Desktop.
Radare2 patch for Divinity Original Sin 2: Definitive Edition's black screen (Wine / DXVK)
# cp DefEd/bin/EoCApp.exe DefEd/bin/EoCApp.exe.bak
# r2 -w DefEd/bin/EoCApp.exe -i dos2defed.r2 -q
# sha1sum DefEd/bin/EoCApp.*
# 04c29114a7ca50d414abab399033ac88ca6dd362 DefEd/bin/EoCApp.exe
# e3baf89f0d0d1885eb7d4d718e76da99f304726b DefEd/bin/EoCApp.exe.bak
s 0x140fa0d90
wao nop
s 0x140fa93ba
wao nop
s 0x140fb3431
wao nop
s 0x1410083e9
wa jmp 0x1410083f9
s 0x141185883
wa jmp 0x14118588b
s 0x1411b3bed
wa jmp 0x1411b3bfa
s 0x1411b3d51
wa jmp 0x1411b3db5
s 0x14125ee98
wa jmp 0x14125eea0
@notfood
Copy link

notfood commented Sep 7, 2018

It'd be nice to have the steps taken to update the .exe, the game updates often and will require patching often.

@lieff
Copy link

lieff commented Sep 7, 2018

Possibly game tries to set mask for wrong CPU which should fail https://github.com/ValveSoftware/wine/blob/proton_3.7/dlls/kernel32/tests/thread.c#L878
seems real bug not in SetThreadAffinityMask, but where mask is calculated.

@berenm
Copy link
Author

berenm commented Sep 8, 2018

I investigated a little bit more to see whether this was a wine issue or not, and from the SetThreadAffinityMask documentation, I believe it might be a game bug that has nothing to with wine.

The game first checks whether there is more or less than 6 cpus. If less, it initializes an affinity mask to 0xfffffffe that is then used for the creation of the game threads, and passed as an argument to SetThreadAffinityMask. From the Windows API documentation, I understand that passing a mask that is larger than the process affinity mask (which in turn cannot be larger than the cpu count) is incorrect, and should be treated as an error.

I don't know though if this is also the actual behavior of the Windows implementation, but it looks to me that Wine is implementing the API specification correctly.

@euclid2718
Copy link

I also would like to know the new addresses.

@berenm
Copy link
Author

berenm commented Sep 12, 2018

I updated the addresses and sha1sums for the latest GOG version.

Please note however that there's a a Wine patch being worked on by Roger Zoellner, to fix this issue the right way.

@Kzimir
Copy link

Kzimir commented Sep 21, 2018

I don't know if someone will read this message but i have a problem with wine-staging 3.16 and the game.
The game works but when i choose the mod for my game (story mod, exploration mod or other), the loading bar stay empty during very long time. The message popup in the loading screen appears randomly and there is the music so the game has not crashed. It really the loading bar which stay empty and don't load...

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