========================================
x-cockpit — Getting started (PC server/bridge)
========================================

Follow bellow steps. Keep this whole folder together 
(do not move x-cockpit.exe away from its data\ folder).

Android client app:
https://play.google.com/store/apps/details?id=eu.sajmonsoft.xcockpit

Video tutorial:
https://x-cockpit.sajmonsoft.eu/#tutorials


1) Fix Windows Firewall (automatic option)
--------------------------------------------------
   On the STATUS tab (right after first launch / paths are OK):
   - Click "Fix firewall"
   - Choose the automatic option so your tablet/phone can 
     connect to this PC over your network.

   (You can also add the rule manually in Windows Firewall).


2) Allow folder access (automatic option)
-------------------------------------------------
   On the STATUS tab:
   Windows Defender (Ransomware protection) can block the program 
   from writing game files like logs and saves.

   - Click "Allow folder access"
   - Choose the automatic option (it asks Windows to allow 
     x-cockpit.exe and X4.exe).
   - CLOSE x-cockpit.exe and start it again so Windows fully 
     applies the new permissions.

   If you need to do this manually, see pictures in:
   > Troubleshooting\AllowFolderAccess(manually)\ <
   Then restart the bridge.


3) Copy the game mod into your X4 profile
----------------------------------------
   Find your Egosoft profile folder:

   Steam:  > Documents\Egosoft\X4\<numbers>\ <
           (the folder containing inputmap.xml and a save\ folder)

   GOG:    > Documents\Egosoft\X4\ <
           (often lacks a number subfolder)

   Copy the entire "extensions" folder from THIS package into your 
   profile folder (at the same level as inputmap.xml). 

   Resulting path should look like this:
   ...\Egosoft\X4\[optional SteamID]\extensions\x-cockpit\content.xml

   IMPORTANT: From now on, use the mod inside your PROFILE for everything 
   (importing/exporting, saving layouts, custom fonts, backgrounds, icons). 
   The mod folder next to x-cockpit.exe is only a temporary source to copy 
   from, or for designing a HUD when X4 is not installed.


4) Run the server and check paths
----------------------------------------------
   - Start x-cockpit.exe
   - The program usually finds your profile and game by itself.
   - Open "Check paths / Configure paths" ONLY if something is 
     missing or wrong, and pick the folders manually.

   In practice, it is enough that:
   - the mod was copied to the correct profile (Step 3), and
   - the Player profile points to that same folder.

   You should see "OK" for: Mod folder, Input file, and Game exe.
   - Press Save if you changed anything.

   If the Mod folder is MISSING, go back to Step 3.


5) Turn the mod ON in X4
------------------------
   - Start X4
   - Go to Settings → Extensions
   - Find "x-cockpit" and set it to ON
   - Restart the game if X4 asks you to.


6) Create a HUD layout or import a stock one
--------------------------------------------
   Either design your own HUD in x-cockpit editor or download a ready layout from the website:

   1. Open https://x-cockpit.sajmonsoft.eu
   2. Browse HUDs
   3. Download a stock layout (.zip file)
   4. Put that ZIP into the imports folder in your X4 PROFILE 
      (the copy from Step 3). Example:
      > Documents\Egosoft\X4\<numbers>\extensions\x-cockpit\md\imports\ <
   5. In the bridge: click Import → choose that ZIP.


7) Start the bridge and launch the game
---------------------------------------
   - Press "Start Bridge" (and "Start Listener" if it is off).
   - Prefer "Launch X4 (debug mode)" from the bridge.

   CRITICAL: If you start X4 normally from Steam/GOG, the HUD 
   on your tablet/phone will often stay empty because it won't 
   receive live game data. Always launch with debug logging.

   If Launch from the bridge has problems (common with some GOG 
   installs), make a shortcut to X4.exe with these parameters:
     -debug script -logfile x4.log
   Details are in:
   > Troubleshooting\X4 Launch arguments.txt <
   (and shortcutarguments.png in the same folder).


8) Connect the tablet/phone app
-------------------------------
   - Install the x-cockpit app on your Android device.
   - Make sure your tablet/phone and PC are on the same Wi‑Fi.
   - Connect to this PC in the app.
   - Keep the X4 window in focus on your PC when you tap buttons 
     on the tablet/phone.


Need more help?
-------------------------------
Check the Troubleshooting folder included in this package 
or watch tutorials at https://x-cockpit.sajmonsoft.eu/#tutorials