December 12 2018 07:33:35
Navigation
· Home
· Articles
· Downloads
· FAQ
· Discussion Forum
· Web Links
· News Categories
· Contact Me
· Photo Gallery
· Search
· Gameservers
Languages
Users Online
· Guests Online: 4

· Members Online: 0

· Total Members: 1,057
· Newest Member: Hydrocious
Teamspeak 3
Last Seen Users
· Homi05:56:35
· sonic10:09:36
· Intruder11:14:18
· Confused Master11:17:53
· ceghe13:31:03
· Hoods15:40:46
· VCG john18:39:46
· dRgiGGLeZ 1 day
· luporandagio 1 day
· braddock 1 day
· Virus 1 day
· 420Ninjutsu 1 day
· martyr 1 day
· WEZ 3 days
· Nosek 4 days

View Thread: Vietcong bug in Wine
Vietcong.Info » Vietcong General Discussion » Vietcong Tech Talk
Who is here? 1 Guest
Current Rating: (Total: 2 ratings)  
 Print Thread
Vietcong bug in Wine
sonic
Hi guys, I started working on fixing Vietcong bug in Wine (see here: https://bugs.wine...gi?id=9337).

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:

Download source  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:
Download source  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?
Edited by sonic on 29-08-2016 18:53
  x 1  x 1  x 1
 
https://github.com/sonicpp
sonic
I just was debugging what files are loaded before it crashed.

So this files are loaded by BES_Load() during loading main menu:
Download source  Code
G\Weapons\vvh_btrap\btrap_pin.bes
G\Weapons\vvh_btrap\btrap_wire2.bes
G\Weapons\VvH_Radio\VvH_Radio_fpv.bes
G\effects\WTR_EXP.BES




In main menu, when i click Multplayer->Player, the following files are being loaded:
Download source  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:
Download source  Code
g\characters\cvp_blckpjmsvc04\cvp_blckpjmsvc04.bes




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)
  x 1
 
https://github.com/sonicpp
Nosek
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 Frown.
  x 2  x 1
 
www.clan-delta.websnadno.cz
sonic
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 Smile)

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).
  x 2
 
https://github.com/sonicpp
sonic
Sorry for spam, this is last post today Wink

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! Shock
Edited by sonic on 29-08-2016 23:53
 
https://github.com/sonicpp
420Ninjutsu
What does those

0x1009169e: movl 0xfffffda4(%ebp),%ecx

things mean ? its so difficult .
 
sonic
420Ninjutsu wrote:

0x1009169e: movl 0xfffffda4(%ebp),%ecx


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:
Download source  Code
0x1008ec80: subl   $12,%esp
0x1008ec83: movl   0x18(%esp),%eax
0x1008ec87: movl   0x10(%esp),%ecx
0x1008ec8b: flds   0xc(%eax)
0x1008ec8e: fmuls   0x0(%ecx)
0x1008ec90: flds   0x2c(%eax)
0x1008ec93: fmuls   0x8(%ecx)
...




(pretty much like what it is in logs.dll and how it looks with VCStarter < 1.7Beta). Here is the same function after vietcong.exe started:
Download source  Code
0x1008ec80: jmp   0x00356e10
0x1008ec85: int   $3
0x1008ec86: int   $3
0x1008ec87: movl   0x10(%esp),%ecx
0x1008ec8b: flds   0xc(%eax)
0x1008ec8e: fmuls   0x0(%ecx)
0x1008ec90: flds   0x2c(%eax)
0x1008ec93: fmuls   0x8(%ecx)
...





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...
Download source  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 :)

Edit: i got it wrong (the code), so i edited it.
Edited by sonic on 30-08-2016 14:15
  x 1  x 1
 
https://github.com/sonicpp
Nosek
sonic wrote:
Btw, thanks to VCStarter1.7 we are from status "Only Main menu works" in status "Everything works". I even played multiplayer Smile

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.
Edited by Nosek on 30-08-2016 18:48
 
www.clan-delta.websnadno.cz
sonic
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):
Download source  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 :=
  x 2  x 1
 
https://github.com/sonicpp
xhc
that sounds good... I will try to make some compare test on debian
 
www.youtube.com/user/xhc1
Silent Bob
Sounds great! Will there be a tutorial what is needed to play Vietcong with the WINE OS? That would be very much appreciated!
 
www.vietcong.info
sonic
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...
  x 2  x 1
 
https://github.com/sonicpp
420Ninjutsu
Wow , sonic , thanks for the detailed instruction . you are a great programmer with very wild appearance ! www.vietcong.info/portal/images/avatars/trpaslik2.png
  x 1
 
Silent Bob
sonic wrote:
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..)
 
www.vietcong.info
sonic
Silent Bob wrote:

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).
  x 1
 
https://github.com/sonicpp
xhc
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)
  x 1
 
www.youtube.com/user/xhc1
sonic
I am back with some FPS tests. Sorry for the delay but i wanted to finnish campaign first Wink

Tested SW:
Linux 4.7.2
Mesa 12.0.1 (for Intel and AMD cards).
Vietcong 1.60 (max quality)

Tested HW:
Resolution: 1366*768
Processor: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
GPU 1: Intel HD Graphics 4600
GPU 2: AMD Radeon R7 M265

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

I also added these tests into Wine AppDB https://appdb.win...p;iId=8864
Edited by sonic on 09-09-2016 13:19
  x 1
 
https://github.com/sonicpp
Kangeruh
Hy,

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

Download source  Code
fixme:dpnet:IDirectPlay8ClientImpl_SetCaps (0x768f580):(0): Stub
fixme:dpnet:IDirectPlay8ClientImpl_EnumHosts (0x768f580):(0x5,0x32eefc,0): Stub
fixme:dpnet:IDirectPlay8ClientImpl_Close (0x768f580):(0): Stub
fixme:d3d:wined3d_device_set_software_vertex_processing device 0x1cdf80, software 0 stub!
fixme:msvcrt:__clean_type_info_names_internal (0x35054c) stub
franky@debian:/media/xxxxx/xxxx/xxxxx/xxxxxx/xxxxxxx/Vietcong$ wine vietcong.exe -addon fistalpha
fixme:win:EnumDisplayDevicesW ((null),0,0x32e378,0x00000000), stub!
fixme:win:EnumDisplayDevicesW ((null),0,0x32e6f8,0x00000000), stub!





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.


Cu
Kan*geruh
Edited by Kangeruh on 16-10-2016 10:41
SignatureHuepf Huepf s14.directupload.net/images/140318/temp/cr9g6zvb.jpg
fs5.directupload.net/images/171125/temp/drg6qo6x.jpg

Sorry,for my Bad Inglisch VC

Say Nix is ​​sometimes more, but it brudelt in a then high, so also nothing.
  x 1
 
xhc
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)
  x 1
 
www.youtube.com/user/xhc1
sonic
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
 
https://github.com/sonicpp
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Blender plugins for Vietcong files Maps & Mapping 18 02-12-2018 16:30
Vietcong Tactics Manual General Discussion 3 02-06-2018 04:30
Vietcong Messenger Allgemeines Diskussionsforum 3 13-05-2018 14:04
Vietcong is still alive! General Discussion 54 02-05-2018 11:37
Vietcong 2 Revive 1.00 Patch General Discussion 9 22-04-2018 23:19
Login
Username

Password



Forgotten your password?
Request a new one here.
Render time: 0.33 seconds - 102 Queries 2,268,789 unique visits