Author Topic: Modfile Inspector, files.xml editor, ModPackage Creator 1.2c  (Read 15317 times)

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
I've been playing around with the Reanimator Tool for the past few hours (nice work! :mrgreen:) and I quickly got tired of always having to copy the modified files to their respective folders... As I had nothing else to do (who cares about studying xD) I thought I'd try programming a little tool that allowes me to directly create a mod package from those cooked files... However as the new HGL launcher doesn't seem to like my own zipped mod packages, I didn't care about implementing this functionality...
When placed in the "Flagship StudiosHellgate London" folder (together with the Reanimator.jar) the program searches for all *.txt.cooked files located in this folder level, creates a new mod package folder + directory tree structure and places the files in their respective folders.

I tried to keep the tool as simple as possible and made it command-line based so it can be used for scripting or whatever other purposes. When running the program you can decide wether you want to add information like the name of your mod (also used as mod folder name), the version, or the author's name (the corresponding "modinfo.ini" file will be created automatically), or if you just want to create the package using standard values (empty name, version, author fields in the "modinfo.ini").

All in all I just want to hear what you guys think of this and where you see some potential for improvements...

How to start:
First of all I expect the Reanimator.jar to be located in the "Flagship StudiosHellgate London" folder (where the NewLauncher.exe is located), so that all the modified files created by Reanimator are also being placed in this folder. The "ModPackageCreator.exe" and its "files.xml" file should also be placed in this folder.
To use the program, either create a shortcut and add the startup parameters there (e.g. "-n "My New Mod" -v "1.2.0" -a "Kite") or open up a command prompt. For quick&dirty tests you can also use the parameter "-x" which will tell the program to just use standard values for all fields.
The final mod package will also be located in the "Flagship StudiosHellgate London" folder.

Important: As the program was written in C# it requires the .Net Framework 2.0 to run!

I might also add a GUI in the near future or add some more customization options (currently there is no option to specify where the final mod package should be created etc.)





HINT:
I tried to find all possible bugs or errors (and I'm pretty confident I slayed most of them :)), but some might still be left. Use with caution and don't blame me if anything bad happens :P If anyone is interested, I can also provide the source-code (undocumented and don't comment on my programming style... or lack thereof xD)

HINT2:
As I have no connection to the development process of the SP modification or Revival, there is no use in asking maeyan or any other developer for help concerning this tool. If you have any problems or questions, feel free to contact me via PM :)



In return I have a small question regarding the "modinfo.ini" file:
Would it be possible to add additional entries to the file like
"Short description" - for a short summarization of what this mod does and
"Description" - for a more complete list of changes?
I think this might help keeping track of all the different mods when having a huge amount of packages...



EDIT:
Added a simple GUI that requires the ModPackageCreator.exe (you need to download both files).

EDIT2:
Just came accross a buggy function in the GUI... v1.1 is the newest version.

EDIT3: v1.2
Added requested features to the ModPackageCreator:
  • -t "type": Defines the installation type of the mod (required, opt-in, opt-out). A shortened parameter version is available via -t R = required, -t OI = opt-in, -t OO = opt-out. If no argument is specified, the standard argument is "required".
  • -c "files": Defines the cooked files to be used for generating the mod package. Multiple files have to be seperated via ";":
    -c "affixes.txt.cooked;itemquality.txt.cooked;"
  • -s: Doesn't require the user to hit a key when packaging is done. Pretty handy when running the program from a script.
  • -z: Not implemented yet, but reserved for zipping the created package.
  • -p "path": Allows you to specify the path where the package should be created

Added features to the GUI:
  • Dialog to select which cooked files should be used.
  • Dialog to select the destination folder of the mod.
  • Option to select the type of the mod.
  • Option to zip a created package (not implemented yet)
  • Option to create a package without using any parameters ("quick & dirty"-style)
  • If you are interested in which parameters are being passed to the ModPackageCreator or if you just want to save them for alter usage, I have also added a button which copies these parameters to your clipboard, e.g.:
    -s -a "nobody" -t "OI" -n "Test" -v "0.1a" -p "E:Program FilesFlagship StudiosHellgate London" -c "affixes.txt.cooked;gameglobals.txt.cooked;global_themes.txt.cooked;itemquality.txt.cooked;items.txt.cooked;monsters.txt.cooked;offer.txt.cooked;treasure.txt.cooked;"

EDIT4: v1.3
Added zipping functionality (and enabled it in the GUI) to automatically zip the created mod package. Uses "SharpZipLib" http://www.sharpziplib.com/ under the GPL license http://www.icsharpcode.net/OpenSource/S ... ib/GPL.asp
WARNING:
As I am deleting the "normal" unzipped mod folder after zipping it, make sure you use a folder name that isn't already existing, e.g. if you name your mod "ABC" and you already have a folder called "ABC", the mod files will be placed inside this folder, but at the end of the progress, the whole folder will be deleted (files can still be found in the zipped folder)! Keep this in mind and you'll have absolutely no problems :)

EDIT5: v1.4
Added requested features to the ModPackageCreator:
  • Added file comparison (via MD5 hash) so only modified files are used when building the package (compares *txt.cooked files in the Dataexcel and data_commonexcel folder with files created by Reanimator).
  • Added switch "-m" to specify that only modified files should be used

GUI changes:
  • Redesigned some of the GUI elements
  • Added checkbox to select/unselect wether only modified files should be used

EDIT6: v1.5 (Creator)
The basic functionality and features of v1.5 are the same as in v1.4. No new features were added, no errors were corrected. The only difference (for programmers) is, that I cleaned up the code, extracted the main functionality and placed it in a seperate DLL (ModPackageCreatorLib.dll) so the most important methods can be used without the need of using the console or parameters. All methods inside the DLL are fully commented so if you are using MS Visual Studio you'll see those neat little help lines and explanations.


EDIT7: v1.5 (GUI)
Added a config file for the GUI which allows you to determine the standard values for all the GUI fields. This way you can save your most commonly used settings (e.g. Mod name, author, target folder, if the folder should be zipped, etc.) and are not forced to enter them each time you start the GUI. Edit the *.config file by hand to make changes.



EDIT8: v1.6 (Creator + GUI)
Added a new option to specify the type of the mod (base/original) and modified the command-line arguments to match the new parameter.
Changed some command-line arguments:
Changed -t to -i (installation type)
Changed -m to -o (onlyUseModifiedFiles)
Added -m (mod type)
[attachment=0:wklvmmpq]ModPackageCreator v1.6 - ModPackageCreator - GUI v1.6.zip[/attachment:wklvmmpq]

Additionally, you can download a new, reworked standalone version of the GUI featuring the creation of multiple mod packages from the next page.(recommended)[/b]


Known bugs/possible problems:
Even though the "files.xml" is designed so that other files and their locations inside the mod package can be added, the Creator and the GUI are currently only looking for *.txt.cooked files, when no arguments are specified via the "-c" switch. I haven't tested this yet, but the program MIGHT process those files correctly when passing these files as arguments via "-c".
Sometimes small changes to *.txt.cooked files aren't recognised correctly when using the option "onlyUseModifiedFiles" resulting in the file not being used as it is "identical" to the original file.

Resolved bugs:
  • GUI signals "Successfully created new mod package XY!" even though the Creator shows an error: Outputs and exceptions from "ModPackageCreator" are now correctly redirected to the GUI
  • There seems to be a problem when generating the directory structure of the mod package. This MIGHT be solved by editing the "files.xml" file and replacing the <folder name="Data"> with <folder name="Dataexcel">.
« Last Edit: Mar 23, 2010; 10:28 PM by Kite »
~ Recettear ~
Capitalism, ho!

ElectricMessiah

  • Nameless
  • *
  • Posts: 64
  • Karma: 0
Re: Mod Package Creator
« Reply #1 on: Dec 01, 2009; 10:39 PM »
I'm probably going to regret this question....

Where is the Reanimator download?  I've not seen a link for it yet.  (runs and hides).

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator
« Reply #2 on: Dec 01, 2009; 11:14 PM »
The Reanimator is a tool only available for Founding members -> viewtopic.php?f=2&t=42
~ Recettear ~
Capitalism, ho!

maeyan

  • Loves Hellgate
  • Administrator
  • Eldest
  • *****
  • Posts: 1997
  • Karma: 31
Re: Mod Package Creator
« Reply #3 on: Dec 02, 2009; 12:06 AM »
This is really cool Kite. Well done!  :D I love community contributions

The new Reanimator suite is written in C# and defines a new modding method, that is actually an XML schema designed to script the modifications. This allows us to combine multiple modifications. There are lots of other tasty tools too, such as IDX explorer and DAT repacking (handy for replacing movies, sounds and strings). If your interested in contributing, send me a PM and i'll hook you up with the SVN credentials.
Don't dream what to be; be what you always dreamed.

Malachor

  • Developer
  • Eldest
  • ****
  • Posts: 1996
  • Karma: 25
Re: Mod Package Creator
« Reply #4 on: Dec 02, 2009; 08:49 AM »
Hi Kite, great program, but could you add the option to modify "type=", so we can use opt-in, opt-out or required, rather than just required?
Could you also add the option to specify the files that go into it? I ended up with 3 txt.cooked files, 2 I expected, 1 I didn't(since I hadn't modified it).
And I was wondering why you've kept the older version of the gui? It might make it a bit confusing, since the main program is with the older version of the gui.

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator
« Reply #5 on: Dec 02, 2009; 10:27 AM »
Quote from: "maeyan"
This is really cool Kite. Well done! :D I love community contributions
Thanks :)

Quote from: "maeyan"
The new Reanimator suite is written in C# and defines a new modding method, that is actually an XML schema designed to script the modifications. This allows us to combine multiple modifications. There are lots of other tasty tools too, such as IDX explorer and DAT repacking (handy for replacing movies, sounds and strings). If your interested in contributing, send me a PM and i'll hook you up with the SVN credentials.
The scripting part sounds very good, especially the combinations of different modifications... I already wanted to ask if something like this might be possible :)
Regarding contributions, you'll probably hear from me one of these days :)


Quote from: "Malachor"
Hi Kite, great program, but could you add the option to modify "type=", so we can use opt-in, opt-out or required, rather than just required?

Sure can do. As I couldn't find any mod that uses something other than "required" I thought I'd be on the safe side if I just kept it at that. But its no big deal changing that.


Quote from: "Malachor"
Could you also add the option to specify the files that go into it? I ended up with 3 txt.cooked files, 2 I expected, 1 I didn't(since I hadn't modified it).

Hmmm... up till now I just take all the files Reanimator creates, so each file is taken.
Are you talking about
1. adding additional parameters to be passed to the program that specify the files
2. a separate... say... XML file where you can specify those files, or
3. the programm actively discovering which files were really modified?


Quote from: "Malachor"
And I was wondering why you've kept the older version of the gui? It might make it a bit confusing, since the main program is with the older version of the gui.

I'm not that used to this version of the board software and I tried all buttons I could find to delete the old version, but had no luck... Maybe one of you can help me there xD

EDIT:
OK... guess I'm blind xD Removed the old version...
« Last Edit: Dec 02, 2009; 03:03 PM by Kite »
~ Recettear ~
Capitalism, ho!

Malachor

  • Developer
  • Eldest
  • ****
  • Posts: 1996
  • Karma: 25
Re: Mod Package Creator
« Reply #6 on: Dec 02, 2009; 11:33 AM »
Quote from: "Kite"
Hmmm... up till now I just take all the files Reanimator creates, so each file is taken.
Are you talking about
1. adding additional parameters to be passed to the program that specify the files
2. a separate... say... XML file where you can specify those files, or
3. the programm actively discovering which files were really modified?
I'd say either #1 or #3 (maybe this would be the best) would be good.

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator
« Reply #7 on: Dec 02, 2009; 02:40 PM »
Quote from: "Malachor"
I'd say either #1 or #3 (maybe this would be the best) would be good.

Okay, the new version is up and I also updated the GUI to support the new features. For now I went with option #1 as I'm not quite sure how to solve option #3. As far as I understand it, Reanimator only modifies files and doesn't add any new entries, so comparing file sizes might not work (only parameters that are already existing are changed).

IMHO this issue should be handled in Reanimator itself so that it doesn't provide/create cooked files which weren't even modified...


I'm not quite sure if I should remove the ".txt.cooked" extension from the cooked files when passing them to the Creator, as the parameter list can get pretty long (-c "affixes.txt.cooked;gameglobals.txt.cooked;items.txt.cooked;monsters.txt.cooked;offer.txt.cooked;treasure.txt.cooked;"). On the other hand handling it this way is pretty easy and straightforward, as this is the format I get when searching for all files in a folder...
~ Recettear ~
Capitalism, ho!

Malachor

  • Developer
  • Eldest
  • ****
  • Posts: 1996
  • Karma: 25
Re: Mod Package Creator
« Reply #8 on: Dec 03, 2009; 01:43 AM »
Quote from: "Kite"
IMHO this issue should be handled in Reanimator itself so that it doesn't provide/create cooked files which weren't even modified....
Reanimator didn't modify the 3rd file. I only had 2 files, that were modified, in the hellgate base folder; where reanimator.jar, and Mod Creator Package.exe are.

Ok, one more thing the latest version created the data folder, but not the excel folder within it. Though it created the data_commonexcel folder.
So my file structure looks like this:
basedataitems.txt.cooked
basedatatreasure.txt.cooked
basedata_commonexcel

when it should be:
basedataexcelitems.txt.cooked
basedataexceltreasure.txt.cooked
basedata_commonexcel

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator
« Reply #9 on: Dec 03, 2009; 09:37 AM »
Hm... this could be a mapping problem... Try modifying the files.xml and change the part

Code: [Select]
<folder name="Data">to
Code: [Select]
<folder name="Dataexcel">
The files.xml is used by the Creator to determine in which folders the different *.txt.cooked files have to be placed when creating a mod package. Basically it is just a representation of the HGL folder structure. This little change should do the trick... I can't check this as I'm currently at my university, but as soon as I'm home I'll have a look at this. I thought I had checked wether all the paths are correct, but looks like I missed this part :)

I think I will rename the files.xml to mapping.xml in my next version... This might make things a little bit less confusing :P
~ Recettear ~
Capitalism, ho!

Malachor

  • Developer
  • Eldest
  • ****
  • Posts: 1996
  • Karma: 25
Re: Mod Package Creator
« Reply #10 on: Dec 03, 2009; 11:11 AM »
That fixed it.

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator
« Reply #11 on: Dec 03, 2009; 10:06 PM »
Whew... checking for modified files is implemented, zipping is also working... and I think I finally implemented all features you were asking for Malachor :) My code won't win any price for runtime efficiency, but its doing the job xD

Any other new requests and/or suggestions are welcome, so if you can think of anything, let me know :)
~ Recettear ~
Capitalism, ho!

freekyjason

  • Founder
  • Named
  • **
  • Posts: 136
  • Karma: 0
Re: Mod Package Creator (for Reanimator)
« Reply #12 on: Dec 12, 2009; 04:03 AM »
grats kite, nice little program that should help the modders :P
"We create... to destroy" Seditius the Cursed

Malachor

  • Developer
  • Eldest
  • ****
  • Posts: 1996
  • Karma: 25
Re: Mod Package Creator v1.5 (for Reanimator)
« Reply #13 on: Jan 01, 2010; 04:49 AM »
Just one more suggestion, though it's not regarding the mod creator: When you edit your original post, may I suggest that you post in the thread that you've updated it. I've just looked at this since I'm having trouble seeing anything* when I install one of my mods, to test the installation, and I've been using 1.4, and I've just noticed that you've got version 1.5 out. Your last update was on the 20th of decemeber, but since the last post was the 12th, I didn't realise you were still updating this.



*it's as though the modinfo isn't being recognised. I've noticed this even when I right click on the mod folder and send to a zip file, or even using winrar directly, so I don't think it's a problem with your program.

Edit: Ok, just tried gui version 1.5 out, and it can't find any cooked files, even though I've changed the target folder to the hellgate londondataexcel folder. And I can't select what files to use. I can click on the "Cooked files to use" button but nothing happens, even the "..." button beside it doesn't do anything.

Kite

  • Developer
  • Eldest
  • ****
  • Posts: 1095
  • Karma: 3
Re: Mod Package Creator v1.5 (for Reanimator)
« Reply #14 on: Jan 01, 2010; 02:13 PM »
I know where you're coming from... the next time I update the tool I'll definitely add the update date to the thread title and make a post... Up till now I didn't post in here but edited my first post as I didn't want to make too many double posts.

Quote from: "Malachor"
Ok, just tried gui version 1.5 out, and it can't find any cooked files, even though I've changed the target folder to the hellgate londondataexcel folder. And I can't select what files to use. I can click on the "Cooked files to use" button but nothing happens, even the "..." button beside it doesn't do anything.

Ok let's see...
I made some assumptions (see my first post) on where to place the "ModPackageCreator.exe", so I'm pretty much using hard-coded relative paths instead of checking the windows registry or asking the user for the paths...



1. The "ModPackageCreator.exe" (+ GUI) has to be placed in the main folder of your HGL installation (e.g. E:Program FilesFlagship StudiosHellgate London) where all the relevant game directories and the launcher.exe are
2. I also expect the "*.txt.cooked' files from the "Reanimator.jar" to be located in this directory
3. Try unchecking the box "Only use modified files" and see if you're now able to create a package. There might be a problem with my hashing algorithm... I'm currently using a MD5-hash to compare the "old" and the "new" *.txt.cooked files... Sometimes when there are only very few changes in the file (e.g. editing a value from 10 to 100 and then saving the file) the algorithm doesn't seem to detect the modification. I'm thinking about replacing this with a CRC32 check sum for higher reliability...
4. The "..." button next to the "Cooked files to use" dropdown list is only used to update the list in case you're running the program before creating the cooked files
5. The "Target folder" button describes the directory the complete mod package should be placed in

In the future I might create a kind of manual explaining the different options and buttons of the GUI... Depending on how much time I can spare I also might do a complete overhaul of the GUI, enabling you to select all the paths and adding some more explanations...


Regarding your problem with the modinfo.ini:
I tried several different target folders and zipped/unzipped the folder several times but could not reproduce your problem... Over here the file is always recognized and displayed fine in the "NewLauncher.exe". The only thing I noticed is that the "NewLauncher.exe" seems to ignore my opt-in/opt-out values and always uses "required"... Am I using the wrong commands/names/values here?

[img=http://img64.imageshack.us/img64/9813/unbenanntjj.png
~ Recettear ~
Capitalism, ho!