Jump to content
Korean Random
EvilAlex

Создание инсталляторов для модпаков на базе Inno Setup

Recommended Posts

TneRED, вот так:

 

#define PackForVersion "0.9.7.0";

[CustomMessages]
FileNotFoundLabel=Игра не найдена в данной директории!%n%nПожалуйста, укажите папку с игрой.
FileVersionWrongLabel=Обнаружена несовместимая версия игрового клиента!%n%nПожалуйста, укажите клиент версии {#PackForVersion}.

[~~Code~~]
function FileVersion(const FilePath: AnsiString): AnsiString;
var
  oFS: Variant;
begin
  oFS:=CreateOleObject('Scripting.FileSystemObject');
    try
      Result:=oFS.GetFileVersion(FilePath);
    except
  end;
end;

function NextButtonClick(CurPage: Integer): Boolean;
begin
   Result:=True;
   If CurPage=6 then
begin
  If not FileExists(ExpandConstant('{app}\WorldOfTanks.exe')) then
begin
  MsgBox(ExpandConstant('{cm:FileNotFoundLabel}'), mbError, MB_OK);
  Result:=False;
end;
  If FileExists(ExpandConstant('{app}')+'\WorldOfTanks.exe') then
begin
  If FileVersion(ExpandConstant('{app}')+'\WorldOfTanks.exe') <> '{#PackForVersion}' then
begin
  MsgBox(ExpandConstant('{cm:FileVersionWrongLabel}'), mbError, MB_OK);
  Result:=False;
end;
end;
end;
end;
Обратите внимание, что версия в exe'шнике игры прописывается как 0.9.7.0, а не 0.9.7. Проверку на запущенный клиент тут я уже видел. Заумную версию, можно конечно сделать намного короче. В примерах в шапке темы скорее всего должен быть код.

 

Спасибо пытался свой написать)

Пишу еще проверку запуска процесса клиента игры пока ничего не работает

[Files]
Source: ISTask.dll; DestDir: {app}; Flags: dontcopy
[Code]
function RunTask(FileName: string; bFullpath: Boolean): Boolean;
external 'RunTask@files:ISTask.dll stdcall delayload';
function InitializeSetup(): Boolean;
begin
Result:=True;
  If RunTask('WorldOfTanks.exe', false) then
    begin
      MsgBox('Перед началом установки МодПака закройте клиент World of Tanks!', mbError, MB_OK);
      Result := False;
    end;
end;
Edited by TneRED

Share this post


Link to post

Short link
Share on other sites

1. подскажите, в чем проблема?

http://s43.radikal.ru/i099/1504/a9/dae794ab29bc.png

 

2. И еще, как сделать к компонентам комментарий (описание).

[Setup]
AppName=Моя программа
AppVersion=1.5
AppPublisher=YURSHAT
AppPublisherURL=
DefaultDirName={pf}\Моя программа

[Languages]
Name: "RU"; MessagesFile: "compiler:Languages\Russian.isl"

[CustomMessages]
RU.CompName1=Компонент 1
RU.CompName2=Компонент 2
RU.ComponentsInfo=Наведите курсор мыши на компонент, чтобы прочитать его описание.
RU.ComponentsImgInfo=Наведите курсор мыши на компонент, чтобы посмотреть его превью.
RU.CompDesc1=Описание первого компонента
RU.CompDesc2=Описание второго компонента

[Files]
Source: "compiler:WizModernImage.bmp"; DestName: "CompDescImg1.bmp"; Flags: dontcopy
Source: "compiler:WizModernImage-IS.bmp"; DestName: "CompDescImg2.bmp"; Flags: dontcopy
Source: "compiler:WizModernImage.bmp"; DestName: "MainPic.bmp"; Flags: dontcopy

[Components]
Name: comp1; Description: "{cm:CompName1}"; 
Name: comp2; Description: "{cm:CompName2}"; 
Name: comp3; Description: "{cm:CompName1}";
Name: comp4; Description: "{cm:CompName2}";
Name: comp5; Description: "{cm:CompName1}";
Name: comp6; Description: "{cm:CompName2}";
[code]
type
TComponentDesc = record
Description: String;
ImageName: String;
Index: Integer;
end;

var
CompDescs: array of TComponentDesc;
CompDescPanel, CompDescImgPanel: TPanel;
CompDescText: array[1..2] of TLabel;
CompIndex, LastIndex: Integer;
CompDescImg: TBitmapImage;

procedure ShowCompDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var
i: Integer;
begin
if Index = LastIndex then Exit;
CompIndex := -1;
for i := 0 to GetArrayLength(CompDescs) -1 do
begin
if (CompDescs[i].Index = Index) then
begin
CompIndex := i;
Break;
end;
end;
if (CompIndex >= 0) and (Area = iaItem) then
begin
if not FileExists(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName) then
ExtractTemporaryFile(CompDescs[CompIndex].ImageName);
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName);
CompDescImg.Show;

CompDescText[2].Caption := CompDescs[CompIndex].Description;
CompDescText[2].Enabled := True;
end else
begin
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
end;
LastIndex := Index;
end;

procedure CompListMouseLeave(Sender: TObject);
begin
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
LastIndex := -1;
end;

procedure AddCompDescription(AIndex: Integer; ADescription: String; AImageName: String);
var
i: Integer;
begin
i := GetArrayLength(CompDescs);
SetArrayLength(CompDescs, i + 1);
CompDescs[i].Description := ADescription;
CompDescs[i].ImageName := AImageName;
CompDescs[i].Index := AIndex - 1
end;

procedure InitializeWizard();
begin
ExtractTemporaryFile('MainPic.bmp');
WizardForm.SelectComponentsLabel.Hide;
WizardForm.TypesCombo.Hide;
WizardForm.ComponentsList.SetBounds(ScaleX(0), ScaleY(0), ScaleX(184), ScaleY(205));
WizardForm.ComponentsList.OnItemMouseMove:= @ShowCompDescription;
WizardForm.ComponentsList.OnMouseLeave := @CompListMouseLeave;

CompDescImgPanel := TPanel.Create(WizardForm);
with CompDescImgPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(0), ScaleX(225), ScaleY(120));
BevelInner := bvLowered;
end;

CompDescText[1] := TLabel.Create(WizardForm);
with CompDescText[1] do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsImgInfo');
end;

CompDescImg := TBitmapImage.Create(WizardForm);
with CompDescImg do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
Stretch := True;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
end;

CompDescPanel := TPanel.Create(WizardForm);
with CompDescPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(125), ScaleX(225), ScaleY(80));
BevelInner := bvLowered;
end;

CompDescText[2] := TLabel.Create(WizardForm);
with CompDescText[2] do
begin
Parent := CompDescPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescPanel.Width - ScaleX(10), CompDescPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsInfo');
end;

AddCompDescription(1, CustomMessage('CompDesc1'), 'CompDescImg1.bmp');
AddCompDescription(2, CustomMessage('CompDesc2'), 'CompDescImg2.bmp');
end; 

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

[Setup]
AppName=Моя программа
AppVersion=1.5
AppPublisher=YURSHAT
AppPublisherURL=
DefaultDirName={pf}\Моя программа

[Languages]
Name: "RU"; MessagesFile: "compiler:Languages\Russian.isl"

[CustomMessages]
RU.CompName1=Компонент 1
RU.CompName2=Компонент 2
RU.ComponentsInfo=Наведите курсор мыши на компонент, чтобы прочитать его описание.
RU.ComponentsImgInfo=Наведите курсор мыши на компонент, чтобы посмотреть его превью.
RU.CompDesc1=Описание первого компонента
RU.CompDesc2=Описание второго компонента

[Files]
Source: "compiler:WizModernImage.bmp"; DestName: "CompDescImg1.bmp"; Flags: dontcopy
Source: "compiler:WizModernImage-IS.bmp"; DestName: "CompDescImg2.bmp"; Flags: dontcopy
Source: "compiler:WizModernImage.bmp"; DestName: "MainPic.bmp"; Flags: dontcopy

[Components]
Name: comp1; Description: "{cm:CompName1}"; 
Name: comp2; Description: "{cm:CompName2}"; 
Name: comp3; Description: "{cm:CompName1}";
Name: comp4; Description: "{cm:CompName2}";
Name: comp5; Description: "{cm:CompName1}";
Name: comp6; Description: "{cm:CompName2}";
[code]
type
TComponentDesc = record
Description: String;
ImageName: String;
Index: Integer;
end;

var
CompDescs: array of TComponentDesc;
CompDescPanel, CompDescImgPanel: TPanel;
CompDescText: array[1..2] of TLabel;
CompIndex, LastIndex: Integer;
CompDescImg: TBitmapImage;

procedure ShowCompDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var
i: Integer;
begin
if Index = LastIndex then Exit;
CompIndex := -1;
for i := 0 to GetArrayLength(CompDescs) -1 do
begin
if (CompDescs[i].Index = Index) then
begin
CompIndex := i;
Break;
end;
end;
if (CompIndex >= 0) and (Area = iaItem) then
begin
if not FileExists(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName) then
ExtractTemporaryFile(CompDescs[CompIndex].ImageName);
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\') + CompDescs[CompIndex].ImageName);
CompDescImg.Show;

CompDescText[2].Caption := CompDescs[CompIndex].Description;
CompDescText[2].Enabled := True;
end else
begin
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
end;
LastIndex := Index;
end;

procedure CompListMouseLeave(Sender: TObject);
begin
CompDescImg.Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
CompDescText[2].Caption := CustomMessage('ComponentsInfo');
CompDescText[2].Enabled := False;
LastIndex := -1;
end;

procedure AddCompDescription(AIndex: Integer; ADescription: String; AImageName: String);
var
i: Integer;
begin
i := GetArrayLength(CompDescs);
SetArrayLength(CompDescs, i + 1);
CompDescs[i].Description := ADescription;
CompDescs[i].ImageName := AImageName;
CompDescs[i].Index := AIndex - 1
end;

procedure InitializeWizard();
begin
ExtractTemporaryFile('MainPic.bmp');
WizardForm.SelectComponentsLabel.Hide;
WizardForm.TypesCombo.Hide;
WizardForm.ComponentsList.SetBounds(ScaleX(0), ScaleY(0), ScaleX(184), ScaleY(205));
WizardForm.ComponentsList.OnItemMouseMove:= @ShowCompDescription;
WizardForm.ComponentsList.OnMouseLeave := @CompListMouseLeave;

CompDescImgPanel := TPanel.Create(WizardForm);
with CompDescImgPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(0), ScaleX(225), ScaleY(120));
BevelInner := bvLowered;
end;

CompDescText[1] := TLabel.Create(WizardForm);
with CompDescText[1] do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsImgInfo');
end;

CompDescImg := TBitmapImage.Create(WizardForm);
with CompDescImg do
begin
Parent := CompDescImgPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescImgPanel.Width - ScaleX(10), CompDescImgPanel.Height - ScaleY(10));
Stretch := True;
Bitmap.LoadFromFile(ExpandConstant('{tmp}\MainPic.bmp'));
end;

CompDescPanel := TPanel.Create(WizardForm);
with CompDescPanel do
begin
Parent := WizardForm.SelectComponentsPage;
SetBounds(ScaleX(192), ScaleY(125), ScaleX(225), ScaleY(80));
BevelInner := bvLowered;
end;

CompDescText[2] := TLabel.Create(WizardForm);
with CompDescText[2] do
begin
Parent := CompDescPanel;
SetBounds(ScaleX(5), ScaleY(5), CompDescPanel.Width - ScaleX(10), CompDescPanel.Height - ScaleY(10));
AutoSize := False;
WordWrap := True;
Enabled := False;
Caption := CustomMessage('ComponentsInfo');
end;

AddCompDescription(1, CustomMessage('CompDesc1'), 'CompDescImg1.bmp');
AddCompDescription(2, CustomMessage('CompDesc2'), 'CompDescImg2.bmp');
end; 

Все конечно хорошо, но что мне нужно вырезать? (Простите за тупизну, но только начинаю, прошу понять, простить :ok:  )

 

И да, тут есть ответ на вторую мою проблему?

 

P.s. В днный момент прописано так.

 

[Components]
Name: KMP; Description:  Mod Pack; Types: custom; Flags: fixed
Name: KMP\P; Description: 1. AIMBOT от ШАЙТАНА.;
Name: KMP\DP; Description: 2. КРАСНЫЕ ШАРЫ для АРТЫ.;
Name: KMP\ZK; Description: 3. Показ разрушенных объектов;
Edited by guceds

Share this post


Link to post

Short link
Share on other sites

 

Все конечно хорошо, но что мне нужно вырезать? (Простите за тупизну, но только начинаю, прошу понять, простить :ok:  )

 

И да, тут есть ответ на вторую мою проблему?

 

P.s. В днный момент прописано так.

 

[Components]
Name: KMP; Description:  Mod Pack; Types: custom; Flags: fixed
Name: KMP\P; Description: 1. AIMBOT от ШАЙТАНА.;
Name: KMP\DP; Description: 2. КРАСНЫЕ ШАРЫ для АРТЫ.;
Name: KMP\ZK; Description: 3. Показ разрушенных объектов;

ставь расширенный компилятор Юникод версии

Share this post


Link to post

Short link
Share on other sites

 

 

ставь расширенный компилятор Юникод версии

А можете пожалуйста дать ссылку в лс или тут. Ибо просил уже ссылку, дали, увы, не работающюю. Был бы признателен :)

Share this post


Link to post

Short link
Share on other sites

Подскажите уважаемые.

http://www.koreanrandom.com/forum/topic/9050-инсталлятор-для-модпаков/?p=179060

Пытаюсь вырезать код и вставить к себе в инсталятор. Только увы не получается (ну это то и понятно, потому что не знаю что к чему относится). Нужно именно, чтобы отображалась картинка в блоке и все. А у меня почему то плющится первая страничка установки, потом когда перехожу к компонентам, то там при наводке на компонент вылезает ошибка.

 

В общем руки явно у меня не из того места..)

 

 

Так же не понимаю, куда впиливать "описание" в свой код. Ошибки вылазят

Edited by guceds

Share this post


Link to post

Short link
Share on other sites

Подскажите уважаемые.

 

http://www.koreanrandom.com/forum/topic/9050-инсталлятор-для-модпаков/?p=179060

Пытаюсь вырезать код и вставить к себе в инсталятор. Только увы не получается (ну это то и понятно, потому что не знаю что к чему относится). Нужно именно, чтобы отображалась картинка в блоке и все. А у меня почему то плющится первая страничка установки, потом когда перехожу к компонентам, то там при наводке на компонент вылезает ошибка.

 

В общем руки явно у меня не из того места..)

 

 

Так же не понимаю, куда впиливать "описание" в свой код. Ошибки вылазят

Ошибка какая?

Share this post


Link to post

Short link
Share on other sites

строка 207

Null Pointer Exteption.

 

"SetBounds(ScaleX(pt.x + 16), ScaleY(pt.y + 7), InfoPic.Width, InfoPic.Height);"

Share this post


Link to post

Short link
Share on other sites

 

 

Null Pointer Exteption.
А где находится указатель точки pt?

Share this post


Link to post

Short link
Share on other sites

а как ее правильно будет указать?

Да и как оставить все как было, только поменять страничку компонентов, чтобы там делилось на два блока (компоненты с выбором, а второй блок картинка). Ибо даже с ошибкой, как я говорил ранее плющит все картинки ( при запуске основная заставка, шапка и т.д.)

а то изучаю тему на 28 страничке и еще не нашел решения

Edited by guceds

Share this post


Link to post

Short link
Share on other sites

 

 

а как ее правильно будет указать?
Не так. Такой способ используется, если нужно выводить изображение под курсором.
 

 

 

а то изучаю тему на 28 страничке и еще не нашел решения
Изучайте лучше тот пример, откуда вы этот код взяли.

Share this post


Link to post

Short link
Share on other sites

Не так. Такой способ используется, если нужно выводить изображение под курсором.

 

 

 

Изучайте лучше тот пример, откуда вы этот код взяли.

 

Долго в него тыкал, но все четно.. Пытался все заменять в

, но все равно не получается.. Вот и ищу помощи, после того, как попробовал различные способы замены. Увы знаний не хватает.

Share this post


Link to post

Short link
Share on other sites

Архивируйте скрипт со всем необходимым для компиляции (кроме модов) и прикрепляйте.

Share this post


Link to post

Short link
Share on other sites

Архивируйте скрипт со всем необходимым для компиляции (кроме модов) и прикрепляйте.

http://rghost.ru/6hvgQw9xn :swt3:

Если что это изначальная версия без ошибки

Edited by guceds

Share this post


Link to post

Short link
Share on other sites

 

А подобный образом?

var
 I: Integer;
....

for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do
begin
 WizardForm.ComponentsList.Checked[I] := SearchValues(ExpandConstant('{app}\1.txt'), WizardForm.ComponentsList.ItemCaption[I]);
end;

Ошибку нашел,но все равно грузит долго, у меня список где то из 40 компонентов 

Share this post


Link to post

Short link
Share on other sites

Ошибку нашел,но все равно грузит долго, у меня список где то из 40 компонентов 

Так не должно быть.

Что значит "долго грузит"? Переход на страницу тормозит?

Share this post


Link to post

Short link
Share on other sites

Так не должно быть.

Что значит "долго грузит"? Переход на страницу тормозит?

Переход норм, а список загружает долго

Share this post


Link to post

Short link
Share on other sites

Переход норм, а список загружает долго

Это как?

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...