Installer last-rites-gog

dosbox:
  fullscreen: true
files:
- installer_gog: 'N/A:Please select the GOG installer for this game:'
- string25: https://web.archive.org/web/20240410024741/http://cd.textfiles.com/simtel/stmsdos9709/disk2/DISC2/BATCHUTL/STRING25.ZIP
- wbat250: https://web.archive.org/web/20150416044452/https://www.horstmuc.de/int/wbat250.zip
game:
  launch_configs:
  - args: --set "ipx ipx=true" -c "set RUNSERVER=1" -conf "dosbox-LASTRITE.conf"
    name: "Multiplayer \u2014 Host"
  - args: --set "ipx ipx=true" -c "set RUNCLIENT=1" -conf "dosbox-LASTRITE.conf"
    name: "Multiplayer \u2014 Join"
  main_file: dosbox-LASTRITE.conf
  working_dir: $GAMEDIR
installer:
- input_menu:
    description: "Choose the game\u2019s default control scheme:"
    id: CONTROLSCHEME
    options:
    - moderncontrols: "Modern (\u1D21\u2009\u1D00\u2009\uA731\u2009\u1D05)"
    - classiccontrols: "Classic (\u2191\u2009\u2190\u2009\u2192\u2009\u2193)"
    preselect: moderncontrols
- extract:
    dst: $CACHE/installer_gog
    file: $installer_gog
    format: gog
- merge:
    dst: $GAMEDIR/imgmount/disc1
    src: $CACHE/installer_gog/game/cd/last_rites.iso
- merge:
    dst: $GAMEDIR/drives/c/LASTRITE
    src: $CACHE/installer_gog/game/LR
- extract:
    dst: $CACHE/wbat250
    file: $wbat250
- merge:
    dst: $GAMEDIR/drives/u/WBAT250
    src: $CACHE/wbat250/W.BAT
- merge:
    dst: $GAMEDIR/drives/u/WBAT250
    src: $CACHE/wbat250/WBAT.COM
- extract:
    dst: $CACHE/string25
    file: $string25
- merge:
    dst: $GAMEDIR/drives/u/STRING25
    src: $CACHE/string25
- write_file:
    content: "#!/usr/bin/env python3\n\nimport mmap\nimport os\nimport shutil\nimport\
      \ sys\nfrom pathlib import Path\n\ndef patch_lr_exe():\n    lr_exe_bak = Path('LR.EXE.bak')\n\
      \    lr_exe = Path('LR.EXE')\n    \n    try:\n        if lr_exe_bak.is_file():\n\
      \            shutil.copy2(lr_exe_bak,lr_exe)\n        elif lr_exe.is_file():\n\
      \            shutil.copy2(lr_exe,lr_exe_bak)\n        else:\n            raise\
      \ FileNotFoundError('Neither LR.EXE nor LR.EXE.bak found.')\n    except FileNotFoundError\
      \ as e:\n        print(e)\n        sys.exit()\n    \n    map_end: int = 0xBF70E\
      \ # 784142\n    \n    offset_patches_moderncontrols: dict = {\n        0xBF658:\
      \ '10 00 00 00', # Decrease Tech Level: q\n        0xBF65C: '12 00 00 00', #\
      \ Increase Tech Level: e\n        0xBF690: '21 00 00 00', # Open/Activate: f\n\
      \        0xBF694: '11 00 00 00', # Move Forwards: w\n        0xBF698: '1F 00\
      \ 00 00', # Move Backwards: s\n        0xBF69C: '2A 00 00 00', # Run: LShift\n\
      \        0xBF6A8: '1E 00 00 00', # Strafe Left: a\n        0xBF6AC: '20 00 00\
      \ 00', # Strafe Right: d\n        0xBF6B0: '39 00 00 00', # Jump: Space\n  \
      \      0xBF6C4: '04 00 00 00', # Right Mouse Button: jump\n    }\n    \n   \
      \ offset_patches_highquality: dict = {\n        0xBF6CF: '00 00 01 01', # F\
      \ buttons: uninverted mouse\n        0xBF6DB: 'C8 00 00 00', # Viewport Scale:\
      \ fullscreen\n        0xBF6F3: '08 00 00 00', # Poly Depth: 8\n        0xBF6F7:\
      \ 'B0 48 01 00', # ??? (Scales with Poly Depth): 84144\n        0xBF707: '10\
      \ 00 00 00', # Max Samples: 16\n    }\n    \n    if len(sys.argv) > 1 and sys.argv[1]\
      \ == 'moderncontrols':\n        offset_payload = offset_patches_moderncontrols\
      \ | offset_patches_highquality\n    else:\n        offset_payload = offset_patches_highquality\n\
      \    \n    with open(lr_exe, \"r+b\") as file:\n        mm = mmap.mmap(file.fileno(),\
      \ map_end)\n        \n        for offset, data in offset_payload.items():\n\
      \            print(hex(offset), data)\n            mm[offset:offset + 4] = bytearray.fromhex(data)\n\
      \        mm.close()\n\nos.chdir(Path(__file__).parent.resolve())\n\npatch_lr_exe()\n"
    file: $GAMEDIR/drives/c/LASTRITE/lutris.patcher.py
- execute:
    command: 'cd "$GAMEDIR/drives/c/LASTRITE" && \

      rm DEFAULT.PLR; \

      python lutris.patcher.py $INPUT_CONTROLSCHEME'
    description: "Patching executable\u2026"
- write_config:
    data:
      cpu:
        cpu_cycles_protected: '74000'
        cpu_throttle: 'true'
      dosbox:
        automount: 'true'
      midi:
        mididevice: none
      mixer:
        compressor: 'off'
        reverb: large
      mouse:
        dos_mouse_immediate: 'true'
      sblaster:
        sbtype: sb16
    file: $GAMEDIR/dosbox-LASTRITE.conf
- write_file:
    content: '[autoexec]

      @echo off


      set PATH=%PATH%;U:\STRING25;U:\WBAT250


      imgmount E "imgmount/disc1/last_rites.iso" -fs iso -t cdrom


      C:

      if not exist \WBAT\LASTRITE.CFG goto initlastritecfg

      strings SERVERIP = read \WBAT\LASTRITE.CFG, 1 > NUL

      strings SERVERPORT = read \WBAT\LASTRITE.CFG, 2 > NUL

      strings MYSERVERPORT = read \WBAT\LASTRITE.CFG, 3 > NUL

      :postinitlastritecfg

      if ""=="%SERVERIP%" set SERVERIP=127.0.0.1

      if ""=="%SERVERPORT%" set SERVERPORT=8765

      if ""=="%MYSERVERPORT%" set MYSERVERPORT=8765

      if 1==%RUNSETUP% goto setup

      goto run

      exit /b


      :initlastritecfg

      echo 127.0.0.1 > \WBAT\LASTRITE.CFG

      echo 8765 >> \WBAT\LASTRITE.CFG

      echo 8765 >> \WBAT\LASTRITE.CFG

      goto postinitlastritecfg

      exit /b


      :setup

      cd \LASTRITE

      SETUP.EXE

      exit /b


      :run

      mixer master 50 /noshow

      if 1==%RUNCLIENT% goto runclient

      if 1==%RUNSERVER% goto runserver

      cd \LASTRITE

      LR.EXE

      exit /b


      :runclient

      cd \WBAT

      wbat cls ! text 1,1 (white on red) :multi-title

      call w.bat box :clientconnect-box

      if errorlevel 100 exit /b

      if errorlevel 2 goto clientdefaults

      :clientretry

      ipxnet connect %SERVERIP% %SERVERPORT% > \WBAT\IPXNET.TMP

      strings IPXNETSTATUS = read \WBAT\IPXNET.TMP, 3 > NUL

      strings IPXNETSTATUS = findc %IPXNETSTATUS%, connected

      if "0"=="%IPXNETSTATUS%" goto clientfail

      set IPXNETSTATUS=

      copy NUL \WBAT\IPXNET.TMP > NUL

      echo %SERVERIP% > \WBAT\LASTRITE.CFG

      echo %SERVERPORT% >> \WBAT\LASTRITE.CFG

      echo %MYSERVERPORT% >> \WBAT\LASTRITE.CFG

      wbat box :clientsuccess-box #1,8

      cd \LASTRITE

      LR.EXE

      exit /b


      :clientdefaults

      set SERVERIP=127.0.0.1

      set SERVERPORT=8765

      goto runclient

      exit /b


      :clientfail

      set IPXNETSTATUS=

      copy NUL \WBAT\IPXNET.TMP > NUL

      wbat box :clientfail-box

      if errorlevel 100 exit /b

      if errorlevel 2 goto runclient

      goto clientretry

      exit /b


      :runserver

      cd \WBAT

      wbat cls ! text 1,1 (white on red) :multi-title

      call w.bat box :serverconnect-box

      if errorlevel 100 exit /b

      if errorlevel 2 goto serverdefaults

      :serverretry

      ipxnet startserver %MYSERVERPORT% > \WBAT\IPXNET.TMP

      strings IPXNETSTATUS = read \WBAT\IPXNET.TMP, 3 > NUL

      strings IPXNETSTATUS = findc %IPXNETSTATUS%, started

      if "0"=="%IPXNETSTATUS%" goto serverfail

      set IPXNETSTATUS=

      copy NUL \WBAT\IPXNET.TMP > NUL

      echo %SERVERIP% > \WBAT\LASTRITE.CFG

      echo %SERVERPORT% >> \WBAT\LASTRITE.CFG

      echo %MYSERVERPORT% >> \WBAT\LASTRITE.CFG

      wbat box :serversuccess-box #1,8

      cd \LASTRITE

      LR.EXE

      exit /b


      :serverdefaults

      set MYSERVERPORT=8765

      goto runserver

      exit /b


      :serverfail

      set IPXNETSTATUS=

      copy NUL \WBAT\IPXNET.TMP > NUL

      wbat box :serverfail-box

      if errorlevel 100 exit /b

      if errorlevel 2 goto runserver

      goto serverretry

      exit /b

      '
    file: $GAMEDIR/dosbox-LASTRITE.conf
    mode: a
- write_file:
    content: '[color]

      Screen=+white on cyan

      BoxHi=+blue on +white

      BoxTitle=+white on red

      '
    file: $GAMEDIR/drives/u/WBAT250/WBAT.INI
- execute:
    command: sed -i -n -z 's/\r*\n/\r\n/g;p' "$GAMEDIR/drives/u/WBAT250/WBAT.INI"
    description: "Converting WBAT.INI file to DOS/Windows line feed\u2026"
- write_file:
    content: ":multi-title\n  Last Rites multiplayer                             \
      \                             \n:\n\n:clientconnect-box \"Connect to Host\"\
      \ [x]\n\nPlease input ~server details~:       \n\n IP address\n (or hostname):\
      \ [$ serverip,255,!]\n\n          Port: [$ serverport,5]\n\n[ Confirm ] [ Defaults\
      \ ]\n:\n\n:clientfail-box \"Connect to Host\" [x]\n\nConnection to         \
      \             \n\n ~%SERVERIP%~:~%SERVERPORT%~\n\nhas ~failed~.\n\n[ Retry ]\
      \ [ Adjust ]\n:\n\n:clientsuccess-box \"Connect to Host\" [x]\n\nConnection\
      \ to                      \n\n ~%SERVERIP%~:~%SERVERPORT%~\n \nhas ~succeeded~.\n\
      \n[ Continue ] (#?seconds)\n:\n\n:serverconnect-box \"Host a server\" [x]\n\n\
      Please input ~server details~:       \n\n          Port: [$ myserverport,5]\n\
      \n[ Confirm ] [ Defaults ]\n:\n\n:serverfail-box \"Host a server\" [x]\n\nOutgoing\
      \ connection from           \n\n port ~%MYSERVERPORT%~\n \nhas ~failed~.\n\n\
      Try a port number above \"1024\".\n\n[ Retry ] [ Adjust ]\n:\n\n:serversuccess-box\
      \ \"Host a server\" [x]\n\nOutgoing connection from           \n\n port ~%MYSERVERPORT%~\n\
      \ \nhas ~succeeded~.\n\n[ Continue ] (#?seconds)\n:\n"
    file: $GAMEDIR/drives/c/WBAT/WBAT.TXT
- execute:
    command: sed -i -n -z 's/\n/\r\n/g;p' "$GAMEDIR/drives/c/WBAT/WBAT.TXT"
    description: "Converting WBAT.TXT file to DOS/Windows line feed\u2026"
description: ''
game_slug: last-rites
gogslug: retro_shooter_rampage_bundle
humblestoreid: ''
installer_slug: last-rites-gog
name: Last Rites
notes: "Fixes:\r\n- Multiplayer support over UDP (IPX emulation)\r\n- Modern control\
  \ scheme (optional)\r\n- Graphical settings optimised\r\n\r\nAdditional controls\
  \ (not listed in-game):\r\n- [\uA7302]\tScanner off/on\r\n- [\uA7303]\tHeadlamp\
  \ off/on\r\n- [\uA7304]\tVirtual Head off/on\r\n- [\uA7305]\tVirtual Head Y-Flip\
  \ off/on (mouse inversion)\r\n- [\uA7306]\tAutorun off/on\r\n- [\uA73010]\tLoad\
  \ last save\r\n- [\uA73012]\tPause\r\n- [-]\tViewport Scale decrease\r\n- [=]\t\
  Viewport Scale increase\r\n\r\nMultiplayer setup:\r\n\tThe Host may need to \u201C\
  open\u201D the following inbound port within their router\u2019s firewall settings\
  \ (port forwarding):\r\n\t- Service name: DOSBOX IPX\r\n\t- Protocol: UDP\r\n\t\
  - Port number: 8765"
runner: dosbox
script:
  dosbox:
    fullscreen: true
  files:
  - installer_gog: 'N/A:Please select the GOG installer for this game:'
  - string25: https://web.archive.org/web/20240410024741/http://cd.textfiles.com/simtel/stmsdos9709/disk2/DISC2/BATCHUTL/STRING25.ZIP
  - wbat250: https://web.archive.org/web/20150416044452/https://www.horstmuc.de/int/wbat250.zip
  game:
    launch_configs:
    - args: --set "ipx ipx=true" -c "set RUNSERVER=1" -conf "dosbox-LASTRITE.conf"
      name: "Multiplayer \u2014 Host"
    - args: --set "ipx ipx=true" -c "set RUNCLIENT=1" -conf "dosbox-LASTRITE.conf"
      name: "Multiplayer \u2014 Join"
    main_file: dosbox-LASTRITE.conf
    working_dir: $GAMEDIR
  installer:
  - input_menu:
      description: "Choose the game\u2019s default control scheme:"
      id: CONTROLSCHEME
      options:
      - moderncontrols: "Modern (\u1D21\u2009\u1D00\u2009\uA731\u2009\u1D05)"
      - classiccontrols: "Classic (\u2191\u2009\u2190\u2009\u2192\u2009\u2193)"
      preselect: moderncontrols
  - extract:
      dst: $CACHE/installer_gog
      file: $installer_gog
      format: gog
  - merge:
      dst: $GAMEDIR/imgmount/disc1
      src: $CACHE/installer_gog/game/cd/last_rites.iso
  - merge:
      dst: $GAMEDIR/drives/c/LASTRITE
      src: $CACHE/installer_gog/game/LR
  - extract:
      dst: $CACHE/wbat250
      file: $wbat250
  - merge:
      dst: $GAMEDIR/drives/u/WBAT250
      src: $CACHE/wbat250/W.BAT
  - merge:
      dst: $GAMEDIR/drives/u/WBAT250
      src: $CACHE/wbat250/WBAT.COM
  - extract:
      dst: $CACHE/string25
      file: $string25
  - merge:
      dst: $GAMEDIR/drives/u/STRING25
      src: $CACHE/string25
  - write_file:
      content: "#!/usr/bin/env python3\n\nimport mmap\nimport os\nimport shutil\n\
        import sys\nfrom pathlib import Path\n\ndef patch_lr_exe():\n    lr_exe_bak\
        \ = Path('LR.EXE.bak')\n    lr_exe = Path('LR.EXE')\n    \n    try:\n    \
        \    if lr_exe_bak.is_file():\n            shutil.copy2(lr_exe_bak,lr_exe)\n\
        \        elif lr_exe.is_file():\n            shutil.copy2(lr_exe,lr_exe_bak)\n\
        \        else:\n            raise FileNotFoundError('Neither LR.EXE nor LR.EXE.bak\
        \ found.')\n    except FileNotFoundError as e:\n        print(e)\n       \
        \ sys.exit()\n    \n    map_end: int = 0xBF70E # 784142\n    \n    offset_patches_moderncontrols:\
        \ dict = {\n        0xBF658: '10 00 00 00', # Decrease Tech Level: q\n   \
        \     0xBF65C: '12 00 00 00', # Increase Tech Level: e\n        0xBF690: '21\
        \ 00 00 00', # Open/Activate: f\n        0xBF694: '11 00 00 00', # Move Forwards:\
        \ w\n        0xBF698: '1F 00 00 00', # Move Backwards: s\n        0xBF69C:\
        \ '2A 00 00 00', # Run: LShift\n        0xBF6A8: '1E 00 00 00', # Strafe Left:\
        \ a\n        0xBF6AC: '20 00 00 00', # Strafe Right: d\n        0xBF6B0: '39\
        \ 00 00 00', # Jump: Space\n        0xBF6C4: '04 00 00 00', # Right Mouse\
        \ Button: jump\n    }\n    \n    offset_patches_highquality: dict = {\n  \
        \      0xBF6CF: '00 00 01 01', # F buttons: uninverted mouse\n        0xBF6DB:\
        \ 'C8 00 00 00', # Viewport Scale: fullscreen\n        0xBF6F3: '08 00 00\
        \ 00', # Poly Depth: 8\n        0xBF6F7: 'B0 48 01 00', # ??? (Scales with\
        \ Poly Depth): 84144\n        0xBF707: '10 00 00 00', # Max Samples: 16\n\
        \    }\n    \n    if len(sys.argv) > 1 and sys.argv[1] == 'moderncontrols':\n\
        \        offset_payload = offset_patches_moderncontrols | offset_patches_highquality\n\
        \    else:\n        offset_payload = offset_patches_highquality\n    \n  \
        \  with open(lr_exe, \"r+b\") as file:\n        mm = mmap.mmap(file.fileno(),\
        \ map_end)\n        \n        for offset, data in offset_payload.items():\n\
        \            print(hex(offset), data)\n            mm[offset:offset + 4] =\
        \ bytearray.fromhex(data)\n        mm.close()\n\nos.chdir(Path(__file__).parent.resolve())\n\
        \npatch_lr_exe()\n"
      file: $GAMEDIR/drives/c/LASTRITE/lutris.patcher.py
  - execute:
      command: 'cd "$GAMEDIR/drives/c/LASTRITE" && \

        rm DEFAULT.PLR; \

        python lutris.patcher.py $INPUT_CONTROLSCHEME'
      description: "Patching executable\u2026"
  - write_config:
      data:
        cpu:
          cpu_cycles_protected: '74000'
          cpu_throttle: 'true'
        dosbox:
          automount: 'true'
        midi:
          mididevice: none
        mixer:
          compressor: 'off'
          reverb: large
        mouse:
          dos_mouse_immediate: 'true'
        sblaster:
          sbtype: sb16
      file: $GAMEDIR/dosbox-LASTRITE.conf
  - write_file:
      content: '[autoexec]

        @echo off


        set PATH=%PATH%;U:\STRING25;U:\WBAT250


        imgmount E "imgmount/disc1/last_rites.iso" -fs iso -t cdrom


        C:

        if not exist \WBAT\LASTRITE.CFG goto initlastritecfg

        strings SERVERIP = read \WBAT\LASTRITE.CFG, 1 > NUL

        strings SERVERPORT = read \WBAT\LASTRITE.CFG, 2 > NUL

        strings MYSERVERPORT = read \WBAT\LASTRITE.CFG, 3 > NUL

        :postinitlastritecfg

        if ""=="%SERVERIP%" set SERVERIP=127.0.0.1

        if ""=="%SERVERPORT%" set SERVERPORT=8765

        if ""=="%MYSERVERPORT%" set MYSERVERPORT=8765

        if 1==%RUNSETUP% goto setup

        goto run

        exit /b


        :initlastritecfg

        echo 127.0.0.1 > \WBAT\LASTRITE.CFG

        echo 8765 >> \WBAT\LASTRITE.CFG

        echo 8765 >> \WBAT\LASTRITE.CFG

        goto postinitlastritecfg

        exit /b


        :setup

        cd \LASTRITE

        SETUP.EXE

        exit /b


        :run

        mixer master 50 /noshow

        if 1==%RUNCLIENT% goto runclient

        if 1==%RUNSERVER% goto runserver

        cd \LASTRITE

        LR.EXE

        exit /b


        :runclient

        cd \WBAT

        wbat cls ! text 1,1 (white on red) :multi-title

        call w.bat box :clientconnect-box

        if errorlevel 100 exit /b

        if errorlevel 2 goto clientdefaults

        :clientretry

        ipxnet connect %SERVERIP% %SERVERPORT% > \WBAT\IPXNET.TMP

        strings IPXNETSTATUS = read \WBAT\IPXNET.TMP, 3 > NUL

        strings IPXNETSTATUS = findc %IPXNETSTATUS%, connected

        if "0"=="%IPXNETSTATUS%" goto clientfail

        set IPXNETSTATUS=

        copy NUL \WBAT\IPXNET.TMP > NUL

        echo %SERVERIP% > \WBAT\LASTRITE.CFG

        echo %SERVERPORT% >> \WBAT\LASTRITE.CFG

        echo %MYSERVERPORT% >> \WBAT\LASTRITE.CFG

        wbat box :clientsuccess-box #1,8

        cd \LASTRITE

        LR.EXE

        exit /b


        :clientdefaults

        set SERVERIP=127.0.0.1

        set SERVERPORT=8765

        goto runclient

        exit /b


        :clientfail

        set IPXNETSTATUS=

        copy NUL \WBAT\IPXNET.TMP > NUL

        wbat box :clientfail-box

        if errorlevel 100 exit /b

        if errorlevel 2 goto runclient

        goto clientretry

        exit /b


        :runserver

        cd \WBAT

        wbat cls ! text 1,1 (white on red) :multi-title

        call w.bat box :serverconnect-box

        if errorlevel 100 exit /b

        if errorlevel 2 goto serverdefaults

        :serverretry

        ipxnet startserver %MYSERVERPORT% > \WBAT\IPXNET.TMP

        strings IPXNETSTATUS = read \WBAT\IPXNET.TMP, 3 > NUL

        strings IPXNETSTATUS = findc %IPXNETSTATUS%, started

        if "0"=="%IPXNETSTATUS%" goto serverfail

        set IPXNETSTATUS=

        copy NUL \WBAT\IPXNET.TMP > NUL

        echo %SERVERIP% > \WBAT\LASTRITE.CFG

        echo %SERVERPORT% >> \WBAT\LASTRITE.CFG

        echo %MYSERVERPORT% >> \WBAT\LASTRITE.CFG

        wbat box :serversuccess-box #1,8

        cd \LASTRITE

        LR.EXE

        exit /b


        :serverdefaults

        set MYSERVERPORT=8765

        goto runserver

        exit /b


        :serverfail

        set IPXNETSTATUS=

        copy NUL \WBAT\IPXNET.TMP > NUL

        wbat box :serverfail-box

        if errorlevel 100 exit /b

        if errorlevel 2 goto runserver

        goto serverretry

        exit /b

        '
      file: $GAMEDIR/dosbox-LASTRITE.conf
      mode: a
  - write_file:
      content: '[color]

        Screen=+white on cyan

        BoxHi=+blue on +white

        BoxTitle=+white on red

        '
      file: $GAMEDIR/drives/u/WBAT250/WBAT.INI
  - execute:
      command: sed -i -n -z 's/\r*\n/\r\n/g;p' "$GAMEDIR/drives/u/WBAT250/WBAT.INI"
      description: "Converting WBAT.INI file to DOS/Windows line feed\u2026"
  - write_file:
      content: ":multi-title\n  Last Rites multiplayer                           \
        \                               \n:\n\n:clientconnect-box \"Connect to Host\"\
        \ [x]\n\nPlease input ~server details~:       \n\n IP address\n (or hostname):\
        \ [$ serverip,255,!]\n\n          Port: [$ serverport,5]\n\n[ Confirm ] [\
        \ Defaults ]\n:\n\n:clientfail-box \"Connect to Host\" [x]\n\nConnection to\
        \                      \n\n ~%SERVERIP%~:~%SERVERPORT%~\n\nhas ~failed~.\n\
        \n[ Retry ] [ Adjust ]\n:\n\n:clientsuccess-box \"Connect to Host\" [x]\n\n\
        Connection to                      \n\n ~%SERVERIP%~:~%SERVERPORT%~\n \nhas\
        \ ~succeeded~.\n\n[ Continue ] (#?seconds)\n:\n\n:serverconnect-box \"Host\
        \ a server\" [x]\n\nPlease input ~server details~:       \n\n          Port:\
        \ [$ myserverport,5]\n\n[ Confirm ] [ Defaults ]\n:\n\n:serverfail-box \"\
        Host a server\" [x]\n\nOutgoing connection from           \n\n port ~%MYSERVERPORT%~\n\
        \ \nhas ~failed~.\n\nTry a port number above \"1024\".\n\n[ Retry ] [ Adjust\
        \ ]\n:\n\n:serversuccess-box \"Host a server\" [x]\n\nOutgoing connection\
        \ from           \n\n port ~%MYSERVERPORT%~\n \nhas ~succeeded~.\n\n[ Continue\
        \ ] (#?seconds)\n:\n"
      file: $GAMEDIR/drives/c/WBAT/WBAT.TXT
  - execute:
      command: sed -i -n -z 's/\n/\r\n/g;p' "$GAMEDIR/drives/c/WBAT/WBAT.TXT"
      description: "Converting WBAT.TXT file to DOS/Windows line feed\u2026"
slug: last-rites-gog
steamid: 814610
version: GOG
year: 1997
{
  "game_slug": "last-rites",
  "version": "GOG",
  "description": "",
  "notes": "Fixes:\r\n- Multiplayer support over UDP (IPX emulation)\r\n- Modern control scheme (optional)\r\n- Graphical settings optimised\r\n\r\nAdditional controls (not listed in-game):\r\n- [\ua7302]\tScanner off/on\r\n- [\ua7303]\tHeadlamp off/on\r\n- [\ua7304]\tVirtual Head off/on\r\n- [\ua7305]\tVirtual Head Y-Flip off/on (mouse inversion)\r\n- [\ua7306]\tAutorun off/on\r\n- [\ua73010]\tLoad last save\r\n- [\ua73012]\tPause\r\n- [-]\tViewport Scale decrease\r\n- [=]\tViewport Scale increase\r\n\r\nMultiplayer setup:\r\n\tThe Host may need to \u201copen\u201d the following inbound port within their router\u2019s firewall settings (port forwarding):\r\n\t- Service name: DOSBOX IPX\r\n\t- Protocol: UDP\r\n\t- Port number: 8765",
  "name": "Last Rites",
  "year": 1997,
  "steamid": 814610,
  "gogslug": "retro_shooter_rampage_bundle",
  "humblestoreid": "",
  "runner": "dosbox",
  "slug": "last-rites-gog",
  "installer_slug": "last-rites-gog",
  "script": {
    "dosbox": {
      "fullscreen": true
    },
    "files": [
      {
        "installer_gog": "N/A:Please select the GOG installer for this game:"
      },
      {
        "string25": "https://web.archive.org/web/20240410024741/http://cd.textfiles.com/simtel/stmsdos9709/disk2/DISC2/BATCHUTL/STRING25.ZIP"
      },
      {
        "wbat250": "https://web.archive.org/web/20150416044452/https://www.horstmuc.de/int/wbat250.zip"
      }
    ],
    "game": {
      "launch_configs": [
        {
          "args": "--set \"ipx ipx=true\" -c \"set RUNSERVER=1\" -conf \"dosbox-LASTRITE.conf\"",
          "name": "Multiplayer \u2014 Host"
        },
        {
          "args": "--set \"ipx ipx=true\" -c \"set RUNCLIENT=1\" -conf \"dosbox-LASTRITE.conf\"",
          "name": "Multiplayer \u2014 Join"
        }
      ],
      "main_file": "dosbox-LASTRITE.conf",
      "working_dir": "$GAMEDIR"
    },
    "installer": [
      {
        "input_menu": {
          "description": "Choose the game\u2019s default control scheme:",
          "id": "CONTROLSCHEME",
          "options": [
            {
              "moderncontrols": "Modern (\u1d21\u2009\u1d00\u2009\ua731\u2009\u1d05)"
            },
            {
              "classiccontrols": "Classic (\u2191\u2009\u2190\u2009\u2192\u2009\u2193)"
            }
          ],
          "preselect": "moderncontrols"
        }
      },
      {
        "extract": {
          "dst": "$CACHE/installer_gog",
          "file": "$installer_gog",
          "format": "gog"
        }
      },
      {
        "merge": {
          "dst": "$GAMEDIR/imgmount/disc1",
          "src": "$CACHE/installer_gog/game/cd/last_rites.iso"
        }
      },
      {
        "merge": {
          "dst": "$GAMEDIR/drives/c/LASTRITE",
          "src": "$CACHE/installer_gog/game/LR"
        }
      },
      {
        "extract": {
          "dst": "$CACHE/wbat250",
          "file": "$wbat250"
        }
      },
      {
        "merge": {
          "dst": "$GAMEDIR/drives/u/WBAT250",
          "src": "$CACHE/wbat250/W.BAT"
        }
      },
      {
        "merge": {
          "dst": "$GAMEDIR/drives/u/WBAT250",
          "src": "$CACHE/wbat250/WBAT.COM"
        }
      },
      {
        "extract": {
          "dst": "$CACHE/string25",
          "file": "$string25"
        }
      },
      {
        "merge": {
          "dst": "$GAMEDIR/drives/u/STRING25",
          "src": "$CACHE/string25"
        }
      },
      {
        "write_file": {
          "content": "#!/usr/bin/env python3\n\nimport mmap\nimport os\nimport shutil\nimport sys\nfrom pathlib import Path\n\ndef patch_lr_exe():\n    lr_exe_bak = Path('LR.EXE.bak')\n    lr_exe = Path('LR.EXE')\n    \n    try:\n        if lr_exe_bak.is_file():\n            shutil.copy2(lr_exe_bak,lr_exe)\n        elif lr_exe.is_file():\n            shutil.copy2(lr_exe,lr_exe_bak)\n        else:\n            raise FileNotFoundError('Neither LR.EXE nor LR.EXE.bak found.')\n    except FileNotFoundError as e:\n        print(e)\n        sys.exit()\n    \n    map_end: int = 0xBF70E # 784142\n    \n    offset_patches_moderncontrols: dict = {\n        0xBF658: '10 00 00 00', # Decrease Tech Level: q\n        0xBF65C: '12 00 00 00', # Increase Tech Level: e\n        0xBF690: '21 00 00 00', # Open/Activate: f\n        0xBF694: '11 00 00 00', # Move Forwards: w\n        0xBF698: '1F 00 00 00', # Move Backwards: s\n        0xBF69C: '2A 00 00 00', # Run: LShift\n        0xBF6A8: '1E 00 00 00', # Strafe Left: a\n        0xBF6AC: '20 00 00 00', # Strafe Right: d\n        0xBF6B0: '39 00 00 00', # Jump: Space\n        0xBF6C4: '04 00 00 00', # Right Mouse Button: jump\n    }\n    \n    offset_patches_highquality: dict = {\n        0xBF6CF: '00 00 01 01', # F buttons: uninverted mouse\n        0xBF6DB: 'C8 00 00 00', # Viewport Scale: fullscreen\n        0xBF6F3: '08 00 00 00', # Poly Depth: 8\n        0xBF6F7: 'B0 48 01 00', # ??? (Scales with Poly Depth): 84144\n        0xBF707: '10 00 00 00', # Max Samples: 16\n    }\n    \n    if len(sys.argv) > 1 and sys.argv[1] == 'moderncontrols':\n        offset_payload = offset_patches_moderncontrols | offset_patches_highquality\n    else:\n        offset_payload = offset_patches_highquality\n    \n    with open(lr_exe, \"r+b\") as file:\n        mm = mmap.mmap(file.fileno(), map_end)\n        \n        for offset, data in offset_payload.items():\n            print(hex(offset), data)\n            mm[offset:offset + 4] = bytearray.fromhex(data)\n        mm.close()\n\nos.chdir(Path(__file__).parent.resolve())\n\npatch_lr_exe()\n",
          "file": "$GAMEDIR/drives/c/LASTRITE/lutris.patcher.py"
        }
      },
      {
        "execute": {
          "command": "cd \"$GAMEDIR/drives/c/LASTRITE\" && \\\nrm DEFAULT.PLR; \\\npython lutris.patcher.py $INPUT_CONTROLSCHEME",
          "description": "Patching executable\u2026"
        }
      },
      {
        "write_config": {
          "data": {
            "cpu": {
              "cpu_cycles_protected": "74000",
              "cpu_throttle": "true"
            },
            "dosbox": {
              "automount": "true"
            },
            "midi": {
              "mididevice": "none"
            },
            "mixer": {
              "compressor": "off",
              "reverb": "large"
            },
            "mouse": {
              "dos_mouse_immediate": "true"
            },
            "sblaster": {
              "sbtype": "sb16"
            }
          },
          "file": "$GAMEDIR/dosbox-LASTRITE.conf"
        }
      },
      {
        "write_file": {
          "content": "[autoexec]\n@echo off\n\nset PATH=%PATH%;U:\\STRING25;U:\\WBAT250\n\nimgmount E \"imgmount/disc1/last_rites.iso\" -fs iso -t cdrom\n\nC:\nif not exist \\WBAT\\LASTRITE.CFG goto initlastritecfg\nstrings SERVERIP = read \\WBAT\\LASTRITE.CFG, 1 > NUL\nstrings SERVERPORT = read \\WBAT\\LASTRITE.CFG, 2 > NUL\nstrings MYSERVERPORT = read \\WBAT\\LASTRITE.CFG, 3 > NUL\n:postinitlastritecfg\nif \"\"==\"%SERVERIP%\" set SERVERIP=127.0.0.1\nif \"\"==\"%SERVERPORT%\" set SERVERPORT=8765\nif \"\"==\"%MYSERVERPORT%\" set MYSERVERPORT=8765\nif 1==%RUNSETUP% goto setup\ngoto run\nexit /b\n\n:initlastritecfg\necho 127.0.0.1 > \\WBAT\\LASTRITE.CFG\necho 8765 >> \\WBAT\\LASTRITE.CFG\necho 8765 >> \\WBAT\\LASTRITE.CFG\ngoto postinitlastritecfg\nexit /b\n\n:setup\ncd \\LASTRITE\nSETUP.EXE\nexit /b\n\n:run\nmixer master 50 /noshow\nif 1==%RUNCLIENT% goto runclient\nif 1==%RUNSERVER% goto runserver\ncd \\LASTRITE\nLR.EXE\nexit /b\n\n:runclient\ncd \\WBAT\nwbat cls ! text 1,1 (white on red) :multi-title\ncall w.bat box :clientconnect-box\nif errorlevel 100 exit /b\nif errorlevel 2 goto clientdefaults\n:clientretry\nipxnet connect %SERVERIP% %SERVERPORT% > \\WBAT\\IPXNET.TMP\nstrings IPXNETSTATUS = read \\WBAT\\IPXNET.TMP, 3 > NUL\nstrings IPXNETSTATUS = findc %IPXNETSTATUS%, connected\nif \"0\"==\"%IPXNETSTATUS%\" goto clientfail\nset IPXNETSTATUS=\ncopy NUL \\WBAT\\IPXNET.TMP > NUL\necho %SERVERIP% > \\WBAT\\LASTRITE.CFG\necho %SERVERPORT% >> \\WBAT\\LASTRITE.CFG\necho %MYSERVERPORT% >> \\WBAT\\LASTRITE.CFG\nwbat box :clientsuccess-box #1,8\ncd \\LASTRITE\nLR.EXE\nexit /b\n\n:clientdefaults\nset SERVERIP=127.0.0.1\nset SERVERPORT=8765\ngoto runclient\nexit /b\n\n:clientfail\nset IPXNETSTATUS=\ncopy NUL \\WBAT\\IPXNET.TMP > NUL\nwbat box :clientfail-box\nif errorlevel 100 exit /b\nif errorlevel 2 goto runclient\ngoto clientretry\nexit /b\n\n:runserver\ncd \\WBAT\nwbat cls ! text 1,1 (white on red) :multi-title\ncall w.bat box :serverconnect-box\nif errorlevel 100 exit /b\nif errorlevel 2 goto serverdefaults\n:serverretry\nipxnet startserver %MYSERVERPORT% > \\WBAT\\IPXNET.TMP\nstrings IPXNETSTATUS = read \\WBAT\\IPXNET.TMP, 3 > NUL\nstrings IPXNETSTATUS = findc %IPXNETSTATUS%, started\nif \"0\"==\"%IPXNETSTATUS%\" goto serverfail\nset IPXNETSTATUS=\ncopy NUL \\WBAT\\IPXNET.TMP > NUL\necho %SERVERIP% > \\WBAT\\LASTRITE.CFG\necho %SERVERPORT% >> \\WBAT\\LASTRITE.CFG\necho %MYSERVERPORT% >> \\WBAT\\LASTRITE.CFG\nwbat box :serversuccess-box #1,8\ncd \\LASTRITE\nLR.EXE\nexit /b\n\n:serverdefaults\nset MYSERVERPORT=8765\ngoto runserver\nexit /b\n\n:serverfail\nset IPXNETSTATUS=\ncopy NUL \\WBAT\\IPXNET.TMP > NUL\nwbat box :serverfail-box\nif errorlevel 100 exit /b\nif errorlevel 2 goto runserver\ngoto serverretry\nexit /b\n",
          "file": "$GAMEDIR/dosbox-LASTRITE.conf",
          "mode": "a"
        }
      },
      {
        "write_file": {
          "content": "[color]\nScreen=+white on cyan\nBoxHi=+blue on +white\nBoxTitle=+white on red\n",
          "file": "$GAMEDIR/drives/u/WBAT250/WBAT.INI"
        }
      },
      {
        "execute": {
          "command": "sed -i -n -z 's/\\r*\\n/\\r\\n/g;p' \"$GAMEDIR/drives/u/WBAT250/WBAT.INI\"",
          "description": "Converting WBAT.INI file to DOS/Windows line feed\u2026"
        }
      },
      {
        "write_file": {
          "content": ":multi-title\n  Last Rites multiplayer                                                          \n:\n\n:clientconnect-box \"Connect to Host\" [x]\n\nPlease input ~server details~:       \n\n IP address\n (or hostname): [$ serverip,255,!]\n\n          Port: [$ serverport,5]\n\n[ Confirm ] [ Defaults ]\n:\n\n:clientfail-box \"Connect to Host\" [x]\n\nConnection to                      \n\n ~%SERVERIP%~:~%SERVERPORT%~\n\nhas ~failed~.\n\n[ Retry ] [ Adjust ]\n:\n\n:clientsuccess-box \"Connect to Host\" [x]\n\nConnection to                      \n\n ~%SERVERIP%~:~%SERVERPORT%~\n \nhas ~succeeded~.\n\n[ Continue ] (#?seconds)\n:\n\n:serverconnect-box \"Host a server\" [x]\n\nPlease input ~server details~:       \n\n          Port: [$ myserverport,5]\n\n[ Confirm ] [ Defaults ]\n:\n\n:serverfail-box \"Host a server\" [x]\n\nOutgoing connection from           \n\n port ~%MYSERVERPORT%~\n \nhas ~failed~.\n\nTry a port number above \"1024\".\n\n[ Retry ] [ Adjust ]\n:\n\n:serversuccess-box \"Host a server\" [x]\n\nOutgoing connection from           \n\n port ~%MYSERVERPORT%~\n \nhas ~succeeded~.\n\n[ Continue ] (#?seconds)\n:\n",
          "file": "$GAMEDIR/drives/c/WBAT/WBAT.TXT"
        }
      },
      {
        "execute": {
          "command": "sed -i -n -z 's/\\n/\\r\\n/g;p' \"$GAMEDIR/drives/c/WBAT/WBAT.TXT\"",
          "description": "Converting WBAT.TXT file to DOS/Windows line feed\u2026"
        }
      }
    ]
  }
}
Back to game