Games Explorer Manager Install: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
Line 16: Line 16:
=== GEM Installer ===
=== GEM Installer ===
The installer for GEM was created and currently maintained by [http://www.pages.drexel.edu/~sag47/ Sam Gleske] ([[User:sag47]]).
The installer for GEM was created and currently maintained by [http://www.pages.drexel.edu/~sag47/ Sam Gleske] ([[User:sag47]]).
= Instructions =
== Compiling GEM Installer ==
# First you must [[Download]] and install the latest version of NSIS.  (Recommended)
# Then download the GEM Installer source (see Download section of this document)
# Extract the source to your desktop (''{Desktop}'')
# Now download the Games Explorer Manager (see Download section of this document)
# Extract the Games Explorer Manager to your desktop
# Copy ''{Desktop}\GameExplorerManager.exe'' to ''{Desktop}\Games Explorer Manager Install src\program''
# Right click on ''GameExplorerManager.nsi'' and click on "Compile NSIS Script"
== Reading and understanding the source ==


= Concepts used by Installer =
= Concepts used by Installer =

Revision as of 19:51, 17 August 2007

Download

Games_Explorer_Manager_Install_src.zip (98 KB) An installer for the GEM (You must compile it with NSIS).
Zip.gif Games Explorer Manager (871 KB) Here is a link to the GEM without the installer.

About

About GEM

The Games Explorer Manager (GEM) is a nice little tool that allows the user to edit the Games Explorer and add their own games or programs (that are already installed) even though Windows Vista didn't already detect them and put it in the list. This is if a user has a game that is so old, not well known that Vista doesn't add it to the games list automatically, or that the developers of the game didn't set up the installer to register with the Vista Games Explorer then this would be a great alternative for someone looking for a quick an easy fix that is simple.

About GEM Installer

This is an installer for the Games Explorer Manager (GEM). This installer is fully compatible with Windows Vista. This installer uses many techniques, concepts, and examples that have been developed over time by the NSIS developers and community. There is a section that will go over the features and functionality of the installer.

Who Created It?

GEM

The Games Explorer Manager (GEM) was developed by a company called Extensible Software. The actual copyright to GEM is held by Andy Chentsov.

GEM Installer

The installer for GEM was created and currently maintained by Sam Gleske (User:sag47).

Instructions

Compiling GEM Installer

  1. First you must Download and install the latest version of NSIS. (Recommended)
  2. Then download the GEM Installer source (see Download section of this document)
  3. Extract the source to your desktop ({Desktop})
  4. Now download the Games Explorer Manager (see Download section of this document)
  5. Extract the Games Explorer Manager to your desktop
  6. Copy {Desktop}\GameExplorerManager.exe to {Desktop}\Games Explorer Manager Install src\program
  7. Right click on GameExplorerManager.nsi and click on "Compile NSIS Script"

Reading and understanding the source

Concepts used by Installer

Terminology Defined

Header: When I say I'm putting code in the header I mean I am putting it somewhere in the installer script that is not inside of a Function, Macro, or Section.

Compression

Through thorough research and development I've devised a small set of settings that produce the highest possible compression by NSIS.

; Best Compression
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On

.onInit Function

Only allow one installer instance at a time.

This is a nice concept that I got from the NSIS wiki. I modified it a little to fit my needs and then like all users should I updated the wiki to include my modified example so others can benefit.

  BringToFront
; Check if already running
; If so don't open another but bring to front
  System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
  Pop $0
  StrCmp $0 0 launch
   StrLen $0 "$(^Name)"
   IntOp $0 $0 + 1
  loop:
    FindWindow $1 '#32770' '' 0 $1
    IntCmp $1 0 +4
    System::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
    StrCmp $2 "$(^Name)" 0 loop
    System::Call "user32::ShowWindow(i r1,i 9) i."         ; If minimized then maximize
    System::Call "user32::SetForegroundWindow(i r1) i."    ; Brint to front
    Abort
  launch:

Check if already installed.

This is something I custom wrote myself by using common sense and a well rounded knowledge of the Windows Registry. I also used the MessageBox plug-in because it allows a lot of leeway with prompting the user. Now what is going on in the code below is the installer reads the Windows Registry for the location of the Uninstaller for GEM. Then if the Uninstaller exists then the program is installed (if not then it must not be installed so continue with the setup). If install is detected then a custom message box is displayed (using the MessageBox plug-in) and then the user decides whether to cancel the setup or to launch the Uninstaller of the currently installed program.

; Check to see if already installed
  ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Games Explorer Manager" "UninstallString"
  IfFileExists $R0 +1 NotInstalled
  messagebox::show MB_DEFBUTTON4|MB_TOPMOST "Games Explorer Manager" \
	"0,103" \
	"GEM is apparently already installed." \
	"Launch Uninstall" "Cancel"
	Pop $R1
  StrCmp $R1 2 Quit +1
  Exec $R0
Quit:
  Quit
 
NotInstalled:

Modern UI Modification

Icons and Graphics

I wanted to change the default icon and graphic scheme in the Modern UI. Well I had to edit the header of my installer.

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "res\inst.ico"
!define MUI_UNICON "res\inst.ico"
 
; Interface Configuration
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "res\ge_top.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "res\ge_left.bmp"

Custom Page

This section is showing you how I created a custom page in the Modern User Interface.

First I inserted my custom page in where I wanted it to appear in my install process and commented out the pages I don't want the user to see.

; Welcome page
;!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "program\license.rtf"
Page custom ScreenShotCustom "" ": Screenshot"
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\GameExplorerManager.exe"
!insertmacro MUI_PAGE_FINISH
 
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
 
; Language files
!insertmacro MUI_LANGUAGE "English"

Then I modify my .onInit Function to initiate the plugins dir. Extract my custom page, screenshot.ini, and finally write any values into my custom page.

Function .onInit
  InitPluginsDir
  File /oname=$PLUGINSDIR\ScreenThumb.bmp "res\ScreenThumb.bmp"
  ; MUI_INSTALL_OPTIONS_EXTRACT puts the file in $PLUGINSDIR
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "screenshot.ini"
FunctionEnd

Then in the header I wanted to reserve the custom page screenshot.ini.

ReserveFile "screenshot.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

Then I wrote the page's custom function that allowed me to call the page to appear (ScreenShotCustom).

Function ScreenShotCustom
  WriteIniStr "$PLUGINSDIR\screenshot.ini" "Field 1" "Text" "$PLUGINSDIR\ScreenThumb.bmp"
  !insertmacro MUI_HEADER_TEXT "Game Explorer Manager Beta 6" "Here is a screenshot."
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "screenshot.ini"
FunctionEnd

Vista Compatibility

XPStyle on

XP Style must first be turned on in order to ensure the compatibility with RequestExecutionLevel. I can't remember where I read this but when I find it I will post the source. Plus I like my installers to look smooth and not like Windows 2000.

RequestExecutionLevel admin

I want my installer to be run at the admin level in Windows Vista. This way the shortcuts are removed correctly when the program is uninstalled.

Development

TODO: