Post by Phantomeis on Sept 30, 2018 3:53:39 GMT
BF2142 v1.51 Ranked LAN Server with FESL and mod support
Introduction
Hi, my goal is to give you guys a tutorial on how to get a ranked LAN-Server and a ranked standalone server working.
This makes use of FESL-MasterServer, the gamespy emulator from maiorBoltach which you can find here at GitHub (my fork)
Within this tutorial you will install a web and a MySQL server on your computer.
You will install libraries for openssl communication with the game and the fesl-server, put up your game server and get your game ready for play without
the offlineprofile-fix and gamespy servers. As a plus you can unlock weapons like in the old days while playing with bots!
Software we will use for this guide. You dont actually need to download any of that, it already comes with the all-in-one-pack!:
* XAMPP 1.7.7 VC9 (we need this old version!)
* Win32_OpenSSL102p
* Unranked Server Setup
* Fesl-Server and its files from GitHub
* XAMPP 1.7.7 VC9 (we need this old version!)
* Win32_OpenSSL102p
* Unranked Server Setup
* Fesl-Server and its files from GitHub
* ccDaemon and ccClient
And the BF2142 Game (and Patch version 1.50 and 1.51) [not included in the download] <---------------
Note: From patchversion 1.50 on you have widescreen support!
From patchversion 1.51 on you have the DRM removed and Northern Strike integrated, so no crack needed!
Preparation
I have prepared a .zip file which contains all the above software and serverfiles, so you only need to drop files to specific places.
This makes things extremly easy and you dont have to fiddle with MySQL!
Download all-in-one Pack 2.5 (MEGA.IO)
Just unpack the .rar somewhere convenient. The now unzipped /Workdir/ is our playground, the guide will reference it always.
2.5 Fixed MYSQL crashes, reduced server-timeout from 30 to 5 seconds. Client-side (ingame server users) will profit with faster map changes. Timeout for dedicated servsrs is reduced to 10 seconds.
2.4 Reverted the vehicle-stats saving due to problems for users. Bundled the Guide into the download
2.3 Thanks to Steve! He fixed vehicles stats saving for the database.
2.2 Fixed bugs in script and made the installation easier, only hosts needs the hosts-file edits now, players only need the hexedited .exe
2.0 Updated the Guide to include LAN Servers which you can create from the game itself to be ranked
1.0 Initial release with Standalone Server + Masterserver
Installing the game
First we install BF2142 and the patch v1.51.
Version v1.25 is fine also since it can run LAN with offlineprofile-fix and has some mods.
But v1.51 can’t create LAN games while running the offlineprofile-fix and having no gamespy to "veryfy" the servers origin, even if it is just LAN.
Version v1.25 is fine also since it can run LAN with offlineprofile-fix and has some mods.
But v1.51 can’t create LAN games while running the offlineprofile-fix and having no gamespy to "veryfy" the servers origin, even if it is just LAN.
I cover both szenarios.
Copy the „cracked“ bf2142.exe from /workdir/cracked_exe/<version> into your BF2142 folder overwriting the original bf2142.exe.
BF2142 v1.25 only needs the following edit in the hosts-file.
You must edit the hosts file located at C / windows / system 32 / drivers / etc / hosts
Add the next lines to the end of the file and save it:
Change your.ip to the IP the computer running the master server is using.
Change your.ip to the IP the computer running the master server is using.
If you want to go public , use your router's IP. Don't do this though because the xampp we use is very old (we need the php 5.2), as is the openssl, which is vulnerable to HeartBleed. Use hamachi or VPN!
If you want to use VPN services (Hamachi, Nord, Tunngle(dead)), use your hamachi/VPN IP.
your.ip bf2142-pc.fesl.ea.com
your.ip gpcm.gamespy.com
your.ip stella.available.gamespy.com
your.ip eapusher.dise.se
127.0.0.1 stella.prod.gamespy.com #do not change
your.ip stella.ms5.gamespy.com
your.ip ea.com
your.ip gamespy.com
your.ip messaging.ea.com
your.ip fesl.ea.com
your.ip gpsp.gamespy.com
your.ip gamestats.gamespy.com
your.ip gpcm.gamespy.com
your.ip stella.available.gamespy.com
your.ip eapusher.dise.se
127.0.0.1 stella.prod.gamespy.com #do not change
your.ip stella.ms5.gamespy.com
your.ip ea.com
your.ip gamespy.com
your.ip messaging.ea.com
your.ip fesl.ea.com
your.ip gpsp.gamespy.com
your.ip gamestats.gamespy.com
your.ip stella.ms5.gamespy.com
your.ip eapusher.dice.se
your.ip stella.master.gamespy.com
your.ip stella.master.gamespy.com
For BF2142 v1.51:
Patch v1.51 needs some more work, start the Tool HxD.exe at /workdir/software/ and drop the bf2142.exe into it.
CTRL + F lets you search for 192.168.1.3, change the IP to your WAN or LAN IP by typing using the keyboard, DONT CTRL+V INSIDE THIS.
To do so, use the right panel from HxD and just type your IP. Do this eight times, then you have found all IPs, but don’t close HxD yet!
Mind the / (slash) that appears sometimes, the IP must end with this slash if you find it!
CTRL + F lets you search for 192.168.1.3, change the IP to your WAN or LAN IP by typing using the keyboard, DONT CTRL+V INSIDE THIS.
To do so, use the right panel from HxD and just type your IP. Do this eight times, then you have found all IPs, but don’t close HxD yet!
Mind the / (slash) that appears sometimes, the IP must end with this slash if you find it!
NOTE: if you are left with the unallocated space after correcting IP, set dots and change the bit-values
of the dots to 00!

Now we change the hidden IP:
First, reverse your IP-Addresses numbers, convert them to HEX and paste them at hex-address 0301a8c0
For example my IP 192.168.178.20 reversed becomes 20.178.168.192
Now we need to convert every number divided by the dots into HEX-code.
Use www.browserling.com/tools/ip-to-hex for hexcode conversion or the windows calculator.
Use www.browserling.com/tools/ip-to-hex for hexcode conversion or the windows calculator.
Using calculator:
Start your calculator in programer mode by pressing ALT+3, select „DEZ“ on the left panel.
Type the first numbers of your IP (for example 192) and then change the calculator mode to „HEX“ on the left side. You get „C0“.
Do this for each number.


Example:
Do this for each number.


Example:
My IP 192.168.172.20 reversed becomes 20.172.168.192 , its numbers are 20 172 168 192 which each get converted, the result being 14 ac a8 c0
Write the HEX-code like this: 14aca8c0
In HxD press CTRL + R, the replace window will open, change the datatype to HEX, search direction to "all" and search for 0301a8c0 and replace with your HEX-code (14aca8c0 in my case).
Write the HEX-code like this: 14aca8c0
In HxD press CTRL + R, the replace window will open, change the datatype to HEX, search direction to "all" and search for 0301a8c0 and replace with your HEX-code (14aca8c0 in my case).
Press OK and we are done with HxD.

Save your changes and close HxD.
The Client is prepared. Send this to your friends if you host the server, so they can connect to you.

Save your changes and close HxD.
The Client is prepared. Send this to your friends if you host the server, so they can connect to you.
Now you can decide if you want to start the server from within the game (via Multiplay->local->create) or if you want a standalone server, wich means you start the server outside of the game with its own server-software.
You can do both, but at least one must be done now, so we can configure the database afterwards.
To play ranked LAN games we must prepare the server that is hidden within bf2142.


Installing the ranked LAN-Server (ingame server)
To play ranked LAN games we must prepare the server that is hidden within bf2142.
Copy the contents of /workdir/drop_in_game_folder/ into your /Battlefield 2142/ folder and overwrite.
The FESL-Server is now located in your /Battlefield 2142/fesl_login_server/ folder.
Rightclick on Masterserver+LAN_Shortcuts.exe send to -> Desktop (we created a shortcut).
Masterserver+LAN_Shortcuts.exe is a simple GUI i made for starting XAMPP, fesl and the Game with three clicks as.
It can start BF2142 as well by using a shortcut called "start_game" already included in /workdir/drop_in_game_folder/.
Edit the shortcut to point at your hexedited bf2142.exe you prepared earlier, also check the last parameter (the most right words) as you can/must change the desired mod to start from here.
The default is "remastermp" as you can see here:
"E:\Program Files (x86)\Electronic Arts\Battlefield 2142\BF2142_192.exe" +menu 1 +fullscreen 1 +widescreen 1 +szx 1920 +szy 1080 +modPath mods/remastermp

Also we need some edits in the Hosts-file for the server-machine.
Installing the standalone game-server
Install BF2142 server from /workdir/Software/ .
Copy the contents of /workdir/drop_in_standalone_server_folder folder into your /Battlefield 2142 Server/ folder and overwrite.
Copy the contents of /workdir/drop_in_standalone_server_folder folder into your /Battlefield 2142 Server/ folder and overwrite.
The FESL-Server is now located in your /Battlefield 2142 Server/fesl_login_server/ folder.
Rightclick on Masterserver+standalone_Shortcuts.exe send to -> Desktop (we created a shortcut).
Masterserver+standalone_Shortcuts.exe is a simple GUI i made for starting XAMPP, ccDaemon, ccClient, fesl and the Game with three clicks.
It starts BF2142 by using a shortcut called "start_game" already included in /workdir/drop_in_standalone_server_folder/.
Edit the shortcut to point at your hexedited bf2142.exe you prepared earlier, also check the last parameter (the most right words) as you can/must change the desired mod to start from here.
The default is "remastermp" as you can see here:
"E:\Program Files (x86)\Electronic Arts\Battlefield 2142\BF2142_192.exe" +menu 1 +fullscreen 1 +widescreen 1 +szx 1920 +szy 1080 +modPath mods/remastermp

Configure your server gameplay settings using the BF2142ServerLauncher.exe or ccClient, which gets explained later.
Note: If you crash your game while spawning on the map, change the sv.maxUnlockLevel to -1.
Open BF2142 server/mods/<mod>/settings/ServerSettings.con and search for sv.MaxUnlockLevel .
Open BF2142 server/mods/<mod>/settings/ServerSettings.con and search for sv.MaxUnlockLevel .
Installing the FESL-MasterServer Database
We install XAMPP 1.7.7 and OpenSSL from /workdir/software/.
Keep the install directories standard.
Open XAMPP-Control panel as we need it later.
Keep the install directories standard.
Open XAMPP-Control panel as we need it later.
Copy the content of the /workdir/drop_in_xampp_folder/ into your C:/XAMPP/ folder and overwrite.
Also we need some edits in the Hosts-file for the server-machine.
Open the XAMPP-Control panel and start Apache and MySQL.
Click “Admin” for MySQL, your browser will open and bring you to “phpMyAdmin”, your MySQL frontend.

You must edit the hosts file located at C / windows / system 32 / drivers / etc / hosts
your.ip bf2142-pc.fesl.ea.com
your.ip gpcm.gamespy.com
your.ip stella.available.gamespy.com
your.ip eapusher.dise.se
127.0.0.1 stella.prod.gamespy.com #dont change this
your.ip stella.ms5.gamespy.com
your.ip ea.com
your.ip gamespy.com
your.ip messaging.ea.com
your.ip fesl.ea.com
your.ip gpsp.gamespy.com
your.ip gamestats.gamespy.com
your.ip stella.ms5.gamespy.com
your.ip eapusher.dice.se
your.ip stella.master.gamespy.com
Add the next lines to the end of the file and save it:
Change "your.ip" to your masterservers IP (IP of the PC running this server)
Change "your.ip" to your masterservers IP (IP of the PC running this server)
your.ip bf2142-pc.fesl.ea.com
your.ip gpcm.gamespy.com
your.ip stella.available.gamespy.com
your.ip eapusher.dise.se
127.0.0.1 stella.prod.gamespy.com #dont change this
your.ip stella.ms5.gamespy.com
your.ip ea.com
your.ip gamespy.com
your.ip messaging.ea.com
your.ip fesl.ea.com
your.ip gpsp.gamespy.com
your.ip gamestats.gamespy.com
your.ip stella.ms5.gamespy.com
your.ip eapusher.dice.se
your.ip stella.master.gamespy.com
Open the XAMPP-Control panel and start Apache and MySQL.
Click “Admin” for MySQL, your browser will open and bring you to “phpMyAdmin”, your MySQL frontend.
Here you can edit unlocks, passwords and other data from soldiers and accounts.

Go into the bf2142 Database, select the table “servers” and click “Inline Edit” on the second row.
Change the IP 192.168.178.20 to your masterserver's IP (the one from the hosts-file), then click save:

Go into the bf2142 Database, select the table “servers” and click “Inline Edit” on the second row.
Change the IP 192.168.178.20 to your masterserver's IP (the one from the hosts-file), then click save:

Close phpMyAdmin.
Please always close your browser-tab from phpMyAdmin, because on some machines an open phpMyAdmin tab blocks write-access to the database!
Addon-Tools for easy management of the standalone server
I included ccDaemon and BF2CC and masterserver_shortcuts.exe in the /workdir/drop_in_server_folder/ .
ccDaemon is a daemon that starts/stops the standalone Server over a remote connection, it can be remote controlled by ccClient.
If you have a dedicated remote server, you will start the daemon there and configure it for your ccClient connection.
If you have a dedicated remote server, you will start the daemon there and configure it for your ccClient connection.

BF2CC makes use of the inbuilt r-con API from battlefield, it connects to your ccDaemon on the same PC or dedicated remote machine to control the maplist, server settings, kick and ban players etc. .

Preparing ccDaemon and BF2Client
Both tools hide in the system-try if minimized!
Start ccDaemon using my masterserver_shortcut.exe or /Battlefield 2142 Server/ccDaemon/ folder.
1. Change the BF2142 Server folder (Dont use the ... Box to the top right, the tool will crash, just type by hand!)
2. Type the WAN/LAN IP into the box (127.0.0.1 if you host on the same machine as the ccClient gets launched).
3. Set an admin password (or leave it empty for default "admin")
_____________________
Start BF2CC using my masterserver_shortcut.exe or /Battlefield 2142 Server/ccClient/ folder.
1. Set to "BF2CCDaemon"-Mode
2. Type IP and Port 4712 (default port is wrong!) you put in ccDaemon
3. Use admin-credentials from ccDaemon (if you typed none, just hit login!)
4. Login
_____________________
When logged in, you must change some critical things in the dashboard on the bottom!
1. Put in WAN or LAN mode, depending on what you want. The Server will appear under "online" or "LAN" depending on your choice.
2. Put your WAN/LAN IP here.
3. Save all changes you ever make with this floppydisk icon.
4. Apply the profile with this button before starting the server.
5. Start/Restart the server with this button.

Now you can change settings for the Server like Tickets, Timings, Maps etc.
Just click the floppydisk icon on the bottom to save ! Then start the server!
BF2CC may crash using project_remastered_mp, you can simply start it again or close the server using ccdaemons UI.
When editing the Maplist, always save before changing windows/taps inside BF2CC!
If you want your server showing up in the serverbrowser-list, open the settings tab and fill this parameters into the
"Add Custom Settings to ServerSettings.con"-Box:
sv.ranked 1
sv.provider 10011
sv.region AT
sv.type 1
sv.globRank 1
sv.globUnlocks 1
If you want your server showing up in the serverbrowser-list, open the settings tab and fill this parameters into the
"Add Custom Settings to ServerSettings.con"-Box:
sv.ranked 1
sv.provider 10011
sv.region AT
sv.type 1
sv.globRank 1
sv.globUnlocks 1
Then tick the "Internet"-radio button. Still use your LAN IP, except you have a public server in WAN, then use WAN IP.
Starting the Masterserver and standalone/LAN-Server
LAN-Server:
Open masterserver_shortcuts.exe from your Desktop.
Start XAMPP Control and there start Apache and MySQL.
Start FESL-Server.
Start BF2142, login, you can create a LAN-server at Multiplay -> Local -> Create . Select maps, setup the bots and start!For other Players:
Get the prepared bf2142.exe from the one who hosts the server and drop it into your bf2142 folder.
Start the game, create an account or login if you already have one.
You can find the LAN-server at Multiplay -> Local at the serverbrowser list!Standalone:
Open masterserver_shortcuts.exe from your Desktop.
Start XAMPP Control and there start Apache and MySQL.
Start FESL-Server.
Start ccDaemon.
Start ccClient. Configure Maps and settigns as you like, save and apply. If you are using mods on your server, exit ccClient now, because using mods with standalone makes ccClient crash often.
If you haven't started the server using ccClient you can do so at ccDaemon, press "start" to bootup the standalone server.
Start BF2142, at Multiplayer -> Local tab you will find your standalone server.
For other Players:
Get the prepared bf2142.exe from the one who hosts the server and drop it into your bf2142 folder.
Start the game, create an account or login if you already have one.
You can now join the standalone Server by using the "Join IP" button at the
Multiplay-screen. Mark the Server as favorite, so you dont have to IP join everytime!
Multiplay-screen. Mark the Server as favorite, so you dont have to IP join everytime!
Your Desktop may look like this now. 


Here are the commnadline arguments for fesl_login_server.exe
FESL/GS login server emulator v.1.0 (BETA 06)
by Andrew Vasiliev
e-mail: vasiliev1979@yandex.ru
Based on "Simple TCP proxy/datapipe" and "GS login server emulator" sources
by Luigi Auriemma
e-mail: aluigi@autistici.org
web: aluigi.org
Usage: %s [options]
..Options:.
-x port port to listen connections (18300 default)
-v verbose output
-l 1 - logfile on, 0 - logfile off (default). FOR DEBUG
-restore_srv enable restore account and password to email
-dbhost host MySQL DB
-dbname DB name
-dbuser DB user
-dbpass DB password
-p increase process priority
-d DIR dump the content of the connections in various tcpdump-like cap files
Admin-Account
There is a pre-created account using the credentials "admin", both for username and password.
The soldier in this account is called "ServerAdmin" and is Rank 1 with some data already in database for you to look at.
Look here to give him all unlocks with an SQL-command!
Support
You can ask for help here, describe me your situation and i will ask you about specific information then to deal with your problem.
How to change the login credentials that FESL uses to connect to the DB?
Standard Logins are:
Username: bf2142
Password: pw2142
I you want to change them, which you should if you go public server, then head into the DB.
Click the bf2142-DB, on the top right menu you find "Privileges", click it.
You find "bf2142" user at the top of the box, click "Edit Privileges".

Scroll down in the new window and find the password-field, change the password to something strong.

Now head into your fesl-folder that is in your \Battlefield 2142 (Server)\fesl_login_server\ and open the _launch.bat using the windows editor.
Change the dbpass value to the password you just changed.

Here are some infos about the parameters used (they arent case sensitive!):
"-D. \ Fesl" folder fesl will remain a network data exchange. required only for catching errors and malfunctions
"-L 1" logs will be written to /logs/ folder
"-V" visible output in the black FESL window, what you see here is what will end up in logs
Done!
"-D. \ Fesl" folder fesl will remain a network data exchange. required only for catching errors and malfunctions
"-L 1" logs will be written to /logs/ folder
"-V" visible output in the black FESL window, what you see here is what will end up in logs
Done!
How to change the Award/Reward/Points system
To change the amount of points you get from a badge/pin/medal, simply make a copy of your medal_data.py and save it/rename it into medal_data_original.py
Do this in this locations:
<Bf2142 game folder>\python\bf2\stats //If you choose to create an Ingame Server you go here
<Bf2142 standalone server folder>\python\bf2\stats //If you choose to create a Standalone Server you go here
I have a guide here to learn to read the medal_data.py, it goes into the database stuff as well, but number of points awarded always gets set in the medal_data.py file!
The DB stuff is to look if someone has a silver or gold status award or to give a player an award (which won't reward points since it doesnt happen ingame, you could add points via db "playerprogress"-DB.