 |
|
It is currently Sat Feb 16, 2019 7:13 pm
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 9 posts ] |
|
Inno Setup DeusEx.ini help needed
Author |
Message |
hgdagon
Mole Person
Joined: Wed Jul 29, 2015 3:06 pm Posts: 5
|
 Inno Setup DeusEx.ini help needed
I'm trying to create a repack with many DeusEx mods. While Editing DeusEx.ini isn't much of a problem in general, adding new Path keys was quite a headcracker. I'm not particularly keen on Pascal, so I asked around in forums, and people wrote a piece of code for which can do that, but is a little less than satisfactory  As you can see, it adds the keys at the end of the sections, and I would, obviously, prefer them to be after the other Path keys. So can anyone help me with a code that can do that? Thanks in advance. P.S. I guess the "spoiler" tag doesn't work on this forum...
|
Wed Jul 29, 2015 3:25 pm |
|
 |
hgdagon
Mole Person
Joined: Wed Jul 29, 2015 3:06 pm Posts: 5
|
 Re: Inno Setup DeusEx.ini help needed
Nevermind, I figured it out. Funny thing, no one even mentioned that I don't need them UNDER the Path keys...
|
Fri Jul 31, 2015 8:51 am |
|
 |
Hanfling
MJ12
Joined: Sun Oct 04, 2009 6:54 pm Posts: 399
|
 Re: Inno Setup DeusEx.ini help needed
Acutally I considered your reasons to be out of a cosmetic concern.
_________________ I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
|
Fri Jul 31, 2015 11:01 am |
|
 |
ggrotz
X-51
Joined: Tue Nov 10, 2009 12:55 am Posts: 772
|
 Re: Inno Setup DeusEx.ini help needed
