Rikill
 
  
  BANNED | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Есть вопрос как сделать чтобы распаковывались несколько архивов?    И как сделать так что бы проигрывалось несколько песен одна за другой, вот скрипт:     Код: #include "botva2.iss"    #include "BASS_Module.iss"    [Setup]    SourceDir=.    OutputDir=Setup    AppName=Dead Space 2 от R.G. Rikill    AppVerName=Dead Space 2    AppVersion=Dead Space 2    AppPublisher=R.G. Rikill    AppCopyright=R.G. Rikill    DefaultDirName={pf}\R.G. Rikill\Dead Space 2    DefaultGroupName=R.G. Rikill\Dead Space 2    AllowNoIcons=yes    OutputBaseFilename=setup    WizardImageFile=C:\Users\Кирилл\Desktop\Games_Dead_Spa - копия - копия.bmp    WizardSmallImageFile=C:\Users\Кирилл\Desktop\Deadspace2mini.bmp    SetupIconFile=C:\Users\Кирилл\Desktop\game.ico    WindowVisible=no    WindowShowCaption=no    WindowResizable=no    Compression=lzma2/Ultra64    DiskSpanning=yes    DiskSliceSize=2100000000    SlicesPerDisk=1       [Languages]    Name: rus; MessagesFile: compiler:Languages\Russian.isl       [Registry]    Root: HKCU; SubKey: Software\EA Games\Dead Space 2; ValueType: string; ValueName: Name; ValueData: Dead Space 2    Root: HKCU; SubKey: Software\EA Games\Dead Space 2\Online Data; ValueType: string; ValueName: authentication; ValueData:       [CustomMessages]    rus.ArcCancel=Отменить распаковку    rus.ArcBreak=Установка прервана!    rus.ArcInfo=Распаковано %1Мб из %2Мб (%3%%). Архив: %4 из %5.    rus.ArcTitle=Распаковка архивов FreeArc    rus.ArcError=Распаковщик FreeArc вернул код ошибки: %1    rus.ArcFail=Распаковка не завершена!    rus.AllProgress=Общий прогресс распаковки: %1%%    rus.ArcBroken=Архив %1 повреждён%nили недостаточно места на диске назначения.       [Tasks]    Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}       [Files]    Source: C:\Program Files (x86)\EA Games\Dead Space 2.arc; DestDir: {app}; Flags: nocompression    Source: unarc.dll; DestDir: {tmp}; Flags: dontcopy deleteafterinstall    Source: C:\Program Files\Inno Setup 5\InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy    Source: f.dll; DestDir: {tmp}; Flags: dontcopy    Source: C:\Program Files\Inno Setup 5\isutils.dll; DestDir: {tmp}; Flags: dontcopy    Source: C:\Program Files\Inno Setup 5\isgsg.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression    Source: C:\Program Files\Inno Setup 5\ISSkin.dll; DestDir: {app}; Flags: dontcopy    Source: C:\Program Files\Inno Setup 5\tiger.cjstyles; DestDir: {tmp}; Flags: dontcopy    Source: C:\Program Files\Inno Setup 5\bass.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression    Source: C:\Users\Кирилл\Desktop\Dead Space 2.mp3; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression    Source: BASS_Files\*; DestDir: {tmp}; Flags: dontcopy       [Icons]    Name: {group}\Dead Space 2; Filename: {app}\deadspace2.exe; WorkingDir: {app}    Name: {userdesktop}\Dead Space 2; Filename: {app}\deadspace2.exe; WorkingDir: {app}; Tasks: desktopicon    Name: {group}\Удаление Dead Space 2; Filename: {app}\unins000.exe; WorkingDir: {app}       [Run]    Description: {cm:LaunchProgram, Dead Space 2}; Filename: {app}\deadspace2.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked       [UninstallDelete]    Type: filesandordirs; Name: {app}       [_Code]    const    // [English] Filenames of FreeArc archives; names of external archives shouldn't be added to Files section    // [Russian] укажите расположение архивов FreeArc; для внешних файлов строку в Files добавлять необязательно    Archives = '{app}\Dead Space 2.arc';       type    TMyMsg = record    hwnd: HWND;    message: UINT;    wParam: Longint;    lParam: Longint;    time: DWORD;    pt: TPoint;    end;       TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;    TArc = record Path: string; Size: Extended; end;       function PeekMessage(var lpMsg: TMyMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';    function TranslateMessage(const lpMsg: TMyMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';    function DispatchMessage(const lpMsg: TMyMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';       const    PM_REMOVE = 1;       procedure AppProcessMessage;    var    Msg: TMyMsg;    begin    while PeekMessage(Msg, WizardForm.Handle, 0, 0, PM_REMOVE) do begin    TranslateMessage(Msg);    DispatchMessage(Msg);    end;    end;       function WrapFreeArcCallback (callback: TFreeArcCallback; paramcount: integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';    function FreeArcExtract (callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; external 'FreeArcExtract@files:unarc.dll cdecl';       var    ProgressBar: TNewProgressBar;    ExtractFile: TNewStaticText;    Button1: TButton;    Cancel: Integer;    n: Integer; Arcs: array of TArc; m: Extended;       function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;       {Перевод числа в строку с точностью 3 знака (%.3n) с округлением дробной части, если она есть}    Function NumToStr(Float: Extended): String;    Begin    Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.');    while (Pos('.', Result) > 0) and ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.'))    do SetLength(Result, Length(Result)-1);    End;       Function Size64(Hi, Lo: Integer): Extended; Begin    Result:= Lo; if Lo< 0 then Result:= Result + $7FFFFFFF + $7FFFFFFF + 2; for Hi:= Hi-1 Downto 0 do Result:= Result + $7FFFFFFF + $7FFFFFFF + 2;    End;       procedure Button1OnClick(Sender: TObject);    begin    Cancel := -127; //error code for Cancel button    end;       function FindArcs(dir: string): Extended;    var    FSR: TFindRec;    Begin    if FindFirst(ExpandConstant(dir), FSR) then    try    repeat    if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE    n:= GetArrayLength(Arcs)    SetArrayLength(Arcs, n +1)    Arcs[n].Path:= ExtractFilePath(ExpandConstant(Archives)) + FSR.Name    Arcs[n].Size:= Size64(FSR.SizeHigh, FSR.SizeLow)    Result:= Result + Arcs[n].Size;    until not FindNext(FSR);    finally    FindClose(FSR);    end;    End;       function FreeArcCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;    var percents: Integer;    begin    if string(what)='filename' then    // ExtractFile.Caption:= str    // желательно сделать перекодировку строки из utf8 в ansi например, при помощи WinAPI MultiByteToWideChar    else if (string(what)='progress') and (sizeArc>0) then begin    percents:= (Mb*1000) div sizeArc;    ProgressBar.Position:= percents;    ExtractFile.Caption:= FmtMessage(cm('ArcInfo'), [IntToStr(Mb), IntToStr(sizeArc), Format('%.1n', [Abs(percents/10)]), IntToStr(n+1), IntToStr(GetArrayLength(Arcs)) ]);    WizardForm.ProgressGauge.Position:= WizardForm.ProgressGauge.Tag + round(ProgressBar.Position * m)    percents:= (WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min)/((WizardForm.ProgressGauge.Max - WizardForm.ProgressGauge.Min)/1000)    WizardForm.FileNameLabel.Caption:= FmtMessage(cm('AllProgress'), [Format('%.1n', [Abs(percents/10)])]);    end;    AppProcessMessage;    Result := Cancel;    end;       function ExtractFreeArcArchive(arcname, destpath: String): Integer;    var callback: longword;    begin    Cancel:= 0;    AppProcessMessage;    callback:= WrapFreeArcCallback(@FreeArcCallback,4); //FreeArcCallback has 4 arguments    try    Result:= FreeArcExtract (callback, 'x', '-o+', '-dp'+destpath, '--', arcname, '', '', '', '', '');    if Result = 0 then Result:= Cancel;    except    Result:= -63; //error code for ArcFail    end;    end;       function UnPack(Archives: string): Integer;    var allSize: Extended; FreeMB, TotalMB: Cardinal; mes: string;    begin    Button1.Show    WizardForm.ProgressGauge.Position:= 0;    WizardForm.ProgressGauge.Max:= 1000    allSize:= FindArcs(Archives)    for n:= 0 to GetArrayLength(Arcs) -1 do begin    m:= Arcs[n].Size/allSize //current archive size    WizardForm.ProgressGauge.Tag:= WizardForm.ProgressGauge.Position    Result:= ExtractFreeArcArchive(Arcs[n].Path, ExpandConstant('{app}'));    if Result <> 0 then begin    mes:= FmtMessage(cm('ArcError'), [IntToStr(Result)]);    GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')), True, FreeMB, TotalMB);    case Result of    -1: if FreeMB < 32 {megabytes of free disk space} then mes:= SetupMessage(msgDiskSpaceWarningTitle)    else mes:= mes + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Arcs[n].Path)]);    -127: mes:= cm('ArcBreak'); //Cancel button    -63: mes:= cm('ArcFail');    end;    MsgBox(mes, mbInformation, MB_OK);    Log(mes);    Break; //leave extraction loop    end;    end;    Button1.visible:= false;    end;       procedure CurStepChanged(CurStep: TSetupStep);    begin    if CurStep = ssPostInstall then UnPack(Archives);    end;    procedure LoadSkin(lpszPath: PAnsiChar; lpszIniFileName: PAnsiChar); external 'LoadSkin@{tmp}\isskin.dll stdcall delayload';    procedure UnloadSkin; external 'UnloadSkin@{tmp}\isskin.dll stdcall delayload';    function ShowWindow(hWnd: Integer; uType: Integer): Integer; external 'ShowWindow@user32.dll stdcall';    procedure InitializeWizard();    begin    ProgressBar := TNewProgressBar.Create(WizardForm);    ExtractFile := TNewStaticText.Create(WizardForm);    with WizardForm.ProgressGauge do    begin    ProgressBar.SetBounds(Left, Top + ScaleX(55), Width, Height)    ProgressBar.Parent := WizardForm.InstallingPage;    ProgressBar.max := 1000;    ProgressBar.Position := 0;    ExtractFile.parent:=WizardForm.InstallingPage;    ExtractFile.autosize:=false;    ExtractFile.Width := Width;    ExtractFile.top:=Top + ScaleX(35);    ExtractFile.caption:=cm('ArcTitle');    end;    Button1:=TButton.create(WizardForm);    Button1.parent:=WizardForm;    Button1.SetBounds(260, WizardForm.cancelbutton.top, 135, WizardForm.cancelbutton.Height);    Button1.caption:=cm('ArcCancel');    Button1.OnClick:=@Button1OnClick;    Button1.Hide;       ExtractTemporaryFile('isskin.dll');    ExtractTemporaryFile('Tiger.cjstyles');    LoadSkin(ExpandConstant('{tmp}\Tiger.cjstyles'), '');    ExtractTemporaryFile('BASS.dll');    ExtractTemporaryFile('f.dll');    ExtractTemporaryFile('botva2.dll');    ExtractTemporaryFile('MusicButton.png');    ExtractTemporaryFile('dead space 2.mp3');    WizardForm.Font.Color:=Clyellow;    WizardForm.Color:=Clblack;    BASS_Init(ExpandConstant('{tmp}\dead space 2.mp3')); //Запускаем музыку    BASS_CreateOnOffButton(ExpandConstant('{tmp}\MusicButton.png'), 20, 320, 36, 36, 4) //Создаем кнопку вкл/выкл    end;    procedure DeinitializeSetup();    begin    BASS_DeInit; //Освобождаем процесс    gdipShutdown    end;      |  
  |