#define GameID "{5F05CE9B-7768-490E-9A71-C6R92B4EX123}" ;Ид инстолятора
#define MyAppName "ModPack by RedZhet" ;Название инстоллятора
#define MyInfoVer "1.2" ;Версия инсталлятора
#define MyAppVer "0.9.0" ;Версия игры
#define MyAppPublisher "ModWarGaming.Ru" ;Имя компании или человека кто делал
#define MyAppURL "http://modwargaming.ru" ;Ссылка для лого
#include "Components.iss" ;Компаненты, они же моды
#include "Messages.iss" ;Сообщение, надписи на кнопках и т.д.
[Setup]
AppId={{#GameID}
AppName={#MyAppName}
AppVersion={#MyAppVer}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
//====={ Ссылки }=====\\
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
//====={ Папка устанвки }=====\\
;DefaultDirName={pf}\{#MyAppName}
DefaultDirName={code:MyDirName}
DefaultGroupName={#MyAppName}
//====={ Картинки }=====\\
SetupIconFile=Files\mw.ico
WizardSmallImageFile=Files\top.bmp
WizardImageFile=Files\fon.bmp
//====={ Отключение строниц }=====\\
DisableProgramGroupPage=yes
//====={ Лицензия и Фак }=====\\
LicenseFile=licensia.txt
InfoBeforeFile=faq.txt
InfoAfterFile=thanks.txt
//====={ Папка создания и название сетапа }=====\\
OutputDir=.\Output
OutputBaseFilename=ModPack by RedZhet
//====={ Сжатие сетапа }=====\\
InternalCompressLevel=ultra64
Compression=lzma2/ultra64
SolidCompression=true
[InstallDelete]
Type: filesandordirs; Name: "{app}\res_mods\*";
//====={ Основные файлы сетапа }=====\\
[Files]
Source: Files\logo.bmp; Flags: dontcopy noencryption noencryption
//====={ Картинки модов }=====\\
Source: D:\ModPack by RedZhet\img_mod\1.bmp; Flags: dontcopy noencryption noencryption
Source: img_mod\2.bmp; Flags: dontcopy noencryption noencryption
Source: img_mod\3.bmp; Flags: dontcopy noencryption noencryption
Source: img_mod\4.bmp; Flags: dontcopy noencryption noencryption
//====={ Выбор языка }=====\\
[Languages]
Name: "eng"; MessagesFile: "compiler:Default.isl"
Name: "rus"; MessagesFile: "compiler:Languages\Russian.isl"
[Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
const
UNDEF_INDEX = -777;
ALPHA_BLEND_LEVEL = 255; // max=Byte=255
WS_EX_LAYERED = $80000;
WS_EX_TRANSPARENT = $20;
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
GWL_EXSTYLE = (-20);
var
InfoPic: TBitmapImage;
LastIndex: Integer;
TempPath: String;
PicForm: TForm;
type
COLORREF = DWORD;
function GetCursorPos(var lpPoint: TPoint): BOOL; external 'GetCursorPos@user32.dll stdcall';
function SetLayeredWindowAttributes(Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; external 'SetLayeredWindowAttributes@user32.dll stdcall';
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLong{#A}@user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall';
function SetFocus(hWnd: HWND): HWND; external 'SetFocus@user32.dll stdcall';
function MyDirName(S:String): String;
var
InsPath: String;
er: boolean;
myFile:String;
begin
Result:=ExpandConstant('C:\Games\World_of_Tanks\'); //если ключа нет то будем ставить сюда
er := RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{1EAC1D02-C6AC-4FA6-9A44-96258C37C812RU}_is1', 'InstallLocation', InsPath);
if er and (InsPath<>'') then //если ключ существует и там что-то записано
begin
Result := InsPath;
end;
end;
procedure LogoOnClick(Sender: TObject);
var ResCode: Integer;
begin
ShellExec('', '{#MyAppURL}', '' , '', SW_SHOW, ewNoWait, ResCode)
end;
procedure RedesignWizardForm;
var
i: integer;
BtnPanel: TPanel;
BtnImage: TBitmapImage;
begin
ExtractTemporaryFile('logo.bmp')
BtnPanel:=TPanel.Create(WizardForm)
with BtnPanel do begin
Left:=0
Top:=315
Width:=179
Height:=46
Cursor:=crHand
OnClick:=@logoOnClick
Parent:=WizardForm
end;
BtnImage:=TBitmapImage.Create(WizardForm)
with BtnImage do begin
AutoSize:=True;
Enabled:=False;
Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\logo.bmp')
Parent:=BtnPanel
end;
with WizardForm do
begin
Caption := ExpandConstant('{cm:Main}');
end;
with WizardForm.WizardBitmapImage do
begin
Width := ScaleX(502);
end;
with WizardForm.WelcomeLabel2 do
begin
Visible := False;
end;
with WizardForm.WelcomeLabel1 do
begin
Visible := False;
end;
with WizardForm.WizardSmallBitmapImage do
begin
Left := ScaleX(0);
Width := ScaleX(502);
Height := ScaleY(70);
end;
with WizardForm.PageDescriptionLabel do
begin
Visible := False;
end;
with WizardForm.PageNameLabel do
begin
Visible := False;
end;
with WizardForm.WizardBitmapImage2 do
begin
Width := ScaleX(502);
end;
with WizardForm.FinishedLabel do
begin
Visible := False;
end;
with WizardForm.FinishedHeadingLabel do
begin
Visible := False;
end;
end;
procedure ShowPicHint(const PicFilePath: String);
var
pt: TPoint;
begin
if not GetCursorPos(pt) then Exit;
InfoPic.Bitmap.LoadFromFile(PicFilePath);
try
with PicForm do
begin
SetBounds(ScaleX(pt.x + 16), ScaleY(pt.y + 7), InfoPic.Width, InfoPic.Height);
Show;
end;
finally
SetFocus(WizardForm.Handle);
end;
end;
procedure CompOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea);
var
UndefPic: String;
begin
if Index = -1 then Exit;
if Index = LastIndex then Exit;
try
case TNewCheckListBox(Sender).ItemCaption[Index] of
'1. Ангар.': UndefPic := '1.bmp';
'2.1. DamoklovMech.': UndefPic := '2.bmp';
'2. Звуковой мод звонок при крите модуля.': UndefPic := '3.bmp';
'3. Zoom.': UndefPic := '4.bmp';
else
begin
LastIndex := UNDEF_INDEX;
PicForm.Hide;
Exit;
end;
end;
if not FileExists(TempPath + UndefPic) then ExtractTemporaryFile(UndefPic);
ShowPicHint(TempPath + UndefPic);
finally
LastIndex := Index;
end;
end;
procedure CompOnMouseLeave(Sender: TObject);
begin
PicForm.Hide;
LastIndex := -1;
end;
procedure InitInfo();
begin
WizardForm.ComponentsList.OnItemMouseMove := @CompOnItemMouseMove;
WizardForm.ComponentsList.OnMouseLeave := @CompOnMouseLeave;
TempPath := AddBackslash(ExpandConstant('{tmp}'));
LastIndex := UNDEF_INDEX;
PicForm := TForm.Create(WizardForm)
with PicForm do
begin
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
InfoPic := TBitmapImage.Create(PicForm)
with InfoPic do
begin
Parent := PicForm;
AutoSize := True;
end;
end;
SetWindowLong(PicForm.Handle, GWL_EXSTYLE, GetWindowLong(PicForm.Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
SetLayeredWindowAttributes(PicForm.Handle, 0, ALPHA_BLEND_LEVEL, LWA_ALPHA);
end;
procedure InitializeWizard();
begin
InitInfo();
RedesignWizardForm;
end;