Archive: Question and Suggestion


Question and Suggestion
I will cut right to the chase here, I am sure many of you have played games based on the unreal engine such as Unreal, Unreal Tournament, Rune, Deus Ex, etc. My question is, is it possible to do blind INI writes in NSIS somehow, or could it be done in another way? What I mean by this is, sometimes INI's in Deus EX (which is what I need this for), use multiple entry names under the same section, IE:

ServerActors=IpDrv.UdpBeacon
ServerActors=IpServer.UdpServerQuery
ServerActors=IpServer.UdpServerUplink

I want to be able to add one, without it over-writing the first entry it finds. And being able to delete the entire string with an un-install would be great too. Of course that would be my suggestion part of this post. Add a few extra cmds such as:

BlindINIWrite
BlindINIReplace
BlindINIDelete

Write would be for writing the sting at the end regardless of an existing entry, Replace would search for a specific value of an entry say, ServerActors=IpDrv.UdpBeacon and replace with ServerActors=IpDrv.UdpBeacon2 and Delete would remove ServerActors=IpDrv.UdpBeacon completely. I'd add these myself but I am a "script kiddie" as it were, I can script in a few languages, know a tiny bit of vc++ (still learning), so I wouldnt know where to begin to add such things.

Sorry Post is so long, Any help here would be great since I can't stand the Unreals "UMOD" engine (being a pain in the ass to make installers for plus I prefer executables).

Many Thanks in Advance,
Aaron


You should write an extension DLL for NSIS (read the docs for more info). I don't think that many people need these functions, so they won't be added to NSIS because it adds extra overhead.


(someone correct me if I'm wrong) but AFAIK the Windows API INI functions don't support blind writes, in fact the INI file format doesn't allow multiple keys with the same name in a single section. So really the problem lies with programs like UT that abuse the INI file format.


You can always just edit the file as if it was a regular file using FileOpen, FileRead, FileWrite and FileClose. Have a look here. It shows you how to replace a line in a text file.


Originally posted by Sunjammer
(someone correct me if I'm wrong) but AFAIK the Windows API INI functions don't support blind writes, in fact the INI file format doesn't allow multiple keys with the same name in a single section. So really the problem lies with programs like UT that abuse the INI file format.
You're right about that Sunjammer, it's not the correct INI format, so it's not possible to use Win32 API. That's why it requires quite some extra code.

Originally posted by kichik
You can always just edit the file as if it was a regular file using FileOpen, FileRead, FileWrite and FileClose. Have a look here. It shows you how to replace a line in a text file.
That's a good solution. Maybe a DLL will be faster, but I don't think srelysian needs to write that many values.

Originally posted by kichik
You can always just edit the file as if it was a regular file using FileOpen, FileRead, FileWrite and FileClose. Have a look here. It shows you how to replace a line in a text file.
That will actually help quite a bit, I was aware btw, that Unreals engine was abusing INI formats, I just thought it might be a nice addition to NSIS just because alot of people play games based on the engine, might be nice to have an install engine that will work for it. Other than UMOD that is, but eh, if its that much trouble? A quick work around is just as good, so I will try to use the file open stuff. Thanks all :)

PS. I suppose I could write a DLL, I've been slowly learning to work with them in VC++ so maybe it will be in my list of things to accomplish.