Vietcong running in Wine crashes always when loading some 3D scene (Mupltiplayer->Player, Campaign, Titles...), so only thing that works is main menu.
I ran same debugging sessions and spent some time in IDA debugger and found the crash place, it is on address 0x1008ec8b in function sub_1008EC80 from logs.dll. All places where it crashes (Mupltiplayer->Player, Campaign, Titles...) has exactly the same behaviour: it tries to manipulate with NULL argument. Looking at the stack shows that this func (sub_1008EC80) is called from 0x10091706 (func sub_1008F8D0). Here is disassembled part of sub_1008EC80 function:
Code
0x1008ec80: subl $12,%esp
0x1008ec83: movl 0x18(%esp),%eax ;<- load arg_8 to eax
0x1008ec87: movl 0x10(%esp),%ecx
0x1008ec8b: flds 0xc(%eax) ; <- here is the crash (eax is NULL)
....
And here is part of sub_1008F8D0 calling sub_1008EC80:
Code
0x1009169e: movl 0xfffffda4(%ebp),%ecx
0x100916a4: subl 0xfffffda0(%ebp),%ecx
0x100916aa: imull $12,%ecx,%ecx
0x100916ad: movl 0xffffff70(%ebp),%edx
0x100916b3: movl 0x8(%edx),%eax
0x100916b6: movl 0xfffffdac(%ebp),%edx
0x100916bc: movw %cx,0x0(%eax,%edx,2)
0x100916c0: movl 0xfffffda4(%ebp),%eax
0x100916c6: movl %eax,0xfffffda0(%ebp)
0x100916cc: movl 0xfffffda4(%ebp),%ecx
0x100916d2: imull $12,%ecx,%ecx
0x100916d5: movl %ecx,0xfffffda4(%ebp)
0x100916db: movl 0x1c(%ebp),%edx ; <- load arg_14
0x100916de: pushl %edx ; <- here we put on stack arg_14 (==NULL) which we pass to func 0x1008ec80
0x100916df: movl 0xfffffdac(%ebp),%eax
0x100916e5: imull $12,%eax,%eax
0x100916e8: movl 0xffffff70(%ebp),%ecx
0x100916ee: movl 0xc(%ecx),%edx
0x100916f1: addl %eax,%edx
0x100916f3: pushl %edx
0x100916f4: movl 0xfffffda8(%ebp),%eax
0x100916fa: addl 0xfffffda4(%ebp),%eax
0x10091700: pushl %eax
0x10091701: call 0x1008ec80 ; <- lets call this function with NULL arg...
I tried to reconstruct calls:
Vietcong.exe -> some unknown stuff -> BES_Load (logs.dll) -> sub_10008DC0 (logs.dll, can call itself recursively) -> sub_sub_1008F8D0 (logs.dll, can call itself recursively) -> sub_1008EC80 (logs.dll, called with NULL pointer).
I have no idea why it its called with NULL pointer (and why it works in Windows). I tried rewrite func BES_CalculateBSphere into C (i did not know where the crash was) and it took me several hours. But understand what is going on between BES_Load() and final sub_1008EC80() would take weeks! And that is why i am writing here, I need your help. Do you guys have any tips, how to debug this problem? I am using winedbg for disassembling and IDA free fo understand the code. You guys also created VC Starter, which fix some bugs (i am using version 1.5.1). Do you rewrite it into C for better reabitility or do you work in clean assembler? What utils do you use?
I also think it is not Wine bug, but that Vietcong depends on some bugs in system libraries or so (thats why there were problems on newer Windows). Did you find some strange behavior in Vietcong when you were creating VC Starter?
Edit: I also found some debug messages (BES_Load(): BES_LoadNODs==%d, ...), do you have any experiences how to enable them?
In main menu, when i click Multplayer->Player, the following files are being loaded:
Code
g\characters\cup_crocker\cup_crocker.bes
g\equipment\us\bes\eop_brt1us_v02.bes
g\characters\cvp_poorvc01\cvp_poorvc01.bes <- always crash on this
Then i tried Titles (or authors, dont know how it is named in English) from main menu. There are about 80 files loaded before crash. Crashed on this one (tried it only once:
For single player->quick fight->Stream there are also about 80 files before it crashed (dont know which file caused this, becouse I killed my debugger by mistake)
sonic wrote:
You guys also created VC Starter, which fix some bugs (i am using version 1.5.1).
It's all Brchi's work. Check this thread http://www.vietco...ead_id=899 as VCStarter 1.65.1 and 1.7 BETA are available. Not that it's going to help you solve the bug (most likely).
But Brchi hasn't been around for quite a while, even his website is off .
Thanks for your help. I will try newer version of VCStarter, but I also dont think that it will help (according to changelog).
I see that Brchi was online 3 days ago, so he visits this forum from time to time (at least i hope so )
Anyway, i found that sub_1008F8D0 (which calls 0x1008ec80 with NULL arguments) has something to do with character models (i see variables like head, shoulder, etc).
I tried VC Starter v1.7 BETA and nothing changed. I also noticed, that VietCong uses SecuROM https://translate...edit-text= . I found some strange functions, which do...absoluttely nothing (really, they just return back after call). Since I am testing on no-cd crack version (and moreover, SecuROM should work in Wine https://wiki.wine...Protection) its probably not the cause of the problem.
So i will wait for Brchi for now, maybe he can help me with this...
Edit: no, wait, i copied wrong files, I was using version 1.6.5. v1.7 BETA fixes the problem! Brchi, i need to talk to you!
Basically, when you are programming in lang like C, you create code in C which is translated into machine code for your processor. And this one instruction of machine code at address 0x1009169e here is translated into assembler - it is like machine code but its better understood by humans.
And what it does? It loads ("move") value from address "ebp + 0xfffffda4", take it and save into ecx register...assembler is very primitive, it just say "load this value", then add some number to loaded value, then multiply by another number...
Anyway, i tried to debug function which caused crash with VCStarter 1.7 and it looks like self-moddifing code. At the beginnig the function was:
As you can see, code at 0x1008ec80 (entry point of this function) is replaced by jump, so this function will be skipped.
If I look at code at place where it jumped...
Code
0x00356e10: pushl %ebp
0x00356e11: movl %esp,%ebp
0x00356e13: movl 0x10(%ebp),%eax
0x00356e16: testl %eax,%eax
0x00356e18: jz 0x00356e24
0x00356e1a: movl %eax,0x10(%ebp) ;<- maybe here is stored valid value into eax
0x00356e1d: popl %ebp
0x00356e1e: jmp *0x3608fc -> 0x1fff0168
0x00356e24: popl %ebp
0x00356e25: ret ; <- since here we are thansk to "jmp" (not "call"), ret will go jump back to 0x10091706
0x00356e26: int $3
...
...I can see that i have no idea what is going on here :D
So is it really some anti-cheat protection? hmm...
There is possibility that fixing this bug (or what is it) will fix also another games in Wine.
Btw, thanks to VCStarter1.7 we are from status "Only Main menu works" in status "Everything works". I even played multiplayer :)
sonic wrote:
Btw, thanks to VCStarter1.7 we are from status "Only Main menu works" in status "Everything works". I even played multiplayer
It worked? That's amazing. Just a small idea and... that's it! I'll give it a try for sure.
Really wish I knew some reverse engineering. Then I'd understand much more of this.
Nosek wrote:
It worked? That's amazing. Just a small idea and... that's it! I'll give it a try for sure.
Yes, it worked :) At first i was like "Yeah, its not working, i knew it", but then i saw that i forgot to copy new dll for VCStarter. So 1.6.5 was not working, but 1.7 is working.
Nosek wrote:
Really wish I knew some reverse engineering. Then I'd understand much more of this.
Well, i do not know it much, too. i knew some Assembly from school (well, i am also programming for several years). I spent whole Sunday before I wrote post here. I still do not know where is the problem. But I hope that Brchi's knowledge can help Wine developers to fix this issues in upstream (more apps could be affected by this "strange behavior")
So, do you have Linux or Mac? You have to also install directplay, if you want play mutiplayer (using winetricks, see this bug: https://bugs.wine...i?id=33295).
And for working server list you have to add this line (as you probably know):
Code
65.112.87.186 master.gamespy.com
but not into Wine virtual disk (C:\WINDOWS\system32\drivers\etc\hosts), but into your unix system (/etc/hosts), see this for details https://forum.win...hp?t=14767
I will try add some info into AppDB of WineHQ (here https://appdb.win...p;iId=5641).
The bug (in Wine bug reposting system) was reported 9 years ago, but it was never fixed. I am so happy that i can play Vietcong on Linux now :=
Silent Bob wrote:
Sounds great! Will there be a tutorial what is needed to play Vietcong with the WINE OS? That would be very much appreciated!
Wine is program which make possible to run Windows application on Mac OS, Linux, FreeBSD etc (i am playing Vietcong on Linux). But i will write some tips for it (here or on Wine AppDB ). I also plan to make some FPS tests...
Silent Bob wrote:
Sounds great! Will there be a tutorial what is needed to play Vietcong with the WINE OS? That would be very much appreciated!
Wine is program which make possible to run Windows application on Mac OS, Linux, FreeBSD etc (i am playing Vietcong on Linux). But i will write some tips for it (here or on Wine AppDB ). I also plan to make some FPS tests...
Sry, to be more precise: does WINE work in different Linux distributions (Debian, Ubuntu,etc..)
Sry, to be more precise: does WINE work in different Linux distributions (Debian, Ubuntu,etc..)
Ah sorry, my bad. I am testing it on Antergos (Arch) Linux and xhc said that he will test it on Debian. But i dont know about any OS specific (Mac OS/Linux,...) or even Distribution specific (Arch, Debian, Suse,...) problems, so I hope that it will run wherever can WINE (x86 processors) be installed (but of course, I'm not sure).
WINE works in every different lin-distributions, it is that same multiplatform project ... in our test is important which version of wine you will use (older versions may not have implemented all needed features of course)
Wine 1.9.17
========
Performance tests (Intel)
---------------------------------
Prologue: 70-80 FPS
Midnight Surprise: 40-70 FPS
The Underground City: 80-120 FPS
Too Many Targets: 50-70 FPS
Halong port: 60-120 FPS
Summary:
-huge FPS drops (more info at the end of this post)
Performance tests (AMD)
---------------------------------
Prologue: 70-80 FPS
Midnight Surprise: 30-60 FPS
The Underground City: 70-120 FPS
Too Many Targets: 50-70 FPS
Halong port: 50-120 FPS
Summary:
-giant FPS drops (more info at the end of this post)
-big tearing problems (maybe driver issues?)
Wine staging 1.9.17. + CSMT
-this is NOT official release of Wine, it can improve performance but it also could be more unstable
=================
Performance tests (Intel)
---------------------------------
Prologue: 90-100 FPS
Midnight Surprise: 40-90 FPS
The Underground City: 70-130 FPS
Too Many Targets: 40-80 FPS
Halong port: 50-120 FPS
Summary:
-huge FPS drops (more info at the end of this post)
Performance tests (AMD)
---------------------------------
Prologue: 100-130 FPS
Midnight Surprise: 30-70 FPS
The Underground City: 70-180 FPS
Too Many Targets: 50-70 FPS
Halong port: 60-130 FPS
Summary:
-giant FPS drops (more info at the end of this post)
-big tearing problems (maybe driver issues?)
Wine staging 1.9.17 + Gallium Nine
-this is NOT official release of Wine, it can improve performance but it also could be more unstable
-Gallium Nine is native D3D9 implementation for some Linux open source graphic drivers (not available for Intel)
===========================
Performance tests (AMD)
---------------------------------
Prologue: 90-130 FPS
Midnight Surprise: 90-120 FPS (crashes very often with error - my tip is flares caused this)
The Underground City: 100-160 FPS
Too Many Targets: 90-110 FPS
Halong port: 90-180 FPS
Summary:
-crashes very often in missions Too Many Targets and Midnight Surprise (my tip is that flares caused this)
-very good and stable FPS (no FPS drops)
-no tearing on AMD card
I discovered few places in campaign with huge (Intel) or giant (AMD) FPS drops. All these places are from night missions: Midnight Surprise (fire explosions and flares) and Tunnel Rat/The Underground City (on some places or during some gunfights). At these places game also sometimes crashed.
With MSAA enabled expect up to 50% worse performance
Very hard time to install Debian 8 and Nvidia 340.96 drivers with Wine 1.9.21 and additional components such as Gecko, Winetricks, etc., which all went a lot.
Grafikkarte is Nvidia Geforce GTX 750 TI with under Debian 8 Nvidia 340.96 Driver.
Test:
* Nvidia driver 340.96 and Settings OK.
* Wine 1.9.21 with additional components OK
* Vietcong single campaign tested with VCStarter 1.7 Beta OK
* Vietcong Addon Fist Alpha single Campaign with VCStarter 1.7 Beta OK
Multiplayer List Server OK, NOT MULTIPLAYER PLAYING .... this going NOT !!!!!
Here is a consoles list excerpt, I hate the D3D: D
I will continue to test with this * dpnet * and * D3D *
EDIT:
I have Debian 8 with KDE and KDM as OS with 64Bit.
Have little Poblems with 64Bit and Winetricks,i make this with GUI and startx,than going good.
if you have debian 64 bit , simply enable "multiarch" and install 32bit wine (multiarch allows using 32 bit apps in 64 bit system) ,,, for multiplayer joining you need install directplay (by winetricks)
I agree with xhc.
You can also try install Vietcong into 32bit prefix, I have it installed in $HOME/.local/share/wineprefixes/ so run it as: env WINEARCH=win32 WINEPREFIX=$HOME/.local/share/wineprefixes/vietcong/ wine vietcong.exe -addon fistalpha