Misery 2.2.1 mod on Linux

Open
#2,215 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
cpp, linux, python
Domain
game-dev

Research direction

The report proposes an untested change to NET_PacketSizeLimit in src/xrCore/net_utils.h and a Python script that edits DDS headers under gamedata/textures, both unverified by the author. Start by reproducing one listed bug, such as the assaulter fence script or the class-switching failure, against the engine source. Done means each claimed fix is confirmed or rejected and the three bugs are triaged into separate issues.

Written by the indexing model from the issue text.

Description

Bug Call of Pripyat Mods Portability

Got the misery mod running natively on Linux Wayland(no X11) and thought it might be useful to share how to run it.

Here's an exact installation order:

  1. Extract vanilla COP 1.6.02 into the game directory
  2. Download and apply this fix to the engine:
diff --git a/src/xrCore/net_utils.h b/src/xrCore/net_utils.h
index 9aa23ac7b..3a20b1098 100644
--- a/src/xrCore/net_utils.h
+++ b/src/xrCore/net_utils.h
@@ -16,7 +16,7 @@ class shared_str;
 
 #pragma pack(push, 1)
 
-const u32 NET_PacketSizeLimit = 16 * 1024;
+const u32 NET_PacketSizeLimit = 128 * 1024;
 
 struct XRCORE_API IIniFileStream
 {
  1. Compile xr_3da with above fix and put it into bin/ directory of the game
  2. Extract misery's gamedata into the game directory
  3. Copy res/fsgame.ltx and res/gamedata/shaders from openxray into the game directory
  4. Run this script that renames all files to lowercase: python3 -c 'import os, sys; [print(f, "->", f.lower()) or os.rename(os.path.join(r, f), os.path.join(r, f.lower())) for r, d, fs in os.walk(sys.argv[1], topdown=False) for f in fs + d if f != f.lower()]' path/to/game
  5. Run this script that fixes freezing during the texture load(maybe it's just an intel arc quirk, dunno):
python3 -c '
import os, shutil, struct

os.makedirs("_dds_bak", exist_ok=True)
for r, _, fs in os.walk("gamedata/textures"):
    for f in fs:
        if not f.endswith(".dds"): 
            continue
        p = os.path.join(r, f)
        with open(p, "r+b") as fp:
            hdr = bytearray(fp.read(128))
            if len(hdr) >= 128 and hdr[:4] == b"DDS ":
                flags, h, w, pitch, depth, mips = struct.unpack("<IIIIII", hdr[8:32])
                if (flags & 0x20000) and mips == 0:
                    shutil.copy2(p, os.path.join("_dds_bak", f))
                    caps = struct.unpack("<I", hdr[108:112])[0]
                    flags &= ~0x20000
                    caps &= ~(0x400000 | 0x8)
                    struct.pack_into("<I", hdr, 8, flags)
                    struct.pack_into("<I", hdr, 108, caps)
                    fp.seek(0)
                    fp.write(hdr)
                    print("Repaired:", p)
'
  1. Run the game: ./bin/xr_3da -fsltx ./fsgame.ltx

Note: an engine and texture fixes are developed by llm. I have not really investigated whether they are correct, but at least I got the game working

Some bugs I noticed almost immediately:

  1. When you start playing as assaulter, a script that triggers animation that should get you over the fence does not work at all, so you have to go around of the building and find exit somewhere else.
  2. Fonts are blurry on HiDPI monitor(with scaling of 2). I guess that's a more general bug, not really related to the mod
  3. In-game class switching does not work at all. You can change class only by manually swapping gamedata files

I'll keep playing for now and check if there are more bugs

Dominant language
C++
Stars
3.6k
Forks
565
Avg merge
9h 54m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenXRay/xray-16

All issues in OpenXRay/xray-16

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.