# 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 |
It seems it needs an update, the sha1sum doesn't match with the current binary.
It might be that the Steam version is different. I have it on GOG.
On GOG version sha1sum doesn't match too.
bc5f4070791bd554f1d906fbcf3682551ed84ffb
I can't test this patch, as the game was updated a few days ago.
However, I took a closer look at Wine's SetThreadAffinityMask implementation. I patched it to print all return results. It never returns a zero value. At least not in my case.
Are you sure, it's related to that?
Edit:
After adjusting the addresses to the updated game, I can confirm, this patch works. Thanks very much!
I will now dig deeper into Wine to find out, what exactly causes the problem.
@Rotscha, could you please give addresses for updated executable?
It'd be nice to have the steps taken to update the .exe, the game updates often and will require patching often.
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.
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.
I also would like to know the new addresses.
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.
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...
This patch should help people like me who got stuck with a black screen on game startup.
The reason has nothing to do with DXVK btw, it is related to thread affinity. The game calls SetThreadAffinityMask, which returns 0 for whatever reason which indicates an error, and the game threads don't start.
This patch will overwrite the jump opcodes after the calls to SetThreadAffinityMask to completely ignore the returned result.