Topic: NSIS Installer people: a few gifts  (Read 5775 times)

0 Members and 1 Guest are viewing this topic.

Offline FireSoul

  • Modder of shiplists
  • Lt. Commander
  • *
  • Posts: 1306
  • mew.
    • http://klingon.lostexiles.net/
NSIS Installer people: a few gifts
« on: August 31, 2004, 10:50:08 am »

ESG sound loop installer fix:

Code: [Select]
;--------------------------------

Section "ESG SoundLoop Fix"
  SectionIn 1
  SetDetailsPrint textonly
  DetailPrint "Removing ESG SoundLoop..."
  SetDetailsPrint listonly
  DetailPrint "- Removing ESG SoundLoop..."

  SetOutPath "$INSTDIR"

  IfFileExists "$INSTDIR\assets\sound\sounds.txt.orig" delete_backup proceed_with_fixing
  delete_backup:
    SetFileAttributes "$INSTDIR\Assets\Sound\sounds.txt.orig" NORMAL
    Delete "$INSTDIR\Assets\Sound\sounds.txt.orig"

  proceed_with_fixing:
    IfFileExists "$INSTDIR\assets\sound\sounds.txt" do_fix no_fix
  do_fix:
    ; Rename file
    SetFileAttributes "$INSTDIR\Assets\Sound\sounds.txt" NORMAL
    Rename "$INSTDIR\Assets\Sound\sounds.txt" "$INSTDIR\Assets\Sound\sounds.txt.orig"
    FileOpen $9 "$INSTDIR\Assets\Sound\sounds.txt.orig" r

    ; open new replacement file
    FileOpen $8 "$INSTDIR\Assets\Sound\sounds.txt" w

    ; copy-paste the "wave" lines from the file, to preserve the tabs
    StrCpy $2 "wave kSndESG0Loop esgloo0.wav ESG Level 0 Sphere Loop y 1 11 99 Esg 35 35 y"   
    StrCpy $3 "wave kSndESG1Loop esgloo1.wav ESG Level 1 Sphere Loop y 1 14 99 Esg 35 35 y"
    StrCpy $4 "wave kSndESG2Loop esgloo2.wav ESG Level 2 Sphere Loop y 1 17 99 Esg 35 35 y"
    StrCpy $5 "wave kSndESG3Loop esgloo3.wav ESG Level 3 Sphere Loop y 1 20 99 Esg 35 35 y"

  fileread_loop:
    FileRead $9 $1
    IfErrors close_files

    ; Strip out 2 EOL special chars for compare
    StrLen $R1 $1
    IntOp $R1 $R1 - 2
    StrCpy $R2 $1 $R1

    ; compare block -- Locate wanted strings
    StrCmp $R2 $2 line_found
    StrCmp $R2 $3 line_found
    StrCmp $R2 $4 line_found
    StrCmp $R2 $5 line_found line_not_found
  line_found:
    DetailPrint "  Commenting out ESGLoop line"
    StrCpy $6 " $1"
    StrCpy $1 $6

  line_not_found:
    FileWrite $8 $1
    goto fileread_loop

  close_files:
    FileClose $8
    FileClose $9
    goto end

  no_fix:
    MessageBox MB_OK "$INSTDIR\Assets\Sound\sounds.txt does not exist. Unable to fix soundloop problem."
 
  end:

SectionEnd





Dynaverse Directory Servers installer-based fix:

Code: [Select]
;--------------------------------

; MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf
; [WONDirectoryServer/Addresses]
; 0="63.101.60.125:15101"
; //0="sfc2.west.won.net:15101"
; //1="sfc2.central.won.net:15101"
; //2="sfc2.east.won.net:15101"


Section "Update Dynaverse2 Directory Servers"
  SectionIn 1 2
  SetDetailsPrint textonly
  DetailPrint "Updating Dynaverse2 Directory Server addresses..."
  SetDetailsPrint listonly
  DetailPrint "- Updating Dynaverse2 Directory Server addresses..."

  SetOutPath "$INSTDIR"

  SetFileAttributes "$INSTDIR\MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf" NORMAL

  DeleteINIStr "$INSTDIR\MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf" "WONDirectoryServer/Addresses" "0"
  DeleteINIStr "$INSTDIR\MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf" "WONDirectoryServer/Addresses" "1"
  DeleteINIStr "$INSTDIR\MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf" "WONDirectoryServer/Addresses" "2"
 
  WriteINIStr "$INSTDIR\MetaAssets\ServerProfiles\Multiplayer\WONServerSetup.gf" "WONDirectoryServer/Addresses" "0" "63.101.60.125:15101"

SectionEnd


;--------------------------------


Enjoy. Use. Make these common. ;)
-- Luc


Author: OP+ Mod
Maintainer: Coopace
Author: Fests+ for OP
Creator: SFC-OP Mini Updater
Maintainer: SFC-EAW for OP Campaigns
Kitbash: SFC2 models

Offline FireSoul

  • Modder of shiplists
  • Lt. Commander
  • *
  • Posts: 1306
  • mew.
    • http://klingon.lostexiles.net/
Re: NSIS Installer people: a few gifts
« Reply #1 on: August 31, 2004, 02:30:12 pm »
Frey wants to give me a DNS entry for Directory server. Installer stuff ready, but am waiting for address. Will keep you posted.


Author: OP+ Mod
Maintainer: Coopace
Author: Fests+ for OP
Creator: SFC-OP Mini Updater
Maintainer: SFC-EAW for OP Campaigns
Kitbash: SFC2 models

Offline Age

  • D.Net VIP
  • Commander
  • *
  • Posts: 2689
  • Gender: Male
Re: NSIS Installer people: a few gifts
« Reply #2 on: October 07, 2004, 03:49:12 pm »
  Does the Directory services installer fix the esg. loop buzz.It would be niceif it did is there an easy way of fixing it.

Offline FireSoul

  • Modder of shiplists
  • Lt. Commander
  • *
  • Posts: 1306
  • mew.
    • http://klingon.lostexiles.net/
Re: NSIS Installer people: a few gifts
« Reply #3 on: October 13, 2004, 07:35:32 pm »


Author: OP+ Mod
Maintainer: Coopace
Author: Fests+ for OP
Creator: SFC-OP Mini Updater
Maintainer: SFC-EAW for OP Campaigns
Kitbash: SFC2 models

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSIS Installer people: a few gifts
« Reply #4 on: May 14, 2006, 08:59:04 am »
For smaller installers; in addition to NSIS's use of the 7-zip LZMA SDK for high compression ratios of the data, UPX can be used with NSIS to compress the exe header of an NSIS installer to shave a few more KB off the installer.

like so:

Code: [Select]
!packhdr "tmp.dat" "c:\upx\upx.exe -9 tmp.dat"
aside: 7-zip can now be used to open compiled NSIS installers (though it will not extract the original nsi script, there was a beta released that did however...)
« Last Edit: May 14, 2006, 09:13:39 am by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: NSIS Installer people: a few gifts
« Reply #5 on: May 16, 2006, 03:30:25 am »
I recently discoverd the NSIS LogicLib include allowing for structures like this:

Code: [Select]
!include "LogicLib.nsh"

Var port_counter
Var test_host_return

${For} $port_counter 2300 2400
DetailPrint "Testing port $port_counter TCP..."
SetDetailsPrint none
ExecWait '"$EXEDIR\sfc_test_host.exe" -l -p $port_counter -d -n -w 2' $test_host_return
;DetailPrint "sfc_test_host.exe returned $test_host_return"
SetDetailsPrint both
${If} $test_host_return = 0
    DetailPrint "...passed!"
${Else}
DetailPrint "...failed!"
  ${EndIf}
${Next}


Weeee! No more strcmp and gotos for me!  :woot: