-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeckops_uninstall.sh
More file actions
executable file
·2410 lines (2114 loc) · 89.8 KB
/
Copy pathdeckops_uninstall.sh
File metadata and controls
executable file
·2410 lines (2114 loc) · 89.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# deckops_uninstall.sh
RED='\033[0;31m'
YELLOW='\033[0;33m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
BOLD='\033[1m'
CLEAR='\033[0m'
info() { printf "${CYAN}${BOLD}[DeckOps]${CLEAR} %s\n" "$1"; }
success() { printf "${GREEN}${BOLD}[ OK ]${CLEAR} %s\n" "$1"; }
warn() { printf "${YELLOW}${BOLD}[ WARN ]${CLEAR} %s\n" "$1"; }
skip() { printf " %s\n" "$1"; }
# ── Branch identity ──────────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ -f "$SCRIPT_DIR/deckops_identity.sh" ]; then
source "$SCRIPT_DIR/deckops_identity.sh"
elif [ -f "$HOME/DeckOps-Nightly/deckops_identity.sh" ]; then
source "$HOME/DeckOps-Nightly/deckops_identity.sh"
elif [ -f "$HOME/DeckOps/deckops_identity.sh" ]; then
source "$HOME/DeckOps/deckops_identity.sh"
else
INSTALL_DIR_NAME="DeckOps-Nightly"
INSTALL_DIR="$HOME/DeckOps-Nightly"
VENV_PYTHON="$INSTALL_DIR/.venv/bin/python3"
APP_TITLE="DeckOps Nightly"
XDG_ID="deckops-nightly"
ENTRY_POINT="$INSTALL_DIR/src/main.py"
fi
echo ""
echo -e "${BOLD} $APP_TITLE -- Full Uninstaller${CLEAR}"
echo ""
zenity --question \
--title="$APP_TITLE Uninstaller" \
--text="This will clear all DeckOps launch options, remove client files, and remove ALL DeckOps and Plutonium data from your Wine prefixes.\n\nContinue?" \
--ok-label="Cancel" \
--cancel-label="Yes, Uninstall" 2>/dev/null
if [ $? -eq 0 ]; then
zenity --info --title="$APP_TITLE" --text="Uninstall cancelled." 2>/dev/null
exit 0
fi
echo ""
info "Closing Steam..."
# Use Steam's own shutdown command for a clean exit. This ensures Steam
# flushes config files and syncs cloud saves before exiting.
if pgrep -x "steam" > /dev/null 2>&1 || pgrep -f "steam.sh" > /dev/null 2>&1; then
steam -shutdown 2>/dev/null
# Wait for Steam to finish closing
deadline=$((SECONDS + 120))
while pgrep -x "steam" > /dev/null 2>&1 || pgrep -f "steam.sh" > /dev/null 2>&1; do
if [ $SECONDS -ge $deadline ]; then
warn "Steam did not close within 120 seconds."
warn "Please close Steam manually and re-run the uninstaller."
exit 1
fi
sleep 1
done
sleep 3
sync
success "Steam closed."
else
skip "Steam was not running."
fi
echo ""
STEAM_ROOTS=(
"$HOME/.local/share/Steam"
"$HOME/.steam/steam"
"$HOME/.steam/root"
"$HOME/.steam/debian-installation"
"/run/media/mmcblk0p1/.local/share/Steam"
"/home/deck/.local/share/Steam"
)
STEAM_ROOT=""
for r in "${STEAM_ROOTS[@]}"; do
if [ -d "$r/steamapps" ]; then
STEAM_ROOT="$r"
break
fi
done
if [ -z "$STEAM_ROOT" ]; then
warn "Steam root not found -- skipping game restore steps."
else
success "Steam found at $STEAM_ROOT"
fi
find_install_dir() {
local appid="$1"
local acf=""
# Build list of all steamapps dirs to search
local search_dirs=()
[ -n "$STEAM_ROOT" ] && search_dirs+=("$STEAM_ROOT/steamapps")
# Parse libraryfolders.vdf for additional library paths
local vdf="$STEAM_ROOT/steamapps/libraryfolders.vdf"
if [ -f "$vdf" ]; then
while IFS= read -r line; do
local libpath
libpath=$(echo "$line" | sed -n 's/.*"path"[[:space:]]*"\([^"]*\)".*/\1/p')
if [ -n "$libpath" ]; then
search_dirs+=("$libpath/steamapps")
search_dirs+=("$libpath/SteamLibrary/steamapps")
fi
done < "$vdf"
fi
# Brute-force SD card mount points
for mount in /run/media/deck/*/SteamLibrary/steamapps /run/media/deck/*/steamapps; do
[ -d "$mount" ] && search_dirs+=("$mount")
done
# Search all dirs for the app manifest
for dir in "${search_dirs[@]}"; do
local candidate="$dir/appmanifest_${appid}.acf"
if [ -f "$candidate" ]; then
acf="$candidate"
break
fi
done
if [ -f "$acf" ]; then
local install_name
install_name=$(sed -n 's/.*"installdir"[[:space:]]*"\([^"]*\)".*/\1/p' "$acf")
if [ -n "$install_name" ]; then
echo "$(dirname "$acf")/common/$install_name"
return
fi
fi
echo ""
}
restore_exe() {
local install_dir="$1"
local exe_name="$2"
local exe_path="$install_dir/$exe_name"
local bak_path="$exe_path.bak"
local old_path="$exe_path.old"
if [ -f "$bak_path" ]; then
mv "$bak_path" "$exe_path" && success "Restored $exe_name (from .bak)" || warn "Failed to restore $exe_name"
elif [ -f "$old_path" ]; then
mv "$old_path" "$exe_path" && success "Restored $exe_name (from .old)" || warn "Failed to restore $exe_name"
elif [ -f "$exe_path" ]; then
skip "$exe_name -- no backup found (may already be original)"
else
skip "$exe_name -- not found"
fi
}
info "Restoring original game executables..."
if [ -n "$STEAM_ROOT" ]; then
# iw3sp and iw4x now use the rename scheme — restore from .bak alongside Plutonium games.
declare -A GAME_EXES=(
[7940]="iw3sp.exe"
[10190]="iw4mp.exe"
[42690]="iw5mp.exe"
[42750]="iw5mp_server.exe"
[202970]="t6sp.exe"
)
declare -A GAME_EXES_MULTI=(
[10090]="CoDWaW.exe CoDWaWmp.exe"
[42700]="BlackOps.exe BlackOpsMP.exe"
[202990]="t6mp.exe t6zm.exe"
[209160]="iw6sp64_ship.exe iw6mp64_ship.exe"
[209650]="s1_sp64_ship.exe s1_mp64_ship.exe"
)
for appid in "${!GAME_EXES[@]}"; do
dir=$(find_install_dir "$appid") || true
if [ -n "$dir" ]; then
for exe in ${GAME_EXES[$appid]}; do
restore_exe "$dir" "$exe"
done
fi
done
for appid in "${!GAME_EXES_MULTI[@]}"; do
dir=$(find_install_dir "$appid") || true
if [ -n "$dir" ]; then
for exe in ${GAME_EXES_MULTI[$appid]}; do
restore_exe "$dir" "$exe"
done
fi
done
fi
echo ""
info "Restoring non-Steam (My Own) game executables..."
# Scan shortcuts.vdf for games added via the My Own flow. These were
# detected by exe name and may have had their exes replaced with wrapper
# scripts. We restore from .bak the same way we do for Steam games.
python3 - << 'PYEOF'
import os, re
STEAM_DIR = os.path.expanduser("~/.local/share/Steam")
USERDATA_DIR = os.path.join(STEAM_DIR, "userdata")
# Same exe list as detect_shortcuts.py EXE_TO_KEYS
KNOWN_EXES = [
"iw3mp.exe", "iw3sp.exe", "iw4mp.exe", "iw4sp.exe",
"iw5mp.exe", "iw5sp.exe", "CoDWaW.exe", "CoDWaWmp.exe",
"BlackOps.exe", "BlackOpsMP.exe", "t6zm.exe", "t6mp.exe", "t6sp.exe",
# Mod client exes (own shortcuts point at these, not original game exes)
"iw4x.exe", "iw3sp_mod.exe",
# AlterWare mod client exes (own shortcuts point at these)
"iw6-mod.exe", "s1-mod.exe",
# LCD own Plutonium wrapper exes (written by plutonium.py, not original game files)
"t4plutsp.exe", "t4plutmp.exe", "t5plutsp.exe", "t5plutmp.exe",
"t6plutmp.exe", "t6plutzm.exe", "iw5plutmp.exe",
]
def parse_shortcuts(path):
"""Pull exe and start_dir from shortcuts.vdf entries."""
if not os.path.exists(path):
return []
try:
with open(path, "rb") as f:
data = f.read()
except Exception:
return []
results = []
for m in re.finditer(b'\x01(?:exe|Exe)\x00([^\x00]+)\x00', data):
exe = m.group(1).decode("utf-8", errors="replace").strip('"')
results.append(exe)
return results
if not os.path.isdir(USERDATA_DIR):
print(" No userdata found, skipping.")
exit(0)
restored = set()
for uid in os.listdir(USERDATA_DIR):
if not uid.isdigit() or int(uid) < 10000:
continue
vdf_path = os.path.join(USERDATA_DIR, uid, "config", "shortcuts.vdf")
for exe_path in parse_shortcuts(vdf_path):
exe_name = os.path.basename(exe_path)
# Check both exact case and lowercase since detect_shortcuts matches lowercase
if exe_name not in KNOWN_EXES and exe_name.lower() not in [e.lower() for e in KNOWN_EXES]:
continue
if exe_path in restored:
continue
bak_path = exe_path + ".bak"
if os.path.exists(bak_path):
try:
os.rename(bak_path, exe_path)
print(f" Restored {exe_name} (from .bak)")
restored.add(exe_path)
except Exception as ex:
print(f" Failed to restore {exe_name}: {ex}")
else:
# Also check in the start_dir for the exe
install_dir = os.path.dirname(exe_path)
for known in KNOWN_EXES:
candidate = os.path.join(install_dir, known)
candidate_bak = candidate + ".bak"
if candidate_bak not in restored and os.path.exists(candidate_bak):
try:
if os.path.exists(candidate):
os.remove(candidate)
os.rename(candidate_bak, candidate)
print(f" Restored {known} (from .bak)")
restored.add(candidate_bak)
except Exception as ex:
print(f" Failed to restore {known}: {ex}")
if not restored:
print(" No non-Steam game backups found.")
PYEOF
echo ""
info "Backing up player save data before cleanup..."
zenity --question \
--title="$APP_TITLE Uninstaller" \
--text="Would you like to back up your save data before uninstalling?\n\nThis preserves player configs, stats, and custom classes\nso they can be restored if you reinstall later." \
--ok-label="Yes, Back Up" \
--cancel-label="No, Skip" 2>/dev/null
if [ $? -ne 0 ]; then
skip "Save backup skipped by user."
else
DECKOPS_SRC="$INSTALL_DIR/src"
DECKOPS_VENV="$VENV_PYTHON"
if [ -f "$DECKOPS_SRC/save_backup.py" ]; then
# Prefer the venv Python (has PyQt5, all deps) but fall back to system
if [ -x "$DECKOPS_VENV" ]; then
_PYBIN="$DECKOPS_VENV"
else
_PYBIN="python3"
fi
cd "$DECKOPS_SRC" && "$_PYBIN" save_backup.py backup "$STEAM_ROOT" 2>&1 | while IFS= read -r line; do
echo " $line"
done
_backup_exit=${PIPESTATUS[0]}
if [ "$_backup_exit" -eq 0 ]; then
success "Save backup complete."
else
warn "Save backup had errors (saves may be incomplete)."
fi
else
skip "save_backup.py not found — skipping save backup."
fi
fi
echo ""
# ── (existing code continues below: info "Removing iw4x / cod4x client files...") ──
info "Removing iw4x / cod4x client files..."
if [ -n "$STEAM_ROOT" ]; then
mw2_dir=$(find_install_dir 10190) || true
if [ -n "$mw2_dir" ]; then
for f in "iw4x.dll" "iw4x.exe"; do
[ -f "$mw2_dir/$f" ] && rm -f "$mw2_dir/$f" && success "Removed $f" || skip "$f not found"
done
for d in "iw4x" "iw4x-updoot"; do
[ -d "$mw2_dir/$d" ] && rm -rf "$mw2_dir/$d" && success "Removed $d/" || skip "$d/ not found"
done
fi
cod4_dir=$(find_install_dir 7940) || true
if [ -n "$cod4_dir" ]; then
for f in "cod4x_021.dll" "cod4x_loader.exe" "cod4x.exe" "deckops_cod4x.json" "servercache.dat"; do
[ -f "$cod4_dir/$f" ] && rm -f "$cod4_dir/$f" && success "Removed $f" || skip "$f not found"
done
fi
# Remove CoD4 user profile/config directory from the Wine prefix
info "Removing CoD4 Wine prefix user data..."
COD4_APPDATA="$STEAM_ROOT/steamapps/compatdata/7940/pfx/drive_c/users/steamuser/AppData/Local/CallofDuty4MW"
if [ -d "$COD4_APPDATA" ]; then
rm -rf "$COD4_APPDATA" && success "Removed CoD4 Wine prefix AppData" || warn "Failed to remove CoD4 Wine prefix AppData"
else
skip "CoD4 Wine prefix AppData not found"
fi
# Remove CoD4x ProgramData staging area (setup.exe + GitHub fallback)
COD4_PROGDATA="$STEAM_ROOT/steamapps/compatdata/7940/pfx/drive_c/ProgramData/CallofDuty4MW"
if [ -d "$COD4_PROGDATA" ]; then
rm -rf "$COD4_PROGDATA" && success "Removed CoD4 Wine prefix ProgramData" || warn "Failed to remove CoD4 Wine prefix ProgramData"
else
skip "CoD4 Wine prefix ProgramData not found"
fi
fi
echo ""
info "Removing IW3SP-MOD files from CoD4 folder..."
if [ -n "$STEAM_ROOT" ]; then
cod4_dir=$(find_install_dir 7940) || true
if [ -n "$cod4_dir" ]; then
for f in "iw3sp_mod.exe" "iw3sp_mod.dll" "deckops_iw3sp.json"; do
[ -f "$cod4_dir/$f" ] && rm -f "$cod4_dir/$f" && success "Removed $f" || skip "$f not found"
done
[ -d "$cod4_dir/iw3sp_mod" ] && rm -rf "$cod4_dir/iw3sp_mod" && success "Removed iw3sp_mod/" || skip "iw3sp_mod/ not found"
else
skip "CoD4 install directory not found"
fi
fi
echo ""
info "Removing Rattpak's T6SP-MOD files from Black Ops II folder..."
if [ -n "$STEAM_ROOT" ]; then
bo2sp_dir=$(find_install_dir 202970) || true
if [ -n "$bo2sp_dir" ]; then
for f in "t6sp-mod.dll" "deckops_t6sp_mod.json"; do
[ -f "$bo2sp_dir/$f" ] && rm -f "$bo2sp_dir/$f" && success "Removed $f" || skip "$f not found"
done
else
skip "Black Ops II SP install directory not found"
fi
fi
echo ""
info "Removing CleanOps files from Black Ops III folder..."
if [ -n "$STEAM_ROOT" ]; then
bo3_dir=$(find_install_dir 311210) || true
if [ -n "$bo3_dir" ]; then
for f in "d3d11.dll" "deckops_cleanops.json"; do
[ -f "$bo3_dir/$f" ] && rm -f "$bo3_dir/$f" && success "Removed $f" || skip "$f not found"
done
else
skip "Black Ops III install directory not found"
fi
fi
echo ""
info "Removing T7X (DeckOps-T7X sibling directory)..."
if [ -n "$STEAM_ROOT" ]; then
bo3_dir=$(find_install_dir 311210) || true
if [ -n "$bo3_dir" ]; then
t7x_sibling="$(dirname "$bo3_dir")/DeckOps-T7X"
if [ -d "$t7x_sibling" ]; then
rm -rf "$t7x_sibling" && success "Removed DeckOps-T7X directory" || warn "Could not remove DeckOps-T7X"
else
skip "DeckOps-T7X directory not found"
fi
# Clean up legacy T7X files from stock BO3 dir (pre-sibling installs)
for f in "t7x.exe" "deckops_t7x.json"; do
[ -f "$bo3_dir/$f" ] && rm -f "$bo3_dir/$f" && success "Removed legacy $f"
done
[ -d "$bo3_dir/t7x" ] && rm -rf "$bo3_dir/t7x" && success "Removed legacy t7x/ directory"
else
skip "Black Ops III install directory not found"
fi
fi
echo ""
info "Removing AlterWare files from Ghosts and Advanced Warfare folders..."
if [ -n "$STEAM_ROOT" ]; then
# Ghosts (appid 209160 covers both SP and MP install dir)
ghosts_dir=$(find_install_dir 209160) || true
if [ -n "$ghosts_dir" ]; then
for f in "iw6-mod.exe" "alterware-launcher.json" "awcache.json" "deckops_alterware.json"; do
[ -f "$ghosts_dir/$f" ] && rm -f "$ghosts_dir/$f" && success "Removed $f (Ghosts)" || skip "$f not found"
done
# Remove AlterWare data/ subdirectories (mod scripts, not base game)
for d in "data/dw" "data/maps" "data/scripts" "data/ui_scripts" "data/sound"; do
[ -d "$ghosts_dir/$d" ] && rm -rf "$ghosts_dir/$d" && success "Removed $d/ (Ghosts)"
done
[ -f "$ghosts_dir/data/open_source_software_disclosure.txt" ] && rm -f "$ghosts_dir/data/open_source_software_disclosure.txt"
else
skip "Ghosts install directory not found"
fi
# Advanced Warfare (appid 209650 covers both SP and MP install dir)
aw_dir=$(find_install_dir 209650) || true
if [ -n "$aw_dir" ]; then
for f in "s1-mod.exe" "alterware-launcher.json" "awcache.json" "deckops_alterware.json"; do
[ -f "$aw_dir/$f" ] && rm -f "$aw_dir/$f" && success "Removed $f (AW)" || skip "$f not found"
done
for d in "data/dw" "data/maps" "data/scripts" "data/ui_scripts" "data/sound"; do
[ -d "$aw_dir/$d" ] && rm -rf "$aw_dir/$d" && success "Removed $d/ (AW)"
done
[ -f "$aw_dir/data/open_source_software_disclosure.txt" ] && rm -f "$aw_dir/data/open_source_software_disclosure.txt"
else
skip "Advanced Warfare install directory not found"
fi
fi
echo ""
info "Removing mod client files from non-Steam (My Own) game folders..."
# For games added via the My Own flow, the install dir isnt in any Steam
# library. We find them by scanning shortcuts.vdf for known exe names and
# cleaning up the same files we would for Steam installs.
python3 - << 'PYEOF'
import os, re, shutil
STEAM_DIR = os.path.expanduser("~/.local/share/Steam")
USERDATA_DIR = os.path.join(STEAM_DIR, "userdata")
# Map exe filename (lowercase) to cleanup actions.
# "files" are removed, "dirs" are removed recursively.
# Must match what iw4x.py, cod4x.py, and iw3sp.py install.
OWN_CLEANUP = {
"iw4mp.exe": {
"files": ["iw4x.dll", "iw4x.exe"],
"dirs": ["iw4x", "iw4x-updoot"],
},
# Own shortcuts point at iw4x.exe, not iw4mp.exe
"iw4x.exe": {
"files": ["iw4x.dll", "iw4x.exe"],
"dirs": ["iw4x", "iw4x-updoot"],
},
"iw3mp.exe": {
"files": ["cod4x_021.dll", "cod4x_loader.exe", "cod4x.exe",
"deckops_cod4x.json", "servercache.dat"],
"dirs": [],
},
"iw3sp.exe": {
"files": ["iw3sp_mod.exe", "iw3sp_mod.dll", "deckops_iw3sp.json"],
"dirs": ["iw3sp_mod"],
},
# Own shortcuts point at iw3sp_mod.exe, not iw3sp.exe
"iw3sp_mod.exe": {
"files": ["iw3sp_mod.exe", "iw3sp_mod.dll", "deckops_iw3sp.json"],
"dirs": ["iw3sp_mod"],
},
# T6SP-MOD replaces t6sp.exe in place; DLL and metadata are the mod artifacts
"t6sp.exe": {
"files": ["t6sp-mod.dll", "deckops_t6sp_mod.json"],
"dirs": [],
},
"blackops3.exe": {
"files": ["d3d11.dll", "deckops_cleanops.json"],
"dirs": [],
},
"t7x.exe": {
"files": [],
"dirs": [],
"remove_install_dir": True, # DeckOps-T7X sibling dir — nuke entirely
},
# AlterWare mod client exes (Ghosts / Advanced Warfare)
"iw6-mod.exe": {
"files": ["iw6-mod.exe", "alterware-launcher.json", "awcache.json",
"deckops_alterware.json", "data/open_source_software_disclosure.txt"],
"dirs": ["data/dw", "data/maps", "data/scripts", "data/ui_scripts", "data/sound"],
},
"iw6mp64_ship.exe": {
"files": ["iw6-mod.exe", "alterware-launcher.json", "awcache.json",
"deckops_alterware.json", "data/open_source_software_disclosure.txt"],
"dirs": ["data/dw", "data/maps", "data/scripts", "data/ui_scripts", "data/sound"],
},
"s1-mod.exe": {
"files": ["s1-mod.exe", "alterware-launcher.json", "awcache.json",
"deckops_alterware.json", "data/open_source_software_disclosure.txt"],
"dirs": ["data/dw", "data/maps", "data/scripts", "data/ui_scripts", "data/sound"],
},
"s1_mp64_ship.exe": {
"files": ["s1-mod.exe", "alterware-launcher.json", "awcache.json",
"deckops_alterware.json", "data/open_source_software_disclosure.txt"],
"dirs": ["data/dw", "data/maps", "data/scripts", "data/ui_scripts", "data/sound"],
},
}
# LCD own Plutonium wrapper exes - these are DeckOps-created bash scripts,
# not original game files. Safe to delete. The shortcut exe field points at
# these so we find the game folder through them during cleanup.
PLUT_WRAPPER_EXES = [
"t4plutsp.exe", "t4plutmp.exe", "t5plutsp.exe", "t5plutmp.exe",
"t6plutmp.exe", "t6plutzm.exe", "iw5plutmp.exe",
]
# Add wrapper exes to cleanup map - each one just removes itself
for _wrapper in PLUT_WRAPPER_EXES:
OWN_CLEANUP[_wrapper] = {
"files": [_wrapper],
"dirs": [],
}
if not os.path.isdir(USERDATA_DIR):
print(" No userdata found, skipping.")
exit(0)
cleaned = set()
for uid in os.listdir(USERDATA_DIR):
if not uid.isdigit() or int(uid) < 10000:
continue
vdf_path = os.path.join(USERDATA_DIR, uid, "config", "shortcuts.vdf")
if not os.path.exists(vdf_path):
continue
try:
with open(vdf_path, "rb") as f:
data = f.read()
except Exception:
continue
# Pull exe paths and start dirs from shortcuts.vdf
for exe_m in re.finditer(b'\x01(?:exe|Exe)\x00([^\x00]+)\x00', data):
exe_raw = exe_m.group(1).decode("utf-8", errors="replace")
exe_path = exe_raw.strip('"')
exe_name = os.path.basename(exe_path).lower()
cleanup = OWN_CLEANUP.get(exe_name)
if not cleanup:
continue
install_dir = os.path.dirname(exe_path)
if not install_dir or install_dir in cleaned:
continue
if not os.path.isdir(install_dir):
continue
cleaned.add(install_dir)
print(f" Cleaning {install_dir}...")
# T7X uses a DeckOps-managed sibling dir — remove the entire directory.
# Safety: only nuke if the directory is actually named DeckOps-T7X.
# A stale shortcut from a pre-sibling install may still point at the
# stock BO3 folder — we must never rmtree that.
if cleanup.get("remove_install_dir"):
if os.path.basename(install_dir) == "DeckOps-T7X":
try:
shutil.rmtree(install_dir)
print(f" Removed entire {os.path.basename(install_dir)}/ directory")
except Exception as ex:
print(f" Failed to remove {os.path.basename(install_dir)}/: {ex}")
else:
# Stale shortcut pointing at stock game dir — only remove
# DeckOps-owned files, never the whole directory.
for fname in ("t7x.exe", "deckops_t7x.json"):
fpath = os.path.join(install_dir, fname)
if os.path.exists(fpath):
try:
os.remove(fpath)
print(f" Removed legacy {fname}")
except Exception as ex:
print(f" Failed to remove {fname}: {ex}")
t7x_data = os.path.join(install_dir, "t7x")
if os.path.isdir(t7x_data):
try:
shutil.rmtree(t7x_data)
print(f" Removed legacy t7x/ directory")
except Exception as ex:
print(f" Failed to remove t7x/: {ex}")
continue
for fname in cleanup["files"]:
fpath = os.path.join(install_dir, fname)
if os.path.exists(fpath):
try:
os.remove(fpath)
print(f" Removed {fname}")
except Exception as ex:
print(f" Failed to remove {fname}: {ex}")
for dname in cleanup["dirs"]:
dpath = os.path.join(install_dir, dname)
if os.path.isdir(dpath):
try:
shutil.rmtree(dpath)
print(f" Removed {dname}/")
except Exception as ex:
print(f" Failed to remove {dname}/: {ex}")
# Also remove plutonium metadata if present
plut_meta = os.path.join(install_dir, "deckops_plutonium.json")
if os.path.exists(plut_meta):
try:
os.remove(plut_meta)
print(f" Removed deckops_plutonium.json")
except Exception:
pass
if not cleaned:
print(" No non-Steam game folders found to clean.")
PYEOF
echo ""
info "Removing DeckOps VDF edits using edit ledger (if available)..."
# The VDF edit ledger records every edit DeckOps made to localconfig.vdf and
# config.vdf at install time. If present, we use it for precise removal
# instead of regex-sweeping. The legacy regex blocks below still run as
# fallback for installs that predate the ledger.
python3 - << 'PYEOF'
import os, re, json, shutil
LEDGER_PATH = os.path.expanduser("~/.config/deckops-nightly/vdf_edits.json")
if not os.path.exists(LEDGER_PATH):
LEDGER_PATH = os.path.expanduser("~/.config/deckops/vdf_edits.json")
steam_dir = os.path.expanduser("~/.local/share/Steam")
userdata = os.path.join(steam_dir, "userdata")
if not os.path.exists(LEDGER_PATH):
print(" No VDF edit ledger found — falling back to legacy cleanup.")
exit(0)
try:
with open(LEDGER_PATH, "r", encoding="utf-8") as f:
ledger = json.load(f)
except (json.JSONDecodeError, OSError) as ex:
print(f" Ledger read failed ({ex}) — falling back to legacy cleanup.")
exit(0)
def validate_vdf(data):
"""Check brace balance using a quote-aware parser."""
depth = 0; in_quote = False
for i, c in enumerate(data):
if c == '"' and (i == 0 or data[i-1] != '\\'):
in_quote = not in_quote
elif not in_quote:
if c == '{': depth += 1
elif c == '}':
depth -= 1
if depth < 0: return False
return depth == 0
def find_block_end(text, start):
depth = 0; i = start; in_quote = False
while i < len(text):
c = text[i]
if c == '"' and (i == 0 or text[i-1] != '\\'):
in_quote = not in_quote
elif not in_quote:
if c == '{': depth += 1
elif c == '}':
depth -= 1
if depth == 0: return i
i += 1
return -1
# ── localconfig.vdf edits ────────────────────────────────────────────────
lc_edits = ledger.get("localconfig", {})
for uid, apps in lc_edits.items():
vdf_path = os.path.join(userdata, uid, "config", "localconfig.vdf")
if not os.path.exists(vdf_path):
continue
with open(vdf_path, "r", errors="replace") as f:
content = f.read()
modified = False
for appid, keys in apps.items():
for key_name, recorded_value in keys.items():
if key_name == "DefaultLaunchOption":
# Remove the appid entry from the Deck configurator apps block
interstitial_pattern = re.compile(
r'"Deck_ConfiguratorInterstitialApps_AppLauncherInteractionIssues"'
r'\s*"[^"]*"\s*"apps"\s*\{',
re.IGNORECASE
)
m = interstitial_pattern.search(content)
if not m:
continue
apps_open = m.end() - 1
apps_close = find_block_end(content, apps_open)
if apps_close == -1:
continue
apps_block = content[apps_open + 1:apps_close]
appid_pat = re.compile(r'"' + re.escape(appid) + r'"\s*\{', re.IGNORECASE)
am = appid_pat.search(apps_block)
if not am:
continue
entry_open = am.start()
entry_close = find_block_end(apps_block, am.end() - 1)
if entry_close == -1:
continue
apps_block = apps_block[:entry_open] + apps_block[entry_close + 1:]
content = content[:apps_open + 1] + apps_block + content[apps_close:]
modified = True
print(f" uid {uid}: [ledger] removed DefaultLaunchOption for appid {appid}")
elif key_name in ("LaunchOptions", "UseSteamControllerConfig"):
# Find the appid block, then blank or remove the key
key_pattern = re.compile(
r'"' + re.escape(appid) + r'"\s*\{',
re.IGNORECASE
)
key_match = key_pattern.search(content)
if not key_match:
continue
app_open = key_match.end() - 1
app_close = find_block_end(content, app_open)
if app_close == -1:
continue
app_inner = content[app_open + 1:app_close]
# Only touch the flat section, not inside sub-blocks
subblock_match = re.search(r'"[^"]+"\s*\{', app_inner)
flat_section = app_inner[:subblock_match.start()] if subblock_match else app_inner
val_pattern = re.compile(
r'("' + re.escape(key_name) + r'"\s*")((?:[^"\\]|\\.)*)(")',
re.IGNORECASE
)
val_match = val_pattern.search(flat_section)
if not val_match:
continue
current_value = val_match.group(2)
# For LaunchOptions, check if the recorded value is still in there
if key_name == "LaunchOptions":
if recorded_value and recorded_value not in current_value:
print(f" uid {uid}: [ledger] appid {appid} LaunchOptions changed — skipping")
continue
# Clear to empty
new_flat = val_pattern.sub(r'\g<1>\g<3>', flat_section, count=1)
else:
# UseSteamControllerConfig — clear to empty
new_flat = val_pattern.sub(r'\g<1>\g<3>', flat_section, count=1)
if subblock_match:
new_app_inner = new_flat + app_inner[subblock_match.start():]
else:
new_app_inner = new_flat
content = content[:app_open + 1] + new_app_inner + content[app_close:]
modified = True
print(f" uid {uid}: [ledger] cleared {key_name} for appid {appid}")
if modified:
bak = vdf_path + ".deckops_uninstall.bak"
if not os.path.exists(bak):
try:
shutil.copy2(vdf_path, bak)
except Exception:
pass
with open(vdf_path, "w", errors="replace") as f:
f.write(content)
if not validate_vdf(content):
print(f" uid {uid}: [ledger] VDF validation FAILED — restoring backup")
if os.path.exists(bak):
try:
shutil.copy2(bak, vdf_path)
except Exception:
print(f" uid {uid}: backup restore also failed")
# ── config.vdf CompatToolMapping edits ────────────────────────────────────
cv_edits = ledger.get("config_vdf", {})
compat_edits = cv_edits.get("CompatToolMapping", {})
if compat_edits:
config_vdf = os.path.join(steam_dir, "config", "config.vdf")
if os.path.exists(config_vdf):
with open(config_vdf, "r", encoding="utf-8") as f:
data = f.read()
cv_modified = False
for appid in compat_edits:
pattern = rf'\t+"{re.escape(appid)}"\n\t+\{{[^}}]*\}}\n?'
if re.search(pattern, data, re.MULTILINE | re.DOTALL):
data = re.sub(pattern, "", data, flags=re.MULTILINE | re.DOTALL)
cv_modified = True
print(f" [ledger] removed CompatToolMapping for appid {appid}")
if cv_modified:
bak = config_vdf + ".bak"
try:
shutil.copy2(config_vdf, bak)
except Exception:
pass
with open(config_vdf, "w", encoding="utf-8") as f:
f.write(data)
# ── configset VDF edits ───────────────────────────────────────────────────
cs_edits = ledger.get("configsets", {})
for cs_filename, keys in cs_edits.items():
# Search across all UIDs for this configset file
if not os.path.isdir(userdata):
break
for uid in os.listdir(userdata):
if not uid.isdigit() or int(uid) < 10000:
continue
steam_cfg_root = os.path.join(
steam_dir, "steamapps", "common",
"Steam Controller Configs", uid, "config"
)
cs_path = os.path.join(steam_cfg_root, cs_filename)
if not os.path.exists(cs_path):
continue
with open(cs_path, "r", encoding="utf-8", errors="replace") as f:
cs_content = f.read()
cs_modified = False
for key in keys:
pattern = rf'\t"{re.escape(key)}"\n\t\{{[^}}]*\}}\n?'
if re.search(pattern, cs_content, re.MULTILINE | re.DOTALL):
cs_content = re.sub(pattern, "", cs_content, flags=re.MULTILINE | re.DOTALL)
cs_modified = True
print(f" uid {uid}: [ledger] removed {key} from {cs_filename}")
if cs_modified:
with open(cs_path, "w", encoding="utf-8") as f:
f.write(cs_content)
# Clean up the ledger file itself
try:
os.remove(LEDGER_PATH)
print(" Ledger file removed.")
except Exception:
pass
print(" Ledger-based VDF cleanup complete.")
PYEOF
echo ""
info "Removing DeckOps Deck configurator launch defaults from localconfig.vdf..."
# Mirrors: wrapper.py set_default_launch_option()
python3 - << 'PYEOF'
import os, re, shutil
# Appids whose DefaultLaunchOption DeckOps writes via set_default_launch_option.
# These live in the Deck_ConfiguratorInterstitialApps "apps" block, not the
# standard LaunchOptions flat key, so they need separate removal.
# See: wrapper.py set_default_launch_option() for the write side.
DECK_APPIDS = {"7940", "10090"}
steam_dir = os.path.expanduser("~/.local/share/Steam")
userdata = os.path.join(steam_dir, "userdata")
if not os.path.isdir(userdata):
print(" No Steam userdata found — skipping.")
exit(0)
def find_block_end(text, start):
depth = 0; i = start; in_quote = False
while i < len(text):
c = text[i]
if c == '"' and (i == 0 or text[i-1] != '\\'):
in_quote = not in_quote
elif not in_quote:
if c == '{': depth += 1
elif c == '}':
depth -= 1
if depth == 0: return i
i += 1
return -1
def validate_vdf(data):
"""Check brace balance using the same quote-aware parser."""
depth = 0; in_quote = False
for i, c in enumerate(data):
if c == '"' and (i == 0 or data[i-1] != '\\'):
in_quote = not in_quote
elif not in_quote:
if c == '{': depth += 1
elif c == '}':
depth -= 1
if depth < 0: return False
return depth == 0
for uid in os.listdir(userdata):
if not uid.isdigit() or int(uid) < 10000:
continue
vdf_path = os.path.join(userdata, uid, "config", "localconfig.vdf")
if not os.path.exists(vdf_path):
continue
with open(vdf_path, "r", errors="replace") as f:
content = f.read()
# Find the Deck configurator apps block
interstitial_pattern = re.compile(
r'"Deck_ConfiguratorInterstitialApps_AppLauncherInteractionIssues"'
r'\s*"[^"]*"\s*"apps"\s*\{',
re.IGNORECASE
)
m = interstitial_pattern.search(content)
if not m:
print(f" uid {uid}: no Deck configurator block found — skipping")
continue
apps_open = m.end() - 1
apps_close = find_block_end(content, apps_open)
if apps_close == -1:
continue
apps_block = content[apps_open + 1:apps_close]
modified = False
for appid in DECK_APPIDS:
appid_pat = re.compile(r'"' + re.escape(appid) + r'"\s*\{', re.IGNORECASE)
am = appid_pat.search(apps_block)
if not am:
continue
entry_open = am.start()
entry_close = find_block_end(apps_block, am.end() - 1)
if entry_close == -1:
continue
apps_block = apps_block[:entry_open] + apps_block[entry_close + 1:]
modified = True
print(f" uid {uid}: removed DefaultLaunchOption for appid {appid}")
if modified:
new_content = content[:apps_open + 1] + apps_block + content[apps_close:]
# Backup before writing
bak = vdf_path + ".deckops_uninstall.bak"
if not os.path.exists(bak):
try:
shutil.copy2(vdf_path, bak)
except Exception:
pass
with open(vdf_path, "w", errors="replace") as f:
f.write(new_content)
# Validate — if corrupt, restore backup and leave edits in place
if not validate_vdf(new_content):
print(f" uid {uid}: VDF validation FAILED — restoring backup")
if os.path.exists(bak):
try:
shutil.copy2(bak, vdf_path)
except Exception:
print(f" uid {uid}: backup restore also failed")
else:
print(f" uid {uid}: no DeckOps configurator defaults found")
PYEOF
echo ""
info "Clearing DeckOps launch options from localconfig.vdf..."
# Mirrors: wrapper.py clear_launch_options()
# Clears LaunchOptions for ALL managed Steam appids so no stale launch
# commands survive uninstall. Covers AlterWare bash substitutions,
# CleanOps DLL injection, LCD Plutonium Heroic launch, and any future
# launch options DeckOps writes.