-
Download the game
-
Install with Wine
wine installer.exe
Installs to:
~/.wine/drive_c/EA Games/Battlefield 1942/ -
CD KEY IN USE - Intermittently get this error joining a server. Fix was to generate a new key each launch. Adapted BF1942-MP-Enabler.exe to run as a console app without requiring input
using System;
using System.Linq;
using Microsoft.Win32;
internal class BF1942KeyGen
{
private static void Main(string[] args)
{
string key = "BF1942" + GenerateRandomSerial(16);
if (SaveKeyToRegistry(key))
{
Console.WriteLine("BF1942 key generated: " + key);
}
else
{
Console.WriteLine("Failed to save key to registry");
}
}
private static string GenerateRandomSerial(int length)
{
Random random = new Random();
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Range(0, length)
.Select(_ => chars[random.Next(chars.Length)])
.ToArray());
}
private static bool SaveKeyToRegistry(string key)
{
try
{
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
RegistryKey subkey = hklm.CreateSubKey("SOFTWARE\\Electronic Arts\\EA GAMES\\Battlefield 1942\\ergc", writable: true);
subkey.SetValue(string.Empty, key);
subkey.Close();
return true;
}
catch (Exception)
{
return false;
}
}
}-
Compile app with Mono C# compiler
sudo pacman -S mono && mcs BF1942KeyGen.cs && mv BF1942KeyGen.exe ~/.wine/drive_c/EA\ Games/Battlefield\ 1942/Tools -
Create launcher script Create
launch.shin the game directory: (runs the key gen every launch)#!/bin/bash cd "/home/dylan/.wine/drive_c/EA Games/Battlefield 1942" wine "./BF1942KeyGen.exe" wine "./BF1942.exe" +restart 1 echo "Press Enter to close this window..." read
Then:
chmod +x launch.sh -
Create desktop file Create
~/.local/share/applications/battlefield-1942.desktop:[Desktop Entry] Version=1.0 Type=Application Name=Battlefield 1942 Exec="/home/dylan/.wine/drive_c/EA Games/Battlefield 1942/launch.sh" Icon=/home/dylan/.wine/drive_c/EA Games/Battlefield 1942/bf1942.ico Categories=Game; Terminal=false