Всё робит, спасибо
Добавлено: Только вот архивы не распаковывает (
Добавлено: Щас настроил...работает
Добавлено: Добавил лого и растянутые картинки)
[more=Скрипт]#define MainExe "{app}\Prince of Persia.exe"
#define GDFBinary "{app}\Prince of Persia.exe"
[Setup]
AppName=Lost Planet Colonies
AppVerName=Lost Planet Colonies
DefaultDirName={pf}\Lost Planet Colonies
OutputDir=Output
Compression=lzma/ultra64
DisableReadyPage=true
InternalCompressLevel=ultra64
SolidCompression=true
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64 x86
RestartIfNeededByRun=false
UsePreviousAppDir=false
DirExistsWarning=no
DisableProgramGroupPage=true
DefaultGroupName=Lost Planet Colonies
UsePreviousGroup=false
UsePreviousSetupType=false
UsePreviousTasks=false
WizardImageFile=D:\test\lp.bmp
WizardSmallImageFile=D:\test\lp_small.bmp
UninstallFilesDir={app}\Uninstall
[Files]
Source:"d:\test\logo.bmp";DestDir:{tmp};Flags: dontcopy nocompression
Source: C:\Program Files\Inno Setup 5\arc.exe; DestDir: {tmp}; Flags: dontcopy
Source: compiler:GameuxInstallHelper.dll; DestDir: {app}\Uninstall; Flags: overwritereadonly ignoreversion
[Languages]
Name: rus; MessagesFile: compiler:\Languages\Russian.isl
[Messages]
SelectDirBrowseLabel=Нажмите «Установить», чтобы начать установку. Если Вы хотите выбрать другую папку, нажмите «Обзор».
[LangOptions]
WelcomeFontName=Tahoma
WelcomeFontSize=11
[Registry]
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia; ValueName: Executable; ValueType: String; ValueData: {app}\PrinceOfPersia_Launcher.exe; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia; ValueName: InstallDir; ValueType: String; ValueData: {app}\; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia; ValueName: Language; ValueType: string; ValueData: Russian; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia\GameUpdate; ValueName: execPath; ValueType: String; ValueData: {app}\Prince of Persia.exe; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia\GameUpdate; ValueName: info; ValueType: String; ValueData: 08a0f1c01d540ee143f7ee48a91898fa; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia\GameUpdate; ValueName: installdir;ValueType: String; ValueData: {app}\; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Ubisoft\Prince of Persia\GameUpdate; ValueName: language; ValueType: String; ValueData: us; Flags: uninsdeletekey
[Icons]
Name: {group}\Prince of Persia; Filename: {app}\Launcher\Launcher.exe; WorkingDir: {app}\Launcher\
Name: {group}\Руководство; Filename: {app}\Support\Manual\PrinceOfPersia.pdf
Name: {group}\ReadMe; Filename: {app}\Support\ReadMe\ReadMe.txt
Name: {group}\Удалить игру; Filename: {uninstallexe}
Name: {commondesktop}\Prince of Persia; Filename: {app}\Launcher\Launcher.exe; WorkingDir: {app}\Launcher\; Check: MakeDesktopIcon
[UninstallDelete]
Name: {app}\*; Type: filesandordirs
[Code]
type
TGUID = record
Data1: Cardinal;
Data2,
Data3: Word;
Data4: array [0..8] of char;
end;
function GenerateGUID(var GUID: TGUID): Cardinal; external 'GenerateGUID@files:GameuxInstallHelper.dll stdcall setuponly';
function AddToGameExplorer(Binary: String; Path: String; InstallType: Integer; var GUID: TGUID): Cardinal; external 'AddToGameExplorerA@files:GameuxInstallHelper.dll stdcall setuponly';
function CreateTask(InstallType: Integer; var GUID: TGUID; TaskType: Integer; TaskNumber: Integer; TaskName: String; Binary: String; Parameters: String): Cardinal; external 'CreateTaskA@files:GameuxInstallHelper.dll stdcall setuponly';
function RetrieveGUIDForApplication(Binary: String; var GUID: TGUID): Cardinal; external 'RetrieveGUIDForApplicationA@{app}\Uninstall\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveFromGameExplorer(var GUID: TGUID): Cardinal; external 'RemoveFromGameExplorer@{app}\Uninstall\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveTasks(var GUID: TGUID): Cardinal; external 'RemoveTasks@{app}\Uninstall\GameuxInstallHelper.dll stdcall uninstallonly';
const
PlayTask = 0;
SupportTask = 1;
var
LogoImage:TBitmapImage;
LogoLabel: TLabel;
LogoPanel: TPanel;
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel,FreeSpaceLabel: TLabel;
DesktopIcon, DirectX: TCheckBox;
GUID: TGUID;
ProgressBar1: TNewProgressBar;
Label1: Tlabel;
WLabel1, WLabel2: TLabel;
FLabel1, FLabel2: TLabel;
PageNameLabel, PageDescriptionLabel: TLabel;
procedure LogoLabelOnClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('open', 'http://www.free-torrents.org/forum', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode)
end; /////Вычисление свободного места на диске
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB > 1024 then
FreeSpaceLabel.Caption := 'Доступно места на диске: '+ FloatToStr(round(FreeMB/1024*100)/100) + ' GB' else
FreeSpaceLabel.Caption := 'Доступно места на диске: '+ IntToStr(FreeMB)+ ' MB';
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;
procedure animateprogress;
begin ProgressBar1.Position := ProgressBar1.Position+1
end;
procedure GetNeedSpaceCaption; /////Вычисление требуемого места для установки
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется места на диске: '+ FloatToStr(round(NeedSize/1024*100)/100) + ' GB' else
NeedSpaceLabel.Caption := 'Требуется места на диске: '+ IntToStr(NeedSize)+ ' MB';end;
function MakeDesktopIcon: Boolean;
begin
Result:=DesktopIcon.Checked;end;
function InstallDirectX: Boolean;
begin
Result:=DirectX.Checked;end;
procedure InitializeWizard();
begin
begin
NeedSize := 6610; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
WizardForm.FilenameLabel.Hide;
WizardForm.ProgressGauge.Top:=ScaleY(100); //Изменение стандартного прогрессбара
WizardForm.ProgressGauge.Width:=262; //
WizardForm.ProgressGauge.Left:=155; //
WizardForm.StatusLabel.Top:=ScaleY(80);
WizardForm.WelcomeLabel2.Top:=ScaleY(90);
NeedSpaceLabel := TLabel.Create(WizardForm);
LogoPanel := TPanel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(202);
Width := ScaleX(209);
Height := ScaleY(13);
end;
end;
FreeSpaceLabel := TLabel.Create(WizardForm);
with FreeSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
begin //Создание чекбокса для создания ярлыка на рабочем столе
DesktopIcon := TCheckBox.Create(WizardForm);
with DesktopIcon do
begin
Parent := WizardForm.SelectDirPage;
Caption := 'Добавить ярлык на Рабочий стол';
Left := ScaleX(0);
Top := WizardForm.DirEdit.Top+35;
Width := ScaleX(400);
Height := ScaleY(15);
TabOrder := 0;
Checked := True;
end;
end;
with LogoPanel do
begin
Parent := WizardForm;
Left := ScaleX(8);
Top := ScaleY(327);
Width := ScaleX(120);
Height := ScaleY(28);
BevelOuter := bvNone;
end;
LogoImage := TBitmapImage.Create(WizardForm);
with LogoImage do
begin
Parent := LogoPanel;
Left := ScaleX(0);
Top := ScaleY(0);
AutoSize:=true;
ReplaceColor:=clFuchsia;
ReplaceWithColor:=clBtnFace;
ExtractTemporaryFile('logo.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}\logo.bmp'));
end;
LogoLabel := TLabel.Create(WizardForm);
with LogoLabel do
begin
Parent := LogoPanel;
Width := LogoPanel.Width;
Height := LogoPanel.Height;
Transparent:=True;
Cursor := crHand;
OnClick:=@LogoLabelOnClick;
end;
begin //Создание чекбокса для установки DirectX
DirectX := TCheckBox.Create(WizardForm);
with DirectX do
begin
Parent := WizardForm.SelectDirPage;
Caption := 'Установить дополнительное программное обеспечение';
Left := ScaleX(0);
Top := WizardForm.DirEdit.Top+55;
Width := ScaleX(400);
Height := ScaleY(15);
TabOrder := 0;
Checked := True;
end;
end;
begin
with WizardForm do
begin
WelcomeLabel1.Hide;
WelcomeLabel2.Hide;
PageNameLabel.Hide;
PageDescriptionLabel.Hide;
DiskSpaceLabel.Hide;
FinishedHeadingLabel.Hide;
FinishedLabel.Hide;
WizardSmallBitmapImage.Left := ScaleX(0);
WizardSmallBitmapImage.Top := ScaleY(0);
WizardSmallBitmapImage.Width := WizardForm.MainPanel.Width;
WizardSmallBitmapImage.Height := WizardForm.MainPanel.Height;
PageDescriptionLabel.Width:=300;
PageNameLabel.Width:=300;
WizardBitmapImage.Width := WizardForm.Width;
WizardBitmapImage.Height := WizardForm.Height;
WizardBitmapImage2.Width := WizardForm.Width;
WizardBitmapImage2.Height := WizardForm.Height;
end;
////////////
FLabel1 := TLabel.Create(WizardForm);
with FLabel1 do
begin
Left := ScaleX(176);
Top := ScaleY(16);
Width := ScaleX(301);
Height := ScaleY(54);
AutoSize := False;
WordWrap := True;
Font.Size := 12;
Font.Style := [fsBold];
Font.Color:= clblack;
// ShowAccelChar := False;
Caption := WizardForm.FinishedHeadingLabel.Caption;
Transparent := True;
Parent := WizardForm.FinishedPage;
end;
FLabel2 :=TLabel.Create(WizardForm);
with FLabel2 do
begin
Top := ScaleY(76);
Left := ScaleX(176);
Width := ScaleX(301);
Height := ScaleY(53); // во втором варианте ScaleY(77);
AutoSize := False;
WordWrap := True;
Font.Color:= clblack;
// ShowAccelChar := False;
Caption := 'Программа установлена на Ваш компьютер.' #13#13
'Нажмите «Завершить», чтобы выйти из программы установки.';
Transparent := True;
Parent := WizardForm.FinishedPage
end;
WLabel1 := TLabel.Create(WizardForm);
with WLabel1 do
begin
Left := ScaleX(176);
Top := ScaleY(16);
Width := ScaleX(301);
Height := ScaleY(54); // во втором варианте ScaleY(100);
AutoSize := False;
WordWrap := True;
Font.Size := 12;
Font.Style := [fsBold];
Font.Color:= clblack;
// ShowAccelChar := False;
Caption := WizardForm.WelcomeLabel1.Caption;
Transparent := True;
Parent := WizardForm.WelcomePage;
end;
WLabel2:=TLabel.Create(WizardForm);
with WLabel2 do
begin
Top := ScaleY(76);
Left := ScaleX(176);
Width := ScaleX(301);
Height := ScaleY(234);
AutoSize := False;
WordWrap := True;
Font.Color:= clblack;
// ShowAccelChar := False;
Caption := WizardForm.WelcomeLabel2.Caption;
Transparent := True;
Parent := WizardForm.WelcomePage;
end;
//////////
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(198);
Width := ScaleX(209);
Height := ScaleY(13);
Caption := 'Требуется место на диске: 7,57 GB' ;
end;
////////////
PageNameLabel := TLabel.Create(WizardForm);
with PageNameLabel do
begin
Left := ScaleX(45);
Top := ScaleY(10);
Width := ScaleX(300);
Height := ScaleY(14);
AutoSize := False;
WordWrap := True;
Font.Color := clwhite;
Font.Style := [fsBold];
Transparent := True;
Parent := WizardForm.MainPanel;
end;
PageDescriptionLabel := TLabel.Create(WizardForm);
with PageDescriptionLabel do
begin
Left := ScaleX(45);
Top := ScaleY(25);
Width := ScaleX(475);
Height := ScaleY(30);
AutoSize := False;
WordWrap := True;
Font.Color := clwhite;
Transparent := True;
Parent := WizardForm.MainPanel;
end;
begin ///Создание нового прогрессбара
ProgressBar1 := TNewProgressBar.Create(wizardform);
with ProgressBar1 do
begin
Parent := wizardform.installingpage;
Top := 100
Width := 150;
Height := wizardform.progressgauge.height;
Max :=3; //кол-во архивов
end;
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
begin
if CurPageID=wpSelectDir then
begin //Тут если Свободное место на диске < требуемого то кнопка "Установвить" на PageSelectDir неактивна
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
WizardForm.NextButton.Caption:='Установить'; //Rename кнопки "Далее" на SelectDir
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep); ///Регистрация в GameExplorer
var
Binary, MainExe: String;
ResultCode:Integer;
begin
if CurStep = ssInstall then //Перед установкой
begin
GenerateGUID(GUID);
ExtractTemporaryFile('arc.exe'); //Извлечение Arc.exe в Temp
begin
WizardForm.StatusLabel.Caption:='Распаковка файлов...';
ExtractTemporaryFile('arc.exe'); //Извлечение из 1-го архива
Exec(ExpandConstant('{tmp}\Arc.exe'), 'x '+AddQuotes(ExpandConstant('{src}\Lost Planet Colonies1.arc'))+' -y -dp'+AddQuotes(ExpandConstant('{app}')), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
ProgressBar1.Position := ProgressBar1.Position+1
WizardForm.StatusLabel.Caption:='Распаковка файлов...';
ExtractTemporaryFile('arc.exe'); //Извлечение из 2-го архива
Exec(ExpandConstant('{tmp}\Arc.exe'), 'x '+AddQuotes(ExpandConstant('{src}\Lost Planet Colonies2.arc'))+' -y -dp'+AddQuotes(ExpandConstant('{app}')), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
ProgressBar1.Position := ProgressBar1.Position+1
WizardForm.StatusLabel.Caption:='Распаковка файлов...';
ExtractTemporaryFile('arc.exe'); //Извлечение из 3-го архива
Exec(ExpandConstant('{tmp}\Arc.exe'), 'x '+AddQuotes (ExpandConstant('{src}\Lost Planet Colonies3.arc'))+' -y -dp'+AddQuotes(ExpandConstant('{app}')), '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
ProgressBar1.Position := ProgressBar1.Position+1
end;
end;
if CurStep = ssPostInstall then
begin
Binary:=ExpandConstant('{#GDFBinary}');
MainExe:=ExpandConstant('{#MainExe}');
AddToGameExplorer(Binary, ExpandConstant('{app}'), 3, GUID);
CreateTask(3, GUID, PlayTask, 0, 'Play', MainExe, '');
end;
end;
function InitializeSetup(): Boolean;
var
UnStr: String;
ErrorCode, Mesages: Integer;
begin //Повторный запуск
Result := True;
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\Prince of Persia_is1', 'UninstallString', UnStr) then
begin
If UnStr <> '' then
begin
Mesages := MsgBox('Lost Planet Colonies уже установлена в Вашей системе.'+#10#10+'Хотите удалить приложение?', mbInformation, MB_YESNOCANCEL);
case Mesages of
idYes:
begin
UnStr := RemoveQuotes(UnStr);
Exec(UnStr, '/silent', '', SW_Show, ewWaitUntilTerminated, ErrorCode);
Result := True;
end
idNo:
begin
Result := True;
end
idCancel:
begin
Result := False;
end;
end;
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ResultStr:String;
Binary: String;
GUID: TGUID;
begin /////////////////////////////////////////Удаление игровых сохранений
if CurUninstallStep=usPostUninstall then
begin
RegQueryStringValue(HKLM, 'Software\блаблабла', 'UnInstConfirm', ResultStr)
if DirExists(ExpandConstant('{userdocs}')+'\Lost Planet Colonies') then
if MsgBox('Удалить сохраненные игры и настройки?',mbconfirmation, mb_YesNo) = IDYES then
begin
if not DelTree(ExpandConstant('{userdocs}')+'\Lost Planet Colonies', True, True, True)
then
MsgBox('Папка не удалена!' #13#13 'Папка не существует или задействована.', mbError, MB_OK);
end;
end;
begin
if CurUninstallStep=usUninstall then //Удаление из GameExplorer
begin
Binary:=ExpandConstant('{#GDFBinary}');
RetrieveGUIDForApplication(Binary, GUID);
RemoveFromGameExplorer(GUID);
RemoveTasks(GUID);
UnloadDll(ExpandConstant('{app}\Uninstall\GameuxInstallHelper.dll'));
end;
end;
end;
[/more]
ЛОГО+КАРТИНКИ