daily pastebin goal
75%
SHARE
TWEET

OFP Aspect Ratio pack v2.06

Faguss May 10th, 2017 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; NSIS Script for OFP Aspect Ratio pack v2.06
  2.  
  3.  
  4. ;------Header---------------
  5.  
  6. !include "MUI2.nsh"
  7. !include "TextFunc.nsh"
  8. !include "WordFunc.nsh"
  9. !include "nsDialogs.nsh"
  10. !include "winmessages.nsh"
  11. !include "logiclib.nsh"
  12. !include "nsArray.nsh"
  13.  
  14. SetCompressor /solid lzma
  15. ShowInstDetails show
  16. RequestExecutionLevel admin
  17. ;BrandingText "NSIS script by Faguss (ofp-faguss.com)"
  18. InstallDir $INSTDIR
  19. ;InstallDirRegKey HKLM "Software\Codemasters\Operation Flashpoint" "MAIN"
  20.  
  21.  
  22.  
  23.  
  24.  
  25. ;------Strings--------------
  26.  
  27. VIAddVersionKey "ProductName" "OFP Aspect Ratio Installer"
  28. VIAddVersionKey "Comments" "Update screen format for the Operation Flashpoint: Resistance 1.96 and ArmA: Cold War Assault 1.99"
  29. VIAddVersionKey "CompanyName" "ofp-faguss.com"
  30. VIAddVersionKey "LegalTrademarks" "Public Domain"
  31. VIAddVersionKey "LegalCopyright" "Public Domain"
  32. VIAddVersionKey "FileDescription" "Install OFP Aspect Ratio package"
  33. VIAddVersionKey "FileVersion" "2.0.6.0"
  34. VIProductVersion "2.0.6.0"
  35.  
  36.  
  37.  
  38.  
  39.  
  40. ;------Variables------------
  41.  
  42. Var finishpagetext
  43. Var parameters
  44. Var runtext
  45. Var exename
  46.  
  47. Var cfgName
  48. Var AR_STRING
  49. Var AR_STRING2
  50. Var dialog
  51. Var hwnd
  52. Var radio1
  53. Var radio2
  54. Var radio3
  55. Var radio4
  56. Var radio5
  57. Var radio6
  58. Var FoundUserInfo
  59. Var ModifiedHPP
  60. Var key
  61. Var value
  62. Var dest
  63. Var ECPRedux
  64. Var Obsolete
  65. Var HasBackup
  66.  
  67.  
  68.  
  69.  
  70.  
  71. ;------Customize------------
  72.  
  73. Name "OFP Aspect Ratio"
  74. OutFile "ofp_aspect_ratio.exe"
  75. !define MUI_ICON "img\orange-install.ico"
  76. !define MUI_WELCOMEFINISHPAGE_BITMAP "img\Installer_Welcome.bmp"
  77.  
  78. !define MUI_WELCOMEPAGE_TITLE "OFP Aspect Ratio v2.06"
  79. !define MUI_WELCOMEPAGE_TEXT "This will update screen format for the$\n$\n$\tOperation Flashpoint: Resistance 1.96$\n$\tArmA: Cold War Assault 1.99$\n$\n$\nFwatch 1.16 included."
  80. !define MUI_HEADERIMAGE
  81. !define MUI_HEADERIMAGE_BITMAP "img\Installer_Header.bmp"
  82. !define MUI_HEADERIMAGE_RIGHT
  83. !define MUI_DIRECTORYPAGE_TEXT_TOP "Make sure this path leads to the game directory.$\n$\nGame must have been run at least once.$\n$\nInstaller will replace resource.cpp and revert config.cpp (from the older version)"
  84. !define MUI_FINISHPAGE_NOAUTOCLOSE
  85. !define MUI_FINISHPAGE_RUN $exename
  86. !define MUI_FINISHPAGE_RUN_PARAMETERS $parameters
  87. !define MUI_FINISHPAGE_RUN_TEXT $runtext
  88. !define MUI_FINISHPAGE_LINK "On-line readme"
  89. !define MUI_FINISHPAGE_LINK_LOCATION "http://www.ofp-faguss.com/files/ofp_aspect_ratio.pdf"
  90. !define MUI_FINISHPAGE_TITLE_3LINES
  91. !define MUI_FINISHPAGE_TEXT $finishpagetext
  92.  
  93. !define MUI_FINISHPAGE_SHOWREADME ""
  94. ;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  95. !define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
  96. !define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
  97.  
  98. !insertmacro MUI_PAGE_WELCOME
  99. !insertmacro MUI_PAGE_DIRECTORY
  100. Page Custom AspectSelection
  101. !insertmacro MUI_PAGE_INSTFILES
  102. !insertmacro MUI_PAGE_FINISH
  103.  
  104. !define MUI_LANGDLL_ALLLANGUAGES
  105. !insertmacro MUI_LANGUAGE "English"
  106. !insertmacro MUI_RESERVEFILE_LANGDLL
  107.  
  108.  
  109.  
  110.  
  111.  
  112. ;------Functions------------
  113.  
  114. ; This reads CWA reg key if OFP is not present
  115. Function .onInit
  116.     StrCpy $AR_STRING ""
  117.     StrCpy $cfgName "flashpoint.cfg"
  118.    
  119.     ${If} $INSTDIR == ""
  120.         ReadRegStr $INSTDIR HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 65790" "InstallLocation"
  121.     ${EndIf}
  122.    
  123.     ${If} $INSTDIR == ""
  124.         ReadRegStr $INSTDIR HKLM "SOFTWARE\Bohemia Interactive Studio\ColdWarAssault" "MAIN"
  125.     ${EndIf}
  126.  
  127.     ${If} $INSTDIR == ""
  128.         ReadRegStr $INSTDIR HKLM "Software\Codemasters\Operation Flashpoint" "MAIN"
  129.     ${EndIf}
  130.  
  131.     ${If} $INSTDIR == ""
  132.         StrCpy $INSTDIR "D:\Games\Operation Flashpoint"
  133.     ${EndIf}
  134. FunctionEnd
  135.  
  136.  
  137. ; This creates a shortcut
  138. Function finishpageaction
  139.     SetOutPath "$INSTDIR\"
  140.     StrCpy $9 "Fwatch.lnk"
  141.    
  142.     IfFileExists $INSTDIR\flashpoint.cfg 0 +2
  143.         StrCpy $9 "Fwatch OFP.lnk"
  144.     IfFileExists $INSTDIR\ColdWarAssault.cfg 0 +2
  145.         StrCpy $9 "Fwatch CWA.lnk"
  146.    
  147.     IfFileExists "$DESKTOP\$9" +2 0
  148.     CreateShortCut "$DESKTOP\$9" "$INSTDIR\$exename" "$parameters"
  149. FunctionEnd
  150.  
  151.  
  152. ; Install directory must have configuration file
  153. Function .onVerifyInstDir
  154.     IfFileExists $INSTDIR\flashpoint.cfg +4 0
  155.         IfFileExists $INSTDIR\ColdWarAssault.cfg +2 0
  156.             Abort
  157.             StrCpy $cfgName "ColdWarAssault.cfg"
  158. FunctionEnd
  159.  
  160.  
  161. ; Detect aspect ratio automatically or provide manual seleciton
  162. Function AspectSelection
  163.     ; Read resolution from the configuration file
  164.     ${ConfigRead} "$INSTDIR\$cfgName" "Resolution_W" $R0
  165.     ${ConfigRead} "$INSTDIR\$cfgName" "Resolution_H" $R1
  166.  
  167.     ; Get rid of extra characters so it's only a number
  168.     ${StrFilter} "$R0" "1" "" "" $R0
  169.     ${StrFilter} "$R1" "1" "" "" $R1
  170.  
  171.     ; Divide width by height
  172.     FloatOp::Autor $0
  173.     FloatOp::D $R0 $R1 $0
  174.  
  175.     ; Assign aspect ratio based on the result
  176.     StrCmp $0 "1.33333" 0 +3
  177.         StrCpy $AR_STRING "4_3"
  178.         StrCpy $AR_STRING2 "4:3"
  179.     StrCmp $0 "1.25" 0 +3
  180.         StrCpy $AR_STRING "5_4"
  181.         StrCpy $AR_STRING2 "5:4"
  182.     StrCmp $0 "1.6" 0 +3
  183.         StrCpy $AR_STRING "16_10"
  184.         StrCpy $AR_STRING2 "16:10"
  185.     StrCmp $0 "1.77778" 0 +3
  186.         StrCpy $AR_STRING "16_9"
  187.         StrCpy $AR_STRING2 "16:9"
  188.     StrCmp $0 "1.66667" 0 +3
  189.         StrCpy $AR_STRING "15_9"
  190.         StrCpy $AR_STRING2 "15:9"
  191.     StrCmp $0 "2.37037" 0 +3
  192.         StrCpy $AR_STRING "21_9"
  193.         StrCpy $AR_STRING2 "21:9"
  194.        
  195.     ; If nothing was assigned then continue; otherwise skip the rest of the page
  196.     StrCmp $AR_STRING "" selection message
  197.        
  198.        
  199.     ; Create dialog with radio buttons
  200.     selection:
  201.     nsDialogs::Create 1018
  202.         Pop $dialog
  203.     ${NSD_CreateRadioButton} 2% 10% 40% 6% "4:3"
  204.         Pop $radio1
  205.         ${NSD_AddStyle} $radio1 ${WS_GROUP}
  206.         ${NSD_OnClick} $radio1 RadioChange
  207.         ${NSD_SetState} $radio1 ${BST_CHECKED}
  208.     ${NSD_CreateRadioButton} 2% 20% 40% 6% "5:4"
  209.         Pop $radio2
  210.         ${NSD_AddStyle} $radio2 ${WS_GROUP}
  211.         ${NSD_OnClick} $radio2 RadioChange
  212.     ${NSD_CreateRadioButton} 2% 30% 40% 6% "16:10"
  213.         Pop $radio3
  214.         ${NSD_AddStyle} $radio3 ${WS_GROUP}
  215.         ${NSD_OnClick} $radio3 RadioChange
  216.     ${NSD_CreateRadioButton} 2% 40% 40% 6% "16:9"
  217.         Pop $radio4
  218.         ${NSD_AddStyle} $radio4 ${WS_GROUP}
  219.         ${NSD_OnClick} $radio4 RadioChange
  220.     ${NSD_CreateRadioButton} 2% 50% 40% 6% "15:9"
  221.         Pop $radio5
  222.         ${NSD_AddStyle} $radio5 ${WS_GROUP}
  223.         ${NSD_OnClick} $radio5 RadioChange
  224.     ${NSD_CreateRadioButton} 2% 60% 40% 6% "21:9"
  225.         Pop $radio6
  226.         ${NSD_AddStyle} $radio6 ${WS_GROUP}
  227.         ${NSD_OnClick} $radio6 RadioChange
  228.     ${NSD_CreateLabel} 0 0 100% 20% "Select your screen's aspect ratio:"
  229.         Pop $hwnd
  230.     nsDialogs::Show
  231.     Goto end
  232.    
  233.     message:
  234.     nsDialogs::Create 1018
  235.         Pop $dialog
  236.     ${NSD_CreateLabel} 0 0 100% 20% "Aspect ratio was set to $AR_STRING2"
  237.         Pop $hwnd
  238.     nsDialogs::Show
  239.    
  240.     end:
  241.    
  242. FunctionEnd
  243.  
  244.  
  245. ; Handle user clicks on the dialog page
  246. Function RadioChange
  247.     Pop $1
  248.     ${If} $1 == $radio1
  249.         StrCpy $AR_STRING "4_3"
  250.         ${NSD_SetState} $radio2 ${BST_UNCHECKED}
  251.         ${NSD_SetState} $radio3 ${BST_UNCHECKED}
  252.         ${NSD_SetState} $radio4 ${BST_UNCHECKED}
  253.         ${NSD_SetState} $radio5 ${BST_UNCHECKED}
  254.         ${NSD_SetState} $radio6 ${BST_UNCHECKED}
  255.     ${EndIf}
  256.     ${If} $1 == $radio2
  257.         StrCpy $AR_STRING "5_4"
  258.         ${NSD_SetState} $radio1 ${BST_UNCHECKED}
  259.         ${NSD_SetState} $radio3 ${BST_UNCHECKED}
  260.         ${NSD_SetState} $radio4 ${BST_UNCHECKED}
  261.         ${NSD_SetState} $radio5 ${BST_UNCHECKED}
  262.         ${NSD_SetState} $radio6 ${BST_UNCHECKED}
  263.     ${EndIf}
  264.     ${If} $1 == $radio3
  265.         StrCpy $AR_STRING "16_10"
  266.         ${NSD_SetState} $radio1 ${BST_UNCHECKED}
  267.         ${NSD_SetState} $radio2 ${BST_UNCHECKED}
  268.         ${NSD_SetState} $radio4 ${BST_UNCHECKED}
  269.         ${NSD_SetState} $radio5 ${BST_UNCHECKED}
  270.         ${NSD_SetState} $radio6 ${BST_UNCHECKED}
  271.     ${EndIf}
  272.     ${If} $1 == $radio4
  273.         StrCpy $AR_STRING "16_9"
  274.         ${NSD_SetState} $radio1 ${BST_UNCHECKED}
  275.         ${NSD_SetState} $radio2 ${BST_UNCHECKED}
  276.         ${NSD_SetState} $radio3 ${BST_UNCHECKED}
  277.         ${NSD_SetState} $radio5 ${BST_UNCHECKED}
  278.         ${NSD_SetState} $radio6 ${BST_UNCHECKED}
  279.     ${EndIf}
  280.     ${If} $1 == $radio5
  281.         StrCpy $AR_STRING "15_9"
  282.         ${NSD_SetState} $radio1 ${BST_UNCHECKED}
  283.         ${NSD_SetState} $radio2 ${BST_UNCHECKED}
  284.         ${NSD_SetState} $radio3 ${BST_UNCHECKED}
  285.         ${NSD_SetState} $radio4 ${BST_UNCHECKED}
  286.         ${NSD_SetState} $radio6 ${BST_UNCHECKED}
  287.     ${EndIf}
  288.     ${If} $1 == $radio6
  289.         StrCpy $AR_STRING "21_9"
  290.         ${NSD_SetState} $radio1 ${BST_UNCHECKED}
  291.         ${NSD_SetState} $radio2 ${BST_UNCHECKED}
  292.         ${NSD_SetState} $radio3 ${BST_UNCHECKED}
  293.         ${NSD_SetState} $radio4 ${BST_UNCHECKED}
  294.         ${NSD_SetState} $radio5 ${BST_UNCHECKED}
  295.     ${EndIf}
  296. FunctionEnd
  297.  
  298.  
  299. ; Modify entries in userinfo.cfg based on selected ratio
  300. Function ChangeUserInfo
  301.  
  302.     ; Default values (4:3)
  303.     StrCpy $R1 "0.75"
  304.     StrCpy $R2 "1"
  305.     StrCpy $R3 "0"
  306.     StrCpy $R4 "0"
  307.     StrCpy $R5 "1"
  308.     StrCpy $R6 "1"
  309.    
  310.     ; Change values if different ratio
  311.     ${If} $AR_STRING == "5_4"
  312.         StrCpy $R1 "0.8"
  313.         StrCpy $R2 "1"
  314.         StrCpy $R3 "0"
  315.         StrCpy $R4 "0.03125"
  316.         StrCpy $R5 "1"
  317.         StrCpy $R6 "0.96875"
  318.     ${EndIf}
  319.    
  320.     ${If} $AR_STRING == "16_10"
  321.         StrCpy $R1 "0.75"
  322.         StrCpy $R2 "1.2"
  323.         StrCpy $R3 "0.083333"
  324.         StrCpy $R4 "0"
  325.         StrCpy $R5 "0.916667"
  326.         StrCpy $R6 "1"
  327.     ${EndIf}
  328.    
  329.     ${If} $AR_STRING == "16_9"
  330.         StrCpy $R1 "0.75"
  331.         StrCpy $R2 "1.333333"
  332.         StrCpy $R3 "0.125"
  333.         StrCpy $R4 "0"
  334.         StrCpy $R5 "0.875"
  335.         StrCpy $R6 "1"
  336.     ${EndIf}
  337.    
  338.     ${If} $AR_STRING == "15_9"
  339.         StrCpy $R1 "0.75"
  340.         StrCpy $R2 "1.25"
  341.         StrCpy $R3 "0.1"
  342.         StrCpy $R4 "0"
  343.         StrCpy $R5 "0.9"
  344.         StrCpy $R6 "1"
  345.     ${EndIf}
  346.    
  347.     ${If} $AR_STRING == "21_9"
  348.         StrCpy $R1 "0.75"
  349.         StrCpy $R2 "1.777778"
  350.         StrCpy $R3 "0.21875"
  351.         StrCpy $R4 "0"
  352.         StrCpy $R5 "0.78125"
  353.         StrCpy $R6 "1"
  354.     ${EndIf}
  355.    
  356.     ; Write settings
  357.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "fovTop" "=$R1;" $2
  358.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "fovLeft" "=$R2;" $3
  359.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "uiTopLeftX" "=$R3;" $4
  360.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "uiTopLeftY" "=$R4;" $5
  361.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "uiBottomRightX" "=$R5;" $6
  362.     ${ConfigWrite} $INSTDIR\Users\$1\userinfo.cfg "uiBottomRightY" "=$R6;" $7
  363.    
  364.     ; Display results
  365.     DetailPrint "User $1:"
  366.     DetailPrint "     fovTop: $2"
  367.     DetailPrint "     fovLeft: $3"
  368.     DetailPrint "     uiTopLeftX: $4"
  369.     DetailPrint "     uiTopLeftY: $5"
  370.     DetailPrint "     uiBottomRightX: $6"
  371.     DetailPrint "     uiBottomRightY: $7"
  372.    
  373.     StrCpy $FoundUserInfo "true"
  374. FunctionEnd
  375.  
  376.  
  377. ; Change macro definition in Aspect_Ratio.hpp
  378. Function AspectRatioHPP
  379.    
  380.     ${If} $ModifiedHPP == "false"
  381.         ${WordFind} $R9 "#define aspect_ratio_" "E+1{" $R0
  382.         IfErrors notfound found
  383.         found:
  384.             StrCpy $R9 "#define aspect_ratio_$AR_STRING$\r$\n"
  385.             StrCpy $ModifiedHPP "true"
  386.         notfound:
  387.     ${EndIf}
  388.  
  389.     Push $0
  390. FunctionEnd
  391.  
  392.  
  393. ; Identify ECP version (original or redux)
  394. Function ECPReduxSearch
  395.  
  396.     ${If} $ECPRedux == "false"
  397.         ${WordFind} $R9 "whitegold" "E+1{" $R0
  398.         IfErrors notfound found
  399.         found:
  400.             StrCpy $ECPRedux "true"
  401.         notfound:
  402.     ${EndIf}
  403.    
  404.     Push $0
  405. FunctionEnd
  406.  
  407.  
  408. ; Identify config.cpp
  409. Function ConfigCheck
  410.  
  411.     ${If} $Obsolete == "false"
  412.         ${WordFind} $R9 "Faguss" "E+1{" $R0
  413.         IfErrors notfound found
  414.         found:
  415.             StrCpy $Obsolete "true"
  416.         notfound:
  417.     ${EndIf}
  418.    
  419.     Push $0
  420. FunctionEnd
  421.  
  422.  
  423.  
  424.  
  425. ;------Sections------------
  426.  
  427. Section
  428.  
  429.     ; Default values for string variables
  430.     StrCpy $finishpagetext ""
  431.     StrCpy $parameters " -nosplash -gamespy=master.ofpisnotdead.com"
  432.     StrCpy $runtext "Launch game with the Fwatch"
  433.     StrCpy $exename "fwatch.exe"
  434.  
  435.  
  436.     ; Display select aspect ratio
  437.     DetailPrint "Ratio set to $AR_STRING"
  438.  
  439.    
  440.    
  441.     ; Check if "users" directory exists
  442.     IfFileExists $INSTDIR\Users 0 +2
  443.         Goto users
  444.         MessageBox MB_OK "Couldn't find $\"Users$\" directory"
  445.         DetailPrint "Installer needs Users\<name>\userinfo.cfg so it can adjust FOV settings"
  446.         Abort
  447.        
  448.     ; Check all the sub-folders in the "users" directory
  449.     ; Change configuration files
  450.     users:
  451.         StrCpy $FoundUserInfo "false"
  452.         FindFirst $0 $1 $INSTDIR\Users\*
  453.         loop:
  454.             StrCmp $1 "" done
  455.             StrCmp $1 "." findnext
  456.             StrCmp $1 ".." findnext
  457.             IfFileExists $INSTDIR\Users\$1\userinfo.cfg 0 findnext
  458.                 Call ChangeUserInfo
  459.             findnext:
  460.                 FindNext $0 $1
  461.                 Goto loop
  462.     done:
  463.     FindClose $0
  464.    
  465.     ; If no configuration file was changed
  466.     ${If} $FoundUserInfo == "false"
  467.         MessageBox MB_OK "Couldn't find $\"userinfo.cfg$\" file"
  468.         DetailPrint "Installer needs Users\<name>\userinfo.cfg so it can adjust FOV settings"
  469.         Abort
  470.     ${EndIf}
  471.  
  472.    
  473.    
  474.     ; Copy config file
  475.     SetOutPath "$INSTDIR\"
  476.     File "Aspect_Ratio.hpp"
  477.    
  478.     ; Change aspect ratio settings in the config file
  479.     StrCpy $ModifiedHPP "false"
  480.     ${LineFind} $INSTDIR\Aspect_Ratio.hpp "" "1:-1" AspectRatioHPP
  481.  
  482.    
  483.    
  484.     ; Create list of mods
  485.     nsArray::Split modfolders @airwolf|@ECP|@ffsx85|@ffsx2007|@GRAA|@JF|@MCM-SLX|@OFrP_Mod|@wgl5|@WW2_MP|@ww4mod25|bin|finmod|Res|x_vte|ffur2006|TuPaS_War |
  486.    
  487.     ; Replace configs and resources in the modfolders
  488.     ${ForEachIn} modfolders $key $value
  489.         StrCpy $dest $value
  490.        
  491.         ; Before making backup for ECP determine if it's original or redux
  492.         ${If} $value == "@ECP"
  493.             StrCpy $ECPRedux "false"
  494.             ${LineFind} $INSTDIR\@ECP\Bin\Config.cpp "/NUL" "1:100" ECPReduxSearch
  495.         ${EndIf}
  496.        
  497.         ; Exception for CWA 1.99
  498.         ${If} $value == "bin"
  499.             StrCmp "$cfgName" "ColdWarAssault.cfg" 0 Skip
  500.                 StrCpy $dest "."
  501.         ${EndIf}
  502.        
  503.         ; Make resource backup if it doesn't exist
  504.         IfFileExists $INSTDIR\$dest\bin\_resource_backup.cpp +2 0
  505.             Rename $INSTDIR\$dest\bin\resource.cpp $INSTDIR\$dest\bin\_resource_backup.cpp
  506.  
  507.         ; Revert to the config backup if it exists
  508.         StrCpy $HasBackup "false"
  509.         StrCpy $Obsolete "false"
  510.          
  511.         IfFileExists $INSTDIR\$dest\bin\_config_backup.cpp 0 +2
  512.             StrCpy $HasBackup "true"
  513.            
  514.         IfFileExists $INSTDIR\$dest\bin\config.bin 0 +2
  515.             StrCpy $HasBackup "true"
  516.        
  517.         ${LineFind} $INSTDIR\$dest\Bin\Config.cpp "/NUL" "1:100" ConfigCheck
  518.        
  519.         ${If} $Obsolete == "true"
  520.         ${AndIf} $HasBackup == "true"
  521.             DetailPrint "---- Reverting $INSTDIR\$dest\bin\config.cpp"
  522.             Rename $INSTDIR\$dest\bin\config.cpp $INSTDIR\$dest\bin\_config_obsolete.cpp
  523.             Rename $INSTDIR\$dest\bin\_config_backup.cpp $INSTDIR\$dest\bin\config.cpp
  524.         ${EndIf}
  525.    
  526.         Skip:
  527.     ${Next}
  528.    
  529.  
  530.    
  531.     ; Copy files   
  532.     IfFileExists $INSTDIR\@airwolf 0 +3
  533.     SetOutPath "$INSTDIR\@airwolf\bin\"
  534.     File "@airwolf\Resource.cpp"
  535.  
  536.     ; Copy files for the correct ECP version
  537.     IfFileExists $INSTDIR\@ECP 0 skipECP
  538.     SetOutPath "$INSTDIR\@ECP\bin\"
  539.     ${If} $ECPRedux == "false"
  540.         DetailPrint "Detected original ECP"
  541.         File "@ECP\Resource.cpp"
  542.     ${Else}
  543.         DetailPrint "Detected ECP Redux"
  544.         File "@ECPR\Resource.cpp"
  545.     ${EndIf}
  546.     skipECP:
  547.    
  548.     IfFileExists $INSTDIR\@ffsx85 0 +3
  549.     SetOutPath "$INSTDIR\@ffsx85\bin\"     
  550.     File "@ffsx85\Resource.cpp"
  551.    
  552.     IfFileExists $INSTDIR\@ffsx2007 0 +3
  553.     SetOutPath "$INSTDIR\@ffsx2007\bin\"       
  554.     File "@ffsx2007\Resource.cpp"
  555.    
  556.     IfFileExists $INSTDIR\@GRAA 0 +3
  557.     SetOutPath "$INSTDIR\@GRAA\bin\"       
  558.     File "@GRAA\Resource.cpp"
  559.    
  560.     IfFileExists $INSTDIR\@JF 0 +3
  561.     SetOutPath "$INSTDIR\@JF\bin\"     
  562.     File "@JF\Resource.cpp"
  563.  
  564.     IfFileExists $INSTDIR\@MCM-SLX 0 +3
  565.     SetOutPath "$INSTDIR\@MCM-SLX\bin\"    
  566.     File "@MCM-SLX\Resource.cpp"
  567.  
  568.     IfFileExists $INSTDIR\@OFrP_Mod 0 +3
  569.     SetOutPath "$INSTDIR\@OFrP_Mod\bin\"       
  570.     File "@OFrP_Mod\Resource.cpp"
  571.    
  572.     IfFileExists $INSTDIR\@wgl5 0 +3
  573.     SetOutPath "$INSTDIR\@wgl5\bin\"       
  574.     File "@wgl5\Resource.cpp"
  575.    
  576.     IfFileExists $INSTDIR\@WW2_MP 0 +3
  577.     SetOutPath "$INSTDIR\@WW2_MP\bin\"     
  578.     File "@WW2_MP\Resource.cpp"
  579.  
  580.     IfFileExists $INSTDIR\@ww4mod25 0 +3
  581.     SetOutPath "$INSTDIR\@ww4mod25\bin\"       
  582.     File "@ww4mod25\Resource.cpp"
  583.  
  584.     ; CWA
  585.     ${If} "$cfgName" == "ColdWarAssault.cfg"
  586.         SetOutPath "$INSTDIR\bin\"
  587.         File "bin\Resource.cpp"
  588.     ${EndIf}
  589.  
  590.     IfFileExists $INSTDIR\finmod 0 +3
  591.     SetOutPath "$INSTDIR\finmod\bin\"      
  592.     File "finmod\Resource.cpp"
  593.  
  594.     IfFileExists $INSTDIR\Res 0 +3
  595.     SetOutPath "$INSTDIR\Res\bin\"     
  596.     File "Res\Resource.cpp"
  597.  
  598.     IfFileExists $INSTDIR\x_vte 0 +3
  599.     SetOutPath "$INSTDIR\x_vte\bin\"       
  600.     File "x_vte\Resource.cpp"
  601.  
  602.     IfFileExists $INSTDIR\ffur2006 0 +3
  603.     SetOutPath "$INSTDIR\ffur2006\bin\"    
  604.     File "ffur2006\Resource.cpp"
  605.  
  606.     IfFileExists $INSTDIR\TuPaS_War 0 +3
  607.     SetOutPath "$INSTDIR\TuPaS_War\bin\"
  608.     File "TuPaS_War\Resource.cpp"
  609.    
  610.    
  611.    
  612.    
  613.    
  614. ; Install Fwatch if it's missing or if it's old version ===========
  615.  
  616.     DetailPrint "   "
  617.     DetailPrint "==== Installing Fwatch ==== "
  618.    
  619.     SetOverwrite ifnewer
  620.     SetOutPath "$INSTDIR\"
  621.     File /r "data\*"
  622.    
  623.   IfFileExists $INSTDIR\flashpoint.cfg 0 +2
  624.     File "fwatch.exe"
  625.   IfFileExists $INSTDIR\ColdWarAssault.cfg 0 +3
  626.     File "fwatchCWA.exe"
  627.     StrCpy $exename "fwatchCWA.exe"
  628.        
  629. ; Check game executable ===========================================
  630.  
  631.     ; Check if this is Steam version
  632.     ${WordFind} $INSTDIR "SteamApps\common" "E+1{" $R0
  633.     IfErrors notfound found
  634.         found:
  635.             StrCpy $parameters "$parameters -steam"
  636.             StrCpy $runtext "Launch game with Steam"
  637.             GoTo allDone
  638.         notfound:
  639.        
  640.   IfFileExists "$INSTDIR\flashpointresistance.exe" allDone 0
  641.   IfFileExists "$INSTDIR\ofp.exe" allDone 0
  642.   IfFileExists "$INSTDIR\flashpointbeta.exe" allDone 0
  643.   IfFileExists "$INSTDIR\operationflashpoint.exe" allDone 0
  644.   IfFileExists "$INSTDIR\operationflashpointbeta.exe" allDone 0
  645.   IfFileExists "$INSTDIR\ColdWarAssault.exe" allDone 0
  646.     StrCpy $parameters "$parameters -nolaunch "
  647.     StrCpy $runtext "Launch Fwatch"
  648.     StrCpy $finishpagetext "$finishpagetext$\n$\nYou will have to start the game manually."
  649.  
  650.   allDone:
  651.   ;if empty string then change it to 'all done'
  652.   StrCmp $finishpagetext "" +1 +2
  653.     StrCpy $finishpagetext "All Done"
  654.    
  655.  
  656.     SetOutPath "$INSTDIR\"
  657.    
  658. SectionEnd
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top