FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   ASIS: Advanced Simple Installer Script (https://fileforums.com/showthread.php?t=99481)

Schabik 25-03-2019 09:16

1 Attachment(s)
Quote:

Originally Posted by Cesar82 (Post 480364)
I do not know what's happening to you.
Here in Full HD resolution change to 125%, 150% 175% works normal.
https://i.imgur.com/bu87yFH.png

OK I'll check it out tomorrow


Ok, the case looks like this,


If I run on basic script (modified only with the statements that verify the selected components to modify files) on my PC with 100% DPI scaling it works fine, the same is after changing to 125%, 150% and 175% but with already runned setup.

I forgot to mention, on both Desktop and Laptop I have 1980x1080 resolution, and on Laptop 125% scaling, as for Desktop 100%


If I run the setup after changing the scale to for example 125% it looks like that:


Attachment 24415


so, the DPICalculator in fact does not work... :(


Edit:


Ok, @KaktoR, @Cesar82 Problem solved.


The Case was that in the original script there were absolute coordinates and sizes for the size of Forms etc.


Just change the absolute sizes to SizeX and SizeY values and Voila :D
For Example if You Have "WilkommenLabel.Width := 600" change it to "WilkommenLabel.Width := SizeX(600)", for "*.Height :=300" change to "*.Height = SizeY(300)", "Top :=" to "Top := SizeY()", "Left :=" to "Left := SizeX()".




Tested it on "WillkommenLabel" and it works.

KaktoR 28-03-2019 11:17

Thanks to @Schabik I was able to fix the DPI for 4K monitors/resolutions.

Here is the new stable version (added to post #1).

Code:

v7.1.2
_____________________________________________________
- Added Redist installation to CompactMode
- Added ISHash library to CompactMode (now really!)
- Updated ISHash library (thanks to peterf1999)
- Added components
  > With this you can unpack language archives or other archives
  > Set them in Settings.ini
  > You don't need to add them to Records.ini
- Reworked Components (thanks to Cesar82)
- Updated 7z to v19.0.0.0
- Changes 'Size=' key in Settings.ini
  > It is now possible to write size as follow:
    b,B,k,K,kb,KB,Kb,m,M,mb,MB,Mb,g,G,gb,GB,Gb,t,T,tb,TB,Tb,p,P,pb,PB,Pb
- Fixed slideshow
  > Before it always show the first picture twice.
- Fixed not correct size in Windows Control Panel
- Fixed some other bugs
- Fixed component progress on ProgressBar
- Fixed ScrollBar on LicensePage and InfoBeforePage if you use cjstyle skin
- Added Skin support to LanguageBox (thanks to Cesar82)
- Added Skin support to Uninstall progress
- Changed appearance in Components page
- Added compact mode to installer
  > This is an option for minimalistic setup with only one page
  > In CompactMode you can only use SFV and MD5 files for CRC check
    I will implement ISHash library later in CompactMode
- Fixed LogButton in CRC Check page
- Fixed other bug if CRC check is disabled
- Added checkbox for "Create Uninstaller"
  > If checkbox is checked, Uninstall files will be created
  > If checkbox is not checked, no uninstall files will be created
- Added [INISettings] to Settings.ini
  > With this you can change INI settings after installation is done
- Fixed french translation for CRC check page (forgot some spaces)
- Added RazorTools
  > ZSTD Precompressor
  > FIFA 19 Cas Decryption Tool + Precompressor
  > Project CARS 2 Bff Decryption Tool
  > LZX Precompressor
- Fixed DPI calculation if text scaling in Windows Display Settings was greater than 100% (thanks to Cesar82)


HunterEmrah 30-03-2019 11:43

1 Attachment(s)
how can i apply custommessage for Main files component ?

Script.iss
Code:

function TranslateComponentName(StrName: String): String;
begin
  case Trim(Uppercase(Copy(StrName, Pos('cm:', LowerCase(StrName)) + Length('cm:'), Length(StrName)))) of
    'EN', 'ENGLISH'  : Result := CustomMessage('CompEnglish');
    'FR', 'FRENCH'    : Result := CustomMessage('CompFrench');
    'DE', 'GERMAN'    : Result := CustomMessage('CompGerman');
    'IT', 'ITALIAN'  : Result := CustomMessage('CompItalian');
    'ES', 'SPANISH'  : Result := CustomMessage('CompSpanish');
    'PL', 'POLISH'    : Result := CustomMessage('CompPolish');
    'RU', 'RUSSIAN'  : Result := CustomMessage('CompRussian');
    'BR', 'BRAZILIAN' : Result := CustomMessage('CompPortugueseBrazil');
    'MX', 'MEXICAN'  : Result := CustomMessage('CompMexican');
    'CZ', 'CZECH'    : Result := CustomMessage('CompCzech');
    'CL', 'COMPLAN'  : Result := CustomMessage('CompLan');
    'CB', 'COMPBONUS' : Result := CustomMessage('CompBonus');
    'GC', 'COMPMAIN'  : Result := CustomMessage('CompMain');
    else
      Result := StrName;
  end;
end;

Code:

ComponentsSize := 0;
  SetArrayLength(CompIndexList, 0);
  IniFile := ExpandConstant('{tmp}\Settings.ini');
  ComponentsPageAvai := GetIniBool('ComponentsSettings', 'Enable', False, IniFile);
  if ComponentsPageAvai then
  begin
    if IniKeyExists('ComponentsSettings', 'Component' + IntToStr(I) + '.Name', IniFile) then
    begin
      CompName := 'cm:COMPMAIN';
      ComponentsList.AddCheckBox(CompName, '', 0, True, False, True, True, nil);
    end;

CustomMessages.iss
Code:

English.CompMain=Main files
also tried to type {cm:CompMain} for CompName, doesn't working

Schabik 30-03-2019 11:58

Quote:

Originally Posted by HunterEmrah (Post 480431)
how can i apply custommessage for Main files component ?

Script.iss
Code:

function TranslateComponentName(StrName: String): String;
begin
  case Trim(Uppercase(Copy(StrName, Pos('cm:', LowerCase(StrName)) + Length('cm:'), Length(StrName)))) of
    'EN', 'ENGLISH'  : Result := CustomMessage('CompEnglish');
    'FR', 'FRENCH'    : Result := CustomMessage('CompFrench');
    'DE', 'GERMAN'    : Result := CustomMessage('CompGerman');
    'IT', 'ITALIAN'  : Result := CustomMessage('CompItalian');
    'ES', 'SPANISH'  : Result := CustomMessage('CompSpanish');
    'PL', 'POLISH'    : Result := CustomMessage('CompPolish');
    'RU', 'RUSSIAN'  : Result := CustomMessage('CompRussian');
    'BR', 'BRAZILIAN' : Result := CustomMessage('CompPortugueseBrazil');
    'MX', 'MEXICAN'  : Result := CustomMessage('CompMexican');
    'CZ', 'CZECH'    : Result := CustomMessage('CompCzech');
    'CL', 'COMPLAN'  : Result := CustomMessage('CompLan');
    'CB', 'COMPBONUS' : Result := CustomMessage('CompBonus');
    'GC', 'COMPMAIN'  : Result := CustomMessage('CompMain');
    else
      Result := StrName;
  end;
end;

Code:

ComponentsSize := 0;
  SetArrayLength(CompIndexList, 0);
  IniFile := ExpandConstant('{tmp}\Settings.ini');
  ComponentsPageAvai := GetIniBool('ComponentsSettings', 'Enable', False, IniFile);
  if ComponentsPageAvai then
  begin
    if IniKeyExists('ComponentsSettings', 'Component' + IntToStr(I) + '.Name', IniFile) then
    begin
      CompName := 'cm:COMPMAIN';
      ComponentsList.AddCheckBox(CompName, '', 0, True, False, True, True, nil);
    end;

CustomMessages.iss
Code:

English.CompMain=Main files
also tried to type {cm:CompMain} for CompName, doesn't working

You have to add to function TranslateComponentName this line

Code:

'CM', 'COMPMAIN' : Result := CustomMessage('CompMain');
Or like you did:
Code:


'GC', 'COMPMAIN'  : Result := CustomMessage('CompMain');

Then to settings.ini cm:CM or cm:GC OR cm:COMPMAIN as the name for the component, just remember to use capital letters after "cm:"

And of course like as You added to CustomMessages.iss
Code:

English.CompMain=Main files
As an advice, try to translate the components names to other languages if the installer is multilang, it will be helpful for others who will use it to unpack the game

HunterEmrah 30-03-2019 12:15

1 Attachment(s)
Quote:

Originally Posted by Schabik (Post 480432)
You have to add to function TranslateComponentName this line
Code:

'CM', 'COMPMAIN' : Result := CustomMessage('CompMain');

already have

Quote:

Originally Posted by Schabik (Post 480432)
Then to settings.ini cm:CM OR cm:COMPMAIN as the name for the component

i have to say, "Main files" components doesn't associated with settings.ini, it's created in script.iss

Code:

//------------ GROUP 1 -------------------------------------
Component1.Name=cm:CompMain
Component1.Level=0
Component1.Exclusive=0
Component1.Checked=1
Component1.Enabled=0

Component2.Name=cm:CompLan
Component2.Level=0
Component2.Exclusive=0
Component2.Checked=1
Component2.Enabled=0

Component3.Name=cm:RU
Component3.File=lzl-selective-russian.bin
Component3.Size=688 mb
Component3.Level=1
Component3.Exclusive=1
Component3.Checked=1
Component3.Enabled=1

Component4.Name=cm:EN
Component4.File=lzl-selective-english.bin
Component4.Size=622 mb
Component4.Level=1
Component4.Exclusive=1
Component4.Checked=0
Component4.Enabled=1

//------------ GROUP 1 -------------------------------------

//------------ GROUP 2 -------------------------------------
Component5.Name=cm:CompBonus
Component5.Level=0
Component5.Checked=1
Component5.Enabled=1

Component6.Name=El Prez Edition Content
Component6.File=lzl-optional-bonus.bin
Component6.Size=0.474 GB
Component6.Level=1
Component6.Exclusive=0
Component6.Checked=1
Component6.Enabled=1

//------------ GROUP 2 -------------------------------------

anyway, i added Main files component in settings.ini, and now have screen like this (see the attachment)

Quote:

Originally Posted by Schabik (Post 480432)
As an advice, try to translate the components names to other languages if the installer is multilang, it will be helpful for others who will use it to unpack the game

that's what i am actually doing :)

Schabik 30-03-2019 12:20

Quote:

Originally Posted by HunterEmrah (Post 480434)
already have


i have to say, "Main files" components doesn't associated with settings.ini, it's created in script.iss

Code:

//------------ GROUP 1 -------------------------------------
Component1.Name=cm:CompMain
Component1.Level=0
Component1.Exclusive=0
Component1.Checked=1
Component1.Enabled=0

Component2.Name=cm:CompLan
Component2.Level=0
Component2.Exclusive=0
Component2.Checked=1
Component2.Enabled=0

Component3.Name=cm:RU
Component3.File=lzl-selective-russian.bin
Component3.Size=688 mb
Component3.Level=1
Component3.Exclusive=1
Component3.Checked=1
Component3.Enabled=1

Component4.Name=cm:EN
Component4.File=lzl-selective-english.bin
Component4.Size=622 mb
Component4.Level=1
Component4.Exclusive=1
Component4.Checked=0
Component4.Enabled=1

//------------ GROUP 1 -------------------------------------

//------------ GROUP 2 -------------------------------------
Component5.Name=cm:CompBonus
Component5.Level=0
Component5.Checked=1
Component5.Enabled=1

Component6.Name=El Prez Edition Content
Component6.File=lzl-optional-bonus.bin
Component6.Size=0.474 GB
Component6.Level=1
Component6.Exclusive=0
Component6.Checked=1
Component6.Enabled=1

//------------ GROUP 2 -------------------------------------

anyway, i added Main files component in settings.ini, and now have screen like this

I use original script from KaktoR and it works.

In settings.ini I had replaced only Component1.Name=Main Files with Component1.Name=cm:GAMEFILES and it worked fine. Try it with the not modified script and add the lines from previous posts

HunterEmrah 30-03-2019 12:30

3 Attachment(s)
but i'm talking about "Main files" component, not "Game Components". Here is the screenshots from untouched script. "Main files" have static title which set in script.iss

Cesar82 30-03-2019 12:54

Quote:

Originally Posted by HunterEmrah (Post 480436)
but i'm talking about "Main files" component, not "Game Components". Here is the screenshots from untouched script. "Main files" have static title which set in script.iss

in the script by text with single quotation marks (Will find in two times):
Code:

'Main Files'
Replace with:
Code:

CustomMessage('MainFiles')
Add in [CustomMessages] inside the script
Code:

English.MainFiles=Main Files
The second option: 'Game Components', to change only if included in the function TranslateComponentName and same message in [CustomMessage], and use in setup.ini into key Component#.Name=cm:SameUsedMessage
In Setup.ini, you can remove component 1
The key: Component1.Name=Game Components
and rearranging the ID of the next components.

HunterEmrah 30-03-2019 13:04

Quote:

CustomMessage('MainFiles')
that's what i needed :) thank you Cesar82

HunterEmrah 30-03-2019 15:04

how to automatically uncheck and disable the checkbox of optional/selective component if file doesn't exist. for eg:

i have only 1 language pack from 5, installer should check availability for all of components and automatically uncheck&disable which are missing

another question, maybe not last. how to integrate INIFile function which changes player name in steam_emu.ini after install, to Language changing? For eg:
During installation i will check English language and after install installer will change "Language=spanish" string to "Language=english" in steam_emu.ini.

In this way, it will be more useful for users if we automate the script. I really loved this script.

Cesar82 31-03-2019 04:01

Quote:

Originally Posted by HunterEmrah (Post 480439)
how to automatically uncheck and disable the checkbox of optional/selective component if file doesn't exist. for eg:

i have only 1 language pack from 5, installer should check availability for all of components and automatically uncheck&disable which are missing

another question, maybe not last. how to integrate INIFile function which changes player name in steam_emu.ini after install, to Language changing? For eg:
During installation i will check English language and after install installer will change "Language=spanish" string to "Language=english" in steam_emu.ini.

In this way, it will be more useful for users if we automate the script. I really loved this script.

For your first problem maybe this will work (If the installer has only one disk).
Code:

procedure CurPageChanged(CurPageID: integer);
var
  I: Integer;
  CompFile: String;
begin
  //...
  if CurPageID = wpWelcome then
  begin
    //....
    #if UseComponents == "1"
    if ComponentsPageAvai then
    begin
      for I := 0 to GetArrayLength(CompIndexList) - 1 do
      begin
        CompFile := GetIniString('ComponentsSettings', 'Component' + IntToStr(CompIndexList[I]) + '.File', '', ExpandConstant('{tmp}\Settings.ini'));
        if (ExtractFileExt(CompFile) <> '') and (not FileExists(ExpandConstant('{src}\' + CompFile))) then
        begin
          ComponentsList.Checked[CompIndexList[I]] := False;
          ComponentsList.ItemEnabled[CompIndexList[I]] := False;
        end;
      end;
    end;
    #endif
  end;
  //...
  //...
end;

To how to integrate INIFile function, ask kaktor to enter the function for this.
Or you can add the code copying from the CIU v3 (Custom Installer Ultimate) script here in the forum (just over 100 lines of code).
To adapt the code you only need change languages of the code and also the GetValStr for the Settings.ini.

HunterEmrah 31-03-2019 05:27

Quote:

Originally Posted by Cesar82 (Post 480441)
For your first problem maybe this will work (If the installer has only one disk).
Code:

procedure CurPageChanged(CurPageID: integer);
var
  I: Integer;
  CompFile: String;
begin
  //...
  if CurPageID = wpWelcome then
  begin
    //....
    #if UseComponents == "1"
    if ComponentsPageAvai then
    begin
      for I := 0 to GetArrayLength(CompIndexList) - 1 do
      begin
        CompFile := GetIniString('ComponentsSettings', 'Component' + IntToStr(CompIndexList[I]) + '.File', '', ExpandConstant('{tmp}\Settings.ini'));
        if (ExtractFileExt(CompFile) <> '') and (not FileExists(ExpandConstant('{src}\' + CompFile))) then
        begin
          ComponentsList.Checked[CompIndexList[I]] := False;
          ComponentsList.ItemEnabled[CompIndexList[I]] := False;
        end;
      end;
    end;
    #endif
  end;
  //...
  //...
end;


Perfect code. I just copied it to where it should, and it works. :p thank you

KaktoR 31-03-2019 05:45

I will add something for language in INI file.

HunterEmrah 31-03-2019 07:14

I tried something but could not give the correct size to "Main files" component, on components page first time size is right, but after clicking components it's resets.

what i changed in script.iss
Quote:

Code:

  I := 1;
  ComponentsSize := GetSizeBytes(GetIniString('Settings', 'Size', '0', IniFile));
  SetArrayLength(CompIndexList, 0);
  IniFile := ExpandConstant('{tmp}\Settings.ini');
  ComponentsPageAvai := GetIniBool('ComponentsSettings', 'Enable', False, IniFile);
  if ComponentsPageAvai then
  begin
    if IniKeyExists('ComponentsSettings', 'Component' + IntToStr(I) + '.Name', IniFile) then
    begin
      CompName := CustomMessage('CompMain'); //Main Files component
      ComponentsList.AddCheckBox(CompName, '', 0, True, False, True, True, nil);
    end;


Given size in Settings.ini
Quote:

Code:

[Settings]
Name=Tropico 6
Size=12.4 gb


I've uploaded a video for a better understanding.
https://streamable.com/wsa4j

Cesar82 31-03-2019 13:25

Quote:

Originally Posted by HunterEmrah (Post 480445)
I tried something but could not give the correct size to "Main files" component, on components page first time size is right, but after clicking components it's resets.

what i changed in script.iss


Given size in Settings.ini


I've uploaded a video for a better understanding.
https://streamable.com/wsa4j

Try this:
Leave as before the part you changed:
ComponentsSize:=0;

1. Then replace the original line (Line commented with //) with the line below in this part.
Code:

procedure ComponentsOnCheck(Sender: TObject);
var
  I: Integer;
begin
  ComponentsSize := 0;
  for I := 0 to GetArrayLength(CompIndexList) - 1 do
    if ComponentsList.Checked[CompIndexList[I]] then
      ComponentsSize := ComponentsSize + GetSizeBytes(GetIniString('ComponentsSettings', 'Component' + IntToStr(CompIndexList[I]) + '.Size', '0', ExpandConstant('{tmp}\Settings.ini')));
  //ComponentsDiskSpaceLabel.Caption := DiskSpaceMB(SetupMessage(msgComponentsDiskSpaceMBLabel), SizeBytesToMB(ComponentsSize, '', 0));
  ComponentsDiskSpaceLabel.Caption := DiskSpaceMB(SetupMessage(msgComponentsDiskSpaceMBLabel), SizeBytesToMB(ComponentsSize + GetSizeBytes(GetIniString('Settings', 'Size', '0', ExpandConstant('{tmp}\Settings.ini'))), '', 0));
end;

2/3. Then substitute the original line (Line commented with "//") by the line below (Required to replace 2 times in the script)
Code:

    //ComponentsDiskSpaceLabel.Caption := DiskSpaceMB(SetupMessage(msgComponentsDiskSpaceMBLabel), SizeBytesToMB(ComponentsSize, '', 0));
    ComponentsDiskSpaceLabel.Caption := DiskSpaceMB(SetupMessage(msgComponentsDiskSpaceMBLabel), SizeBytesToMB(ComponentsSize + GetSizeBytes(GetIniString('Settings', 'Size', '0', ExpandConstant('{tmp}\Settings.ini'))), '', 0));



All times are GMT -7. The time now is 12:19.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com