StranikS_Scan Posted August 16, 2024 Share Posted August 16, 2024 1 час назад, DraugDM сказал: они же рядом с папкой патча лежат! Значит с ними ничего делать не надо (С) Твой кэп @ Quote Link to comment Short link Share on other sites More sharing options...
Qirashi Posted August 16, 2024 Share Posted August 16, 2024 2 часа назад, DraugDM сказал: ну сейчас у меня каждый мод отдельный в папке по полному пути лежит - mods\1.28.0.0 - и сам мод! в иносетап добавил \mods\{#Patch}\ чтобы в каждой папке с модом не переписывать(не менять) названия патча при каждом обновлении игры... а вот с конфигами которые лежат рядом с папкой не знаю как быть... Куда проще написать внешний скрипт парсер который будет переименовывать папки с версией. Или писать кастомные функции для inno setup. Мне проще, у меня все моды в архивах и кастомные функции распаковки. Т.е так как привязка к чекбоксам, я могу несколько архивов поочерёдно распаковать в 1 папку. Насколько я знаю без костылей напрямую inno setup не даст это сделать. И у тебя выбор, либо переписывать скрипт, либо делать внешнюю утилиту на батнике. Я бы советовал питон. Что-то такое: import os """ Скрипт парсит все папки которые рядом с скриптом. Входит в каждую и ищет в ней old_version Если есть совпадение, то заменяет old_version на new_version """ # Какую версию на какую заменить old_version = "1.28.0.0" new_version = "1.29.0.0" def rename_directories(base_dir): for entry in os.listdir(base_dir): entry_path = os.path.join(base_dir, entry) if os.path.isdir(entry_path): for sub_entry in os.listdir(entry_path): sub_entry_path = os.path.join(entry_path, sub_entry) if os.path.isdir(sub_entry_path) and old_version in sub_entry: new_name = sub_entry.replace(old_version, new_version) new_path = os.path.join(entry_path, new_name) os.rename(sub_entry_path, new_path) print(f"Папка переименована: {sub_entry_path} -> {new_path}") # Путь до директории где лежит скрипт. base_directory = os.path.dirname(os.path.abspath(__file__)) # Можно указать свой путь вот так: # base_directory = 'свой/путь/до/папки' rename_directories(base_directory) @ Quote Link to comment Short link Share on other sites More sharing options...
DraugDM Posted August 16, 2024 Share Posted August 16, 2024 6 минут назад, Qirashi сказал: Куда проще написать внешний скрипт парсер который будет переименовывать папки с версией. Или писать кастомные функции для inno setup. Мне проще, у меня все моды в архивах и кастомные функции распаковки. Т.е так как привязка к чекбоксам, я могу несколько архивов поочерёдно распаковать в 1 папку. Насколько я знаю без костылей напрямую inno setup не даст это сделать. И у тебя выбор, либо переписывать скрипт, либо делать внешнюю утилиту на батнике. Я бы советовал питон. Что-то такое: import os """ Скрипт парсит все папки которые рядом с скриптом. Входит в каждую и ищет в ней old_version Если есть совпадение, то заменяет old_version на new_version """ # Какую версию на какую заменить old_version = "1.28.0.0" new_version = "1.29.0.0" def rename_directories(base_dir): for entry in os.listdir(base_dir): entry_path = os.path.join(base_dir, entry) if os.path.isdir(entry_path): for sub_entry in os.listdir(entry_path): sub_entry_path = os.path.join(entry_path, sub_entry) if os.path.isdir(sub_entry_path) and old_version in sub_entry: new_name = sub_entry.replace(old_version, new_version) new_path = os.path.join(entry_path, new_name) os.rename(sub_entry_path, new_path) print(f"Папка переименована: {sub_entry_path} -> {new_path}") # Путь до директории где лежит скрипт. base_directory = os.path.dirname(os.path.abspath(__file__)) # Можно указать свой путь вот так: # base_directory = 'свой/путь/до/папки' rename_directories(base_directory) спс! буду пробывать... @ Quote Link to comment Short link Share on other sites More sharing options...
Qirashi Posted August 16, 2024 Share Posted August 16, 2024 Удачи) @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted October 19, 2024 Share Posted October 19, 2024 (edited) в данном коде (с использованием файла findwot.dll) есть возможность, если модпак сделан для лесты чтобы он находил именно/только клиент лесты? если да, подскажите плиз!!! знаю что есть вариант OpenWG.Utils и тд но если есть возможность с этим кодом, хотелось бы оставить его подправив просто. function WOT_GetClientsCount(): Integer; external 'WOT_GetClientsCount@files:findwot.dll cdecl'; function WOT_GetClientBranch(ClientIndex: Integer): Integer; external 'WOT_GetClientBranch@files:findwot.dll cdecl'; procedure WOT_GetClientPathW(Buffer: String; BufferSize: Integer; ClientIndex: Integer); external 'WOT_GetClientPathW@files:findwot.dll cdecl'; function Get_Wot_Dir(Param: String): String; var ClientsCount, Index: Integer; FoundDir: String; begin Result:=ExpandConstant('{sd}\Games\World_of_Tanks'); SetLength(FoundDir, 1024); ClientsCount:=WOT_GetClientsCount(); if ClientsCount > 0 then begin for Index:=0 to ClientsCount-1 do begin if WOT_GetClientBranch(Index) = 1 then begin WOT_GetClientPathW(FoundDir, Length(FoundDir)-1, Index); Result:=ExpandConstant(FoundDir); end; end; end; end; Edited October 19, 2024 by Lom @ Quote Link to comment Short link Share on other sites More sharing options...
StranikS_Scan Posted October 20, 2024 Share Posted October 20, 2024 (edited) Надо проверять по пути, что это Леста и, если да, то помеcтить путь в Result и делать Break. Типа так: function WOT_GetClientsCount(): Integer; external 'WOT_GetClientsCount@files:findwot.dll cdecl'; function WOT_GetClientBranch(ClientIndex: Integer): Integer; external 'WOT_GetClientBranch@files:findwot.dll cdecl'; procedure WOT_GetClientPathW(Buffer: String; BufferSize: Integer; ClientIndex: Integer); external 'WOT_GetClientPathW@files:findwot.dll cdecl'; function Get_Wot_Dir(Param: String): String; var ClientsCount, Index: Integer; FoundDir: String; begin Result:=ExpandConstant('{sd}\Games\World_of_Tanks'); SetLength(FoundDir, 1024); ClientsCount:=WOT_GetClientsCount(); if ClientsCount > 0 then begin for Index:=0 to ClientsCount-1 do begin if WOT_GetClientBranch(Index) = 1 then begin WOT_GetClientPathW(FoundDir, Length(FoundDir)-1, Index); FoundDir:=ExpandConstant(FoundDir); if FileExists(FoundDir+'\lgc_api.exe')) then begin Result:=FoundDir; Break; end; end; end; end; end; Может не сработать, т.к. я не помню, что там правильно писать в Inno, в сравнении с Delphi. Edited October 20, 2024 by StranikS_Scan @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted October 20, 2024 Share Posted October 20, 2024 3 часа назад, StranikS_Scan сказал: Надо проверять по пути, что это Леста и, если да, то помеcтить путь в Result и делать Break. Типа так: Ошибку выдаёт @ Quote Link to comment Short link Share on other sites More sharing options...
StranikS_Scan Posted October 20, 2024 Share Posted October 20, 2024 1 час назад, Lom сказал: Ошибку выдаёт Скобку убери справа лишнюю. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted October 20, 2024 Share Posted October 20, 2024 (edited) 19 минут назад, StranikS_Scan сказал: Скобку убери справа лишнюю. точняк, проблема была в этом. но всё равно, код не находит игру. видать в findwot.dll нет так сказать поддержки лесты. (файл findwot.dll 20 года а леста вроде 22 году появилась?!) Edited October 20, 2024 by Lom 1 @ Quote Link to comment Short link Share on other sites More sharing options...
hevi Posted October 28, 2024 Share Posted October 28, 2024 а разве щас папка с танками называется World_of_Tanks а не Tanki @ Quote Link to comment Short link Share on other sites More sharing options...
Draugd Posted yesterday at 01:19 PM Share Posted yesterday at 01:19 PM Плиз подскажите где на что поменять чтобы по автомату выбирал лесту! const UNDEF_INDEX = -777; ALPHA_BLEND_LEVEL = 255; // max=Byte=255 WS_EX_LAYERED = $80000; WS_EX_TRANSPARENT = $20; LWA_COLORKEY = 1; LWA_ALPHA = 2; GWL_EXSTYLE = (-20); var InfoPic: Longint; LastIndex: Integer; TempPath: String; PicForm: TForm; type COLORREF = DWORD; function SetLayeredWindowAttributes(Hwnd: THandle; crKey: COLORREF; bAlpha: Byte; dwFlags: DWORD): Boolean; external '[email protected] stdcall'; function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLong{#A}@user32.dll stdcall'; function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLong{#A}@user32.dll stdcall'; function SetFocus(hWnd: HWND): HWND; external '[email protected] stdcall'; function WOT_GetClientsCount(): Integer; external 'WOT_GetClientsCount@files:FindWot.dll cdecl'; function WOT_GetClientBranch(ClientIndex: Integer): Integer; external 'WOT_GetClientBranch@files:FindWot.dll cdecl'; procedure WOT_GetClientPathW(Buffer: String; BufferSize: Integer; ClientIndex: Integer); external 'WOT_GetClientPathW@files:FindWot.dll cdecl'; function DefaultDirName(Param: String): String; var ClientsCount, Index: Integer; FoundDir: String; begin SetLength(FoundDir, 1024); ClientsCount:=WOT_GetClientsCount(); if ClientsCount > 0 then begin for Index:=0 to ClientsCount-1 do begin if WOT_GetClientBranch(Index) = 1 then begin WOT_GetClientPathW(FoundDir, Length(FoundDir)-1, Index); Result:=ExpandConstant(FoundDir); end; end; end else Result:=ExpandConstant('{sd}\Games\World_of_Tanks'); end; procedure ShowPicHint(const PicFilePath: String); begin ImgRelease(InfoPic); InfoPic := ImgLoad(PicForm.Handle, PicFilePath, 0, 0, 340, 260, False, False); PicForm.SetBounds(WizardForm.Left + ScaleX(509), WizardForm.Top + ScaleY(80), 340, 260); ImgApplyChanges(PicForm.Handle); PicForm.Show(); SetFocus(WizardForm.Handle); end; procedure CompOnItemMouseMove(Sender: TObject; X, Y: Integer; Index: Integer; Area: TItemArea); var UndefPic: String; begin if Index = -1 then Exit; if Index = LastIndex then Exit; try case TNewCheckListBox(Sender).ItemCaption[Index] of '1.Командирская камера.': UndefPic := 'KK.bmp'; '2.Винтик.': UndefPic := 'VNT.bmp'; else begin LastIndex := UNDEF_INDEX; PicForm.Hide(); ImgApplyChanges(PicForm.Handle); Exit; end; end; if not FileExists(TempPath + UndefPic) then ExtractTemporaryFile(UndefPic); ShowPicHint(TempPath + UndefPic); finally LastIndex := Index; end; end; procedure CompOnMouseLeave(Sender: TObject); begin ImgRelease(InfoPic); PicForm.Hide; ImgApplyChanges(PicForm.Handle); LastIndex := -1; end; procedure InitInfo(); begin WizardForm.ComponentsList.OnItemMouseMove := @CompOnItemMouseMove; WizardForm.ComponentsList.OnMouseLeave := @CompOnMouseLeave; TempPath := AddBackslash(ExpandConstant('{tmp}')); LastIndex := UNDEF_INDEX; PicForm := TForm.Create(WizardForm); with PicForm do begin BorderStyle := bsNone; FormStyle := fsStayOnTop; end; SetWindowLong(PicForm.Handle, GWL_EXSTYLE, GetWindowLong(PicForm.Handle, GWL_EXSTYLE) or WS_EX_LAYERED); SetLayeredWindowAttributes(PicForm.Handle, 0, ALPHA_BLEND_LEVEL, LWA_ALPHA); end; procedure InitializeWizard1(); begin InitInfo(); end; function NextButtonclick(CurPageID: Integer): Boolean; begin Result := True; case CurPageID of wpSelectDir: if not FileExists(ExpandConstant('{app}\WorldOfTanks.exe')) then begin MsgBox('Не верно указана папка World of Tanks!', mbError, MB_OK); Result := False; end; end; end; @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted yesterday at 01:55 PM Share Posted yesterday at 01:55 PM автоматом не знаю но теперь в новом патче лесты, нужно вот тут - if not FileExists(ExpandConstant('{app}\WorldOfTanks.exe')) then делать вот так - if not FileExists(ExpandConstant('{app}\Tanki.exe')) then begin @ Quote Link to comment Short link Share on other sites More sharing options...
Draugd Posted yesterday at 04:07 PM Share Posted yesterday at 04:07 PM (edited) 2 часа назад, Lom сказал: автоматом не знаю но теперь в новом патче лесты, нужно вот тут - if not FileExists(ExpandConstant('{app}\WorldOfTanks.exe')) then делать вот так - if not FileExists(ExpandConstant('{app}\Tanki.exe')) then begin так уже заменял... он все равно при установки по автомату на евро лезет... если два клиента установлено... Edited yesterday at 04:09 PM by Draugd @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted yesterday at 04:35 PM Share Posted yesterday at 04:35 PM 21 минуту назад, Draugd сказал: так уже заменял... он все равно при установки по автомату на евро лезет... если два клиента установлено... у меня тоже. у нас с тобой старый код просто. почти все перешли на новый вариант а как в этом сделать так как нам нужно никто не подсказал. и думаю не подскажет)) @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
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.