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

Post by T_Rex » 2007-02-23 01:02:39

Dangit, I think I just saw that... maybe a double dollar - $$.

I'll look around!

Hey - do you find that it packs the theater twice? I think I have a way around that, if it does....
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 01:06:37

Packs twice, no I dont think so, when I rar up the source files they are pretty much the same 2.97mb.
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-23 04:16:42

Ok, few things. 8) (BTW, this is rockin! I'm learning stuff, you're learning stuff, everybody's getting a feel for how this works, and ultimately F4 is going to gain from it!) :D

First, the double dollar works. I used this line:

Code: Select all

Messagebox MB_OK "$0\Utilities\LxNormalFix.exe $$LP @Taiwan @$0\Theaters\Taiwan\terrdata"
That outputs what the string will read as, but puts it into a messagebox (I remmed out the actual execwaits).

It output:
Image
Which looks to be just about perfect, right?

Here's the reference I used:
http://www.nullsoft.com/free/nsis/makensis.htm#V
then search on the page for $$, which says:
$$ Use to represent $.
Second, I think I have a way to optimize this a bit better. I think there only needs to be 1 File /r command.

Ok, this picks up right after the OFFound/RVFound parts:

Code: Select all

AFInstall:
; get the AF base directory into a variable
ReadRegStr $0 HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir"
; sets the right campaign directory
StrCpy $1 "$0\campaign\korea"
StrCpy $8 "AF"
Goto CreateDirs

F4Install:
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir"
StrCpy $1 "$0\campaign\save"

CreateDirs:
SetOutPath $0
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 "$1\*.*" "$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\*.*"

StrCmp $8 "F4" F4curTheater TheaterAdmin

StrCpy $9 "Unknown error before curTheater: $8."
Goto Error

F4curTheater:
; 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
Then it goes on as you have it. The main changes were just restructuring it to make is so there is only one File /r command, and setting up $1 as a variable to hold the respective campaign\save directory strings, since they are different between F4 and AF. We could probably set that as a global variable if we really wanted to. Anyway, that seems more efficient to me, and should still be effective.

Well, I guess there'd still be another branch for the LXnormalfix for LP, but thats really just another strcmp and a couple labels.

Finally, if you want to set up a splashscreen when the installer runs, let me know and I can tell you where to put those commands. :)
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 10:18:45

Can we make the LxNormalFix parameters just as variable, so we could just do "LxNormalFix.exe $stuff" where the stuff variable would have been set properly at the F4 and AF parts?
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-23 13:02:06

Ahhh, sure! (I think.) ;)

Since you're using lstupdate, that frees up several built in variables, we could use $2 for instance (or even $1 again).

What's the syntax for the LP implementation? I took a guess with my example. :)
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 13:27:03

LxNormalFix $LP @theater_name @terrdata_path
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-23 14:43:45

Okely dokely. :D

Check this out:

Code: Select all

AFInstall:
; get the AF base directory into a variable
ReadRegStr $0 HKLM "Software\Lead Pursuit\Battlefield Operations\Falcon" "basedir"
; sets the right campaign directory
StrCpy $1 "$0\campaign\korea"
StrCpy $2 "$0\Utilities\LxNormalFix.exe $$LP @Taiwan @$0\Theaters\Taiwan\terrdata"
StrCpy $8 "AF"
Goto CreateDirs

F4Install:
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir"
StrCpy $1 "$0\campaign\save"
StrCpy $2 "$0\Utilities\LxNormalFix.exe @Taiwan @$0\Theaters\Taiwan\terrdata" ; lxnormalfix string
And then the lxnormalfix line looks like:

Code: Select all

ExecWait "$0\Utilities\LXNormalFix.exe $2"
ALSO, check THIS out, to kinda automate the script for other theaters (this would replace the $2 lines above):

Code: Select all

StrCpy $3  "$0\Utilities\LxNormalFix.exe $$LP @${TNAME}  @$0\Theaters\${TNAME}\terrdata"
It uses the global variable $TNAME to set it up. You could even use that same trick anyplace you use "Taiwan" in the entire script. Then, to do Iran, just define TNAME as "Iran" and everything else automagically changes, too. :) Something to keep in mind. :)

I tested both of these with messageboxes and it looks like it works ok. :8
Sic Semper tyrannosauro.

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

Post by T_Rex » 2007-02-23 16:36:47

Also, just going through this, I don't think you need:

Code: Select all

CreateDirectory "$0\Theaters\Taiwan\terrdata\" 
Since it is created with the next to createdirectory commands, too. I'm almost positive they do it recursively.

Also, double check because I may have referenced $2 twice with my recent additions.
Sic Semper tyrannosauro.

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

Post by T_Rex » 2007-02-23 17:33:51

Ok, I've redone the script as a real template, taking out some of the instructional stuff, and added a couple more user-defined variables, and made greater use of the existing ones.

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 APP "BeringInstaller"
!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"

;=== 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 $9 "No appropriate registry found." 
Goto Error

F4Exists:
IntCmp $1 0 0 F4Install 

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

ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir"
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

RVFound: 
StrCpy $8 "F4" 
StrCpy $7 "RV"
Goto F4Install

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

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

StrCpy $1 "$0\campaign\korea"
StrCpy $2 "$0\Utilities\LxNormalFix.exe $$LP @${TNAME} @$0\Theaters\${TNAME}\terrdata"
StrCpy $8 "AF"
Goto CreateDirs

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

CreateDirs:
SetOutPath $0
CreateDirectory "$0\Theaters\${TNAME}\campaign\"
CreateDirectory "$0\Theaters\${TNAME}\terrdata\"
CreateDirectory "$0\Theaters\${TNAME}\terrdata\terrain\"
CreateDirectory "$0\Theaters\${TNAME}\terrdata\texture\"
CreateDirectory "$0\Theaters\${TNAME}\terrdata\weather\"

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

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

StrCmp $8 "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" "Taiwan" "REG_SZ" $R0

StrCmp $7 "OF" TheaterAdmin

; RV stuff

TheaterAdmin:
SetOutPath $0

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


ExecWait "$0\Utilities\SPTinstall.exe /auto $0\theaters\${TNAME}\terrdata\"

ExecWait "$0\Utilities\LXNormalFix.exe $2"

; 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" "$3" "REG_SZ" $R0

Goto finish

Error:
Messagebox MB_OK $9

Finish:

SectionEnd
Edit: changed the devdirectory a little bit, also, do you want me to copy this to the first post in this thread to make it easier to find?
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-24 00:02:55

Here is the Taiwan v0.2 script I used:

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.2"

; 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-taiwan.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
StrCpy $1 "$0\campaign\korea" 
StrCpy $8 "AF" 
Goto CreateDirs

F4Install: 
ReadRegStr $0 HKLM "Software\MicroProse\Falcon\4.0" "basedir" 
StrCpy $1 "$0\campaign\save"

CreateDirs: 
SetOutPath $0 
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 "$1\*.*" "$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\*.*" 

StrCmp $8 "F4" F4curTheater TheaterAdmin 

StrCpy $9 "Unknown error before curTheater: $8." 
Goto Error 

F4curTheater: 
; 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"

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

; 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"
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

AFTerrain:
ExecWait "$0\Utilities\SPTinstall.exe -auto $0\Theaters\Taiwan\terrdata"
ExecWait "$0\Utilities\LxNormalFix.exe $$LP @Taiwan @$0\Theaters\Taiwan\terrdata"

Goto Finish

Error:
Messagebox MB_OK $9

Finish:

SectionEnd
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-24 00:26:13

Ok, I see part of the problem.

Copy and paste this.

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.2"

; 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-taiwan.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"
; sets the right campaign directory
StrCpy $1 "$0\campaign\korea" ; campaing\save string
StrCpy $2 "$0\Utilities\LxNormalFix.exe $$LP @Taiwan @$0\Theaters\Taiwan\terrdata" ; lxnormalfix string
StrCpy $8 "AF"
Goto CreateDirs

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

CreateDirs:
SetOutPath $0
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 "$1\*.*" "$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\*.*"

StrCmp $8 "F4" F4curTheater TheaterAdmin

StrCpy $9 "Unknown error before curTheater: $8."
Goto Error

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" "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

ExecWait "$0\Utilities\lstupdate.exe $8 +Theaters\Taiwan\taiwan.tdf"
ExecWait "$0\Utilities\SPTinstall.exe -auto $0\Theaters\Taiwan\terrdata"
ExecWait "$0\Utilities\LXNormalFix.exe $2"

; 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 OldReg
OldReg:
${registry::Write} "hklm\SOFTWARE\MicroProse\Falcon\4.0" "curTheater" "$3" "REG_SZ" $R0

Goto Finish

Error:
Messagebox MB_OK $9

Finish:

SectionEnd

I took out the AFTerrain (and changed it to Finish) after the last messagebox, and I used the $2 variable to hold the string for LXNormalfix, and $3 to hold the previous registry value. I also grouped all the utils together.

However, this doesn't fix the SPTinstall space problem... :(

But, that should be pretty good. Compile that and let me know if there are any errors.

Also, check out the "newer" template I posted above. :)

(I can also put some messageboxes in to show you what it is doing in different places. Don't worry, you'll get the hang of it!) :D

Edit - oh and cou cou Coubierre ;) if you're still following this, do you know if an AutoIT exe handle SPTinstall with spaces correctly?
Sic Semper tyrannosauro.

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

Post by T_Rex » 2007-02-24 15:51:26

BINGO!

SnakeMan - in the TheaterAdmin section, change the execwait SPTInstall line to this:

Code: Select all

ExecWait '$0\Utilities\SPTinstall.exe -auto "$0\Theaters\Taiwan\terrdata"'
(Notice the single quotes on the outside, and the double quotes on the inside.)

That got it to work on my AF/spaces in the pathname install.
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-24 17:58:16

Great, changed. Will be on the next release. Lets pool up few more fixes before spewing it out.

Thanks for your effort, it will be glorious time for theater releases as we have this fine installer.
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."

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-26 16:16:55

About the filecopy for campaign/save/*.* files, this is the list we need to copy:

atc.ini
attrit.pri
cas.pri
DEFAULT.idx
DEFAULT.wch
Defense.pri
doctrine0.txt
doctrine1.txt
doctrine2.txt
doctrine3.txt
doctrine4.txt
doctrine5.txt
doctrine6.txt
doctrine7.txt
Element2.db
Element.b
Element.db
Emerganc.b
END.B
f0.ia
f1.ia
f2.ia
f3.ia
f4.ia
f5.ia
f6.ia
f7.ia
f8.ia
f9.ia
f10.ia
f11.ia
f12.ia
f13.ia
f14.ia
Falcon4.AII
FALCON4.RT
FALCON4.TT
FEATURE.B
FLEVENT.DB
Flight.db
FLIST.TXT
FORDEND.DB
FORDEVT.DB
FORDNCE.DB
FORDWEAP.DB
furball.dfs
Header.b
header.db
Intdict.pri
KOREA.NAM - needed or not?
Korea.tm - needed or not?
Loadout.b
LOADOUTH.B
m0.ia
m1.ia
m2.ia
m3.ia
m4.ia
m.ia
match play.dfs
mission.dat
MISSION.GBD
mpwcells.bin - some RV only?
New Game.dfs
NoSquad.b
OBJECTIV.B
OFFENSE.PRI
PackHead.b
PElement.db
PHEADER.DB
Pilot.db
related.db
Results.db
RoE.b
SITUATE.B
SQUAD.B
stations.dat
STEERPT.B
STEERPTH.B
Strings.idx
Strings.txt - RV only?
Strings.wch
Support.b
taceng.db
TASK.GBD
team furball.dfs
teplanes.lst
teunits.lst
THREAT.B
Threats.b
tmp.frc
tmp.his
VALIDAC.ACT
voicerange.dat
Weather.b

Thats the list roughly from RV dir at the moment. In F4AF we have the te-navunits.lst also.

I know I know the other junk files dont make the theater crash so they are in fact no problem, but if we copy all sorts of user savegame and korea related training/TE files into a new theater it causes problems. Problems of people then running those savegames or training/TE files and they are not working properly. Also its about neatness, I go nuts if my new theater campaign dir is filled with junk, heh.

So is there a way to copy only specific files take from a list, like filecopy @filelist.txt or similar (I dont know I think I did see such @ thingy in somewhere, dos or I dont know, just guessing here). Of course we could do that whole list with individual filecopy lines but its kind of messy like that too.

We could copy everything and then go back and delete the *.trn, *.cam and *.tac to clean up it a bit too.

Ideas?
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-26 18:08:54

I am *SO* glad you posted that list!

I'm trying to get another theater working, and was trying to figure out which of those files really was needed. There are a couple ways of doing this. Personally, I'd like to not use an ini-type file to reference. That just seems like over-coding something. We know the list, we might as well just use individual copy commands IMHO (which, BTW, I think is what BMS used to install BMS1.03 IIRC). But, I recognize the cumbersome aspect of that, too. We can use some wildcards to help minimize it.

The del *.tac/trn/etc. idea is good, too, but I'm also thinking about people coming into theater devs. The list might be a good way to tell people who open up an installer which files are necessary - take some of the mystery out of it.

I'll work up some scripting for it. :)
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-26 18:37:28

I was comparing my current list for the old SP4.2 released theater file list and this is what is different:

SP4.2 list
Not included:
DEFAULT.idx
DEFAULT.wch
f14.ia
KOREA.NAM
Korea.tm
m.ia
mpwcells.bin
Strings.txt

Of course SP4.2 is old stuff and lot have changed since then, but thought to put up that list just for comparison.

I believe those last two are some RV development leftovers. The f14.ia and m.ia are strange to me and I guess the korea.* files are indeed just some specific original microprose korean theater files... however its strange that user community tools wont create such files for user made theaters, wonder why. Would be really interesting to find out what are korea.nam and korea.tm files indeed.
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-26 18:45:52

Ok, let's try this: (the "filesonly" could probably be removed, but just in case...)

Code: Select all

CopyFiles /filesonly "$1\*.pri" "$0\Theaters\Taiwan\campaign\" 
Takes care of:
attrit.pri
cas.pri
Defense.pri
Intdict.pri
OFFENSE.PRI

Code: Select all

CopyFiles /filesonly "$1\*.txt" "$0\Theaters\Taiwan\campaign\" 
Strings.txt - RV only?
FLIST.TXT
doctrine0.txt
doctrine1.txt
doctrine2.txt
doctrine3.txt
doctrine4.txt
doctrine5.txt
doctrine6.txt
doctrine7.txt

Code: Select all

CopyFiles /filesonly "$1\*.b" "$0\Theaters\Taiwan\campaign\" 

Emerganc.b
Element.b
END.B
Header.b
FEATURE.B
Loadout.b
LOADOUTH.B
NoSquad.b
OBJECTIV.B
PackHead.b
RoE.b
SITUATE.B
SQUAD.B
STEERPT.B
STEERPTH.B
Support.b
THREAT.B
Threats.b
Weather.b

Code: Select all

CopyFiles /filesonly "$1\*.db" "$0\Theaters\Taiwan\campaign\" 
header.db
FLEVENT.DB
Element2.db
Element.db
Flight.db
FORDEND.DB
FORDEVT.DB
FORDNCE.DB
FORDWEAP.DB
PElement.db
PHEADER.DB
Pilot.db
related.db
Results.db
taceng.db

Code: Select all

CopyFiles /filesonly "$1\*.ia" "$0\Theaters\Taiwan\campaign\" 
f0.ia
f1.ia
f2.ia
f3.ia
f4.ia
f5.ia
f6.ia
f7.ia
f8.ia
f9.ia
f10.ia
f11.ia
f12.ia
f13.ia
f14.ia
m0.ia
m1.ia
m2.ia
m3.ia
m4.ia
m.ia

Code: Select all

CopyFiles /filesonly "$1\*.dfs" "$0\Theaters\Taiwan\campaign\" 
team furball.dfs
furball.dfs
match play.dfs
New Game.dfs

Code: Select all

CopyFiles /filesonly "$1\*.dat" "$0\Theaters\Taiwan\campaign\" 
voicerange.dat
stations.dat
mission.dat

Code: Select all

CopyFiles /filesonly "$1\*.gbd" "$0\Theaters\Taiwan\campaign\" 
MISSION.GBD
TASK.GBD

Code: Select all

CopyFiles /filesonly "$1\*.lst" "$0\Theaters\Taiwan\campaign\" 
teplanes.lst
teunits.lst
tenavunits.lst for AF

Code: Select all

CopyFiles /filesonly "$1\*.idx" "$0\Theaters\Taiwan\campaign\" 
Strings.idx
DEFAULT.idx

Code: Select all

CopyFiles /filesonly "$1\*.wch" "$0\Theaters\Taiwan\campaign\" 
DEFAULT.wch
Strings.wch

Code: Select all

CopyFiles /filesonly "$1\atc.ini" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\Falcon4.AII" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\FALCON4.RT" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\FALCON4.TT" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\KOREA.NAM" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\Korea.tm" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\mpwcells.bin" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\tmp.frc" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\tmp.his" "$0\Theaters\Taiwan\campaign\" 
CopyFiles /filesonly "$1\VALIDAC.ACT" "$0\Theaters\Taiwan\campaign\" 
And that wraps up the remaining files.

I think. :)
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-26 18:57:35

Okay sounds pretty good to me :)

All right so now I'm working next on the Iran theater, I'll do some linking for it and what ever I can think of to improve, then I start to put together installer for it... but there lays the problem. The 220mb sized texture.zip, I dont know maybe there is something wrong with me but I just hate the wasted bandwidth and hdd/server space to include it on to this theater also as its already included in ODS theater. Oh and my 1mb/256 ADSL aint actually super fast to upload such theater, especially if our release rate is what we seen on Taiwan.

Heh, so hmm I was thinking, could we make some <theatername>_install_v0.X and then upgrade installer exe for that?

I mean if we do now Iran theater v0.2 with the 220mb ODS texture zip, then all the rest upgrades would be made with only incremental installer which drops in the updated files... or is that just stupid to create two installers for one theater?

We need some good planning for this big theater download size. I dont mind transferring large sizes, but transferring them again for no reason is just stupid...
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-26 19:13:11

Initial thought (brainstorming)... how about a theaters\admin\tilefiles\ and have subfolders from there for each theater. We can have the installers copy the tile files (texture.zip/fartiles.*) to there. Then, subsequent installers can check which file is newer and overwrite it if the new file is newer.

So, for Iran/ODS for example, 2 installers... or 3 depending on how you count. One that installs just the texture.zip information to the admin\tilefiles\ODS or \Iran, and another for the other stuff. That second installer would check those folders, and if nothing is found, prompt the user to download the texture files and cancel the install. The third installer might be a BIG installer with everything together for people that want that/can afford to upload it someplace.

Just some ideas.

Also, I'd be curious how small the NSIS would compact that, though. You might be surprised.
Sic Semper tyrannosauro.

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

Post by T_Rex » 2007-02-28 16:34:25

Dammit Snake, I think I found the problem with RV/OF install for Taiwan.

Ok, the section that starts F4Exists, replace with this:

Code: Select all

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 F4Version

; 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

F4Version:
; 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
The only things changed are this:
IntCmp $1 0 0 F4Version

Had been:
IntCmp $1 0 0 F4Install

It was skipping the whole part about assigning F4 (and RV/OF) to variables.

Then add the line:
F4Version:
above the registry checks.

Let me know if you want me to post the whole thing.

Sorry. grrrrr
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-28 19:27:27

Okay script updated and it compiles. We'll see if everything runs good when next release comes out.
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."

User avatar
Khronik
PMC Theater Developer
Posts: 51
Joined: 2006-05-02 22:01:01
Location: montreal quebec canada

Post by Khronik » 2007-03-04 10:35:49

I noticed your making your installer falcon version aware (AF/RV/ETC).

Have you considered making the installer have options so that the user can choose witch version they want installed? That way the script will be simpler and more specific to the needs for each version, just an idea.

You also need to delimit all variable that might contain spaces. F4 users usually dont but AF defaults to a " Battlefiled Operations " folder that contains spaces and need to be delimited in script executes. In the ODSAF installer i delimited all paths just to be sure.

ie for sptinstall,

ExecWait '"$PLUGINSDIR\sptinstall.exe" -auto "$INSTDIR\ODSAF\terrdata\desstorm"'

$INSTDIR being the variable for install path extracted from reg. $PLUGINSDIR being the variable for temp installer tools path.

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

Post by T_Rex » 2007-03-04 17:46:35

Heya khronik! :)

Where were you a month ago? ;) :)

Bien sur, your input and advice is GREATLY appreciated.

The way I set up the installer so far, is pretty modular, while still being completely self-contained. At some point, when the campaigns really start being installed, each version will need its own stuff, but I've got some ideas how to take care of that with the current structure.

Like I said, though, its always good to have another set of eye looking at this. :)
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-03-04 20:48:30

I think the latest Taiwan/Korea128 theaters should have quick new version since the installer is porked on the lstupdate part, also seems like ccc could not it to make run SeasonSwitcher either. I believe the latest script edition in my installer dir is now correct fixed one gathered from this topic.
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."

User avatar
Khronik
PMC Theater Developer
Posts: 51
Joined: 2006-05-02 22:01:01
Location: montreal quebec canada

Post by Khronik » 2007-03-04 21:14:27

T_Rex wrote:Heya khronik! :)

Where were you a month ago? ;) :)

Bien sur, your input and advice is GREATLY appreciated.

The way I set up the installer so far, is pretty modular, while still being completely self-contained. At some point, when the campaigns really start being installed, each version will need its own stuff, but I've got some ideas how to take care of that with the current structure.

Like I said, though, its always good to have another set of eye looking at this. :)
Np Whatever I can do is my pleasure.. Do you have a final copy of the NSIS script, or is it the one above, and are you going to be using the same script for all theaters? If not i can help with the others.

Khronik.

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-03-04 21:33:20

The script discussed in this topic will be used for all PMC theaters, of course it might reguire some personalizing on some specific theaters with multiple campaign dirs like Europe and Vietnam.
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-03-05 01:05:49

Yeah SM - we basically ended up doing what K-man suggested. It should work better now.

8)
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-03-23 12:52:43

Now I'm creating installers for rest of the theaters and came up into Europe and Vietnam which uses databases.

So how do we plan this whole database business, I assume the installer needs to include all the database different files (heh what a mess)?
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."

ccc
Chief of Staff
Posts: 4857
Joined: 2000-08-06 22:01:01

Post by ccc » 2007-03-23 13:17:38

Vietnam needs a dedicated database.

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-03-30 15:21:24

Apparently AF uses validac.BIN filename, so I had to change the line copying the validac.act file to validac.* so we get the proper one.
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."

User avatar
Sherlock
Lt. General
Posts: 1167
Joined: 2006-05-24 22:01:01
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.
Location: Arizona, USA

Post by Sherlock » 2007-03-30 15:58:28

Snake Man wrote:Apparently AF uses validac.BIN filename, so I had to change the line copying the validac.act file to validac.* so we get the proper one.
Yes. You are correct. AF has this difference.
Sherlock
Victurous te Saluto

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-04-01 15:05:38

Is there way to disable the NSIS packing (LZMA or what was it using) certain files, like texture.zip?

It takes forever to pack texture.zip in for example ODS theater and it cant pack it since its packed pretty good already.
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-04-02 15:07:07

That's a big file anyway, right?

The way I've seen it work is that if it can't compress, it doesn't.

It might just be taking a long time to get it packed in with the other files.

There is a way to exclude files from the file command. This is where AutoIT comes in handy. You can basically make the zip a self-extracting archive that (with AutoIT) installs to the right place (after checking the registry entries).

Then, you can either pack that exe into the NSIS installer and have it call the exe at the right time, or you can pack the NSIS installer into an AutoIT script so that it runs the installer, then runs the self-extracting zip.

I'll keep digging a bit though and see if there's a way to turn off the NSIS compression for particular files.
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-04-02 15:35:24

Yes its 276mb zip. What I would want NSIS to do is just to STORE the file, not try to pack it as it really takes like closer to 10minuts than five to chew on it now :(

But its not a big deal if there isn't solution for it right away, its not like I'm compiling ODS installer everyday, so I can wait when its compiled every now and then. So dont spend too much time worrying about this pack/store feature.
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."

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-04-04 23:25:24

So if I understand the posts about ODS v0.6 installer correctly, it will not install if you ONLY have F4AF present in registry?

Also SPTInstall requires the old F4 registry entry to work at all?

If all that is correct, then it sucks pretty bad. We can modify the installer to handle the only F4AF scenario, but I dont know what we can do with the SPTInstall.

Do you know anyone who could code brand new terrain rebuilder, perhaps one which calculates the normals at the same time?
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-04-04 23:41:06

Or, I think I can spoof the SPTinstall.

Create an old F4 registry entry with the necessary information, then run SPTinstall, then clean up the registry when done. (Or not.) ;) :)

To be honest, I haven't followed the installer bug reports. :(

What exactly is happening?

Edit: just skimmed the posts.

Would be great if we could figure out which exact entries it needs. I'll work up some script language that will place a basedir and current theater entries that designate the (hopefully) appropriate AF directories. It will probably take some trial and error or educated guessing to get it right.

Question for the AF guys - how do you get it to work? Do you package the entire terrain already built? Do you have a workaround? :)
Sic Semper tyrannosauro.

User avatar
Khronik
PMC Theater Developer
Posts: 51
Joined: 2006-05-02 22:01:01
Location: montreal quebec canada

Post by Khronik » 2007-04-04 23:51:52

Yeah if only AF regkey is detected then get NSIS to insert the legacy F4 regkey for the duration of the install so SPT will function properly.

Theres the option of using Htti.exe (LP's version of SPTinstall) that came with HiTiles AF, though that might be a sensitive issue heh.
Last edited by Khronik on 2007-04-05 01:53:37, edited 1 time in total.

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

Post by T_Rex » 2007-04-05 00:34:36

hehehe

Good info. I'll defer to SM. 8)
Sic Semper tyrannosauro.

ranger822
Banned user
Posts: 389
Joined: 2004-07-27 22:01:01
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.
Location: Beautiful Virginia

Installer Phobia

Post by ranger822 » 2007-04-05 01:51:16

I have to admit I am an installer retard -- I am surprised I was able to get Baldeagls "idiot proof" installer working for ITO2 (well mostly)

ITO2 use InstallShield for the basic installer. Fred made it pretty much perfect and the nice thing is the way it is built you can make a few edits and it can be used for anything theater using CobraOne.exe. It should be possible to edit the installer script to adapt for other theaters.

ITO2 also made use of NSIS for the movies update and the dreaded cockpitsIsraeli update.

Besides that info I think I just want to read what you smart guys are doing. Hopefully my next project will include someone on the team besides myself that will do the installer. (hint hint Tom - for that RV conversion). That is if you REALLY want the installer to work. :twisted:

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-04-05 02:40:53

No, we are not going to add anything to windows registry.

And no, we are not going to use installshield again, NSIS is great on all aspects.

So does anyone know for a fact that htti.exe wont need anything on the registry? Yet I still think we need to make just brand new util, one which replaces SPTInstall.exe and LxNormalFix.exe utils...
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 17 guests