• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Making an installer?

Messages
1,964
Country
unitedkingdom
Can anyone shed some light on how to make an installer for my scenery? For commercial use? Do I need to know how to code it?
 
You can use an installer system like NSIS or WiX. I think Bill Leaming has a tutorial or example for NSIS somewhere (demonstrating finding the FSX directory by registry entry). I haven't looked into scenery.cfg modification, but I'm fairly certain that most installer systems allow for custom actions. Alternatively, you could build your own installer from scratch (similar to what I've done for my 3U2 scenery).
 
Shaun,

NSIS (Nullsoft Scriptable Install System*) is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution. Being a user's first experience with your product, a stable and reliable installer is an important component of succesful software. With NSIS you can create such installers that are capable of doing everything that is needed to setup your software. NSIS is script-based and allows you to create the logic to handle even the most complex installation tasks. Many plug-ins and scripts are already available: you can create web installers, communicate with Windows and other software components, install or update shared components and more.

http://nsis.sourceforge.net/Features

I have also installed HM NIS Edit: http://nsis.sourceforge.net/HM_NIS_Edit although frankly I use it more for creating/editing/compiling scripts than for it's ability to create GUI's. For my purposes, once I had a generic template setup for custom aircraft installations, it now is a trivial matter to create a new installer for any project.

In fact, it only takes two lines of script to install a complete aircraft and its subfolders and files now. The rest is for the GUI and is quickly edited.
Code:
  SetOutPath "$INSTDIR\SimObjects\Rotorcraft\MILVIZ_MD_530"
  File /r "D:\Installer Build Folders\MD530_Build_Folder\SimObjects\Rotorcraft\MILVIZ_MD_530\*.*"
The first line above sets up the install path to the sim, which is contained in the token $INSTDIR, previously found by reading the Registry.

The second line's "magic" is the /r flag, which instructs NSIS to recursively parse the build folder's tree structure and include all files and folders found (*.*)

*Nota bene: NSIS is an Open Source program and may be freely used for creating installers by freeware and commercial developers.
 
I use payware version ClickTeam InstallCreator and setup now to run serial numbers.

Its easy, you do not have to know how to do code, but you will need to know the actual location and settings for locations or it will not install correctly. So what ever you use, be sure to ask someone about the windows install directories for installing your software to the correct locations. Otherwise, grumbling customers.
 
If I define the default installation directory as $Desktop, it works fine.

But I want it to find the .....\fsx folder. Using $FSX doesn't seem to work.

I can call it

InstallDir C:\FSX

and just have users navigate to theirs if it differs, or select their \Prepar3D v2\ if necessary.

I guess installing it into the user's activated scenery list is quite challenging for a noob?
 
Last edited:
Additionally, how can one install multiple files?

I tried to make a path $FSX\Effects

With the folder hierarchy effects\texture

With some files in effects and some in texture

But the effects were added while the texture folder is now empty except for the files I tried to add.

Crap!
 
Normally you'd get the path from the Registry:

Code:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Microsoft Games\Flight Simulator\10.0" "SetupPath"
 
Oh right, does that go in the default installation directory?

; The default installation directory
InstallDir C:\FSX

I've fixed the problem regarding the effects; I had to create different sections and install the .fx and .bmp separately.
 
Assuming you are using NSIS, you need to first read the Registry:
Code:
ReadRegStr $INSTDIR HKCU "Software\Microsoft\Microsoft Games\flight simulator\10.0" AppPath

Then, create a 'fallback' path:
Code:
InstallDirRegKey HKLM "Software\Microsoft\Microsoft Games\flight simulator\10.0" SetupPath

The path is now assigned to the $INSTDIR token, and you can install with something like the following:
Code:
 SetOutPath "$INSTDIR\SimObjects\Airplanes\Beech_King_Air_350i Milviz"
 File /r "D:\Installer Build Folders\Beech KingAir_350i Build Folder\SimObjects\Airplanes\Beech_King_Air_350i Milviz\*.*"

Note that the /r flag following the File command means "recurse all folders and files." It is a shortcut that save you from having to write script for every folder and sub-folder! :wizard:
 
Amazing, thanks Bill.

I meant install multiple files in different directories. I've managed this by having them in different sections.
 
Now to battle with the challenge of FSX SE and P3D v1 and v2. Ugh. I think I might just have the user navigate for themselves.

How does one find out what the registry key for LM P3d is?
 
Last edited:
Found the apppaths and I've got some radio buttons which define the ReadRegStr depending on the choice (FSX, FSX SE OR LM P3D), but this creates four iterations of the scenery in the installer.

Is there a way to just define the readregstr and install path by the radio buttons.
 
Last edited:
I use a script to do this, I can post it here if you like, and you could see what you can make of it.

This uses these includes:
!include "LogicLib.nsh"
!include "nsDialogs.nsh"

and of course you'd need to define the variables used:
Var hCtl_Chooser
Var hCtl_Chooser_RadioButton1
Var hCtl_Chooser_RadioButton2
Var hCtl_Chooser_Label1
Var hCtl_Chooser_Label2

var FSXexists
var P3Dexists
var FSXpath
var P3Dpath
var FSXstate
var P3Dstate
var SIMchoice


Code:
Function fnc_Chooser_Create

  ; === Chooser (type: Dialog) ===
  nsDialogs::Create 1018
  Pop $hCtl_Chooser
  ${If} $hCtl_Chooser == error
    Abort
  ${EndIf}
  !insertmacro MUI_HEADER_TEXT "Simulator Chooser" "The installer has found the following compatible simulators:"

  ; === RadioButton1 (type: RadioButton) ===
  ${If} $FSXexists == 1
  ${NSD_CreateRadioButton} 157 74 147 24 "Microsoft Flight Simulator X"


   Pop $hCtl_Chooser_RadioButton1

     ${NSD_Check} $hCtl_Chooser_RadioButton1
   ${Endif}

  ; === RadioButton2 (type: RadioButton) ===
    ${If} $P3Dexists == 1
  ${NSD_CreateRadioButton} 157 92 166 25 "Lockheed Martin Prepar3D v2"
  Pop $hCtl_Chooser_RadioButton2
      ${If} $FSXexists == 0
       ${NSD_Check} $hCtl_Chooser_RadioButton2
       ${EndIf}
   ${Endif}

    ; === Label1 (type: Label) ===
  ${NSD_CreateLabel} 71 29 328 42 "This installer can install to Flight Simulator X, or Prepar3D v2. Installed simulators are shown here. If you have both installed, you must choose the simulator you wish to install to."
  Pop $hCtl_Chooser_Label1


  ; === Label2 (type: Label) ===
  ${NSD_CreateLabel} 71 154 286 42 "If you wish to install to both simulators, you need to run the installer twice."
  Pop $hCtl_Chooser_Label2


FunctionEnd

; dialog show function
Function fnc_Chooser_Show
  Call fnc_Chooser_Create

  nsDialogs::Show $hCtl_Chooser


FunctionEnd

Function nsDialogsPageLeave

${NSD_GetState} $hCtl_Chooser_RadioButton1 $FSXstate
${NSD_GetState} $hCtl_Chooser_RadioButton2 $P3Dstate

SetShellVarContext all
${If} $FSXstate == ${BST_CHECKED}
StrCpy $SIM_PRODUCT_NAME "${PRODUCT_NAME} FSX"
StrCpy $SIM_CONFIG_PATH "$APPDATA\Microsoft\FSX\"
StrCpy $SIMchoice "FSX"
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Microsoft Games\Flight Simulator\10.0" "SetupPath"
${ElseIf} $P3Dstate == ${BST_CHECKED}
StrCpy $SIM_PRODUCT_NAME "${PRODUCT_NAME} P3D"
StrCpy $SIM_CONFIG_PATH "$APPDATA\Lockheed Martin\Prepar3D v2\"
StrCpy $SIMchoice "P3D"
ReadRegStr $INSTDIR HKLM "Software\Lockheed Martin\Prepar3D v2" "SetupPath"
${EndIf}
;MessageBox MB_OK "INSTALLING to $INSTDIR"

ClearErrors

  FunctionEnd

On exit, you'll have the scenery.cfg location, the installdir, and a product name with the sim as suffix.
 
Wow, that's more than I could have asked for. Thanks so much.

Now, to sit and make sense of all of this!
 
For whatever it's worth, here is my basic template for all Milviz installers, covering FSX, FSX:SE, and P3Dv2.

Note that the file installer_banner1.bmp is a 1280x720 pixel bitmap that I use as a "splash screen" for the installer's background:
Code:
!define PRODUCT_NAME "Product Name"
!define PRODUCT_VERSION "v1.150204"
!define PRODUCT_PUBLISHER "My Company"
!define PRODUCT_WEB_SITE "http://www.MyCompany.com"

SetCompressor lzma

; MUI 1.67 compatible ------
!include "MUI2.nsh"
!include LogicLib.nsh
!include nsDialogs.nsh

; MUI Settings
  ;Request application privileges for Windows
  RequestExecutionLevel admin

;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING
;--------------------------------

; Page components
; installer background screen
!define screenimage installer_banner1.bmp
!ifdef screenimage

; set up background image
; uses BgImage plugin

Function .onGUIInit
    ; extract background BMP into temp plugin directory
    InitPluginsDir
    File /oname=$PLUGINSDIR\installer_banner1.bmp "${screenimage}"

    BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\installer_banner1.bmp
    BgImage::Redraw /NOUNLOAD
FunctionEnd

Function .onGUIEnd
    ; Destroy must not have /NOUNLOAD so NSIS will be able to unload and delete BgImage before it exits
    BgImage::Destroy
FunctionEnd

!endif

;Pages

XPStyle on
Var Dialog
Var Label
Var GroupBox1
Var RadioButton1
Var RadioButton2
Var RadioButton3
Var RadioButton1_State
Var RadioButton2_State
Var RadioButton3_State
Var Checkbox2
Var Checkbox2_State
Var hCtl_TestDesigner_Font1
Var hCtl_TestDesigner_Font2
Page custom nsDialogsPage nsDialogsPageLeave

PageEx license
   LicenseData My_License.txt
   LicenseForceSelection checkbox
PageExEnd

Function nsDialogsPage
  ; custom font definitions
  CreateFont $hCtl_TestDesigner_Font1 "Microsoft Sans Serif" "11" "700"
  CreateFont $hCtl_TestDesigner_Font2 "Microsoft Sans Serif" "10" "400"

    nsDialogs::Create 1018
    Pop $Dialog

    ${If} $Dialog == error
        Abort
    ${EndIf}
    SetCtlColors $Dialog 0x000000 0x99B4D1

    ${NSD_CreateGroupBox} 5u 0u 96.5% 45u "1) Choose Simulator Version!"
    Pop $GroupBox1
        SendMessage $GroupBox1 ${WM_SETFONT} $hCtl_TestDesigner_Font1 0
        SetCtlColors $GroupBox1 0x000000 0x99B4D1

    ${NSD_CreateRadioButton} 10u 12u 60% 10u "&FSX -or- FSX:SE (Stand-Alone)"
    Pop $RadioButton1
    ${NSD_SetState} $RadioButton1 ${BST_CHECKED}
        ${NSD_AddStyle} $RadioButton1 ${WS_GROUP}
        SendMessage $RadioButton1 ${WM_SETFONT} $hCtl_TestDesigner_Font2 0

    ${NSD_CreateRadioButton} 10u 22u 60% 10u "&FSX:SE (Side-by-Side)"
    Pop $RadioButton2
        SendMessage $RadioButton2 ${WM_SETFONT} $hCtl_TestDesigner_Font2 0

    ${NSD_CreateRadioButton} 10u 32u 60% 10u "&Prepar3D v2"
    Pop $RadioButton3
        SendMessage $RadioButton3 ${WM_SETFONT} $hCtl_TestDesigner_Font2 0
      
        ${NSD_CreateCheckBox} 8u 125u 95% 10u "&UNINSTALL ProductName (Select Sim Version First!)"
    Pop $Checkbox2
    SendMessage $Checkbox2 ${WM_SETFONT} $hCtl_TestDesigner_Font1 0
    SetCtlColors $Checkbox2 0x000000 0xFFFF00
  
        nsDialogs::Show

FunctionEnd

Function nsDialogsPageLeave

    ${NSD_GetState} $RadioButton1 $RadioButton1_State
        ${NSD_GetState} $RadioButton2 $RadioButton2_State
        ${NSD_GetState} $RadioButton3 $RadioButton3_State
        ${NSD_GetState} $Checkbox2 $Checkbox2_State

        ${If} $RadioButton1_State == 1
              ReadRegStr $INSTDIR HKCU "Software\Microsoft\Microsoft Games\flight simulator\10.0" AppPath
    ${EndIf}

        ${If} $RadioButton2_State == 1
              ReadRegStr $INSTDIR HKCU "Software\Microsoft\Microsoft Games\flight simulator - steam edition\10.0" AppPath
    ${EndIf}

        ${If} $RadioButton3_State == 1
              ReadRegStr $INSTDIR HKLM "Software\Lockheed Martin\Prepar3D v2" SetupPath
        ${EndIf}

FunctionEnd

;  !insertmacro MUI_PAGE_DIRECTORY ; UNCOMMENT TO SEE BROWSE BUTTON!
  !insertmacro MUI_PAGE_INSTFILES

InstallDirRegKey HKLM "Software\Microsoft\Microsoft Games\flight simulator\10.0" SetupPath

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "ProductName_FSX_v1.150204.exe"

ShowInstDetails show

Section "MainSection" SEC01

${If} $Checkbox2_State != 1
  SetOutPath "$INSTDIR"
  SetOverwrite ifnewer

  ; PUT INSTALLER FILES HERE!
  ; EXAMPLE
;  SetOutPath "$INSTDIR\Fonts"
;  File "D:\Installer Build Folders\My_BuildFolder\Fonts\*.*"

;  SetOutPath "$INSTDIR\Modules"
;  File "D:\Installer Build Folders\My_BuildFolder\Modules\MyModule.dll"

;  SetOutPath "$INSTDIR\Effects"
;  File /r "D:\Installer Build Folders\My_BuildFolder\Effects\*.*"

;  SetOutPath "$INSTDIR\SimObjects\Airplanes\MyAirplane"
;  File /r "D:\Installer Build Folders\My_BuildFolder\SimObjects\Airplanes\MyAircraft\*.*"

${EndIf}


${If} $Checkbox2_State == 1

; PUT UNINSTALLER HERE!
; EXAMPLE
;  SetOutPath "$INSTDIR"
;  SetOverwrite on
;  SetOutPath "$INSTDIR\SimObjects\Airplanes"
;  RMDir /r "$INSTDIR\SimObjects\Airplanes\MyAircraft"

${EndIf}
SectionEnd

Section "Start Menu Shortcuts"
${If} $Checkbox2_State != 1

${EndIf}
SectionEnd

Section -Post
SectionEnd
 
Hmm, I need it to install some different files into FSX and P3D. I'm just going to make different installers for these, and have the user able to switch between Vanilla and SE, and P3D/v2.
 
What is so neat about NSIS is that one may make it as simple or as complex as one wishes. It is practically infinite in the number of ways possible to configure the scripts.
 
Back
Top