csgo-osx-linux icon indicating copy to clipboard operation
csgo-osx-linux copied to clipboard

Game freezes (crash) when loading annotation saved under Linux

Open vadcx opened this issue 2 years ago • 7 comments

Your system information

Operating System Version:
"Manjaro Linux" (64 bit)
Kernel Name: Linux
Kernel Version: 6.11.2-4-MANJARO
X Server Vendor: The X.Org Foundation
X Server Release: 12101014
X Window Manager: KWin
Steam Runtime Version: steam-runtime_0.20241024.105847

Details:

Update 2026-01-21:

Looks like only the empty UUID bug is left to be solved, as bumped below by Kishiko.

Original report below:

Confirmed by a friend (dust2 file), doesn't seem to be CRLF related?

Game crashes/freezes when trying to load the annotation file

Steps for reproducing this issue:

  1. Linux to create the file; Windows OR Linux to load the file (confirmed)
  2. .../game/csgo/annotations/dust2_grenade_test.txt / crashy_office.txt
  3. sv_allow_annotations 1;
  4. annotation_create grenade "crashy annotation";
  5. annotation_save "crashy_office"
  6. annotation_load "crashy_office"
  7. Freeze.

Pwns the window manager pretty hard too under KDE+X11.

crashy_office.txt dust2_grenade_test.txt

vadcx avatar Nov 14 '24 21:11 vadcx

+also on Steam Deck (Steam OS).

KDany avatar Nov 15 '24 20:11 KDany

Having the same issue : (

someStranger8 avatar Nov 16 '24 23:11 someStranger8

TL;DR: it looks like both none-CRLF-files as well as missing Node-Ids in annotation-files created under linux result in crashes.

easily reproduced on arch, but i'm not so sure it's not at all CRLF-related:

this is an empty annotation-file, kindly provided by a windows-user: mirage_win.txt i can load this on linux without crashing the game.

this is an empty annotation-file, created by me on arch-linux: mirage.txt other than LF instead of CRLF it is exactly the same as the file created on windows. loading this on linux crashes my game.

this is the same (linux-)file after converting LF to CRLF using the unix2dos commandline-utility: mirage_crlf.txt i can load this file without crashing my game.

curiously, the CRLF-file provided in the OP (dust2_grenade_test.txt) will crash my game. it does however have different content than crashy_office.txt, so i've done some more testing:

i put myself in position for a mirage window-smoke and created an annotation. i got my exact position using getpos and had a windows-user create the same annotation using setpos.

here's the window-smoke created in windows, loading this does not crash my game: mirage_win_content.txt

here it is created on linux, with LF replaced by CRLF using unix2dos, loading this does crash my game: mirage_content_crlf.txt

a quick diff on the two files reveals differences in the following lines:

  • 11: the field "Id" of MapAnnotationNode0 has content on windows but none on linux
  • 14: the content of the field "Angles" of MapAnnotationsNode0 differes from windows to linux
  • 46: again the field "Id", MapAnnotationNode1 has content on windows but none on linux
  • 71: the field "MasterNodeId" of MapAnnotationNode1 has content on windows but none on linux

while i'm not sure why the angles are different in the two files (maybe someone moved their mouse or something) i would assume it to be more likely the missing Ids are responsible for the crash, along with "missing" CRs.

valve pls fix <3

rootgordon avatar Jan 05 '25 13:01 rootgordon

kishiko_de_dust2.txt created on Linux (LF-only newlines, no CRLF) with manually adjusted Id and MasterNodeId fields using copy pasted UUIDs from online generators:

  • Does not crash on load.

The unmodified file (as generated by annotation_save) with empty Id and MasterNodeId fields:

  • Does crash on load.

Testing rootgordon's mirage.txt:

  • Does not crash on load.

Seems like CRLF vs LF is no longer an issue, and the bug is simply the lack of UUID generation populating the appropriate fields on annotation_save

I also noted that: [ loading annotations, adding a new one, and then saving again ] reverts all Id and MasterNodeId fields to "" again, causing the file to crash the game on subsequent loads.

Kishiko73 avatar Jan 22 '26 15:01 Kishiko73

I wrote a small python script that fixes the ID issues by generating a new UUID and managing the MasterNodeId. The script is only tested on grenade nodes, but I think it should work fine for any node type.

You can either put it in the ./annotations/local/ directory or next to the .txt itself, as described in the script comments. The input_file and output_file strings can be edited to whatever you want. The output_file will contain correct values for the Id's and MasterNodeId's, and make it possible to be loaded.

The script can be ran by installing a recent version of python and running python3 script_name.py using your terminal within the scripts directory.

I hope this might help someone!

import uuid
import re

# This is the file the code will fix
# input_file will automatically append .txt
# You can also put the python script in the './annotations/local/' directory
# and change the input_file to "testGuide/testGuide"
input_file = "testGuide"
output_file = f"{input_file}_fixed.txt"

# Keep track of last node's UUID to use for MasterNodeId
last_id = None
current_id = None

with open(f"{input_file}.txt", "r") as f:
    lines = f.readlines()

new_lines = []
for line in lines:
    # Match Id = "" lines
    if re.match(r'\s*Id\s*=\s*""', line):
        new_uuid = str(uuid.uuid4())
        last_id = current_id
        current_id = new_uuid
        new_lines.append(re.sub(r'""', f'"{new_uuid}"', line))
    # Match MasterNodeId = "" lines
    elif re.match(r'\s*MasterNodeId\s*=\s*""', line):
        if last_id is not None:
            new_lines.append(re.sub(r'""', f'"{last_id}"', line))
        else:
            # fallback: generate a new UUID if no previous id
            new_uuid = str(uuid.uuid4())
            new_lines.append(re.sub(r'""', f'"{new_uuid}"', line))
    else:
        new_lines.append(line)

with open(output_file, "w") as f:
    f.writelines(new_lines)

print(f"Finished! Fixed annotation file saved as {output_file}") 

ElgMoes avatar Mar 20 '26 02:03 ElgMoes

That python script fixed my issue. Why doesn't the Linux build write the UUIDs? I can't load the annotations with annotation_load either.

Fesiug avatar Apr 15 '26 20:04 Fesiug

I made @ElgMoes code into a proper script to make fixing files easier

Lolmerkat avatar Sep 08 '26 18:09 Lolmerkat