Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Script generated by the Inno Setup Script Wizard.
- ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
- #define MyAppName "The Perfect Recipe"
- #define MyVersionInfo="0.1.0.3"
- #define MyAppVersion "v21 11/8/2024"
- #define MyAppPublisher "BethesdaGameStudios"
- #define MyAppURL "https://creations.bethesda.net/en/starfield/details/daa65855-1e97-495d-aa7d-fd675e40024c/The_Perfect_Recipe"
- #define MyAppExeName "PerfectRecipe.exe"
- [Setup]
- AppId={{B642ECAD-1F90-4E03-BABB-F7FAD0AE4322}
- AppName={#MyAppName}
- AppVersion={#MyAppVersion}
- AppPublisher={#MyAppPublisher}
- AppPublisherURL={#MyAppURL}
- AppSupportURL={#MyAppURL}
- AppUpdatesURL={#MyAppURL}
- ArchitecturesAllowed=x64compatible
- ArchitecturesInstallIn64BitMode=x64compatible
- DefaultGroupName={#MyAppName}
- DisableProgramGroupPage=yes
- PrivilegesRequiredOverridesAllowed=dialog
- OutputBaseFilename=PerfectRecipeV21I103
- Compression=lzma2
- SolidCompression=yes
- WizardStyle=modern
- LanguageDetectionMethod=UILanguage
- DefaultDirName=C:\Games\Starfield.Digital.Premium.Edition-InsaneRamZes\Data
- OutputDir=D:\media\!Downloads\Starfield_mods\PerfectRecipe\
- SetupIconFile=D:\media\!Downloads\Starfield_mods\favicon.ico
- InfoBeforeFile=D:\media\!Downloads\Starfield_mods\Deimog\Description_eng.txt
- LicenseFile=D:\media\!Downloads\Starfield_mods\!License\mit_eng.txt
- VersionInfoVersion={#MyVersionInfo}
- [Languages]
- Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
- Name: "english"; MessagesFile: "compiler:Default.isl"
- [CustomMessages]
- russian.DescriptionFile=Описание на русском.
- russian.LicenseFile=Лицензия на русском.
- russian.StarfieldIniMissing=Файл "Starfield.ini" не найден в выбранном каталоге. Пожалуйста, выберите корректный каталог.
- russian.CreateFolderError=Ошибка. Не удалось создать каталог:
- english.DescriptionFile=Description in English.
- english.LicenseFile=License in English.
- english.StarfieldIniMissing=The file "Starfield.ini" was not found in the selected folder. Please choose the correct folder.
- english.CreateFolderError=Error. Failed to create the directory:
- [Files]
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c.esm"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - main.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - textures.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - voices_de.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - voices_en.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - voices_es.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - voices_fr.ba2"; DestDir: "{app}"; Flags: ignoreversion
- Source: "D:\media\!Downloads\Starfield_mods\PerfectRecipe\The Perfect Recipe v21\sfbgs00c - voices_ja.ba2"; DestDir: "{app}"; Flags: ignoreversion
- [Icons]
- Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
- Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
- [Code]
- var
- TargetFolder, TargetFile, PluginEntry: string;
- DescriptionPath, LicensePath: string;
- //Пропишем основные пути и файлы
- procedure InitializeGlobals;
- begin
- TargetFolder := ExpandConstant('{localappdata}\starfield\');
- TargetFile := TargetFolder + 'plugins.txt';
- PluginEntry := '*sfbgs00c.esm';
- DescriptionPath := 'D:\media\!Downloads\Starfield_mods\PerfectRecipe\';
- LicensePath := 'D:\media\!Downloads\Starfield_mods\!License\';
- end;
- //Проверяем наличие Starfield.ini, чтобы убедиться, что пользователь выбрал корректный каталог с игрой
- function CheckStarfieldIni(): Boolean;
- var
- IniPath: string;
- begin
- IniPath := ExpandConstant('{app}\..\Starfield.ini');
- Result := FileExists(IniPath);
- if not Result then
- MsgBox(ExpandConstant('{cm:StarfieldIniMissing}'), mbError, MB_OK);
- end;
- //Если каталог выбран невереный, то не пускаем дальше
- function NextButtonClick(CurPageID: Integer): Boolean;
- begin
- Result := True;
- if CurPageID = wpSelectDir then
- begin
- if not CheckStarfieldIni() then
- Result := False;
- end;
- end;
- //Проверяем наличие каталога и создаём если его нет
- procedure EnsureDirectoryExists(Dir: string);
- begin
- if not DirExists(Dir) then
- begin
- if not CreateDir(Dir) then
- MsgBox(ExpandConstant('{cm:CreateFolderError}' + Dir), mbError, MB_OK);
- end;
- end;
- //Создаём пустой файл, если он отсутствует
- procedure EnsureFileExists(FileName: string);
- begin
- if not FileExists(FileName) then
- TStringList.Create.SaveToFile(FileName);
- end;
- //Запускаем проверку и создание каталогов/файлов, добавляем строку в файл.
- procedure AddPluginEntry;
- var
- FileList: TStringList;
- begin
- EnsureDirectoryExists(TargetFolder);
- EnsureFileExists(TargetFile);
- FileList := TStringList.Create;
- try
- FileList.LoadFromFile(TargetFile);
- FileList.Duplicates := dupIgnore;
- if FileList.IndexOf(PluginEntry) = -1 then
- FileList.Add(PluginEntry);
- FileList.SaveToFile(TargetFile);
- finally
- FileList.Free;
- end;
- end;
- //При удалении мода удаляем добавленную строку из файла
- procedure RemovePluginEntry;
- var
- FileList: TStringList;
- i: Integer;
- begin
- if not FileExists(TargetFile) then
- Exit;
- FileList := TStringList.Create;
- try
- FileList.LoadFromFile(TargetFile);
- for i := FileList.Count - 1 downto 0 do
- begin
- if CompareText(FileList[i], PluginEntry) = 0 then
- FileList.Delete(i);
- end;
- FileList.SaveToFile(TargetFile);
- finally
- FileList.Free;
- end;
- end;
- //При удалении запускаем удаление строки из файла
- procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
- begin
- if CurUninstallStep = usPostUninstall then
- begin
- InitializeGlobals;
- RemovePluginEntry;
- end;
- end;
- //При установке определяем на каком языке будет лицензия и описание
- procedure InitializeWizard;
- begin
- if ActiveLanguage = 'russian' then
- begin
- WizardForm.LicenseMemo.Lines.LoadFromFile(LicensePath + 'mit_rus.txt');
- WizardForm.InfoBeforeMemo.Lines.LoadFromFile(DescriptionPath + 'Description_rus.txt');
- end
- else
- begin
- WizardForm.LicenseMemo.Lines.LoadFromFile(LicensePath + 'mit_eng.txt');
- WizardForm.InfoBeforeMemo.Lines.LoadFromFile(DescriptionPath + 'Description_eng.txt');
- end;
- end;
- //При установке запускаем проверку и создание каталогов/файлов, добавляем строку в файл.
- function InitializeSetup: Boolean;
- begin
- InitializeGlobals;
- AddPluginEntry;
- Result := True;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement