Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Setup]
- AppName=Call of Duty Launcher
- AppPublisher=Ma3xZ (c) 2019
- AppVersion=1.0
- DefaultDirName={src}
- Uninstallable=no
- AlwaysShowComponentsList=no
- DisableDirPage=yes
- DisableFinishedPage=yes
- DisableProgramGroupPage=yes
- DisableReadyMemo=yes
- DisableReadyPage=yes
- DisableWelcomePage=yes
- SetupIconFile=icon.ico
- WindowResizable=no
- WizardSmallImageFile=image.bmp
- OutputBaseFilename=launcher
- ShowLanguageDialog=no
- [Languages]
- Name: ru; MessagesFile: compiler:Languages\Russian.isl
- Name: en; MessagesFile: compiler:Default.isl
- [Files]
- DestName: "WizardForm.BitmapImage1.bmp"; Source: "image.bmp"; Flags: dontcopy solidbreak
- [CustomMessages]
- ruSettingsText=Íàñòðîéêè
- enSettingsText=Settings
- ruSaveText=Ñîõðàíèòü
- enSaveText=Save
- ruJustExitText=Âûõîä
- enJustExitText=Exit
- ruLangText=EN
- enLangText=RU
- ruRatioText=Ñîîòíîøåíèå ñòîðîí ýêðàíà:
- enRatioText=Display Aspect Ratio:
- ruResolutionText=Ðàçðåøåíèå ýêðàíà:
- enResolutionText=Display Resolution:
- ruFullScreenText=Ïîëíîýêðàííûé ðåæèì
- enFullScreenText=Full-screen mode
- [Code]
- var
- Settings, Save, LangBtn, JustExit: TNewButton;
- COD, CODUO: TNewButton;
- SettingsPage: TWizardPage;
- Image: TBitmapImage;
- Ratio, Resolution: TNewComboBox;
- RatioText, ResolutionText: TLabel;
- FullScreen: TnewCheckbox;
- lang: String;
- FOVString, FullscreenString, WidthString, HeightString: string;
- FOVValue, FullscreenValue, WidthValue, HeightValue: string;
- ResolutionDefault: string;
- WidthNewValue, HeightNewValue: String;
- const
- GWL_STYLE = -16;
- WS_MINIMIZEBOX = $20000;
- WS_MAXIMIZEBOX = $10000;
- function ReleaseCapture: Longint; external 'ReleaseCapture@user32.dll stdcall';
- procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin ReleaseCapture; SendMessage(WizardForm.Handle,$0112,$F012,0); end;
- procedure ExitProcess(uExitCode: Integer); external 'ExitProcess@kernel32.dll stdcall';
- function SetWindowLong(Wnd: HWnd; Index: Integer; NewLong: Longint): Longint; external 'SetWindowLongA@user32.dll stdcall';
- function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall';
- function TryGetFileLine(const FileName: string; Index: Integer; out Line: string): Boolean; var FileLines: TArrayOfString;
- begin Result := LoadStringsFromFile(FileName, FileLines) and (GetArrayLength(FileLines) > Index); if Result then Line := FileLines[Index]; end;
- procedure GetConfigValues();
- begin
- // if the first line of the file was successfully read and could have been
- // converted to integer, then...
- if TryGetFileLine(ExpandConstant('{src}\Main\config.cfg'), 47, FOVString) and TryGetFileLine(ExpandConstant('{src}\Main\config.cfg'), 142, FullscreenString) and
- TryGetFileLine(ExpandConstant('{src}\Main\config.cfg'), 129, WidthString) and TryGetFileLine(ExpandConstant('{src}\Main\config.cfg'), 128, HeightString) then
- begin
- FOVValue:=FOVString;
- FullscreenValue:=FullscreenString;
- WidthValue:=WidthString;
- HeightValue:=HeightString;
- StringChangeEx(FOVValue, 'seta cg_fov "', '', True);
- StringChangeEx(FOVValue, '"', '', True);
- StringChangeEx(FullscreenValue, 'seta r_fullscreen "', '', True);
- StringChangeEx(FullscreenValue, '"', '', True);
- StringChangeEx(WidthValue, 'seta r_customwidth "', '', True);
- StringChangeEx(WidthValue, '"', '', True);
- StringChangeEx(HeightValue, 'seta r_customheight "', '', True);
- StringChangeEx(HeightValue, '"', '', True);
- end;
- end;
- procedure WriteNewValue();
- var
- i, t:integer;
- UnicodeStr: string;
- ANSIStr: AnsiString;
- begin
- WidthNewValue:= Resolution.Text;
- i:=Pos('x', WidthNewValue);
- Delete (WidthNewValue, i, i+1);
- HeightNewValue:= Resolution.Text;
- t:=Pos('x', HeightNewValue);
- Delete (HeightNewValue, 1, t);
- if LoadStringFromFile(ExpandConstant('{src}\Main\config.cfg'), AnsiStr) then
- begin
- UnicodeStr:=AnsiStr;
- StringChangeEx(UnicodeStr, FOVString, 'seta cg_fov "' + FOVValue + '"', False);
- SaveStringtoFile(ExpandConstant('{src}\Main\config.cfg'), AnsiString(UnicodeStr), False);
- end;
- if LoadStringFromFile(ExpandConstant('{src}\Main\config.cfg'), AnsiStr) then
- begin
- if Fullscreen.Checked then FullscreenValue:= '1' else FullscreenValue:='0';
- UnicodeStr:=AnsiStr;
- StringChangeEx(UnicodeStr, FullscreenString, 'seta r_fullscreen "' + FullscreenValue + '"', False);
- SaveStringtoFile(ExpandConstant('{src}\Main\config.cfg'), AnsiString(UnicodeStr), False);
- end;
- if LoadStringFromFile(ExpandConstant('{src}\Main\config.cfg'), AnsiStr) then
- begin
- UnicodeStr:=AnsiStr;
- StringChangeEx(UnicodeStr, WidthString, 'seta r_customwidth "' + WidthNewValue + '"', False);
- SaveStringtoFile(ExpandConstant('{src}\Main\config.cfg'), AnsiString(UnicodeStr), False);
- end;
- if LoadStringFromFile(ExpandConstant('{src}\Main\config.cfg'), AnsiStr) then
- begin
- UnicodeStr:=AnsiStr;
- StringChangeEx(UnicodeStr, HeightString, 'seta r_customheight "' + HeightNewValue + '"', False);
- SaveStringtoFile(ExpandConstant('{src}\Main\config.cfg'), AnsiString(UnicodeStr), False);
- end;
- end;
- procedure SetCfgRatio();
- begin
- GetConfigValues;
- ResolutionDefault:= (WidthValue + 'x' + HeightValue);
- case ResolutionDefault of
- '1920x1080', '1600x900', '1366x768', '1280x720', '1024x600', '960x540', '854x480', '640x360':
- begin
- Ratio.ItemIndex:=0;
- FOVValue:='95';
- end;
- '1920x1020', '1680x1050', '1440x900', '1280x800', '1152x720', '1024x640':
- begin
- Ratio.ItemIndex:=1;
- FOVValue:='90';
- end;
- '1600x1200', '1400x1050', '1280x960', '1152x864', '1024x768', '960x720', '800x600', '720x540', '640x480':
- begin
- Ratio.ItemIndex:=2;
- FOVValue:='80';
- end;
- '1920x1536', '1280x1024':
- begin
- Ratio.ItemIndex:=3;
- FOVValue:='80';
- end;
- end;
- end;
- procedure SetCfgResolution();
- var
- i: integer;
- begin
- i:=Resolution.Items.IndexOf(ResolutionDefault);
- Resolution.ItemIndex:=i;
- end;
- procedure SetCfgFullscreen();
- begin
- if FullscreenValue = '1' then Fullscreen.Checked:=True else Fullscreen.Checked:=False;
- end;
- procedure ChangeAspectRatio(Sender: TObject);
- begin
- case Ratio.ItemIndex of
- 0:
- begin
- Resolution.Clear;
- Resolution.Items.Add('1920x1080');
- Resolution.Items.Add('1600x900');
- Resolution.Items.Add('1366x768');
- Resolution.Items.Add('1280x720');
- Resolution.Items.Add('1024x600');
- Resolution.Items.Add('960x540');
- Resolution.Items.Add('854x480');
- Resolution.Items.Add('640x360');
- Resolution.ItemIndex:=0;
- end;
- 1:
- begin
- Resolution.Clear;
- Resolution.Items.Add('1920x1020');
- Resolution.Items.Add('1680x1050');
- Resolution.Items.Add('1440x900');
- Resolution.Items.Add('1280x800');
- Resolution.Items.Add('1152x720');
- Resolution.Items.Add('1024x640');
- Resolution.ItemIndex:=0;
- end;
- 2:
- begin
- Resolution.Clear;
- Resolution.Items.Add('1600x1200');
- Resolution.Items.Add('1400x1050');
- Resolution.Items.Add('1280x960');
- Resolution.Items.Add('1152x864');
- Resolution.Items.Add('1024x768');
- Resolution.Items.Add('960x720');
- Resolution.Items.Add('800x600');
- Resolution.Items.Add('720x540');
- Resolution.Items.Add('640x480');
- Resolution.ItemIndex:=0;
- end;
- 3:
- begin
- Resolution.Clear;
- Resolution.Items.Add('1920x1536');
- Resolution.Items.Add('1280x1024');
- Resolution.ItemIndex:=0;
- end;
- end;
- end;
- procedure WriteCustomSettings();
- begin
- case Ratio.ItemIndex of
- 0:
- StringChangeEx(FOVValue, FOVValue, '95', True);
- 1:
- StringChangeEx(FOVValue, FOVValue, '90', True);
- 2,3:
- StringChangeEx(FOVValue, FOVValue, '80', True);
- end;
- end;
- procedure Click(Sender: TObject);
- var
- ResultCode: Integer;
- begin
- case Sender of
- COD:
- begin
- ExecAsOriginalUser(ExpandConstant('{src}\CODSP.exe'), '', ExpandConstant('{src}'), SW_SHOW, ewNoWait, ResultCode);
- WizardForm.Close;
- ExitProcess(1);
- end;
- CODUO:
- begin
- ExecAsOriginalUser(ExpandConstant('{src}\CODSP.exe'), '', ExpandConstant('{src}'), SW_SHOW, ewNoWait, ResultCode);
- WizardForm.Close;
- ExitProcess(1);
- end;
- Settings:
- begin
- SetCfgRatio;
- ChangeAspectRatio(Settings);
- SetCfgResolution;
- SetCfgFullscreen;
- COD.Hide;
- CODUO.Hide;
- Settings.Hide;
- Save.Show;
- RatioText.Show;
- Ratio.Show;
- ResolutionText.Show;
- Resolution.Show;
- FullScreen.Show;
- end;
- Save:
- begin
- WriteCustomSettings;
- COD.Show;
- CODUO.Show;
- Save.Hide;
- Settings.Show;
- RatioText.Hide;
- Ratio.Hide;
- ResolutionText.Hide;
- Resolution.Hide;
- FullScreen.Hide;
- WriteNewValue;
- end;
- LangBtn:
- begin
- if lang='ru' then
- begin
- lang:= 'en';
- LangBtn.Caption:= CustomMessage(lang+'LangText');
- Settings.Caption:= CustomMessage(lang+'SettingsText');
- Save.Caption:= CustomMessage(lang+'SaveText');
- JustExit.Caption:= CustomMessage(lang+'JustExitText');
- RatioText.Caption:= CustomMessage(lang+'RatioText');
- ResolutionText.Caption:= CustomMessage(lang+'ResolutionText');
- FullScreen.Caption:= CustomMessage(lang+'FullScreenText');
- end else begin
- lang:= 'ru';
- LangBtn.Caption:= CustomMessage(lang+'LangText');
- Settings.Caption:= CustomMessage(lang+'SettingsText');
- Save.Caption:= CustomMessage(lang+'SaveText');
- JustExit.Caption:= CustomMessage(lang+'JustExitText');
- RatioText.Caption:= CustomMessage(lang+'RatioText');
- ResolutionText.Caption:= CustomMessage(lang+'ResolutionText');
- FullScreen.Caption:= CustomMessage(lang+'FullScreenText');
- end;
- end;
- JustExit:
- begin
- WizardForm.Close;
- ExitProcess(1);
- end;
- end;
- end;
- procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
- begin
- if CurPageID=wpReady then
- Confirm := False;
- end;
- procedure HideDefaultElements();
- begin
- SetWindowLong(WizardForm.handle, GWL_STYLE, GetWindowLong(WizardForm.handle, GWL_STYLE)and(not WS_MINIMIZEBOX)and(not WS_MAXIMIZEBOX));
- with WizardForm do begin
- PageNameLabel.Hide;
- PageDescriptionLabel.Hide;
- ReadyLabel.Hide;
- ReadyMemo.Hide;
- ReadyPage.Hide;
- MainPanel.Hide;
- Bevel.Hide;
- Bevel1.Hide;
- InnerNotebook.Hide;
- end;
- end;
- procedure MakeImage();
- begin
- ExtractTemporaryFile('WizardForm.BitmapImage1.bmp');
- Image := TBitmapImage.Create(WizardForm);
- with Image do
- begin
- Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardForm.BitmapImage1.bmp'));
- Parent := WizardForm.InnerPage;
- Left := ScaleX(0);
- Top := ScaleY(0);
- Width := ScaleX(400);
- Height := ScaleY(200);
- Stretch:=True;
- OnMouseDown:=@LabelOnMouseDown;
- BringtoFront;
- end;
- end;
- procedure MakeCustomButtons();
- begin
- COD := TNewButton.Create(WizardForm);
- with COD do
- begin
- Parent := WizardForm;
- Left := ScaleX(5);
- Top := ScaleY(200+5);
- Width := ScaleX((400-15)/2);
- Height := ScaleY(300-205-5-25-5);
- Caption := 'Call of Duty';
- OnClick:=@Click;
- BringToFront;
- end;
- COD.TabOrder := 0;
- CODUO := TNewButton.Create(WizardForm);
- with CODUO do
- begin
- Parent := WizardForm;
- Left := ScaleX(400-400/2+5);
- Top := ScaleY(200+5);
- Width := ScaleX((400-15)/2);
- Height := ScaleY(300-205-5-25-5);
- Caption := 'Call of Duty: United Offensive';
- OnClick:=@Click;
- BringToFront;
- end;
- CODUO.TabOrder := 1;
- Settings := TNewButton.Create(WizardForm);
- with Settings do
- begin
- Parent := WizardForm;
- Left := ScaleX(5);
- Top := ScaleY(300-30);
- Width := ScaleX(130);
- Height := ScaleY(25);
- Caption := 'Íàñòðîéêè';
- BringToFront;
- OnClick:=@Click;
- end;
- Settings.TabOrder := 2;
- Save := TNewButton.Create(WizardForm);
- with Save do
- begin
- Parent := WizardForm;
- Left := ScaleX(5);
- Top := ScaleY(300-30);
- Width := ScaleX(130);
- Height := ScaleY(25);
- Caption := 'Ñîõðàíèòü';
- BringToFront;
- Hide;
- OnClick:=@Click;
- end;
- Save.TabOrder := 2;
- LangBtn := TNewButton.Create(WizardForm);
- with LangBtn do
- begin
- Parent := WizardForm;
- Left := ScaleX(400/2-15);
- Top := ScaleY(300-30);
- Width := ScaleX(30);
- Height := ScaleY(25);
- Caption := 'EN';
- BringToFront;
- OnClick:=@Click;
- end;
- LangBtn.TabOrder := 3;
- JustExit := TNewButton.Create(WizardForm);
- with JustExit do
- begin
- Parent := WizardForm;
- Left := ScaleX(400-5-130);
- Top := ScaleY(300-30);
- Width := ScaleX(130);
- Height := ScaleY(25);
- Caption := 'Âûéòè';
- OnClick:=@Click;
- end;
- JustExit.TabOrder := 4;
- end;
- procedure MakeComboBox();
- begin
- RatioText := TLabel.Create(WizardForm);
- with RatioText do
- begin
- Parent := WizardForm.InnerPage;
- Caption := 'Ñîîòíîøåíèå ñòîðîí ýêðàíà:';
- Font.Style:=[fsBold];
- Transparent := False;
- Left := ScaleX(5);
- Top := ScaleY(205);
- Width := ScaleX(200);
- Height := ScaleY(20);
- Hide;
- end;
- Ratio := TNewComboBox.Create(WizardForm);
- with Ratio do
- begin
- Parent := WizardForm.InnerPage;
- SetBounds(ScaleX(5), ScaleY(205+20), ScaleX(400/2-15), ScaleX(15));
- Style := csDropDownList;
- Items.Add('16:9');
- Items.Add('16:10');
- Items.Add('4:3');
- Items.Add('5:4');
- ItemIndex := 0;
- OnChange:= @ChangeAspectRatio;
- Hide;
- end;
- Ratio.TabOrder := 0;
- ResolutionText := TLabel.Create(WizardForm);
- with ResolutionText do
- begin
- Parent := WizardForm.InnerPage;
- Caption := 'Ðàçðåøåíèå ýêðàíà:';
- Font.Style:=[fsBold];
- Transparent := False;
- Left := ScaleX(400/2+5);
- Top := ScaleY(205);
- Width := ScaleX(200);
- Height := ScaleY(20);
- Hide;
- end;
- Resolution := TNewComboBox.Create(WizardForm);
- with Resolution do
- begin
- Parent := WizardForm.InnerPage;
- SetBounds(ScaleX(400/2+5), ScaleY(205+20), ScaleX(400/2-10), ScaleX(15));
- Style := csDropDownList;
- Items.Add('1920x1080');
- Items.Add('1600x900');
- Items.Add('1366x768');
- Items.Add('1280x720');
- Items.Add('1024x576');
- Items.Add('960x540');
- Items.Add('854x480');
- Items.Add('640x360');
- ItemIndex := 0;
- // Resolution.OnChange:= @InterfaceLangComboBoxChanged;
- Hide;
- end;
- Resolution.TabOrder := 1;
- FullScreen := TNewCheckBox.Create(WizardForm);
- with FullScreen do
- begin
- Parent := WizardForm.InnerPage;
- Left := ScaleX(5);
- Top := ScaleY(205+20+15+10);
- Width := ScaleX(400-10);
- Height := ScaleY(17);
- Caption := 'Çàïóñê èãðû â ïîëíîýêðàííîì ðåæèìå';
- Hide;
- end;
- FullScreen.TabOrder := 2;
- end;
- procedure InitializeWizard();
- begin
- with WizardForm do begin
- BorderStyle:=bsNone;
- ClientWidth:=ScaleX(400);
- ClientHeight:=ScaleY(300);
- Caption:='Call of Duty Launcher';
- SettingsPage := CreateCustomPage(wpReady, 'ISCustomPage1_Caption', 'ISCustomPage1_Description');
- end;
- HideDefaultElements;
- MakeCustomButtons;
- MakeImage;
- MakeComboBox;
- if ActiveLanguage='ru' then begin
- lang:= 'ru';
- langBtn.Caption:= CustomMessage(lang+'LangText');
- end else begin
- lang:= 'en';
- langBtn.Caption:= CustomMessage(lang+'LangText');
- end;
- if FileExists(ExpandConstant('{src}\CODSP.exe')) then COD.Enabled else COD.Enabled:=False;
- if FileExists(ExpandConstant('{src}\CODUOSP.exe')) then CODUO.Enabled else CODUO.Enabled:=False;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement