youngbucks
15th May 2008 01:58 UTC
Background Image Problems
Ok im having a porblem with my installer. The background image script i put into the installer worked for only a short time now when i startup the installer the BImage doesnt show for the license page and directory page,only leading up to the installation page it shows and it worked before. It gives no errors when i compile it so its weird why it wont work, maybe someone can help. Here is the current one im testing:
XPStyle on
# !define DEBUG
!macro GetReturnValue
!ifdef DEBUG
Pop $R9
StrCmp $R9 success +2
DetailPrint "Error: $R9"
!endif
!macroend
Function .onGUIInit
InitPluginsDir
File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\B.bmp"
!ifdef DEBUG
BgImage::SetReturn /NOUNLOAD on
!endif
BgImage::SetBg /NOUNLOAD /GRADIENT 0
!insertmacro GetReturnValue
BgImage::AddImage /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD
FunctionEnd
ShowInstDetails show
Section
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD
SectionEnd
Function .onGUIEnd
BgImage::Destroy
FunctionEnd
I think i accidentally edited a small part of it once by accident but i look at this i don't see what could be the problem. help please:(
BTW: Im using nullsoft installer v2.37
kichik
15th May 2008 18:22 UTC
Script seems fine, but it's not the complete script so I can't tell what else is getting in the way.
youngbucks
15th May 2008 19:55 UTC
Here is the complete original script of the BImage plugin:
Name "BgImage.dll test"
OutFile "BgImage Test.exe"
XPStyle on
!define DEBUG
!macro GetReturnValue
!ifdef DEBUG
Pop $R9
StrCmp $R9 success +2
DetailPrint "Error: $R9"
!endif
!macroend
Function .onGUIInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
# lets extract some bitmaps...
File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
!ifdef DEBUG
# turn return values on if in debug mode
BgImage::SetReturn /NOUNLOAD on
!endif
# set the initial background for images to be drawn on
# we will use a gradient from drak green to dark red
BgImage::SetBg /NOUNLOAD /GRADIENT 0 0x80 0 0x80 0 0
!insertmacro GetReturnValue
# add an image @ (150,0)
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\2.bmp 150 0
!insertmacro GetReturnValue
# add the same image only transparent (magenta wiped) @ (150,16)
BgImage::AddImage /NOUNLOAD /TRANSPARENT 255 0 255 $PLUGINSDIR\2.bmp 150 16
!insertmacro GetReturnValue
# create the font for the following text
CreateFont $R0 "Comic Sans MS" 50 700
# add a blue shadow for the text
BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
!insertmacro GetReturnValue
# add a green shadow for the text
BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
!insertmacro GetReturnValue
# add the text
BgImage::AddText /NOUNLOAD "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
!insertmacro GetReturnValue
# show our creation to the world!
BgImage::Redraw /NOUNLOAD
# Refresh doesn't return any value
FunctionEnd
ShowInstDetails show
Section
# play some sounds
FindFirst $0 $1 $WINDIR\Media\*.wav
StrCmp $0 "" skipSound
moreSounds:
StrCmp $1 "" noMoreSounds
BgImage::Sound /NOUNLOAD /WAIT $WINDIR\Media\$1
# Sound doesn't return any value either
MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds
FindNext $0 $1
Goto moreSounds
noMoreSounds:
FindClose $0
skipSound:
# change the background image to Mike, tiled
BgImage::SetBg /NOUNLOAD /TILED $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
# we have to redraw to reflect the changes
BgImage::Redraw /NOUNLOAD
MessageBox MB_OK "Mike the llama"
# clear everything
BgImage::Clear /NOUNLOAD
# Clear doesn't return any value
# set another gradient
BgImage::SetBg /NOUNLOAD /GRADIENT 0xFF 0xFA 0xBA 0xAA 0xA5 0x65
!insertmacro GetReturnValue
# add some text
BgImage::AddText /NOUNLOAD "A Desert for Mike" $R0 0 0 0 50 50 800 150
!insertmacro GetReturnValue
# add mike as an image
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp 50 150
!insertmacro GetReturnValue
# again, we have to call redraw to reflect changes
BgImage::Redraw /NOUNLOAD
SectionEnd
Function .onGUIEnd
# Destroy must not have /NOUNLOAD so NSIS will be able to unload
# and delete BgImage before it exits
BgImage::Destroy
# Destroy doesn't return any value
FunctionEnd
As for the full script for the installer of the program in workign on:
Name "Cryptonite: Dual Segas"
Caption "Cryptonite: Dual Segas"
Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico"
OutFile "Install.exe"
InstallDir $DESKTOP\Cryptonite
LicenseText "Please read these Terms carefully before accessing or using the software"
LicenseData "TOU.txt"
Page license
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
#Splash Screen
Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "my_splash.bmp"
; optional
; File /oname=spltmp.wav "my_splashshit.wav"
advsplash::show 1000 2000 2000 -1 $TEMP\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
RequestExecutionLevel admin
;--------------------------------
#Installation Section Starts Here
!define MUI_PRODUCT "Cryptonite: Dual Segas"
!define MUI_FILE "savefile"
!define MUI_VERSION "1.0.0"
!define MUI_BRANDINGTEXT "Cryptonite: Dual Segas"
CRCCheck On
Section "Installation F (required)"
SetOutPath $INSTDIR
SectionIn RO
File Install2.nsi
File Segas.exe
File DXT10.DLL
File Setup.ini
File Av.VDF
WriteRegStr HKLM SOFTWARE\NSIS_Cryptonite "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "DisplayName" "Dual Segas"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM SOFTWARE\Cryptonite\Dual Segas "$INSTDIR"
WriteUninstaller "uninstall.exe"
SectionEnd
; Uninstaller
UninstallText "This will uninstall Segas. Hit next to continue."
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico"
Section "Uninstall"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite"
DeleteRegKey HKLM "SOFTWARE\SOFTWARE\Cryptonite\Dual Segas"
Delete "$INSTDIR\install2.nsi"
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR\"
IfFileExists "$INSTDIR" 0 NoErrorMsg
MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
NoErrorMsg:
SectionEnd
kichik
15th May 2008 21:36 UTC
That's the original example script which doesn't have a license page or a directory selection page.
youngbucks
15th May 2008 21:51 UTC
Yes thats the original example script but even when i add both license page and directory it does the same thing.
kichik
15th May 2008 22:28 UTC
Attach (do not copy & paste) the complete example which fails for you.
youngbucks
16th May 2008 00:02 UTC
Here is my script that i cant get to work. You have to add a image with the name "B", extension bmp to ${NSISDIR}\Contrib\Graphics\Wizard to get it to compile. The size of the background image i work with is 1280*960 and it only works perfectly without "/FILLSCREEN" when the resolution is 1280*960. When i change the resolution its outve place and when i add "/FILLSCREEN" the screen goes black and it says "Cannot load bitmap".
kichik
16th May 2008 11:48 UTC
/FILLSCREEN is only valid for BgImage::SetBg and not for BgImage::AddImage. In your script, black comes from the BgImage::SetBg call and the error comes from using /FILLSCREEN in the BgImage::AddImage.
You should attach the script that gives you trouble and the one that's working next time.
youngbucks
16th May 2008 17:46 UTC
Ok ill remember next time and thanks for the help i fixed the problem now :)