isn't the first check you added (BTSREGKEY) the same reg key as the first check in the BUG code?
I believe so. I just wanted to use the old one I knew worked, because in testing since things were failing I figured I'd try to keep the old function unaltered, since I knew it worked (at least for regular BtS, but it fails for Complete, which is the the whole point in this).
Where do you take what's in CivInstallDir and set it as the installation directory?
To be honest I'm not quite sure.
I assumed that this function just did it, at least it seemed to:
Code:
;Default installation folder
InstallDir ""
;Get installation folder from registry if available
InstallDirRegKey HKLM "${BTSREGKEY}" "INSTALLDIR"
So I replaced that with this:
Code:
;Default installation folder
Var CivInstallDir ;EXE
Function findCivInstallDir
Push $0
ReadRegStr $0 ${FIRAXIS_REG_ROOT} "${BTSREGKEY}" 'INSTALLDIR'
${If} ${FileExists} $0
StrCpy $CivInstallDir $0
Goto done
${EndIf}
# standard Civ4:BTS
ReadRegStr $0 ${FIRAXIS_REG_ROOT} "${FIRAXIS_REG_KEY}\Sid Meier's Civilization 4 - Beyond the Sword" 'INSTALLDIR'
${If} ${FileExists} $0
StrCpy $CivInstallDir $0
Goto done
${EndIf}
# Civ4 Complete
ReadRegStr $0 ${FIRAXIS_REG_ROOT} "${FIRAXIS_REG_KEY}\Sid Meier's Civilization 4 Complete" 'INSTALLDIR'
${If} ${FileExists} $0
StrCpy $0 "$0\Beyond the Sword"
${If} ${FileExists} $0
StrCpy $CivInstallDir $0
Goto done
${EndIf}
${EndIf}
# Civ4 Gold
ReadRegStr $0 ${FIRAXIS_REG_ROOT} "${FIRAXIS_REG_KEY}\Sid Meier's Civilization 4 Gold" 'INSTALLDIR'
${If} ${FileExists} $0
StrCpy $0 "$0\Beyond the Sword"
${If} ${FileExists} $0
StrCpy $CivInstallDir $0
Goto done
${EndIf}
${EndIf}
done:
Pop $0
FunctionEnd
And changed all references to INSTDIR1 with CivInstallDir. It compiles, but no dice on the autodetection (haven't gone beyond this phase yet, since if autodetection failed, I haven't seen the point in seeing if the actual install functions).
I also tried changing this code:
Code:
Function onInitDirectoryPage1
StrCpy $CurrentPage "DirectoryPage1"
;Section 1 selected?
SectionGetFlags ${Section1} $0
IntOp $R0 $0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} checkRegEntry
Abort ;skip page
checkRegEntry:
StrCmp $INSTDIR "" 0 checkDefaultLocation
StrCpy $INSTDIR1 "" ;we know nothing
Return
checkDefaultLocation:
StrCpy $INSTDIR1 "$INSTDIR" ;found it!
FunctionEnd
To this (and multiple itterations, moving around the various variables):
Code:
Function onInitDirectoryPage1
Call findCivInstallDir
StrCpy $CurrentPage "DirectoryPage1"
;Section 1 selected?
SectionGetFlags ${Section1} $0
IntOp $R0 $0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} findCivInstallDir
Abort ;skip page
findCivInstallDir:
StrCmp $INSTDIR "" 0 checkDefaultLocation
StrCpy $CivInstallDir "" ;we know nothing
Return
checkDefaultLocation:
StrCpy $CivInstallDir "$INSTDIR" ;found it!
FunctionEnd
No dice.
Here is the entirety of the default script in case that makes things easier.:
And here is the current last tested script (keep in mind I've had it fail about 50 times and have been scattering things around to try to fix it, so it might be a little messed up):
Lastly keep in mind this is a shared install script. I have this uploaded this so other modders can easily use an installer without coding knowledge. I need the script to be able to just define all the !define stuff at the beggining of the script to use it. So I need the main body of the script softcoded.