FWIW, in case someone else has a problem (or you're interested), here's what I've been using for the GMDX and HDTP installers (which will probably be open-sourced on final, mainly as a help towards this kind of purpose). Note that while DeusEx.ini is generally compatible with the INI file facilities available through the OS, since Paths is a duplicate key, it doesn't work. But one can use the TStringList equivalent to do it. Basically, the final result we're looking for is either: or Depending on whether HDTP is present. The main thing is to make sure the target line is placed before the line in which the resources exists.
_________________ You can find my Deus Ex Loader here. | HDTP Beta 3
|
Fri Jul 31, 2015 9:28 pm |
|
 |
that guy
The Nameless Mod
Joined: Mon Apr 26, 2004 1:54 am Posts: 1312 Location: Perth, Western Australia
|
 Re: Inno Setup DeusEx.ini help needed
I believe inno setup allows you to package and execute built executables so you could simply write your script in whatever programming language you prefer and then bundle it into the installer to be executed on installation.
|
Tue Aug 04, 2015 5:48 pm |
|
 |
Hanfling
MJ12
Joined: Sun Oct 04, 2009 6:54 pm Posts: 399
|
 Re: Inno Setup DeusEx.ini help needed
Afaik non existing Paths are ignored anyway, so it would be probably save to just always have the HDTP entry. And why do you actually modify the game's ini file instead of supplying a Default.ini to be used when starting GMDX?
_________________ I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
|
Wed Aug 05, 2015 1:47 am |
|
 |
ggrotz
X-51
Joined: Tue Nov 10, 2009 12:55 am Posts: 772
|
 Re: Inno Setup DeusEx.ini help needed
It's a safer behavior in terms of not breaking any other things or settings as many of the other mod installers do. For instance, the New Vision installer does this and as a result is one of the banes of my existence re the HDTP installer script.
_________________ You can find my Deus Ex Loader here. | HDTP Beta 3
|
Wed Aug 05, 2015 11:40 pm |
|
 |
hgdagon
Mole Person
Joined: Wed Jul 29, 2015 3:06 pm Posts: 5
|
 Re: Inno Setup DeusEx.ini help needed
@ggrotz Well, as you mentioned, to help others, who work on projects like this, here's what I got from other communities.  |  |  |  | Code: function FormatPathString(str : String) : String; var firstThreeChars : String; charsAfterFirstThree : String; tempString : String; finalString : String; dividerPosition : Integer; begin
firstThreeChars := Copy(str, 0, 3); //First copy the first thee character which we want to keep charsAfterFirstThree := Copy(str,4,Length(str)); //copy the rest of the string into a new variable dividerPosition := Pos('\', charsAfterFirstThree); //find the position of the following '\' tempString := Copy(charsAfterFirstThree,dividerPosition+1,Length(charsAfterFirstThree)-dividerPosition); //Take everything after the position of '\' (dividerPosition+1) and copy it into a temporary string finalString := firstThreeChars+tempString; //put your first three characters and your temporary string together Result := finalString; //return your final string end;
procedure AppendKey(const FileName, Section, KeyName, KeyValue: string); var S: string; I: Integer; CurLine: string; LineIdx: Integer; SnFound: Boolean; Strings: TStringList; begin Strings := TStringList.Create; try S := Format('[%s]', [Section]);
Strings.LoadFromFile(FileName); SnFound := False; LineIdx := Strings.Count;
for I := Strings.Count - 1 downto 0 do begin CurLine := Trim(Strings[I]); // if the iterated line is a section, then... if (Length(CurLine) > 2) and (CurLine[1] = '[') and (CurLine[Length(CurLine)] = ']') then begin // if the iterated line is the section we are looking for, then... if CompareText(S, CurLine) = 0 then begin SnFound := True; Break; end; end else if CurLine = 'Paths=' + FormatPathString(KeyValue) then LineIdx := I; end;
if not SnFound then begin Strings.Add(S); Strings.Add(Format('%s=%s', [KeyName, KeyValue])); end else Strings.Insert(LineIdx, Format('%s=%s', [KeyName, KeyValue]));
Strings.SaveToFile(FileName); finally Strings.Free; end; end;
|  |  |  |  |
And then I call it like this  |  |  |  | Code: procedure CurStepChanged(CurStep: TSetupStep); Begin if (CurStep=ssDone) and IsComponentSelected('NV') then begin AppendKey(ExpandConstant('{app}\System\DeusEx.ini'), 'Core.System', 'Paths', '..\New Vision\Maps\*.dx'); AppendKey(ExpandConstant('{app}\System\DeusEx.ini'), 'Core.System', 'Paths', '..\New Vision\Textures\*.utx'); end; if (CurStep=ssDone) and IsComponentSelected('HDTP') then begin AppendKey(ExpandConstant('{app}\System\DeusEx.ini'), 'Core.System', 'Paths', '..\HDTP\System\*.u'); AppendKey(ExpandConstant('{app}\System\DeusEx.ini'), 'Core.System', 'Paths', '..\HDTP\Textures\*.utx'); end; if (CurStep=ssDone) and IsComponentSelected('NV') and IsComponentSelected('HDTP') then begin AppendKey(ExpandConstant('{app}\System\hdtp.ini'), 'Core.System', 'Paths', '..\New Vision\Maps\*.dx'); AppendKey(ExpandConstant('{app}\System\hdtp.ini'), 'Core.System', 'Paths', '..\New Vision\Textures\*.utx'); end; End;
|  |  |  |  |
Obviously, your code is much shorter, but I like to keep thing separate (I have a bit of concentration problem).
|
Sat Aug 08, 2015 5:13 pm |
|
 |
that guy
The Nameless Mod
Joined: Mon Apr 26, 2004 1:54 am Posts: 1312 Location: Perth, Western Australia
|
 Re: Inno Setup DeusEx.ini help needed
I'd forgotten how ugly pascal is
|
Thu Aug 13, 2015 1:06 pm |
|
|
|
Page 1 of 1
|
[ 9 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 5 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
 |