I'm in a similar situation as Pyrii, and I'd like some help.
I have searched the forums and the FAQ and example files and such, and have found some things I can use I think. The problem is I'm not a coder, and I'm just too thick to get into my head exactly what
to write in my installer script to make it work.
(sorry - this is not an attempt at "hijacking" the thread, I just thought that since a thread with such a similar problem was already posted, I would reply here instead of making a new thread)
OK, here's the deal:
There is a game that I have made some high resolution textures for. Luckily for me, this game is very easy to customize. All I have to do to make the game use my higher res textures, is to hex edit some game files, so that the game doesn't find the original texture names inside those files.
The game will then automatically look for the texture name in a DynamicallyLoaded folder, and if it finds a texture there with the same name as the file it missed inside the game file, it will use that texture in place of the original, even though the new texture is of a higher resolution.
Now - that's all well and good. But I can't very well tell people who download my textures that they have to hex edit these game files one by one, editing sometimes multiple strings inside them.
So after some head scratching, I finally had an "aha!!" moment, and figured the most obvious answer would be to batch hex edit these files.
And I actually made installers that does this, and they work. So everyone should be happy, right?
Well - it turns out that I did this in the most clumsy and awkward way. What my installers are currently doing, is to extract a folder with a hex editor inside it, then run a .bat file that runs a script for that hex editor, so that it batch hex edits the game files. When it's done, it deletes the hex editing tool's folder. On uninstall, the hex editor in it's folder is again extracted, and an UNDO script is run(basically reversing what the install did).
But then I thought that it would be much better if I could somehow make my installer run the hex editor from inside, instead of exctracting it and then running it.
And so I came here, looking for an answer.
And from your posts in this thread, it looks like my NSIS installer will be able to hex edit the files in question without
the need for an external hex editor.
Which is great news.
But now I need to get an example of how exactly to make this work. I think I have found the examples, it's just that I have no idea what to put in place of the file_handle
, and other such function examples. Again, I'm no coder.
What I have gathered so far, is that I could perhaps use FileOpen
, and FileClose
. I just don't get how
The files I want to open(hex edit), are called: Kernel_GFXALL.ibt
I need my installer to search through them one at a time, for the same file names, and change them. As an example, one file name inside the .ibt files would be swooshc01
, and I want to rename it so that it's called bwooshc01
Likewise, I want the other file names I need to change to have their first letter changed to a 'b'.
This has to be done in both of the .ibt files(maybe a lot more of them later on, but for now it's those two).
So in essense; I need to open a file(the .ibt), find a specific string[where the texture name is](how do I find the "name" of the string, btw? Line number?), change a letter(or hex number) in that string, search for the next string with a given texture name, change a letter in that
string, and so on, then save the altered .ibt file.
And it needs to do this for both of the files.
Could someone please give me an example of a script that would do this?
I need to be spoon fed!
I'm not asking you to do it all for me, I just need it explained in simple terms. I got my installer working this far because I found examples by searching these forums that I could use by pretty much just replace the names in the example with my own, plus some trial and error.
Thanks in advance.
PS: Sorry about the long post, just thought I'd try to explain exactly what I need and why.