Skip to content

Instantly share code, notes, and snippets.

@DylanPMunyard
Last active March 9, 2026 10:39
Show Gist options
  • Select an option

  • Save DylanPMunyard/aa791733d55d5deef10c158e306287c5 to your computer and use it in GitHub Desktop.

Select an option

Save DylanPMunyard/aa791733d55d5deef10c158e306287c5 to your computer and use it in GitHub Desktop.
1942 on Linux

Installation

  1. Download the game

  2. Install with Wine

    wine installer.exe

    Installs to: ~/.wine/drive_c/EA Games/Battlefield 1942/

  3. Create launcher script

    Create launch.sh in the game directory.

    #!/bin/bash
    cd "~/.wine/drive_c/EA Games/Battlefield 1942"
    
    # Parse bf1942://IP:PORT URL if provided
    JOIN_ARGS=()
    if [[ "$1" == bf1942://* ]]; then
        hostport="${1#bf1942://}"
        hostport="${hostport%/}"
        IP="${hostport%%:*}"
        PORT="${hostport##*:}"
        if [[ -n "$IP" && -n "$PORT" ]]; then
            JOIN_ARGS=(+joinServer "$IP" +port "$PORT")
        fi
    fi
    
    wine "./BF1942.exe" +restart 1 +game.setGameDisplayMode 2560 1440 32 60 "${JOIN_ARGS[@]}"
    echo "Press Enter to close this window..."
    read

    Then: chmod +x launch.sh

    launch.sh Code explainer

    The JOIN_ARGS code is to parse optional arguments in the form bf1942://101.35.241.106:14567. This will join the server with the given IP and port.

  4. Create desktop file

    Create ~/.local/share/applications/battlefield-1942.desktop:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Battlefield 1942
    Exec="~/.wine/drive_c/EA Games/Battlefield 1942/launch.sh" %u
    Icon=~/.wine/drive_c/EA Games/Battlefield 1942/bf1942.ico
    Categories=Game;
    Terminal=false
    MimeType=x-scheme-handler/bf1942;
  5. Register the bf1942:// URL scheme

    This lets you join servers directly from the browser via links like bf1942://51.81.48.224:14567 (e.g. from joinme.click):

    xdg-mime default battlefield-1942.desktop x-scheme-handler/bf1942

    Verify: xdg-mime query default x-scheme-handler/bf1942 should return battlefield-1942.desktop

    Test: xdg-open "bf1942://51.81.48.224:14567" should launch the game and connect to the server.

Optional - but probably a good idea

To run mods like FHSW and BF1918 that consume > 2GB of memory, you'll need the 4GB patch.

  1. Download it https://ntcore.com/4gb-patch/
  2. Run it wine 4gb_patch.exe and choose BF1942.exe to patch it

If you don't do this, the maps will typically load and then the game will crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment