Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: FreeSpaceFreak on February 14, 2012, 01:48:42 pm

Title: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on February 14, 2012, 01:48:42 pm
With modpacks becoming increasingly large both in filesize and filecount, it gets hard to keep track of which files you actually need and which are just wasting space. So I made a tool that does it for you! It's still in beta, but should be pretty stable by now. All instructions can be found in the readme that comes with the download.

Disclaimer: This program has limited scope (multimod and VPs are not supported), so a file in the "unused" list may still be in use. This is merely a tool that lists the files you should take another look at, see why they were originally put in, and if this reason is still valid.

Hope it will be of good use!

Download Windows EXE (http://www.mediafire.com/download.php?je95k9m88n80rqp) (1.26MB from MediaFire)

or check out the source code from http://freespace-open-modpack-cleaner.googlecode.com/svn/trunk/
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: Rga_Noris on February 14, 2012, 03:08:27 pm
WAY cool!
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: headdie on February 14, 2012, 03:14:25 pm
Defiantly taking a look at this
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: Nyctaeus on February 14, 2012, 03:33:35 pm
It's awesome! Very useful thing. The easiest way to check what we don't need.
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: headdie on February 14, 2012, 04:59:24 pm
ran a quick test on one of my mods in progress i know has junk in there and seems to work nice enough
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: Droid803 on February 14, 2012, 07:45:08 pm
Just tried it out, coming up with a few false 'positives".

For one, it's saying things which are used as glowpoint textures a re unused (in maps, should they be in effects?), and that muzzle flash effects aren't used (in effects), as well as an effect used by afterburner thruster particles (in effects).
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: FreeSpaceFreak on February 15, 2012, 02:46:40 am
Ah, good to hear people using it :)

Droid - Yeah, glowpoints go in effects - the maps folder is expected to only contain ship textures. Muzzleflashes - it checks the weapons tables for those, not the muzzleflash table. Are you sure there's a weapon using the muzzleflash listed? Afterburner particles - those aren't in, you're right. What's the syntax for that? It's apparently not in the Wiki (which I based the table-readers on).
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: T-LoW on February 15, 2012, 04:07:43 am
For the love of god finally something that tells me what to delete! Thank you!
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: Fury on February 15, 2012, 04:45:19 am
Muzzleflashes - it checks the weapons tables for those, not the muzzleflash table.
In weapons.tbl you define name of the muzzleflash for the weapon, this name is then parsed from mflash.tbl which lists actual effects used for the muzzleflash. You HAVE to parse both mflash.tbl and -mfl.tbm to get accurate results for muzzleflashes. I also noticed that this program skips weapon_expl.tbl and -wxp.tbm, which means the program lists effects listed in these tables as unused as well.

Hopefully support for hud, interface, sound, music and voice files will be added at later date. Definitely an excellent start for such an useful program! :)

Have to add that support for mod.ini would be nice, in a way that the program notifies if a file is unused in the original mod but used by another mod. For example, you have mods A and B. B depends on A and references to an effects file called fancy.dds. Fancy.dds is found in mod A, but mod A does not use this file. It'd be better if this file is moved to mod B if possible.
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: Goober5000 on February 15, 2012, 11:58:56 am
Defiantly taking a look at this

That's the spirit.  Stick it to the man!
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: headdie on February 15, 2012, 12:16:25 pm
Defiantly taking a look at this

That's the spirit.  Stick it to the man!

doh spellcheck fail
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: Rga_Noris on February 15, 2012, 12:55:52 pm
Just curious...

What are your plans for this? What goals do you have?
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: mjn.mixael on February 15, 2012, 01:59:33 pm
Give me multi-mod or give me death. (Also VP support!) No problem, right? :p
Title: Re: PUBLIC BETA: Modpack Cleaner
Post by: FreeSpaceFreak on February 15, 2012, 03:16:27 pm
In weapons.tbl you define name of the muzzleflash for the weapon, this name is then parsed from mflash.tbl which lists actual effects used for the muzzleflash. You HAVE to parse both mflash.tbl and -mfl.tbm to get accurate results for muzzleflashes. I also noticed that this program skips weapon_expl.tbl and -wxp.tbm, which means the program lists effects listed in these tables as unused as well.

You're right! I always thought the tabled muzzleflash name and filename had to be the same... Which is the case for weapon_expl.tbl (according to the Wiki), so at least that should be alright.

Where to go with this... I started doing this mainly as an exercise in C++ and wxWidgets. I might add multimod, since people are asking for it; VP support will be a challenge, so that's probably gonna happen too. Cleaning other folders, I dunno. Maps and effects are the usual memory hogs, and AFAIK there's no real challenge in the other folders (it's all used in the same way as maps and effects) so at that point it just becomes cumbersome and repetitive, not much of an exercise anymore.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: Droid803 on February 15, 2012, 05:39:05 pm
Afterburner particles - those aren't in, you're right. What's the syntax for that? It's apparently not in the Wiki (which I based the table-readers on).

Code: [Select]
$Thruster Particles:
$Thruster Particle Bitmap: GN_Particle_Red.ani
$Min Radius: 0.25
$Max Radius: 0.75
$Min Created: 8
$Max Created: 15
$Variance: 0.25
$Thruster Particles:
$Afterburner Particle Bitmap: Vapula_Particle.ani
$Min Radius: 0.25
$Max Radius: 0.75
$Min Created: 15
$Max Created: 30
$Variance: 0.25

A (working) example of thruster particles.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: Fury on February 15, 2012, 11:52:57 pm
What's the point with adding support to vp's? If you use this app, it means you're developing a mod or at least messing with the modpack, which again means you've already extracted contents of vp-files. Even if you run this app against vp-files, you're not going to be able to do any cleaning unless you extract said vp-files. It seems a lot of work for no gain whatsoever to add support for vp's.

Which is the case for weapon_expl.tbl (according to the Wiki), so at least that should be alright.
Well, if may want to consider adding a notification that weapon_expl.tbl references to unused effect and it could be removed from tbl as well as the effect itself.

Cleaning other folders, I dunno. Maps and effects are the usual memory hogs, and AFAIK there's no real challenge in the other folders (it's all used in the same way as maps and effects) so at that point it just becomes cumbersome and repetitive, not much of an exercise anymore.
Memory hogs yes, but I think this tool has real potential to become a true modpack cleaner and it'd be real benefit to everybody to not bundle useless files in their modpacks. A lot of mods these days have a ton of files in their interface folder for example, which makes noticing unused files hard.

How about setting up svn repository for this, it'd be a lot more convenient for people to contribute? That way you don't have to add features that have no interest to you, but others may want to. And everyone benefits from it.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: mjn.mixael on February 16, 2012, 06:12:27 am
What's the point with adding support to vp's? If you use this app, it means you're developing a mod or at least messing with the modpack, which again means you've already extracted contents of vp-files. Even if you run this app against vp-files, you're not going to be able to do any cleaning unless you extract said vp-files. It seems a lot of work for no gain whatsoever to add support for vp's.

Let's say you are developing a mod against the MediaVPs. How does this program check (assuming multi-mod support) that certain files exist if it can't read into the MediaVPs VPs?
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: Fury on February 16, 2012, 06:35:44 am
The tool does not check for missing effects or maps as it is. The tool would first need to be able to check and notify of missing files.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: FreeSpaceFreak on February 17, 2012, 02:32:06 am
*snip*

Great, thanks :)

VP support - it could be useful if you're overriding an MVP file. Let's say you want the Orion in different colours, so you override the MVP textures with identically-named ones in your own modpack. Anyway, I'll probably add it just because it's interesting to do.

SVN repo - that'd be cool, though I wouldn't know how to go about it. Either way, the source code is provided (I can upload the VC10 project file if anyone wants it), contributions are welcome (as is criticism on my newb coding BTW).
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: Iss Mneur on February 17, 2012, 05:55:15 pm
VP support - it could be useful if you're overriding an MVP file. Let's say you want the Orion in different colours, so you override the MVP textures with identically-named ones in your own modpack. Anyway, I'll probably add it just because it's interesting to do.
If you do implement VP support. I have a working wxBase implementation that will read .vps.  It should be fairly straight forward to port to STL C++ like what you are using. It was originally done up in anticipation of a wxLauncher feature(s) that I haven't gotten to yet, but as far as I recall the implemenation works as advertised for reading of vps.  You can find it on the wxLauncher googlecode page: http://code.google.com/p/wxlauncher/source/checkout?repo=libvp

SVN repo - that'd be cool, though I wouldn't know how to go about it. Either way, the source code is provided (I can upload the VC10 project file if anyone wants it), contributions are welcome (as is criticism on my newb coding BTW).
I would suggest just hosting it on a place like googlecode.com and be done with it.  They cover everything needed to setup.  If you are having problems with SVN itself (ie. how to use it) I would suggest the "SVN Book" that is available online for free or on paper.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.5
Post by: FreeSpaceFreak on February 21, 2012, 03:35:01 pm
If you do implement VP support. I have a working wxBase implementation that will read .vps.  It should be fairly straight forward to port to STL C++ like what you are using. It was originally done up in anticipation of a wxLauncher feature(s) that I haven't gotten to yet, but as far as I recall the implemenation works as advertised for reading of vps.  You can find it on the wxLauncher googlecode page: http://code.google.com/p/wxlauncher/source/checkout?repo=libvp

Thanks, though I'd rather write my own VP reader - it's a challenge :drevil:

Quote
I would suggest just hosting it on a place like googlecode.com and be done with it.  They cover everything needed to setup.  If you are having problems with SVN itself (ie. how to use it) I would suggest the "SVN Book" that is available online for free or on paper.

Okay, that's good to know. First I want to do a pretty major rewrite, that will enable users to see exactly where a file is in use; after that beta (i.e. the next one) I'll put the code up on SVN.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on February 29, 2012, 01:55:46 pm
Beta 0.6 is now up, download link in OP! Apart from bugfixes and an icon (on Windows, anyway), the main new feature is that you can now actually see where every file is used. Hope that'll prove a useful idea :D

I made a project for it at Google Code and committed the source there (link also in OP), with MSVC2010 project (wxWidgets 2.9) and Linux make things. Now here's a (probably) silly question: I check it out under Ubuntu and I can't run the autogen.sh script. "Permission denied". What am I doing wrong? I can compile FSO from SVN just fine, so I assume I did something wrong in the project SVN settings?

I put this on SVN so y'all can contribute if you feel like it; the main to-dos are multimod, VP support, and cleaning more stuff.

Droid: this version should recognize thruster particles correctly, if you remove the extensions in the table.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: niffiwan on February 29, 2012, 03:46:44 pm
Re: your autogen.sh problem, you might need to make the script executable?  i.e.

Code: [Select]
chmod +x autogen.sh
Disclaimer: I can't SVN from work so I can't check this for certain. 
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: Fury on February 29, 2012, 11:25:18 pm
Beta 0.6 is now up, download link in OP!
The Windows exe link still points to 0.5.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on March 01, 2012, 03:43:11 am
Whoops :nervous: The one time I didn't check the download links before posting...

Niffiwan: Thanks, that did the trick. Compiling from SVN should be possible now.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: mjn.mixael on December 05, 2013, 11:50:08 pm
So, I want to be able to use this, but it listed a few textures that I know for a fact are in use... so it makes me uncomfortable to take it's recommendations on which textures are unused. :(
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on December 06, 2013, 12:50:38 am
Well, multimod and VPs are not supported as of right now - if that's where the textures are used, it's, eh, unfortunate - I don't have a timeline for those features.

If that's not the cause, then it's a bug and I'd like to hear more about it :)
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: mjn.mixael on December 06, 2013, 01:26:20 am
I'm 98% sure it's not due to models in a vp somewhere. I know I have a POF in data/models that uses glass-trans.dds. In fact, I've confirmed that to be the case. However this still insists it's not used.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on December 08, 2013, 10:30:50 am
I'm 98% sure it's not due to models in a vp somewhere. I know I have a POF in data/models that uses glass-trans.dds. In fact, I've confirmed that to be the case. However this still insists it's not used.
That's funny, -trans textures should be supported... Does it still happen if the model is in its own mod folder? If so, could you upload it?
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: mjn.mixael on December 16, 2013, 03:26:18 pm
Haven't tested, but I intend to.
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on December 18, 2013, 01:52:31 pm
Haven't tested, but I intend to.
's alright, no pressure :)
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: Nyctaeus on November 23, 2019, 01:33:26 pm
 :bump: :headz:

Yay for 6-years old necro.

May I request some humble and noble coding soul to upgrade MCleaner to support Knossos modpack structure? Ya know, different packages etc...
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: Cyborg17 on November 23, 2019, 09:51:47 pm
I was about to say, "someone actually got to one of my long term goals!" Remind me to look at this after 19.0 is out?  I do want to see something like this finished.

Knossos also needs some work (although who knows, maybe I won't be good at finding bugs there)
Title: Re: PUBLIC BETA: Modpack Cleaner v0.6
Post by: FreeSpaceFreak on December 01, 2019, 03:23:04 am
Holy necro, batman! I completely forgot I did this. Or that Google Code was a thing at some point :nervous:

Turns out I actually still have the old source code. Since I'm gonna be away from my machine for the next five weeks I'll just attach it here for whoever's interested. Warning: this was one of my first forays into C++, I'm not taking any responsibility for the quality of this code :P

[attachment eaten by a Shivan]