Automatic Run

Questions about Wine on Linux
Locked
MajorLunaC
Level 1
Level 1
Posts: 6
Joined: Sun Nov 09, 2014 12:27 pm

Automatic Run

Post by MajorLunaC »

I've been having trouble with Punkbuster. I know it's not really working well with many games, but the problem I'm getting is exactly the same problem that frequently happens on windose:
"Game disconnected: you were kicked by PunkBuster. Stated reason: PunkBuster kicked player '_________' (for 0 minutes) ... RESTRICTION: Service Communication Failure: PnkBstrB.exe initialization failed"

In essence, Punkbuster starts and runs PnkBstrA.exe, and at some point PnkBstrB.exe is started (varies: at the same time, after, when logging in, etc.). At many times, PnkBstrB.exe fails to start. My workaround for this (based on some windose solutions) is to start taskmgr.exe and run PnkBstrB.exe manually (PnkBstrA.exe seems to always work), and immediately run the game from there, as well. The problem is, results vary widely: Some days, I play for hours non-stop with no problems. Other days, I ALWAYS get kicked with the first 5 minutes of joining a map. I don't really understand why this happens, especially since the games are quite old (Battlefield 2 and Battlefield 2142). Maybe I'm not updating Punkbuster manually frequently enough (nearly daily)? Although it happens even after updates.

I'm constantly looking for other solutions to this ridiculous problem and I've seen the possibility of "go to Services and make PnkBstrB.exe and PnkBstrA.exe and run Automatic and Start the service." Essentially, it would automatically restart the services should they ever go down. The problem is, how exactly do I do this? I don't even clearly understand what "Services" is. Is it "Task Manager"? Because wine's "Task Manager" does not seem to have the option "run Automatic" anywhere. Is there a workaround for this? Maybe a script outside or inside Wine? There is also "Look in your services.msc list and see if it's disabled, if that's the case just re-enable it." but services.msc does not seem to exist.
MajorLunaC
Level 1
Level 1
Posts: 6
Joined: Sun Nov 09, 2014 12:27 pm

Re: Automatic Run

Post by MajorLunaC »

I'm sorry for double posting, but I managed to figure it out after fidgeting with various ways to do it. Windows batch (.bat) running doesn't seem to work for me, and it was a nightmare trying to figure out DOS commands, which are so limited that there isn't even a while loop or sleep of any kind! So instead, I wrote a Bash script to keep PnkBstrB.exe running in case it goes down and causes the initialization error that kicks you out of online games. I call it punkBloop:

-----------------------Copy below here---------------------------------------

#!/bin/bash

#punkBloop keeps PnkBstrB.exe running while PnkBstrA.exe is running.
# DO NOT USE pnk="$(ps -u $USER | grep PnkBstr*)" BECAUSE IT IS NOT UPDATED!

export WINEPREFIX=/home/$USER/.wine WINEARCH=win32

while ps -u $USER | grep PnkBstrA.exe
do
if ! ps -u $USER | grep PnkBstrB.exe
then
wine "C:\windows\system32\PnkBstrB.exe"
fi
sleep 15s
done

exit 0

-----------------------Copy above here-----------------------------------------

Modify it as needed. I'm hoping 15 seconds is enough of an interval for the checks of PnkBstrB.exe. If not, change "sleep 15s" to a shorter interval.

I tried to use the Wine HQ Wiki 7.4. How do I launch native applications from a Windows application?, but it doesn't seem to work well for me, and seems excessively complex. Instead, I just run this in a separate terminal from the game, but you can try some sort of single command.
Locked