Installers

F4Browse, CATE, Tacedit, Terrainview & TheaterMaker etc utility related

Moderators: Lone Wolf, Snake Man

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Installers

Post by T_Rex » 2007-02-18 04:17:08

Hey guys!

Seeing SnakeMan ask about installers in another thread, made me realize this is something we should probably all be comparing notes on, and learning from each other about.

I've used the NSIS installer system for a couple different... uh... "projects" now and really like it. The scripting is relatively easy for a non-coder (like me) to figure out, but is still powerful and flexible. It has a strong user community and good open-source support. It also is "portable" in that there is a version I can run from almost any PC on my USB memory stick. :) ;)

I would be more than happy to share any installer scripts I've done with anyone else who is interested.

A theater isn't much good if others can't easily install it, ;) so I think one goal we should all have is to make it as easy as possible for people to experience these other theaters. :)

========================
Edit: my current NSIS theater template - 20 Apr 07

Code: Select all

; Script generated by the HM NIS Edit Script Wizard.

/*
Theater Installer template

@@Version history here


1a - Proof of concept

*/

; HM NIS Edit Wizard helper defines
; these define some variables I use in some later statements

!define TNAME "Bering"
!define FRIENDLYNAME "Bering Theater Installer"
!define VER "0.0.0.1" ; this has to be #.#.#.#
!define TDIRECTORY "Theater\${TNAME}"
!define DEVDIRECTORY "F:\FF4Installers\Theaters\${TNAME}" ;@@
!define LICENSEFILE "${DEVDIRECTORY}\license.txt"
;variables for previous installs to delete
!define PrevDir01 "theaters\${TNAME}"
!define PrevDir02 "DesertStormTheaterAddon"
; then further defines for however many you want to delete

; define other variables to free up generic ones
var F4root
var ErrCode
var F4ver
var F4subver

;=== Program Details
Name "${FRIENDLYNAME}"
OutFile "${TNAME}_${VER}.exe"
Caption "${FRIENDLYNAME}"

VIProductVersion "${VER}"
VIAddVersionKey ProductName "${FRIENDLYNAME}"
VIAddVersionKey Comments "Installs the Bering theater."
;VIAddVersionKey CompanyName "Bering Theaters, Inc."
;VIAddVersionKey LegalCopyright "Trexian Tools"
VIAddVersionKey FileDescription "${FRIENDLYNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${FRIENDLYNAME}"
VIAddVersionKey LegalTrademarks "Bering and Bering Straits are Trademarks of Bering Trademark Holding Company"
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""

;=== Runtime Switches
CRCCheck On
;SilentInstall Silent
AutoCloseWindow True
SetCompressor lzma
BrandingText "Grinning and Bering it."

;=== Includes - this will include the necessary dlls and functions that I use in the installer
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "Registry.nsh"
!include "WinMessages.nsh"
!include "TextFunc.nsh"
!include "TextReplace.nsh"
!include "Sections.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${DEVDIRECTORY}\${TNAME}.ico"
!define MUI_INSTALLCOLORS /windows

; Welcome page
;!define MUI_WELCOMEFINISHPAGE_BITMAP "${DEVDIRECTORY}\leftgraphic.bmp"
!define MUI_WELCOMEPAGE_TITLE "${FRIENDLYNAME} ${VER} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${FRIENDLYNAME} ${VER} into your Falcon installation."
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "${LICENSEFILE}"

; Instfiles page
!insertmacro MUI_PAGE_INSTFILES

; Finish page - this is the last page people see
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_TITLE "${FRIENDLYNAME} ${VER} Installation completed."
!define MUI_FINISHPAGE_TEXT "Click 'Finish' to close this wizard."
!insertmacro MUI_PAGE_FINISH

; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------


Section "Installer" SEC01

; F4registry check -
${registry::KeyExists} "HKLM\Software\MicroProse\Falcon\4.0" $0
${registry::KeyExists} "HKLM\Software\Lead Pursuit\Battlefield Operations\Falcon" $1
IntCmp $0 0 F4Exists
IntCmp $1 0 AFInstall
StrCpy $ErrCode "No appropriate registry found."
Goto Error

F4Exists:
IntCmp $1 0 0 F4Version

Messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "" "Select where you want the theater installed." "OF/RV" "AF" IDCANCEL
Pop $0
IntCmp $0 3 Finish
IntCmp $0 2 AFInstall

F4Version:

ReadRegStr $F4Root HKLM "Software\MicroProse\Falcon\4.0" "basedir"
IfFileExists $F4Root\theater.lst 0 NoFileFound
IfFileExists $F4Root\terrdata\objects\KoreaObj.Dxl RVFound
IfFileExists $F4Root\terrdata\objects\KoreaObj.lod OFFound NoFileFound

NoFileFound:
StrCpy $ErrCode "No F4 install found."
Goto Error

RVFound:
StrCpy $F4ver "F4"
StrCpy $F4subver "RV"
Goto F4Install

OFFound:
StrCpy $F4ver "F4"
StrCpy $F4subver "OF"
Goto F4Install

AFInstall:
ReadRegStr $F4root HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir"

StrCpy $1 "$F4root\campaign\korea"
StrCpy $2 "$F4root\Utilities\LxNormalFix.exe $$LP @${TNAME} @$F4root\Theaters\${TNAME}\terrdata"
StrCpy $F4ver "AF"
Goto CheckPrevious

F4Install:
ReadRegStr $F4root HKLM "Software\MicroProse\Falcon\4.0" "basedir"
StrCpy $1 "$F4root\campaign\save"
StrCpy $2 "$F4root\Utilities\LxNormalFix.exe @${TNAME} @$F4root\Theaters\${TNAME}\terrdata"

; check for existing directory and delete if necessary
CheckPrevious:
StrCpy $7 ${PrevDir01}
IfFileExists "$F4root\${PrevDir01}\*.*" DelPrevVer

StrCpy $7 ${PrevDir02}
IfFileExists "$F4root\${PrevDir02}\*.*" DelPrevVer

; go on as many previous directories as you want to delete - doing the StrCpy $7 and next previous directory

Goto CreateDirs

DelPrevVer:
MessageBox MB_OKCANCEL "Previous version detected: $7.  OK to delete previous version and install, or cancel installation?" IDOK DeletePrev IDCANCEL Finish

DeletePrev:
RMDir "$F4root\${PrevDir01}"
RMDir "$F4root\${PrevDir02}"

; and so on until all prev dirs are deleted


CreateDirs:

CreateDirectory "$F4root\Theaters\${TNAME}\campaign\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\terrain\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\texture\"
CreateDirectory "$F4root\Theaters\${TNAME}\terrdata\weather\"

SetOutPath "$F4root\Theaters\${TNAME}"

SetOverwrite Ifnewer

CopyFiles /filesonly "$1\*.pri" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.txt" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.b" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.db" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.ia" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.dfs" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.dat" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.gbd" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.lst" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.idx" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\*.wch" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\atc.ini" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\Falcon4.AII" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\FALCON4.RT" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\FALCON4.TT" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\KOREA.NAM" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\Korea.tm" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\mpwcells.bin" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\tmp.frc" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\tmp.his" "$F4root\Theaters\${TNAME}\campaign\"
CopyFiles /filesonly "$1\VALIDAC.ACT" "$F4root\Theaters\${TNAME}\campaign\"

CopyFiles /filesonly "$F4root\terrdata\korea\texture\texture.bin" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles /filesonly "$F4root\terrdata\korea\texture\texture.zip" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles /filesonly "$F4root\terrdata\korea\texture\fartiles.pal" "$F4root\Theaters\${TNAME}\terrdata\texture\"
CopyFiles "$F4root\terrdata\korea\weather\*.*" "$F4root\Theaters\${TNAME}\terrdata\weather\"

; unpack the theater files
File /r "${DEVDIRECTORY}\*.*" ;@@

; snake try to make campmap and campaign files included only once
;campmap
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\art\DesertStorm1\art\resource\campmap.*" "$F4Root\Theaters\${TNAME}\art\DesertStorm2\art\resource\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\art\DesertStorm1\art\resource\campmap.*" "$F4Root\Theaters\${TNAME}\art\DesertStorm3\art\resource\"
;campaign files
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\desertstorm.*" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm2\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\desertstorm.*" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm3\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\kneemap.gif" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm2\"
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\campaign\DesertStorm1\kneemap.gif" "$F4Root\Theaters\${TNAME}\campaign\DesertStorm3\"

; database copy
StrCmp $F4subver "OF" DataBaseOF
StrCmp $F4subver "RV" DataBaseRV

; database AF
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\AF\*.*" "$F4Root\Theaters\${TNAME}\objects\"
goto EndOfDataBaseCopy

DataBaseOF:
; database OF
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\OF\*.*" "$F4Root\Theaters\${TNAME}\objects\"
goto EndOfDataBaseCopy

DataBaseRV:
; database RV
CopyFiles /filesonly "$F4Root\Theaters\${TNAME}\objects\RV\*.*" "$F4Root\Theaters\${TNAME}\objects\"

EndOfDataBaseCopy:
RMDir /r "$F4Root\Theaters\${TNAME}\objects\F4AF\"
RMDir /r "$F4Root\Theaters\${TNAME}\objects\RV\"
RMDir /r "$F4Root\Theaters\${TNAME}\objects\OF\"

StrCmp $F4ver "F4" F4curTheater TheaterAdmin

F4curTheater:
; set current theater to new theater
; this reads the specified registry value into $3 for use later
ReadRegStr $3 HKLM "Software\MicroProse\Falcon\4.0" "curTheater"
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "${TNAME}" "REG_SZ" $R0

StrCmp $F4subver "OF" TheaterAdmin

; RV stuff

TheaterAdmin:
SetOutPath "$F4root\utilities"

ExecWait "lstupdate.exe $8 +Theater\${TNAME}\${TNAME}.tdf"

ExecWait 'SPTinstall.exe -auto "$F4root\Theaters\${TNAME}\terrdata"'

ExecWait "LXNormalFix.exe $2"

; compress textures if F4 then finish
StrCmp $F4ver "AF" Finish

ExecWait "$F4root\Utilities\Seasonswitcher.exe -0"

MessageBox MB_YESNO "Do you want to make the new theater the current one?" IDYES Finish IDNO 0
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "$3" "REG_SZ" $R0

Goto finish

Error:
Messagebox MB_OK $ErrCode

Finish:

SectionEnd
Last edited by T_Rex on 2007-04-20 13:38:04, edited 8 times in total.
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-18 10:59:51

I totaly agree with you T_Rex :).

First I'll answer to SM questions about what I'm using :oops: .

Snake Man wrote: what installer software are you using for the OF installers? Is it easy to use? Is it freeware/ie not big commercial complicated thing? Does it do everything a Falcon theater would need?
I'm using the autoit scripting language : AutoIt homepage.

It is very easy to use.

It is freeware.

And it does everything a Falcon theater would need ;), and more except coffee :oops: .


Example is given with OF theaters installers I made of course, but also with :
- IUC Falcon installer (if you remember T_Rex ;) )
- the Rapace Launcher a utility to manage online connection (version check, online parameters sharing, version online update...)


If you're interested I can share installers script I made as open-source scripts. I have two types of script :
- one managing the standard process (SPTinstall, lxnormalfix, seasonswitcher) the resulting installer is the smallest but as an installer it is very time consumming
- one simply extracting an archive and updating the theater.lst file, bigger installer but very fast

It can be improved, particularly in the design field in which I'm not really an expert :oops: ...

If interested tell me cos I'll need to translate comments in the script ;).


Another point I'd like to mention, building theater installers, easy to use for users, is relatively easy to do. I think the effort of evolution we could do here together is in the way to update theaters.
I proposed it to Snakeman, I think it could be interesting to developp an online theater updater, like we have already developp with the Rapace Launcher.
The principle being very simple, once this program is launched what it would do :
- look for the Falcon4 installations available on the computer
- look for theaters installed
- check online if updates are available
- propose to the user to download and apply updates

Another important specification being to allow the theater developpement lead (SM ;)) to very easily control and release updates.

I think it is very interesting in the developpement stage of theaters. Among Cellules Rapaces we experimented this way of working as beta testers for OF group and it was very efficient (particularly linked with the RL as updates are systematicaly checked when running the launcher insurring all people have exactly the same falcon version) considering sometimes there were daily updates.
And it is also interesting after a developpement stage simply for theaters support and evolution :).

This distribution process is not really new, but I think it would fit very well theater developpement and be very helpy.

And AutoIt would be perfect for such a project ;).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-18 16:41:30

Ahh, sure. I use AutoIT occasionally, too. I've used it to make an app to call from NSIS to manipulate data in windows apps.

As I've learned more about NSIS, it can do most of the same things, only some are easier to do "externally" with an app made by AutoIT.

What compression do you use for files?

Oh - and does it do registry changes?
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-18 17:27:31

T_Rex wrote: What compression do you use for files?

Oh - and does it do registry changes?
Simply I'm using winrar or 7z for file compression, building sfx archives. 7z allow better compression than winrar but decompression is a bit longer.
At the moment my personnal OF DVD with all theater packages is not full. The day it will be I think I'll generalise 7z or better compression process.

Yes it does registry changes, very easy with AutoIt :).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-18 17:51:43

7zip is excellent, I love it. The same compression LZMA is what NSIS uses. :)

I suspect that if you made an installer with AutoIT and I made one with NSIS, they would look very similar. :)
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-19 02:58:28

T_Rex wrote:Seeing SnakeMan ask about installers in another thread, made me realize this is something we should probably all be comparing notes on, and learning from each other about.
Yeah good idea. As you're guys seen the Iran theater "developer" version in pure rar + bat system, it does not mean that all PMC releases come in form like that, basically it is just a dev version with the quickest and roughest download possible.
T_Rex wrote:It has a strong user community and good open-source support.
That sounds always good.
Couby wrote:the standard process (SPTinstall, lxnormalfix, seasonswitcher) the resulting installer is the smallest but as an installer it is very time consumming
Could you please show me the simple & basic script how its done for the mentioned utils to build the terrain files?

Seems like you two are using two different install systems, NSIS and AutoIT, I guess its not good idea to ask which is better heh(?).

Basically I want installer to support two Falcon installs, RV+F4AF. So how do we detect this? What if user has both of them installed like I have? Also should Couby still handle the OF conversions as standalone, or should we coordinate all the junk into one big three-F4 version installer? I mean RV+OF are pretty much the same theater file wise aren't they?

PMC will not support the theater installer to be complete, ie full terrain + texture files resulting to sizes beyond 400mb. We just dont have the server space to host such files and its basically not wise to make people download more than they have to. As result we only ship out terrain/ dir with .L2, .O2, .map and .mea theater files, texture directory comes only with .pal + .bin and .zip files, weather dir is small but that also is copied from the Falcon version we are installing the theater. Same copying goes for the campaign files. The SPTinstall will create the necessary terrain files for us, cutting down the download size dramatically. I'm not sure about the database edits yet, but I think it goes like the good old days, we only include the modified files, rest are copied from F4 dir.

So now I want to make installer that does these following tasks:
  • 1) Checks / chooses F4 version, from registry if possible
    2) Copies over campaign/save/ and some other files
    3) If korean texture.bin, copies korean texture/ dir
    4) Executes SPTinstall, LxNormalFix and if RV/OF, SeasonSwitcher
    5) Uses lstupdate to update theater.lst file
What kind of installer script or otherwise that setup would require?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-19 04:23:58

*** WARNING - Long post *** I haven't even written it yet, but I can feel it. :)
Snake Man wrote:Could you please show me the simple & basic script how its done for the mentioned utils to build the terrain files?

Seems like you two are using two different install systems, NSIS and AutoIT, I guess its not good idea to ask which is better heh(?).
hehehe

Couby and I have been around long enough not to fall into THAT trap. ;) I think we'd both say, "The one you're more comfortable with is better." :D In looking at what Couby's accomplished, it really seems like both AIT and NSIS can "do" the same things, just in different ways.
Basically I want installer to support two Falcon installs, RV+F4AF. So how do we detect this? What if user has both of them installed like I have? Also should Couby still handle the OF conversions as standalone, or should we coordinate all the junk into one big three-F4 version installer? I mean RV+OF are pretty much the same theater file wise aren't they?
As the main dev, part of that is up to you - how you want to package it.

I helped build an RV installer for Aeyes' new F-14, and it sent me thinking alot about how to integrate one installer for each different flavor, and I think it is do-able. A combination of registry checks and file checks can determine what installs are present/active. The tricky part would be if someone wanted to install into both RV/OF and AF. But, I have some ideas on how to handle that structurally.
PMC will not support the theater installer to be complete, ie full terrain + texture files resulting to sizes beyond 400mb.
Ok, we can work with that. I just packaged the Balkans full install into 260mb. :)

Oh, and don't forget other options like mediafire.com and peer2peer nets.

Here's the (important part of the) script I used for the Balkans:

Code: Select all

Section "Installer" SEC01

; F4registry check - if no F4 registry, it kicks to the end
${registry::KeyExists} "HKLM\Software\MicroProse\Falcon\4.0" $0
IntCmp $0 0 F4FileCheck
strcpy $9 "No F4 registry found."
goto Error

; check if F4 source files exist
F4FileCheck:
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir"
IfFileExists $0\theater.lst 0 NoFileFound
IfFileExists $0\terrdata\objects\KoreaObj.Dxh 0 NoFileFound
IfFileExists $0\RedViper.pdb FileFound NoFileFound

NoFileFound:
strcpy $9 "No RedViper install found."
Goto Error

FileFound:
; SetOutPath install directory = F4 basedir
SetOutPath $0

; theater.lst manipulations
strcpy $3 "Theaters\Balkans\balkans.tdf"
strcpy $4 "Theaters/Balkans/balkans.tdf"

; this is a function that looks for the string in the text file, if it finds it, it goes to "entryexists" portion

	${textreplace::FindInFile} "$0\theater.lst" "$3" "/S=1" $5
	strcmp $5 1 EntryExists
	${textreplace::FindInFile} "$0\theater.lst" "$4" "/S=1" $5
	strcmp $5 1 EntryExists

goto NoEntry

EntryExists:
	MessageBox MB_OKCANCEL "Entry exists. OK to overwrite existing data." IDOK InstallTheater IDCANCEL Finish

NoEntry:
;	MessageBox MB_OK "No Entry."

FileOpen $6 "$0\theater.lst" a
FileSeek $6 0 END
FileWrite $6 "$\r$\n" ; write a new line
FileWrite $6 "Theaters\Balkans\balkans.tdf"
FileWrite $6 "$\r$\n" ; write an extra line
FileClose $6 ; and close the file

InstallTheater:
SetOutPath $0
File /r "c:\RVBalkans\*.*"

Goto finish

Error:
Messagebox MB_OK $9

Finish:
To run those other apps is easy, too, if that's necessary.
So now I want to make installer that does these following tasks:
  • 1) Checks / chooses F4 version, from registry if possible
To differentiate RV and OF, it would also need to do some filechecking, but that's not a big deal.
2) Copies over campaign/save/ and some other files
3) If korean texture.bin, copies korean texture/ dir
4) Executes SPTinstall, LxNormalFix and if RV/OF, SeasonSwitcher
5) Uses lstupdate to update theater.lst file[/list]
What kind of installer script or otherwise that setup would require?
Either one would do it. Although, my NSIS script does the same thing lstupdate does internally (the theater.lst manipulations).

Also, for a proof of concept I did for Aeyes, which shows what can be done with splashscreens and to personalize the installer, grab:
http://www.mediafire.com/?bcyizntjjnz
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-19 06:56:32

T_Rex wrote:Couby and I have been around long enough not to fall into THAT trap. :wink: I think we'd both say, "The one you're more comfortable with is better." In looking at what Couby's accomplished, it really seems like both AIT and NSIS can "do" the same things, just in different ways.
I can't say better :wink: .

Snake Man wrote:Could you please show me the simple & basic script how its done for the mentioned utils to build the terrain files?
I'm translating my comments and I'll do.


For the rest, unique installer for the 3 F4 versions, as mentionned by T_Rex all is doable :).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-19 19:13:59

I just remembered another reason I started with NSIS - vpatch:
http://www.tibed.net/vpatch/

Basically, it can figure the difference between an "original" file and a "new" file and create a patch, that NSIS can use as part of an installer.

So, let's say you have an OF .L2 and an AF .L2 and they are 120 mb, but really, only about 2 mb are different. To have a unified installer, you'd need to package both .L2s and then have the installer decide which one to actually install.

But, with vpatch, you can have a patch that (ideally) was only the 2mb difference. Then, the installer can be packaged with a single .L2, then if it is installing on AF, then it also runs the smaller patch.

Now, in my experience, it doesn't always work quite like that... in that, if the different bytes are at the "beginning" of a file, then you could have a "patch" that is almost as big as the file itself. Plus, I may not have been using it correctly when I was testing it.

But, it is worth looking into.

Also, IIRC, you can have it create a self-patcher exe, which could be called from AutoIT, I think.
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-21 06:57:28

Couby wrote:
Snake Man wrote:Could you please show me the simple & basic script how its done for the mentioned utils to build the terrain files?
I'm translating my comments and I'll do.
I'm late sorry, a bit busy these days :(. Hope to do so before the end of the week.
ImageImage

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-21 10:38:28

Okay so lets get small and quick theater installer tutorial together.

I chose the NSIS installer.

I downloaded it from nsis.sourceforge.net and installed.

Now I need to create the script to run the already mentioned specific tasks, could you guys please help me to create this script.
  • 1) Checks / chooses F4 version, RV, OF or F4AF
    2) Copies campaign/save/ specified files to <theater>/campaign dir.
    3) If korean texture.bin, copies korean texture/ dir to <theater>/terrdata/
    4) Copies weather dir from F4 into <theater>/terrdata/ dir.
    5) Executes SPTinstall -auto <theater>/terrdata,
    6) Executes LxNormalFix @name @<theater>/terrdata
    6a) if RV/OF adds to registry the curTheater, then executes SeasonSwitcher -0
    7) Executes lstupdate.exe +<theater>\theatername.tdf
Thats the approximate stuff. I would really appreciate if someone (T_Rex?) would teach me to do script like that, ie to make that script for me heh. I'm kind of in the mood that I'm not going to spend my time starting to learn the whole process from the ground up by myself, I rather use my time editing the theater(s). However I think consulting the installer making completely (so I have zero clue about it) to someone else is a bad move, what if that someone disappears just before some major theater release or something, that would be a bad thing. If I get the working script, then I guess its not much more than to drop files into the dir and compile the thing.

Any help is greatly appreciated :)
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 14:02:53

Oh one more thing - NSIS scripts can be edited from Notepad, but I recommend using an editor designed for NSIS that helps with syntax. I use HM NSIS editor:

http://hmne.sourceforge.net/

(There are other editors, and there's probably one that can do both NSIS and AutoIT editing....) :)

That will help.

I will try to post a full script, with alot of commenting, today that should meet most, if not all, your checklist. Do you want me to post it here, or start a new thread?

A question, though - I thought the curTheater registry entry was an SP3 feature, so it would also be present in OF?
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-21 15:20:26

Yes post it here please, this is okay topic.

curTheater is necessary for your RV and OF because SeasonSwitcher looks the registry of which terrdata to process, yes I know its sick but what can I do as thats the only util (and TerrainTexCompress is the same) that builds the dds tiles + fartiles :(
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 15:54:57

Right no problem.

So we need to change the curTheater to whatever theater we've installed, then run the seasonswitcher?

Depending on interruptions, I should have something in the next couple hours....
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-21 16:14:04

Code: Select all

reg add HKLM\Software\Microprose\Falcon\4.0 /v curTheater /t REG_SZ /d "Iran" /F
Thats what I was using on the runme.bat file for Iran theater. There was also value theaterDir mentioned to me but apparently it wont matter.

So yeah first we change the curTheater and then run "SeasonSwitcher -0" so it then finds the proper RV or OF registry root dir and picks up the theater and terrdata dir from there.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 16:27:45

Ok, it'll also mean the new theater pops up when the person goes into the sim next! :)

(Unless we change it back before the installer finishes.... or we could give the person the option....)
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-21 16:37:07

Either way is fine by me. I dont think anyone gets angry because previous theater selection was changed to the latest installed theater, or that it automatically is not the new installed theater selected when running the sim. Both options are ok for me.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 18:07:13

Ok here is a rough workup of an NSIS installer template.

Couple notes:
1) the dev should have the theater structure all set up in his directory to pack into the installer, basically the same as if he wanted to cut and paste it onto the install.

2) I'd be shocked if I got the syntax right on the theater utilities.

3) I don't know anything about installing theaters into AF, so there might be process-issues that don't work in this installer.

4) There are places it could be more robust - in error checking and filechecking to make sure the right utilities are there, and differentiating the installs.

5) I'm no coder. :) If something doesn't work, let's talk about it. I have no pride in ownership of this. :)

Required plugins:
http://nsis.sourceforge.net/Registry_plug-in
http://nsis.sourceforge.net/MessageBox_plug-in

Might need this one, too, if you opt not to use lstupdate:
http://nsis.sourceforge.net/TextReplace_plugin

Code: Select all

; Script generated by the HM NIS Edit Script Wizard.

/*
Theater Installer template for SnakeMan

First, you will notice there are 2 ways to comment a line, either
with a semi-colon ";" for a single line, or for a block of lines
you can use /* to start and */ ;to finish.
/*
I think that is a common standard with some version of C programming, also.

I usually use this portion of the header as a kind of changelog to
list the different versions, in descending order.  For instance, I would say:

Bering Strait Theater

2a - 5 Mar 07
- start of CATE tiling
b
- placement of some airbases

1a - 28 Feb 07
- basic DEM data and rought tiling

*/


; HM NIS Edit Wizard helper defines
; these define some variables I use in some later statements

!define TNAME "Bering"
!define FRIENDLYNAME "Bering Theater Installer"
!define APP "BeringInstaller"
!define VER "0.0.0.2" ; for some reason, this has to be #.#.#.# but I usually change the name after I build the exe

; there are some other definitions that I got from another template
/*
!define WEBSITE "www.pmctactical.org/forum/index.php"
*/

;=== Program Details
; these establish some things about the installer the most important one to me is the outfile
Name "${FRIENDLYNAME}"
; outfile is the name of the installer.  Unless otherwise set, it will be the same directory as where the script is
OutFile "${TNAME}.exe"
Caption "${FRIENDLYNAME}"
; these VI definitions are what is displayed if you hover the mouse over the icon
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${FRIENDLYNAME}"
VIAddVersionKey Comments "Installs the Bering theater."
;VIAddVersionKey CompanyName "Bering Theaters, Inc."
;VIAddVersionKey LegalCopyright "Trexian Tools"
VIAddVersionKey FileDescription "${FRIENDLYNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${FRIENDLYNAME}"
;VIAddVersionKey LegalTrademarks "Bering and Bering Straits are Trademarks of Bering Trademark Holding Company, Inc."
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""

;=== Runtime Switches
; the CRC check is something I use on bigger installers to make sure everything checks out.
CRCCheck On
;WindowIcon Off - not sure what this does
;SilentInstall Silent - this can be used if you don't want all the screen options - literally a one-click installer
AutoCloseWindow True ; this makes it more efficient
SetCompressor lzma ; this is something I use to make sure it uses the LZMA compression, which I believe is the best
BrandingText "Grinning and Bering it." ; branding text is just something that's displayed at the bottom of the installer

;=== Includes - this will include the necessary dlls and functions that I use in the installer
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "Registry.nsh"
!include "WinMessages.nsh"
;!include "GetParameters.nsh"
!include "TextFunc.nsh"
!include "TextReplace.nsh"
!include "Sections.nsh"

; MUI Settings - the MUI is the Modern UI for NSIS, this section defines its parameters (there are alot more that I don't use)
!define MUI_ABORTWARNING

/* this MUI_ICON is the first instance of using a path.  In this template, I'll add an @@ sign.
  You need to make sure that the paths are correct to what you want to go to.  As you can see 
  in the MUI_UNICON (the uninstall icon) there are some variables you can use for paths, also
*/
!define MUI_ICON "@@:\FF4Installers\Icon.ico" 
;!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
;!define MUI_SPECIALBITMAP "Bitmap.bmp"
!define MUI_INSTALLCOLORS /windows

; Welcome page - this is the first page of the installer (I also have a snippet for a splashscreen, but we'll keep this simple) 
!define MUI_WELCOMEFINISHPAGE_BITMAP "@@:\FF4Installers\leftgraphic.bmp"
; using the variables means we don't have to remember to change all these when we use the template for another theater
!define MUI_WELCOMEPAGE_TITLE "${FRIENDLYNAME} ${VER} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${FRIENDLYNAME} ${VER} into your Falcon installation."
!insertmacro MUI_PAGE_WELCOME
; Directory page - this is for if you want the user to designate where to install it - IMHO that's not a good idea
;!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will install ${NAME}  ${VER} into the following folder. Please verify that this is the folder of your Falcon 4 installation.  Click Install to start the installation."
;!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Falcon 4 folder"
;!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!define MUI_FINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_INSTFILES
; Finish page - this is the last page people see
!define MUI_FINISHPAGE_TITLE "${FRIENDLYNAME} ${VER} Installation completed."
!define MUI_FINISHPAGE_TEXT "Click 'Finish' to close this wizard."
!insertmacro MUI_PAGE_FINISH

; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------

; now we're ready for the actual installer!
Section "Installer" SEC01

; F4registry check - if no F4 registry, it kicks to the end - the $0 is a variable that holds the -1 (not found) or 0 (found)
; we can also start to determine which install we have
${registry::KeyExists} "HKLM\Software\MicroProse\Falcon\4.0" $0
${registry::KeyExists} "HKLM\Software\Lead Pursuit\Battlefield Operations\Falcon" $1
IntCmp $0 0 F4Exists ; IntCmp compares the integer in $0 with our number (0) and if it is =, it goes to label "F4Exists"
IntCmp $1 0 AFInstall
StrCpy $9 "No appropriate registry found." ; this copies the string to $9 - I'm using that as an error label
Goto Error

; now make a variable to hold what versions we have installed
F4Exists:
IntCmp $1 0 0 F4Install; this determines if there's an AF reg entry, and if so, it only advances 1 line, if not, it goes to F4Install

; at this point, we need to determine if the person wants to install over "original" F4 or RV
; BTW, this is the first time I've built a custom messagebox, so this might not work
; you'll need this dll http://nsis.sourceforge.net/MessageBox_plug-in

Messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "" "Select where you want the theater installed." "OF/RV" "AF" IDCANCEL
Pop $0 ; this places the response 1, 2, or 3, into $0
IntCmp $0 3 Finish
IntCmp $0 2 AFInstall

; now we know they want OF/RV so we need to differentiate - I'm only going to look for RV, if it isn't RV, I'm going to assume OF for now
; this will also validate the install a bit
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir" ; this reads the specified registry value into $0
IfFileExists $0\theater.lst 0 NoFileFound ; if the file exists, go to next line (don't skip a line) if it doesn't, go to label "NoFileFound"
IfFileExists $0\terrdata\objects\KoreaObj.Dxl RVFound
IfFileExists $0\terrdata\objects\KoreaObj.lod OFFound NoFileFound

NoFileFound:
StrCpy $9 "No F4 install found."
Goto Error

RVFound: ; I want to set up a variable to differentiate OF and RV
StrCpy $8 "F4" ; we'll use this for the lstupdate variable
StrCpy $7 "RV"
Goto F4Install

OFFound:
StrCpy $8 "F4"
StrCpy $7 "OF"
Goto F4Install

AFInstall:
; get the AF base directory into a variable
ReadRegStr $0 HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir"
SetOutPath $0 ; this tells the installer to make the base directory the 'current' directory for unpacking files
; unpack the theater files
File /r "@@:\BeringAF\*.*" ; this is the subdir in the developer's PC that has the files for AF
StrCpy $8 "AF"

; Now, I don't know enough about AF's theaters to say if you could use the vpatch option.
; I'll assume you just want to copy what you need completely - basically there will be 2 zips within the installer, one for AF, the other for F4.

Goto TheaterAdmin

F4Install:
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir" 
SetOutPath $0 
; unpack the theater files
File /r "@@:\BeringF4\*.*" ; this is the subdir in the developer's PC that has the files for F4
; set current theater to new theater
ReadRegStr $2 HKLM "Software\MicroProse\Falcon\4.0" "curTheater" ; this reads the specified registry value into $2 for use later
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "Bering" "REG_SZ" $R0

StrCmp $7 "OF" TheaterAdmin ; if it is an OF install, skip straight to theater admin otherwise, do RV stuff

; RV will eventually have an ability to replace 3d models - do this here, and anything else specific to RV

TheaterAdmin: ; this will be the area where we do stuff that it doesn't really matter which install it is
SetOutPath $0
ExecWait "$0\Utilities\lstupdate.exe $8 +Bering\Bering.tdf" ; the trick here will be making sure that the lstupdate is unpacked to that subfolder
; and that the theater directory standard is used in the dev packing/unpacking
; since this is new, I haven't tested it - here's what I use to do the same thing :)

/*
; theater.lst manipulations
strcpy $3 "Theaters\Bering\Bering.tdf"
strcpy $4 "Theaters/Bering/Bering.tdf"

	${textreplace::FindInFile} "$0\theater.lst" "$3" "/S=1" $5
	strcmp $5 1 EntryExists
	${textreplace::FindInFile} "$0\theater.lst" "$4" "/S=1" $5
	strcmp $5 1 EntryExists

goto NoEntry

EntryExists:
	MessageBox MB_OKCANCEL "Entry exists. OK to overwrite existing data." IDOK InstallTheater IDCANCEL Finish

NoEntry:
;	MessageBox MB_OK "No Entry."

FileOpen $6 "$0\theater.lst" a
FileSeek $6 0 END
FileWrite $6 "$\r$\n" ; write a new line
FileWrite $6 "Theaters\Bering\Bering.tdf"
FileWrite $6 "$\r$\n" ; write an extra line
FileClose $6 ; and close the file

*/
; copy files
CopyFiles /filesonly "$0\campaign\save\*.*" "$0\Theaters\Bering\campaign\"
CopyFiles /filesonly "$0\terrdata\texture\texture.bin" "$0\Theaters\Bering\terrdata\texture\" ; if necessary
CopyFiles "$0\terrdata\weather\*.*" "$0\Theaters\Bering\terrdata\weather\"

; also, since I package everything together, I haven't run these utilities in awhile, so the syntax might be off
ExecWait "$0\Utilities\SPTinstall.exe /auto $0\theaters\Bering\terrdata\"
ExecWait "$0\Utilities\LXNormalFix.exe @Bering @$0\theaters\Bering\terrdata\"

; just compress textures if F4 then finish
StrCmp $8 "AF" Finish

ExecWait ""$0\Utilities\Seasonswitcher.exe -0"

MessageBox MB_YESNO "Do you want to make the new theater the current one?" IDYES Finish IDNO 0
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "$2" "REG_SZ" $R0

Goto finish

Error:
Messagebox MB_OK $9

Finish:

SectionEnd
Last edited by T_Rex on 2007-02-22 18:02:19, edited 3 times in total.
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-21 19:20:45

Quite a script.

I have now downloaded this http://nsis.sourceforge.net/MessageBox_plug-in and unzipped it to the nsis/examples directory, is that correct way to do it?
File /r "@@:\BeringAF\*.*" ; this is the subdir in the developer's PC that has the files for AF
What does that @@:\ mean?

If I place the NSI file in what ever dir, I need to place the theater files then into this BeringAF/ dir?
CopyFiles /filesonly "$0\campaign\save\*.*"
What if I want to copy list of files... a long list, but not all? For example in RV there is tons of useless TAC and TRN files for new theaters since they refer to Korean landscape, none of those are wanted in new theater.

And this also has to have check RV vs AF as there is the te-navunits.lst in AF but no such file in RV. Also AF dir is campaign/korea/ where in RV its campaign/save/
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 19:44:53

Snake Man wrote:Quite a script.
Indeed. :)
I have now downloaded this http://nsis.sourceforge.net/MessageBox_plug-in and unzipped it to the nsis/examples directory, is that correct way to do it?
Yeah. You may also need the registry and textreplace plugins. If you get errors, let me know. I can't remember which ones are necessary.

Edit - NOT examples subdir, plugins dir. :thumbs:
File /r "@@:\BeringAF\*.*" ; this is the subdir in the developer's PC that has the files for AF
What does that @@:\ mean?
That is something I use to remind me to change something. I can search a document for @@ and it'll take me to the places I need to fix. For the template, I did that to make sure the user put the correct path in. :)
If I place the NSI file in what ever dir, I need to place the theater files then into this BeringAF/ dir?
Ah, no.

The .nsi can be in any directory. It is used to compile the exe.

The "file" command should go to the path for the files you want to install. So for Iran on your computer, it might be "C:\theaterdev\Iran". You should have the theater structure the same way you want it to install.

For instance in this example, the theaterdev\Iran files would be copied straight to the Falcon4 directory.
CopyFiles /filesonly "$0\campaign\save\*.*"
What if I want to copy list of files... a long list, but not all? For example in RV there is tons of useless TAC and TRN files for new theaters since they refer to Korean landscape, none of those are wanted in new theater.
You can use wildcards, or list the files individually. Or, if it is quicker, copy all the files, then delete the unnecessary ones.
And this also has to have check RV vs AF as there is the te-navunits.lst in AF but no such file in RV.
Well, does having it in an F4 install hurt anything?
Also AF dir is campaign/korea/ where in RV its campaign/save/
Ok, then I guess that copyfile command would have to have 2 separate ones - one for F4, one for AF.
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-21 20:06:26

I guess now there's no use for me to translate comments of my script :oops: .

That will give me time to do some other things :).

I'll test and follow closely OF installations, and if I can report some usefull things of course I'll do ;).

Sorry to have been too slow :).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-21 20:22:57

Actually - not to make more work for you :D but I'm still interested in your process.

Like I said, I'm NOT a coder, and I'm open to learning different approaches to things. I have some experience with AutoIT, so there might be ways your "fixes" can help me make my own installations better.

If it helps, you don't need to translate your comments! :)
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-21 22:32:41

As I know you understand french I have to admit it will be faster :oops: .

The smallest exemple I have is the Quebec theater. You can get the source : here (5,00 Mo).

Feel free to use ;).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 03:15:27

Ah merci!

La tante de ma femme est en Boucherville! :D

Si elle n'est pas gentille... p't'etre un LGB..... ;)

(JOKE joke joke....) :D

Edit - Ok, I just quickly scanned the OFQTI.au3 and it is amazing how similar the process is. Actually, I guess it isn't THAT amazing, since they are doing the same things. :)

I'm wondering if it would be better to have an .au3 that ran things like SPTInstall and LXNormalfix. I think the NSIS installer's 'execwait' doesn't always wait as long as it should before moving to the next line of the script, which can cause problems. That's something that AutoIT is very good at, though - running something and waiting for it to completely finish.

:D
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-22 07:15:43

T_Rex wrote:Ah merci!

La tante de ma femme est en Boucherville! :D

Si elle n'est pas gentille... p't'etre un LGB..... ;)

(JOKE joke joke....) :D
Sorry IRL I only drop paratroopers, or LGB but disarmed :lol: ;).

T_Rex wrote: Edit - Ok, I just quickly scanned the OFQTI.au3 and it is amazing how similar the process is. Actually, I guess it isn't THAT amazing, since they are doing the same things. :)

I'm wondering if it would be better to have an .au3 that ran things like SPTInstall and LXNormalfix. I think the NSIS installer's 'execwait' doesn't always wait as long as it should before moving to the next line of the script, which can cause problems. That's something that AutoIT is very good at, though - running something and waiting for it to completely finish.

:D
Scaring NSIS :lol:
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 14:16:32

Hey Coubeau-

How hard would it be to write an au3 script like this:

1) read an ini type file to get a theater name and .tdf filename
....(a) maybe also the l2 location for the new theater
....(b) if the new standard directory structure was used, this would be easier, I think
2) use that information to run sptinstall and lxnormalfix
3) do it on either an AF or F4 install

What I'm thinking is that an NSIS installer can use the information and create an ini (or the theater dev can just make one) and put it in the Theaters subdir where the au3 exe can find it. Then, as the installer goes through, instead of running it from inside NSIS, it can call the au3 exe to run those apps. Maybe the lstinstaller too.

That way, instead of the theater dev making sure the syntax is right, we can have you make sure it is right. ;)

Edit: for F4 theaters, you could even have the au3 just get the curtheater registry key, as long as the NSIS makes the new theater current before the new utility runs. :)
Sic Semper tyrannosauro.

Couby
1st Lt
Posts: 127
Joined: 2006-12-25 22:35:21
Location: France
Contact:

Post by Couby » 2007-02-22 14:53:00

The use of ini files is very very easy with autoit (with autoit ini predifined file structure), so what you're asking is doable :).
ImageImage

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 15:00:08

Cool. Let's keep that in mind for later testing. :)

Oh, and Snake Man, I can break up that script into smaller pieces to illustrate how each section works, if you want.

I also read someplace that AF terrain and F4 terrain are the same? So they would only need to be packaged once. I can revise the script template to reflect that, if you want.
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-22 17:06:58

I tried to compile the script, its says

Code: Select all

Invalid command: ${registry::KeyExists}
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 17:19:09

http://nsis.sourceforge.net/Registry_plug-in

Might need this one, too, if you opt not to use lstupdate:
http://nsis.sourceforge.net/TextReplace_plugin

Sorry - I didn't do a good job of keeping track of what plugins I used. :)

Never in a million years did I think I'd actually be trying to show someone else how to do it! :D
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-22 17:40:40

Thats now fixed, thanks. New error came up

Code: Select all

Error: could not resolve label "Finish:" in install section "Installer" (0)
Error - aborting creation process
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 17:58:58

Shit.

This part, about 10 lines from the end:

Code: Select all

; just compress textures if F4 then finish
StrCmp $8 "AF" Finish: 
Remove the colon at the end.

The "section" labels should only have colons when they are set, not when they are referred to.

So, it should be:
StrCmp $8 "AF" Finish

But the goto-label would be:
Finish:

Sorry. I'll edit the post, too.
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-22 18:27:13

Apparently the installer first unpacks the campaign dir files into place and then does the CopyFiles command, so it overwrites the new theater campaign files with the korean ones heh.

Any way to change the copying order here?

Do we need to suffle them through some temp dir or something?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 18:44:59

Snake Man wrote:Apparently the installer first unpacks the campaign dir files into place and then does the CopyFiles command, so it overwrites the new theater campaign files with the korean ones heh.

Any way to change the copying order here?

Do we need to suffle them through some temp dir or something?
Yeah you can do this.

Edit - or move the campaign copyfiles to earlier than the File /r command. :)

Did a quick google and also found that you can set the overwrite condition before that copyfile.

So, in the line before the copying of the campaign files put:
SetOverwrite Off

After that, you can either leave it like that, or set other options like On or ifnewer (that's a bit risky with RV).

Edit2 - I just remembered how I did that elsewhere. :) I had a separate File /R for the campaign files. I created the campaign directory, then unpacked all the other files, copied the Korean ones, then unpacked the newer ones. I think the overwrite off is probably a better idea. :D Wish I'd thought to look for it earlier! :D Only problem I can see is if someone is trying to re-install to fix a porked install. Might cause problems....
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-22 19:06:48

Hmm the SetOverwrite Off wont work, it still overwrites. I guess its just easier to change the copyfiles before the theater files are unpacked?

And how do I add that agreement policy thing on the beginning of the installer, you know when you get piece of text and have to answer "I agree" to continue, or when answering "Decline" the installer quits immediately?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 19:20:44

Ok, not sure why that doesn't work, but I'll play with it.

For the license, after the !insertmacro MUI_PAGE_WELCOME try adding this:
!insertmacro MUI_PAGE_LICENSE "License.rtf" ; the license.rtf should be the path to the text on the dev machine

I've never actually done that. :)

A good reference for MUI options:
http://www.pepesoft.tox.pl/nsis_pl/docs ... ern_ui.php
Sic Semper tyrannosauro.

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 19:39:56

Ok, for some reason, the SetOverwrite works for me, but I can't get the license text to work.

I'll keep working on it and report back here.
Sic Semper tyrannosauro.

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 20:15:56

Ok, this is driving me crazy.

If I use:

Code: Select all

  !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
It works fine, although I get the NSIS license.

But, if I use anything else - absolute paths, same directory, relative paths, whatever - I get a compile error.

Damn computers!

:D
Sic Semper tyrannosauro.

T_Rex
FreeFalcon
Posts: 848
Joined: 2001-03-04 23:01:01
Location: here

Post by T_Rex » 2007-02-22 20:37:29

Bah! I'm an idiot.

I had accidentally named the file license.txt.txt - that was why it couldn't find it! Grrrrrr.....

So, now the MUI section looks like this:

Code: Select all

!define MUI_WELCOMEPAGE_TITLE "${FRIENDLYNAME} ${VER} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${FRIENDLYNAME} ${VER} into your Falcon installation."
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "license.txt"
The radio buttons definition just makes it kinda cool, I think. :) There are other options.

And the license.txt is in the same folder as the nsi you are compiling - and make sure it is named correctly! ;)

Edit - oh and this is my SetOverwrite:

Code: Select all

SetOverwrite off
File /r "@@:\BeringAF\*.*"
Sic Semper tyrannosauro.

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Post by Snake Man » 2007-02-23 00:48:44

Thank you very much, now I have the script that compiles and guess what, the installer actually works. Thanks again, your help is very much appreciated!

Here is the current script I got from you:

Code: Select all

!define TNAME "Taiwan"
!define FRIENDLYNAME "PMC Taiwan Theater Installer"
!define APP "TaiwanInstaller"
;for some reason, this has to be #.#.#.# but I usually change the name after I build the exe
!define VER "0.0.0.1"

; these establish some things about the installer the most important one to me is the outfile
Name "${FRIENDLYNAME}"
; outfile is the name of the installer.  Unless otherwise set, it will be the same directory as where the script is
OutFile "PMC_${TNAME}_Theater_v${VER}.exe"
Caption "${FRIENDLYNAME}"
; these VI definitions are what is displayed if you hover the mouse over the icon
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${FRIENDLYNAME}"
VIAddVersionKey Comments "Installs the Taiwan theater."
VIAddVersionKey LegalCopyright "PMC Tactical"
VIAddVersionKey FileDescription "${FRIENDLYNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${FRIENDLYNAME}"

;=== Runtime Switches
; the CRC check is something I use on bigger installers to make sure everything checks out.
CRCCheck On
; this makes it more efficient
AutoCloseWindow True
; this is something I use to make sure it uses the LZMA compression, which I believe is the best
SetCompressor lzma
; branding text is just something that's displayed at the bottom of the installer
BrandingText "http://www.pmctactical.org"

;=== Includes - this will include the necessary dlls and functions that I use in the installer
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "Registry.nsh"
!include "WinMessages.nsh"
!include "TextFunc.nsh"
!include "Sections.nsh"

; MUI Settings - the MUI is the Modern UI for NSIS, this section defines its parameters (there are alot more that I don't use)
!define MUI_ABORTWARNING
!define MUI_INSTALLCOLORS /windows

; Welcome page - this is the first page of the installer (I also have a snippet for a splashscreen, but we'll keep this simple)
;!define MUI_WELCOMEFINISHPAGE_BITMAP "@@:\FF4Installers\leftgraphic.bmp"
; using the variables means we don't have to remember to change all these when we use the template for another theater
!define MUI_WELCOMEPAGE_TITLE "${FRIENDLYNAME} ${VER} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "Setup will install ${FRIENDLYNAME} ${VER} into your Falcon installation."
!insertmacro MUI_PAGE_WELCOME

!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "EULA.txt"

; Instfiles page
!define MUI_FINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_INSTFILES
; Finish page - this is the last page people see
!define MUI_FINISHPAGE_TITLE "${FRIENDLYNAME} ${VER} Installation completed."
!define MUI_FINISHPAGE_TEXT "Click 'Finish' to close this wizard."
!insertmacro MUI_PAGE_FINISH

; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------

; now we're ready for the actual installer!
Section "Installer" SEC01

; F4registry check - if no F4 registry, it kicks to the end - the $0 is a variable that holds the -1 (not found) or 0 (found)
; we can also start to determine which install we have
${registry::KeyExists} "HKLM\Software\MicroProse\Falcon\4.0" $0
${registry::KeyExists} "HKLM\Software\Lead Pursuit\Battlefield Operations\Falcon" $1
; IntCmp compares the integer in $0 with our number (0) and if it is =, it goes to label "F4Exists"
IntCmp $0 0 F4Exists
IntCmp $1 0 AFInstall
; this copies the string to $9 - I'm using that as an error label
StrCpy $9 "No appropriate registry found."
Goto Error

; now make a variable to hold what versions we have installed
F4Exists:
; this determines if there's an AF reg entry, and if so, it only advances 1 line, if not, it goes to F4Install
IntCmp $1 0 0 F4Install

; at this point, we need to determine if the person wants to install over "original" F4 or RV

Messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "" "Select where you want the theater installed." "OF/RV" "AF" IDCANCEL
; this places the response 1, 2, or 3, into $0
Pop $0
IntCmp $0 3 Finish
IntCmp $0 2 AFInstall

; now we know they want OF/RV so we need to differentiate - I'm only going to look for RV, if it isn't RV, I'm going to assume OF for now
; this will also validate the install a bit 
; this reads the specified registry value into $0
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir"
; if the file exists, go to next line (don't skip a line) if it doesn't, go to label "NoFileFound"
IfFileExists $0\theater.lst 0 NoFileFound
IfFileExists $0\terrdata\objects\KoreaObj.Dxl RVFound
IfFileExists $0\terrdata\objects\KoreaObj.lod OFFound NoFileFound

NoFileFound:
StrCpy $9 "No F4 install found."
Goto Error

; I want to set up a variable to differentiate OF and RV
RVFound:
; we'll use this for the lstupdate variable
StrCpy $8 "F4"
StrCpy $7 "RV"
Goto F4Install

OFFound:
StrCpy $8 "F4"
StrCpy $7 "OF"
Goto F4Install

AFInstall:
; get the AF base directory into a variable
ReadRegStr $0 HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir" 
; this tells the installer to make the base directory the 'current' directory for unpacking files
SetOutPath $0 

; copy files
;SetOverwrite Off

; snake test
CreateDirectory "$0\Theaters\Taiwan\campaign\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\terrain\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\texture\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\weather\"

CopyFiles /filesonly "$0\campaign\korea\*.*" "$0\Theaters\Taiwan\campaign\"
CopyFiles /filesonly "$0\terrdata\korea\texture\texture.bin" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles /filesonly "$0\terrdata\korea\texture\texture.zip" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles /filesonly "$0\terrdata\korea\texture\fartiles.pal" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles "$0\terrdata\korea\weather\*.*" "$0\Theaters\Taiwan\terrdata\weather\"

; unpack the theater files 
; this is the subdir in the developer's PC that has the files for AF 
File /r "Theater_src_Taiwan\*.*"
StrCpy $8 "AF"

; Now, I don't know enough about AF's theaters to say if you could use the vpatch option.
; I'll assume you just want to copy what you need completely - basically there will be 2 zips within the installer, one for AF, the other for F4.

Goto TheaterAdmin 

F4Install: 
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir" 
SetOutPath $0 

; copy files
;SetOverwrite Off

; snake test
CreateDirectory "$0\Theaters\Taiwan\campaign\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\terrain\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\texture\"
CreateDirectory "$0\Theaters\Taiwan\terrdata\weather\"

CopyFiles /filesonly "$0\campaign\save\*.*" "$0\Theaters\Taiwan\campaign\"
CopyFiles /filesonly "$0\terrdata\korea\texture\texture.bin" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles /filesonly "$0\terrdata\korea\texture\texture.zip" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles /filesonly "$0\terrdata\korea\texture\fartiles.pal" "$0\Theaters\Taiwan\terrdata\texture\"
CopyFiles "$0\terrdata\korea\weather\*.*" "$0\Theaters\Taiwan\terrdata\weather\"

; unpack the theater files 
;this is the subdir in the developer's PC that has the files for F4 
File /r "Theater_src_Taiwan\*.*"
; set current theater to new theater 
; this reads the specified registry value into $2 for use later
ReadRegStr $2 HKLM "Software\MicroProse\Falcon\4.0" "curTheater"
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "Taiwan" "REG_SZ" $R0

; if it is an OF install, skip straight to theater admin otherwise, do RV stuff
StrCmp $7 "OF" TheaterAdmin

; this will be the area where we do stuff that it doesn't really matter which install it is
TheaterAdmin: 
SetOutPath $0 
; the trick here will be making sure that the lstupdate is unpacked to that subfolder
ExecWait "$0\Utilities\lstupdate.exe $8 +Theaters\Taiwan\taiwan.tdf"

; copy files was here before.

; also, since I package everything together, I haven't run these utilities in awhile, so the syntax might be off
ExecWait "$0\Utilities\SPTinstall.exe -auto $0\Theaters\Taiwan\terrdata"
ExecWait "$0\Utilities\LxNormalFix.exe @Taiwan @$0\Theaters\Taiwan\terrdata"

; just compress textures if F4 then finish
StrCmp $8 "AF" Finish

ExecWait "$0\Utilities\SeasonSwitcher.exe -0"

MessageBox MB_YESNO "Do you want to make the new theater the current one?" IDYES Finish IDNO 0
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "$2" "REG_SZ" $R0

Goto Finish

Error:
Messagebox MB_OK $9

Finish:

SectionEnd
There is one problem at the moment, I'm not sure but LxNormalFix for F4AF should have the "$LP" parameter included, the NSIS gives me error if there is such parameter as it takes the dollar sign as variable thing.

Any ideas for that?
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests