-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwineTricks
More file actions
executable file
·4745 lines (3967 loc) · 186 KB
/
wineTricks
File metadata and controls
executable file
·4745 lines (3967 loc) · 186 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/sh
# Quick and dirty script to download and install various
# redistributable runtime libraries
#
# Current maintainers: Austin English, Dan Kegel
# Copyright 2007, 2008, 2009, 2010 Google (Dan Kegel, dank@kegel.com)
# Copyright 2008, 2009, 2010 Austin English (austinenglish@gmail.com)
# License: LGPL (for compatibility with winehq)
# Thanks to Detlef Riekenberg for lots of updates
# Thanks to Saulius Krasuckas for corrections and suggestions
# Thanks to Erik Inge Bolsø for several patches
# Thanks to Hugh Perkins for the directplay patch
# Please report problems at http://code.google.com/p/winezeug/issues
# See also http://wiki.winehq.org/winetricks
#
# Note to contributors: please avoid gnu extensions in this shell script,
# as it has to run on MacOSX and Solaris, too. A good book on the topic is
# "Portable Shell Programming" by Bruce Blinn, ISBN: 0-13-451494-7
#---- Constants -------------------------------------------------
# Name of this version of winetricks (YYYYMMDD)
VERSION=20101106
#---- Functions -------------------------------------------------
# Detect which sudo to use
detect_sudo() {
SUDO=sudo
test "$GUI" = 1 || return
if test x"$DISPLAY" != x""
then
if test -x "`which gksudo 2>/dev/null`"
then
SUDO=gksudo
elif test -x "`which kdesudo 2>/dev/null`"
then
SUDO=kdesudo
fi
fi
}
# Detect which menu program to use
detect_menu() {
# TODO: add 'dialog'
MENU=xmessage
if test -x "`which zenity 2>/dev/null`"
then
MENU=zenity
elif test -x "`which kdialog 2>/dev/null`"
then
MENU=kdialog
fi
}
warn() {
echo "------------------------------------------------------"
echo "$@"
echo "------------------------------------------------------"
test "$GUI" = 1 || return
# For some reason, nulls were showing up in $@?!, causing truncated output in zenity
msg="`echo $@ | tr '\000' ' '`"
case $MENU in
*zenity) zenity --error --title=Winetricks --text="$msg" --no-wrap;;
*kdialog) kdialog --title Winetricks --error "$msg" ;;
*xmessage) xmessage -title Winetricks -center " Error: $msg " ;;
esac
}
die() {
warn "$@"
exit 1
}
# Abort if user doesn't own the given directory (or its parent, if it doesn't exist yet)
die_if_user_not_dirowner() {
if test -d "$1"
then
checkdir="$1"
else
# fixme: quoting problem?
checkdir=`dirname "$1"`
fi
nuser=`id -u`
nowner=`ls -l -n -d -L "$checkdir" | awk '{print $3}'`
if test x$nuser != x$nowner
then
die "You (`id -un`) don't own $checkdir. Don't run winetricks as another user!"
fi
}
#----------------------------------------------------------------
usage() {
set +x
# WARNING: do not use single quote in any package description; that breaks the gui menu.
echo "Usage: $0 [options] package [package] ..."
echo "This script can help you prepare your system for Windows applications"
echo "that mistakenly assume all users' systems have all the needed"
echo "redistributable runtime libraries or fonts."
echo "Some options require the Linux 'cabextract' program."
echo ""
echo "Options:"
echo " -q quiet. You must have already agreed to the EULAs."
echo " -v verbose"
echo " -V display Version"
echo "Packages:"
echo " 7zip 7-zip file archiver"
echo " adobeair Adobe AIR runtime"
echo " amstream MS amstream.dll"
echo " art2kmin MS Access 2007 runtime"
echo " atmlib Adobe Type Manager. Needed for Adobe CS4"
echo " autohotkey Autohotkey (open source gui scripting language)"
echo " baekmuk Baekmuk Korean fonts"
echo " cmake CMake, the cross-platform, open-source build system"
echo " colorprofile Standard RGB color profile"
echo " comctl32 MS common controls 5.80"
echo " comctl32.ocx MS comctl32.ocx and mscomctl.ocx, comctl32 wrappers for VB6"
echo " comdlg32.ocx MS comdlg32.ocx for VB6"
echo " controlpad MS ActiveX Control Pad"
echo " corefonts MS Arial, Courier, Times fonts"
echo " crypt32 MS crypt32.dl"
echo " cygwin Unix apps for Windows (needed by some build scripts)"
echo " d3dx9 MS d3dx9_??.dll (from DirectX 9 user redistributable)"
echo " d3dx9_26 MS d3dx9_26.dll"
echo " d3dx9_28 MS d3dx9_28.dll"
echo " d3dx9_31 MS d3dx9_31.dll"
echo " d3dx9_35 MS d3dx9_35.dll"
echo " d3dx9_36 MS d3dx9_36.dll"
echo " d3dx9_42 MS d3dx9_42.dll"
echo " d3dx10 MS d3dx10_??.dll (from DirectX user redistributable)"
echo " d3dxof MS d3dxof.dll (from DirectX user redistributable)"
echo " dcom98 MS DCOM (ole32, oleaut32); requires Windows 98 license, but does not check for one"
echo " devenum MS devenum.dll (from DirectX 9 user redistributable)"
echo " dinput8 MS dinput8.dll (from DirectX 9 user redistributable)"
echo " dirac the Dirac directshow filter"
echo " directmusic MS DirectMusic (from DirectX 9 user redistributable)"
echo " directplay MS DirectPlay (from DirectX 9 user redistributable)"
echo " directx9 MS DirectX 9 user redistributable (not recommended! use d3dx9 instead)"
echo " directx9-beta MS DirectX 9 user redistributable - beta verb (not recommended! use d3dx9 instead)"
echo " divx divx video codec"
echo " dmsynth MS dmsynth.dll (midi sythesizer from DirectX 9 user redistributable)"
echo " dotnet11 MS .NET 1.1 (requires Windows license, but does not check for one)"
# Doesn't work yet, don't make it public
# echo " dotnet11sdk MS .NET Framework SDK Version 1.1 (requires Windows license, but does not check for one; may not work yet)"
echo " dotnet20 MS .NET 2.0 (requires Windows license, but does not check for one)"
# Doesn't work yet, don't make it public
# echo " dotnet20sdk MS .NET Framework SDK Version 2.0 (requires Windows license, but does not check for one, may not work yet)"
echo " dotnet20sp2 MS .NET 2.0 sp2 (requires Windows license, but does not check for one)"
echo " dotnet30 MS .NET 3.0 (requires Windows license, but does not check for one, might not work yet)"
echo " droid Droid fonts (on LCD, looks better with fontsmooth-rgb)"
echo " dsound MS dsound.dll (from DirectX 9 user redistributable)"
echo " dxsdk_nov2006 DirectX Software Development Kit, November 2006 version"
echo " eadm EA Download Manager"
echo " eufonts Updated fonts for Romanian and Bulgarian"
echo " fakechinese Creates aliases for Chinese fonts using WenQuanYi fonts"
echo " fakejapanese Creates aliases for Japanese fonts using Takao fonts"
echo " fakekorean Creates aliases for Korean fonts using Baekmuk fonts"
echo " ffdshow ffdshow video codecs"
echo " firefox Firefox web browser"
echo " flash Adobe Flash Player ActiveX and firefox plugins"
echo " fm20 MS Forms 2.0 Object Library"
echo " fontfix Fix bad fonts which cause crash in some apps (e.g. .net)."
echo " fontsmooth-bgr Enables subpixel smoothing for BGR LCDs"
echo " fontsmooth-disable Disables font smoothing"
echo " fontsmooth-gray Enables grayscale font smoothing"
echo " fontsmooth-rgb Enables subpixel smoothing for RGB LCDs"
echo " gdiplus MS gdiplus.dll"
echo " gecko-dbg The HTML rendering Engine (Mozilla), with debugging symbols"
echo " gecko The HTML rendering Engine (Mozilla)"
echo " gfw MS Game For Windows Live (xlive.dll)"
echo " glut The glut utility library"
echo " hosts Adds empty C:\windows\system32\drivers\etc\{hosts,services} files"
echo " ie6 Microsoft Internet Explorer 6.0"
echo " ie6_full Microsoft Internet Explorer 6.0, full installer"
echo " ie7 Microsoft Internet Explorer 7.0"
echo " ie8 Microsoft Internet Explorer 8.0"
echo " jet40 MS Jet 4.0 Service Pack 8"
echo " kde KDE for Windows installer"
echo " l3codecx MPEG Layer-3 Audio Codec for Microsoft DirectShow"
echo " liberation Red Hat Liberation fonts (Sans, Serif, Mono)"
echo " lucida MS Lucida Console font"
echo " mdac25 MS MDAC 2.5: Microsoft ODBC drivers, etc."
echo " mdac27 MS MDAC 2.7"
echo " mdac28 MS MDAC 2.8"
echo " mfc40 MS mfc40 (Microsoft Foundation Classes from Visual C++ 4)"
echo " mfc42 MS mfc42 (same as vcrun6 below)"
echo " mingw-gdb GDB for MinGW"
echo " mingw Minimalist GNU for Windows, including GCC for Windows!"
echo " mono26 mono-2.6"
echo " mozillabuild Mozilla build environment"
echo " mpc Media Player Classic"
echo " mshflxgd MS Hierarchical FlexGrid Control"
echo " msi2 MS Windows Installer 2.0"
echo " msls31 MS Line Services 3.1 (needed by native riched?)"
echo " msmask MS Masked Edit Control"
echo " mspaint MS Paint (gotta draw stick figures somehow...)"
echo " msscript MS Windows Script Control"
echo " msxml3 MS XML Core Services 3.0"
echo " msxml4 MS XML Core Services 4.0"
echo " msxml6 MS XML Core Services 6.0"
echo " ogg ogg filters/codecs: flac, theora, speex, vorbis, schroedinger"
echo " ole2 MS 16 bit OLE"
echo " openwatcom Open Watcom C/C++ compiler (can compile win16 code!)"
echo " pdh MS pdh.dll (Performance Data Helper)"
echo " physx NVIDIA/AGEIA PhysX runtime"
echo " psdk2003 MS Platform SDK 2003"
echo " psdkvista MS Vista SDK (does not install yet)"
echo " psdkwin7 MS Windows 7 SDK (installing just headers and c++ compiler works)"
echo " python26 Python 2.6.2 (and pywin32)"
echo " python-comtypes Python 0.6.1-1 comtypes package"
echo " quartz quartz.dll (from Directx 9 user redistributable)"
echo " quicktime72 Apple Quicktime 7.2"
echo " quicktime76 Apple Quicktime 7.6"
echo " riched20 MS RichEdit Control, riched20 and riched32"
echo " riched30 MS RichEdit Control, riched30"
echo " richtx32 MS Rich TextBox Control 6.0"
echo " safari Apple Safari web browser"
echo " secur32 MS secur32"
echo " shockwave Adobe Shockwave Player"
echo " steam Steam Client App from Valve"
echo " tahoma MS Tahoma font (not part of corefonts)"
echo " takao Takao Japanese fonts"
echo " unifont Unifont alternative to Arial Unicode MS"
echo " urlmon MS urlmon.dll"
echo " usp10 MS usp10.dll (Uniscribe)"
echo " utorrent uTorrent"
echo " vb2run MS Visual Basic 2 runtime"
echo " vb3run MS Visual Basic 3 runtime"
echo " vb4run MS Visual Basic 4 runtime"
echo " vb5run MS Visual Basic 5 runtime"
echo " vb6run MS Visual Basic 6 Service Pack 6 runtime"
echo " vc2005express MS Visual C++ 2005 Express"
echo " vc2005expresssp1 MS Visual C++ 2005 Express SP1 (does not work yet)"
echo " vc2005sp1 MS Visual C++ 2005 Service Pack 1 and ATL fix (install trial 1st)"
echo " vc2005hotfix MS Visual C++ 2005 hotfixes (install sp1 1st)"
echo " vc2005trial MS Visual C++ 2005 Trial"
echo " vcrun2003 MS Visual C++ 2003 libraries (mfc71,msvcp71,msvcr71)"
echo " vcrun2005 MS Visual C++ 2005 sp1 libraries (mfc80,msvcp80,msvcr80)"
echo " vcrun2008 MS Visual C++ 2008 libraries (mfc90,msvcp90,msvcr90)"
echo " vcrun2010 MS Visual C++ 2010 libraries (mfc100,msvcp100,msvcr100)"
echo " vcrun6 MS Visual C++ 6 sp4 libraries (mfc42, msvcp60, msvcrt)"
echo " vcrun6sp6 MS Visual C++ 6 sp6 libraries (mfc42, msvcp60, msvcrt; 64 MB download)"
echo " vjrun20 MS Visual J# 2.0 SE libraries (requires dotnet20)"
echo " vlc VLC media player"
echo " wenquanyi WenQuanYi CJK font (on LCD looks better with fontsmooth-rgb)"
echo " windowscodecs MS Windows Imaging Component"
echo " winhttp MS winhttp.dll (requires Windows license, but does not check for one)"
echo " wininet MS wininet.dll (requires Windows license, but does not check for one)"
echo " wme9 MS Windows Media Encoder 9 (requires Windows license, but does not check for one)"
echo " wmp10 MS Windows Media Player 10 (requires Windows license, but does not check for one)"
echo " wmp9 MS Windows Media Player 9 (requires Windows license, but does not check for one)"
echo " wsh56js MS Windows scripting 5.6, jscript only, no cscript"
echo " wsh56 MS Windows Scripting Host 5.6"
echo " wsh56vb MS Windows scripting 5.6, vbscript only, no cscript"
echo " xact MS XACT Engine (x3daudio?_?.dll, xactengine?_?.dll)"
echo " xinput MS XInput (Xbox controller support, xinput?_?.dll)"
echo " xvid xvid video codec"
echo "Pseudopackages:"
echo " alldlls=builtin Force use of builtin dlls (even if loaded with absolute path) (except for msvcp80 and d3dx9_*)"
echo " alldlls=default Remove all DLL overrides"
echo " allfonts All listed fonts and aliases (corefonts, droid, eufonts, liberation, lucida, tahoma, cjkfonts)"
echo " allcodecs All listed codecs (xvid, ffdshow)"
echo " cjkfonts All Chinese, Japanese, Korean fonts and aliases (fakechinese, fakejapanese, fakekorean, unifont)"
echo " ddr=gdi Set DirectDrawRenderer to GDI (default)"
echo " ddr=opengl Set DirectDrawRenderer to OpenGL"
echo " dsoundbug9612 Use DirectSound MaxShadowSize=0 workaround for bug #9612"
echo " forcemono Force using mono instead of .Net (for debugging)"
echo " glsl-disable Disable GLSL use by Wine Direct3D"
echo " glsl-enable Enable GLSL use by Wine Direct3D (default)"
echo " heapcheck Enable heap checking"
echo " multisampling=enabled Enable Direct3D multisampling"
echo " multisampling=disabled Disable Direct3D multisampling (default)"
echo " native_mdac Override odbc32, odbccp32 and oledb32"
echo " native_oleaut32 Override oleaut32"
echo " nocrashdialog Disable the graphical crash dialog"
echo " orm=backbuffer Registry tweak: OffscreenRenderingMode=backbuffer"
echo " orm=fbo Registry tweak: OffscreenRenderingMode=fbo (default)"
echo " rtlm=auto Set RenderTargetLockMode to auto (default)"
echo " rtlm=disabled Set RenderTargetLockMode to disabled"
echo " rtlm=readdraw Set RenderTargetLockMode to readdraw"
echo " rtlm=readtex Set RenderTargetLockMode to readtex"
echo " rtlm=texdraw Set RenderTargetLockMode to texdraw"
echo " rtlm=textex Set RenderTargetLockMode to textex"
echo " sandbox Sandbox the wineprefix - remove links to ~"
echo " sound=alsa Set sound driver to ALSA"
echo " sound=audioio Set sound driver to AudioIO"
echo " sound=coreaudio Set sound driver to CoreAudio"
echo " sound=esd Set sound driver to Esound"
echo " sound=jack Set sound driver to Jack"
echo " sound=nas Set sound driver to Nas"
echo " sound=oss Set sound driver to OSS"
echo " sound=disabled Disable sound"
echo " strictdrawordering=enabled Enable StrictDrawOrdering (default)"
echo " strictdrawordering=disabled Disable StrictDrawOrdering"
echo " nt40 Set windows version to nt40"
echo " vd=off Disable virtual desktop"
echo " vd=1024x768 Enable virtual desktop, set size to 1024x768"
echo " win98 Set windows version to Windows 98"
echo " win2k Set windows version to Windows 2000"
echo " winxp Set windows version to Windows XP"
echo " vista Set windows version to Windows Vista"
echo " win7 Set windows version to Windows 7"
echo " winver= Set windows version to default (winxp)"
echo " volnum Rename drive_c to harddiskvolume0 (needed by some installers)"
echo " mwo=force Set MouseWarpOverride to force (needed by some games)"
echo " mwo=enabled Set MouseWarpOverride to enabled (default)"
echo " mwo=disable Set MouseWarpOverride to disable"
echo " npm-repack Set NonPower2Mode to repack"
echo " psm=on Set PixelShaderMode to enabled"
echo " psm=off Set PixelShaderMode to disabled"
echo " vsm-hard Set VertexShaderMode to hardware"
}
#----------------------------------------------------------------
# Trivial GUI just to handle case where user tries running without commandline
kdialog_showmenu() {
title="$1"
shift
text="$1"
shift
col1name="$1"
shift
col2name="$1"
shift
while test $# -gt 0
do
args="$args $1 $1 off"
shift
done
kdialog --title "$title" --separate-output --checklist "$text" $args
}
xmessage_showmenu() {
title="$1"
shift
text="$1"
shift
col1name="$1"
shift
col2name="$1"
shift
if test $# -gt 0
then
args="$1"
shift
fi
while test $# -gt 0
do
args="$args,$1"
shift
done
(echo "$title"; echo ""; echo "$text") | \
xmessage -print -file - -buttons "Cancel,$args" | sed 's/Cancel//'
}
showmenu()
{
case $MENU in
zenity)
echo "zenity --title 'Winetricks' --text 'Select packages to install' --list --checklist --column '' --column Package --column Description --height 440 --width 600 \\" > "$WINETRICKS_TMP"/zenity.sh
usage | grep '^ [0-9a-z]' | sed 's/^ \([^ ]*\) *\(.*\)/FALSE "\1" '"'\2'/" | sed 's/$/ \\/' >> "$WINETRICKS_TMP"/zenity.sh
todo="`sh "$WINETRICKS_TMP"/zenity.sh | tr '|' ' '`"
;;
kdialog)
packages=`usage | awk '/^ [0-9a-z]/ {print $1}'`
todo="`kdialog_showmenu "winetricks" "Select a package to install" "Install?" "Package" $packages`"
;;
xmessage)
packages=`usage | awk '/^ [0-9a-z]/ {print $1}'`
todo="`xmessage_showmenu "winetricks" "Select a package to install" "Install?" "Package" $packages`"
;;
esac
if test "$todo"x = x
then
exit 0
fi
}
#----- Helpers ------------------------------------------------
GUI=0
case x"$1" in
x) GUI=1 ;;
x-h|x--help|xhelp) usage ; exit 1 ;;
x-V|x--version|xversion) echo "Winetricks version $VERSION. (C) 2007-2010 Dan Kegel et al. LGPL." ; exit 0;;
esac
early_wine()
{
WINEDLLOVERRIDES=mshtml= $WINE "$@"
}
# Default values for important settings if not already in environment.
# These settings should not need editing here.
case "$OS" in
"Windows_NT")
# Cheezy fix for getting rid of double slashes when running cygwin in wine
case $HOME in
/) HOME="" ;;
esac
WINE=""
WINEPREFIX=${WINEPREFIX:-$HOME/.wine}
DRIVE_C="C:/"
XXXPATH=cygpath
;;
*)
WINE=${WINE:-wine}
WINEPREFIX=${WINEPREFIX:-$HOME/.wine}
DRIVE_C="$WINEPREFIX/dosdevices/c:"
XXXPATH="early_wine winepath"
;;
esac
WINDIR="$DRIVE_C/windows"
# Win(e) 32/64?
# Using the variable SYSTEM32_DLLS instead of SYSTEM32 because some stuff does go under system32 for both arch's
# e.g., spool/drivers/color
if test -d "$DRIVE_C/windows/syswow64"
then
ARCH=win64
SYSTEM32_DLLS="$WINDIR/syswow64"
else
ARCH=win32
SYSTEM32_DLLS="$WINDIR/system32"
fi
# Decide where to store downloaded files
if test ! "$WINETRICKS_CACHE" -a -d $HOME/.winetrickscache
then
# For backwards compatibility
WINETRICKS_CACHE="$HOME/.winetrickscache"
else
# See http://standards.freedesktop.org/basedir-spec/latest/ar01s03.html
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
WINETRICKS_CACHE="${WINETRICKS_CACHE:-$XDG_CACHE_HOME/winetricks}"
fi
test -d "$WINETRICKS_CACHE" || mkdir -p "$WINETRICKS_CACHE"
# Internal variables; these locations are not too important
WINETRICKS_CACHE_WIN="`$XXXPATH -w $WINETRICKS_CACHE | tr '\012' ' ' | sed 's/ $//'`"
WINETRICKS_TMP="$DRIVE_C"/winetrickstmp
WINETRICKS_TMP_WIN='c:\winetrickstmp'
mkdir -p "$WINETRICKS_TMP"
# Handle case where z: doesn't exist
case "$WINETRICKS_CACHE_WIN" in
""|*\?\\unix*)
# WINETRICKS_CACHE isn't accessible via a drive letter mapping, so make one,
# but be sure to clean it up later.
for letter in y x w v u t s r q
do
if ! test -d "$WINEPREFIX"/dosdevices/${letter}:
then
WINETRICKS_CACHE_SYMLINK="$WINEPREFIX"/dosdevices/${letter}:
ln -sf "$WINETRICKS_CACHE" "$WINETRICKS_CACHE_SYMLINK"
break
fi
done
;;
esac
# Overridden for windows
ISO_MOUNT_ROOT=/mnt/winetricks
# Which sourceforge mirror to use. Rotate based on time, since
# their mirror picker sometimes persistantly sends you to a broken
# mirror.
case `date +%S` in
*[23]) SOURCEFORGE=http://easynews.dl.sourceforge.net/sourceforge ;;
*) SOURCEFORGE=http://downloads.sourceforge.net;;
esac
# Execute with error checking
try() {
# "VAR=foo try cmd" fails to put VAR in the environment
# with some versions of bash if try is a shell function?!
# Adding this explicit export works around it.
export WINEDLLOVERRIDES
echo Executing "$@"
# Mark executable - needed if running on windows vista
case "$1" in
*.exe) chmod +x "$1" || true
cmd /c "$@"
;;
*)
"$@"
;;
esac
status=$?
if test $status -ne 0
then
die "Note: command '$@' returned status $status. Aborting."
fi
}
try_regedit() {
# on windows, doesn't work without cmd /c
case "$OS" in
"Windows_NT") cmdc="cmd /c";;
*) unset cmdc
esac
try early_wine $cmdc regedit "$@"
}
regedit() {
die oops, bug, please report
}
try_cabextract() {
# Not always installed, but shouldn't be fatal unless it's being used
CABEXTRACT="`which cabextract 2>/dev/null`"
if test ! -x "$CABEXTRACT"
then
die "Cannot find cabextract. Please install it (e.g. 'sudo apt-get install cabextract' or 'sudo yum install cabextract')."
fi
try $CABEXTRACT "$@"
}
cabextract() {
die oops, bug, please report
}
try_unzip() {
# Not always installed, but shouldn't be fatal unless it's being used
UNZIP="`which unzip 2>/dev/null`"
if test ! -x "$UNZIP"
then
die "Cannot find unzip. Please install it (e.g. 'sudo apt-get install unzip' or 'sudo yum install unzip')."
fi
try $UNZIP "$@"
}
unzip() {
die oops, bug, please report
}
# verify an sha1sum
verify_sha1sum() {
wantsum=$1
file=$2
gotsum=`$SHA1SUM < "$file" | sed 's/(stdin)= //;s/ .*//'`
if [ "$gotsum"x != "$wantsum"x ]
then
die "sha1sum mismatch! Rename $file and try again."
fi
}
# Download a file
# Usage: package url [sha1sum [filename]]
# Caches downloads in winetrickscache/$package
download() {
if [ "$4"x != ""x ]
then
file="$4"
else
file=`basename "$2"`
fi
cache="$WINETRICKS_CACHE/$1"
mkdir -p "$cache"
if test ! -f "$cache/$file" || test "$WINETRICKS_CONTINUE_DOWNLOAD"
then
cd "$cache"
# Mac folks tend to have curl rather than wget
# On Mac, 'which' doesn't return good exit status
# Need to jam in --header "Accept-Encoding: gzip,deflate" else
# redhat.com decompresses liberation-fonts.tar.gz!
if [ -x "`which wget 2>/dev/null`" ]
then
# Use -nd to insulate ourselves from people who set -x in WGETRC
# [*] --retry-connrefused works around the broken sf.net mirroring
# system when downloading corefonts
# [*] --read-timeout is useful on the adobe server that doesn't
# close the connection unless you tell it to (control-C or closing
# the socket)
try wget -O "$file" -nd -c --read-timeout=300 --retry-connrefused --header "Accept-Encoding: gzip,deflate" "$2"
elif [ -x "`which curl 2>/dev/null`" ]
then
# curl doesn't get filename from the location given by the server!
# fortunately, we know it
try curl -L -o "$file" -C - --header "Accept-Encoding: gzip,deflate" "$2"
else
die "wget/curl not found, cannot download any files. Please install either wget or curl."
fi
# Need to decompress .exe's that are compressed, else cygwin fails
# Only affects cygwin, so don't barf if 'file' not installed
FILE=`which file 2>/dev/null`
case $FILE-$file in
/*-*.exe)
case `file $file` in
*gzip*) mv $file $file.gz; gunzip < $file.gz > $file;;
esac
esac
cd "$olddir"
fi
if [ "$3"x != ""x ]
then
verify_sha1sum $3 "$cache/$file"
fi
}
set_winver() {
echo "Setting Windows version to $1"
cat > "$WINETRICKS_TMP"/set-winver.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine]
"Version"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP_WIN"\\set-winver.reg
}
set_app_winver() {
app="$1"
version="$2"
echo "Setting $app to $version mode"
(
echo REGEDIT4
echo ""
echo "[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\$app]"
echo "\"Version\"=\"$version\""
) > "$WINETRICKS_TMP"/set-winver.reg
try_regedit "$WINETRICKS_TMP_WIN"\\set-winver.reg
rm "$WINETRICKS_TMP"/set-winver.reg
}
set_ddr() {
echo "Setting DirectDrawRenderer to $1"
cat > "$WINETRICKS_TMP"/set-ddr.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"DirectDrawRenderer"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-ddr.reg
}
set_orm() {
echo "Setting OffscreenRenderingMode to $1"
cat > "$WINETRICKS_TMP"/set-orm.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"OffscreenRenderingMode"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP_WIN"\\set-orm.reg
}
set_mmdevapi() {
echo "Setting mmdevapi to $1"
override_dlls $1 mmdevapi
}
set_rtlm() {
echo "Setting RenderTargetLockMode to $1"
cat > "$WINETRICKS_TMP"/set-rtlm.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"RenderTargetLockMode"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-rtlm.reg
}
set_sdo() {
echo "Setting StrictDrawOrdering to $1"
cat > "$WINETRICKS_TMP"/set-sdo.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"StrictDrawOrdering"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-sdo.reg
}
set_vsm() {
echo "Setting Vertex Shaders to $1"
cat > "$WINETRICKS_TMP"/set-vsm.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"VertexShaderMode"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-vsm.reg
}
set_multisampling() {
echo "Setting Multisampling to $1"
cat > "$WINETRICKS_TMP"/set-multi.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"Multisampling"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-multi.reg
}
set_mwo () {
echo "Setting MouseWarpOverride to $1"
cat > "$WINETRICKS_TMP"/set-mwo.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\DirectInput]
"MouseWarpOverride"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-mwo.reg
}
npm_repack (){
echo "Setting Nonpower2Mode to repack"
cat > "$WINETRICKS_TMP"/set-npw.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"Nonpower2Mode"="repack"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-npw.reg
}
set_psm() {
echo "Setting PixelShaderMode to $1"
cat > "$WINETRICKS_TMP"/set-psm.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"RenderTargetLockMode"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP"/set-psm.reg
}
set_sound_driver() {
echo "Setting sound driver to $1"
cat > "$WINETRICKS_TMP"/set-sound.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Drivers]
"Audio"="$1"
_EOF_
try_regedit "$WINETRICKS_TMP_WIN"\\set-sound.reg
}
set_videomemorysize() {
size=$1
echo "Setting video memory size to $size"
case $size in
default)
cat > "$WINETRICKS_TMP"/set-video.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"VideoMemorySize"=-
_EOF_
;;
*)
cat > "$WINETRICKS_TMP"/set-video.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Direct3D]
"VideoMemorySize"="$size"
_EOF_
esac
try_regedit "$WINETRICKS_TMP_WIN"\\set-video.reg
}
set_virtualdesktop() {
size=$1
case $size in
off|disabled)
cat > "$WINETRICKS_TMP"/vd.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Explorer]
"Desktop"=-
[HKEY_CURRENT_USER\Software\Wine\Explorer\Desktops]
"Default"=-
_EOF_
;;
[1-9]*x[1-9]*)
cat > "$WINETRICKS_TMP"/vd.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Explorer]
"Desktop"="Default"
[HKEY_CURRENT_USER\Software\Wine\Explorer\Desktops]
"Default"="$size"
_EOF_
;;
*)
die "you want a virtual desktop of $size? I don't understand."
;;
esac
try_regedit "$WINETRICKS_TMP"/vd.reg
}
disable_crashdialog() {
echo "Disabling graphical crash dialog"
cat > "$WINETRICKS_TMP"/crashdialog.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\WineDbg]
"ShowCrashDialog"=dword:00000000
_EOF_
try_regedit "$WINETRICKS_TMP_WIN"\\crashdialog.reg
}
sandbox() {
# Unmap drive Z
# Might want to unpack gecko first, since Wine won't be able to get to /usr/lib/wine after this
rm -f "$WINEPREFIX/dosdevices/z:"
# remove symlinks (won't do anything if they're already directories)
rm -f "$WINEPREFIX/drive_c/users/$USER/Desktop"
rm -f "$WINEPREFIX/drive_c/users/$USER/My Documents"
rm -f "$WINEPREFIX/drive_c/users/$USER/My Music"
rm -f "$WINEPREFIX/drive_c/users/$USER/My Pictures"
rm -f "$WINEPREFIX/drive_c/users/$USER/My Videos"
# create replacement directories if needed
mkdir -p "$WINEPREFIX/drive_c/users/$USER/Desktop"
mkdir -p "$WINEPREFIX/drive_c/users/$USER/My Documents"
mkdir -p "$WINEPREFIX/drive_c/users/$USER/My Music"
mkdir -p "$WINEPREFIX/drive_c/users/$USER/My Pictures"
mkdir -p "$WINEPREFIX/drive_c/users/$USER/My Videos"
# Disable unixfs
# Unfortunately, when you run with a different version of wine, wine will recreate this key.
# See http://bugs.winehq.org/show_bug.cgi?id=22450
$WINE regedit /d 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\Namespace\{9D20AAE8-0625-44B0-9CA7-71889C2254D9}'
# Disable recreation of the above key - or any updating of the regisry - when running with new version of wine.
echo disable > "$WINEPREFIX/.update-timestamp"
}
unset_winver() {
echo "Clearing Windows version back to default"
cat > "$WINETRICKS_TMP"/unset-winver.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine]
"Version"=-
_EOF_
try_regedit "$WINETRICKS_TMP_WIN"\\unset-winver.reg
}
override_dlls() {
mode=$1
if [ $mode = "disabled" ]
then
mode=""
fi
shift
echo Using $mode override for following DLLs: $@
cat > "$WINETRICKS_TMP"/override-dll.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\DllOverrides]
_EOF_
while test "$1" != ""
do
case "$1" in
comctl32)
rm -rf "$WINDIR"/winsxs/manifests/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest
;;
esac
# Note: if you want to override even DLLs loaded with an absolute path,
# you need to add an asterisk:
echo "\"*$1\"=\"$mode\"" >> "$WINETRICKS_TMP"/override-dll.reg
#echo "\"$1\"=\"$mode\"" >> "$WINETRICKS_TMP"/override-dll.reg
shift
done
try_regedit "$WINETRICKS_TMP_WIN"\\override-dll.reg
cat "$WINETRICKS_TMP"/override-dll.reg
rm "$WINETRICKS_TMP"/override-dll.reg
}
override_no_dlls() {
$WINE regedit /d 'HKEY_CURRENT_USER\Software\Wine\DllOverrides'
}
override_all_dlls() {
# Disable all but the commonly used DLLs Wine doesn't have a credible alternative for
# i.e. Don't disallow msvcp80 or d3dx9_* for now
# d3dx9_24.dll d3dx9_25.dll d3dx9_26.dll d3dx9_27.dll d3dx9_28.dll d3dx9_29.dll d3dx9_30.dll d3dx9_31.dll d3dx9_32.dll d3dx9_33.dll d3dx9_34.dll d3dx9_35.dll d3dx9_36.dll d3dx9_37.dll d3dx9_38.dll d3dx9_39.dll d3dx9_40.dll d3dx9_41.dll d3dx9_42.dll d3dxof.dll
override_dlls builtin \
acledit aclui activeds actxprxy advapi32 advpack amstream atl authz avicap32 \
avifil32 avifilebavrt bcrypt browseui cabinet capi2032 cards cfgmgr32 clusapi \
comcat comctl32 comdlg32 commdlg compobj compstui credui crtdll crypt32 cryptdlg \
cryptdll cryptnet cryptui ctapi32 ctl3d ctl3d32 ctl3dv2 d3d10 \
d3d10core d3d8 d3d9 d3dim d3drm \
d3dxof dbghelp dciman32 ddeml ddraw ddrawex \
devenum dinput dinput8 dispdib dispex dmband dmcompos dmime dmloader dmscript \
dmstyle dmsynth dmusic dmusic32 dnsapi dplay dplayx dpnaddr dpnet dpnhpast \
dpnlobby dpwsockx drmclien dsound dssenh dswave dwmapi dxdiagn dxgi faultrep \
fltlib fusion fwpuclnt gdi32 gdiplus glu32 gpkcsp hal hid hlink \
hnetcfg httpapi iccvid icmp imagehlp imm imm32 inetcomm inetmib1 infosoft \
initpki inkobj inseng iphlpapi itircl itss jscript kernel32 loadperf localspl \
localui lz32 lzexpand mapi32 mapistub mciavi32 mcicda mciqtz32 mciseq mciwave \
midimap mlang mmdevapi mmsystem mpr mprapi msacm msacm32 mscat32 mscms \
mscoree msctf msdaps msdmo msftedit mshtml msi msimg32 msimtf msisip \
msnet32 msrle32 mssign32 mssip32 mstask msvcirt msvcr70 msvcr71 msvcr80 \
msvcr90 msvcrt msvcrt20 msvcrt40 msvcrtd msvfw32 msvidc32 msvideo mswsock msxml3 \
msxml4 nddeapi netapi32 newdev ntdll ntdsapi ntprint objsel odbc32 odbccp32 \
ole2 ole2conv ole2disp ole2nls ole2prox ole2thk ole32 oleacc oleaut32 olecli \
olecli32 oledb32 oledlg olepro32 olesvr olesvr32 olethk32 openal32 opengl32 pdh \
pidgen powrprof printui propsys psapi pstorec qcap qedit qmgr qmgrprxy \
quartz query rasapi16 rasapi32 rasdlg resutils riched20 riched32 rpcrt4 rsabase \
rsaenh rtutils sccbase schannel secur32 security sensapi serialui setupapi setupx \
sfc sfc_os shdoclc shdocvw shell shell32 shfolder shlwapi slbcsp slc \
snmpapi softpub spoolss sti storage stress svrapi sxs t2embed tapi32 \
toolhelp traffic twain twain_32 typelib unicows updspapi url urlmon user32 \
userenv usp10 uxtheme vdmdbg ver version w32skrnl w32sys wbemprox wiaservc \
win32s16 win87em winaspi windebug windowscodecs wined3d winedos winemapi wing wing32 \
winhttp wininet winmm winnls winnls32 winscard winsock wintab wintab32 wintrust \
wldap32 wmi wmiutils wnaspi32 wow32 ws2_32 wsock32 wtsapi32 wuapi wuaueng \
xinput1_1 xinput1_2 xinput1_3 xinput9_1_0 xmllite
}
override_app_dlls() {
app=$1
shift
mode=$1
shift
echo Using $mode override for following DLLs when running $app: $@
(
echo REGEDIT4
echo ""
echo "[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\$app\\DllOverrides]"
) > "$WINETRICKS_TMP"/override-dll.reg
while test "$1" != ""
do
case "$1" in
comctl32)
rm -rf "$WINDIR"/winsxs/manifests/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest
;;
esac
echo "\"$1\"=\"$mode\"" >> "$WINETRICKS_TMP"/override-dll.reg
shift
done
try_regedit "$WINETRICKS_TMP_WIN"\\override-dll.reg
rm "$WINETRICKS_TMP"/override-dll.reg
}
register_font() {
file=$1
shift
font=$1
#echo "Registering $file as $font"
cat > "$WINETRICKS_TMP"/register-font.reg <<_EOF_
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts]
"$font"="$file"
_EOF_
# too verbose
try_regedit "$WINETRICKS_TMP_WIN"\\register-font.reg
}
append_path() {
# Prepend $1 to the windows path in the registry. Caller must use single quotes and double backslashes in argument.
NEW_PATH="$1"
WIN_PATH="`WINEDEBUG= $WINE cmd.exe /c echo "%PATH%" | tr -d '\r' | sed 's,\\\\,\\\\\\\\,g'`"