View Full Version : [ModBuddy Extension] Vanilla Asset Browser


CommanderZ
Oct 03, 2010, 11:39 AM
About Vanilla Asset Browser

This simple extension allows you to browse vanilla assets hierarchy without leaving ModBuddy. Text files will be opened directly in ModBuddy, images, sounds and other files will be opened in their associated programs.

Advanced usage

Opening files in external editor
Simply hold SHIFT while opening and file from the Vanilla Assets :)
You can change the editor in <ModBuddy folder>/MatejZabsky/ExternalEditorPath.txt

Advanced search modes

Prefix search - add one space character before search query (has no effect on file content search).
Regular expression search - if you use any other character than letters, ".", "_" and " ", the search query will be interpreted as PCRE regular expression (for both file name and file content searches).


Installation

1) Download the attached archive and extract it
2) Register ModBuddy as Visual Studio Isolated Shell (http://forums.civfanatics.com/showthread.php?t=387554)
3) Open the "vsix" file found in the archive
4) Visual Studio Extension Installer pops up - click Install
5) Once the installation is complete, close the window
6) Restart ModBuddy (if it was running)
7) Go to View->Other Windows->Vanilla Assets
8) Find the CivilizationV.exe with the dialog box that pops up
9) You should now see a floating window with root asset directories. Dock it somewhere and you are done :)

Upgrading to newer version

1) Download the attached archive and extract it
2) Open the "vsix" file found in the archive
3) Visual Studio Extension Installer pops up - click Install
4) Once the installation is complete, close the window
5) Restart ModBuddy (if it was running)

Version History

1.7 (17.10.2010)
- fixed the VA window not opening (reported by VRBones)

1.6 (13.10.2010)
- fixed the VA window being confused with Solution Explorer (reported by JeBuS27)

1.5 (12.10.2010)
- added option to open files in external editor

1.4 (7.10.2010)
- added prefix and regex search options

1.3 (5.10.2010)
- instant search by file contents
- search text box is now more responsive (no lag)

1.3 (5.10.2010)
- instant search by file contents
- search text box is now more responsive (no lag)

1.2 (5.10.2010)
- fixed bug where the tree would be populated more than once after the window is closed and reopened (reported by damocles88)

1.1 (4.10.2010)
- instant search by file name
- configuration file is now saved into correct directory
- removed unnecessary message boxes
- generally more polished

1.0 (3.10.2010)
- first version

Planned Features

- cache file content index onto hard drive so it doesn't have too be rebuild every time ModBuddy loads

Screenshot

http://forums.civfanatics.com/attachment.php?attachmentid=267192&d=1286312905

Source code

I will post C# source code upon request.

CommanderZ
Oct 04, 2010, 02:20 PM
Update: Posted version 1.1!

1.1 (4.10.2010)
- instant search by file name
- configuration file is now saved into correct directory
- removed unnecessary message boxes
- generally more polished

See the original post for screenshot and download.

damocles88
Oct 05, 2010, 03:54 AM
Very nice, thanks a bunch for this. Saves digging around in files or database managers to find what I need.

but I have found one bug...

For some reason the vanilla assets window is showing the same folders about 5 times. So I get one list of folders starting with Automation and ending with UI, but then another 4 or 5 more lists that immediately follow, all going from Automation to UI. It's a minor bug that doesn't affect how useful the tool is, but thought you might like to know :)

CommanderZ
Oct 05, 2010, 04:00 AM
Very nice, thanks a bunch for this. Saves digging around in files or database managers to find what I need.

but I have found one bug...

For some reason the vanilla assets window is showing the same folders about 5 times. So I get one list of folders starting with Automation and ending with UI, but then another 4 or 5 more lists that immediately follow, all going from Automation to UI. It's a minor bug that doesn't affect how useful the tool is, but thought you might like to know :)

Could you please post a screenshot, I can't replicate this bug.

EDIT: Never mind, just found what causes it, will fix it ASAP.

CommanderZ
Oct 05, 2010, 04:21 AM
Fixed, thanks for reporting.

1.2 (5.10.2010)
- fixed bug where the tree would be populated more than once after the window is closed and reopened (reported by damocles88)

damocles88
Oct 05, 2010, 04:52 AM
Fast work!

Shiggs713
Oct 05, 2010, 05:43 AM
Wow, this looks like a fantastic utility tool. Great work!

ps you should get the mods to move this to the proper sub forum so more people can find it ;)

CommanderZ
Oct 05, 2010, 05:48 AM
you should get the mods to move this to the proper sub forum so more people can find it

Which is the correct subforum? The closest match is "Civ5 - Utility Programs", but I'm not sure whether it really fits.

Shiggs713
Oct 05, 2010, 05:55 AM
yea that would be it. Its not a big deal though, great job once again.

Szpilman
Oct 05, 2010, 07:22 AM
Wow, CommanderZ, you're putting out great ModBuddy extensions, thanks a lot!

A question: using the vanilla assets browser is it possible to accidentally alter their original value? Or are they browsed strictly read-only?

CommanderZ
Oct 05, 2010, 07:37 AM
Wow, CommanderZ, you're putting out great ModBuddy extensions, thanks a lot!

A question: using the vanilla assets browser is it possible to accidentally alter their original value? Or are they browsed strictly read-only?

The files are opened as normal files (writable). To be honest, I have no idea how to tell the Visual Studio to open ordinary writable file in read-only mode.

I could can mark the file read-only (using the file system flag) and then open it, but it might break Steam updater (though that is not very likely, most file-manipulation functions in most languages don't pay very much attention the the flag). If the file is read-only, the file is opened in some sort of semi-writable mode - you can type into it, but a lock icon is shown near file name and a warning box pops up while saving the file (allowing you to overwrite the file).

And thanks all for the positive replies!

salaminizer
Oct 05, 2010, 07:48 AM
when I run the vsix it says it haven't found a registered application, after I ran the .reg file and changed the .pkgdef file.

Szpilman
Oct 05, 2010, 08:08 AM
My concern is unknowingly hitting a key while browsing an Asset file. That's why I have made a copy of the Assets folder (which I keep in ModBuddy's project root folder). Would it be possible to point the extension to that location instead?

CommanderZ
Oct 05, 2010, 09:21 AM
when I run the vsix it says it haven't found a registered application, after I ran the .reg file and changed the .pkgdef file.

Hmm, weird. Are you sure you have the ModBuddy correctly installed? Try to do the two steps again (verify you did them correctly). Also, check whether the extension is not already installed (Go to Tools->Extension manager->All).

The installation instructions worked for me and for other people too, so I don't know what else could be wrong.

My concern is unknowingly hitting a key while browsing an Asset file. That's why I have made a copy of the Assets folder (which I keep in ModBuddy's project root folder). Would it be possible to point the extension to that location instead?

Check "<ModBuddy directory>/MatejZabsky/ExecutablePath.txt". You can change the value to anything you want and the extension will try to load the directory. The only "genuineness" check is during the first startup (when you are asked for the CiV executable).

salaminizer
Oct 05, 2010, 10:48 AM
Hmm, weird. Are you sure you have the ModBuddy correctly installed? Try to do the two steps again (verify you did them correctly). Also, check whether the extension is not already installed (Go to Tools->Extension manager->All).

The installation instructions worked for me and for other people too, so I don't know what else could be wrong.



Check "<ModBuddy directory>/MatejZabsky/ExecutablePath.txt". You can change the value to anything you want and the extension will try to load the directory. The only "genuineness" check is during the first startup (when you are asked for the CiV executable).

ok, running the ModBuddy exe directly from the folder (that is, not from Steam) made it work somehow :confused:

thanks :goodjob:

CommanderZ
Oct 05, 2010, 11:18 AM
ok, running the ModBuddy exe directly from the folder (that is, not from Steam) made it work somehow

thanks

It is more likely you did something to fix the issue before you tried to run the ModBuddy directly ;) I usually run ModBuddy through the launcher and it works fine.

CommanderZ
Oct 05, 2010, 03:24 PM
Update time! The search by file contents is now in. It is not really "instant" (it takes a few moments for the results to pop up), but it is still much faster than using Windows Search :)

The fast search has its price though: the ModBuddy now takes a ten or so more seconds to load (all the text Assets are being preloaded into memory).

1.3 (5.10.2010)
- instant search by file contents
- search text box is now more responsive (no lag)

See the first post for download and a screenshot.

Szpilman
Oct 05, 2010, 05:25 PM
Do you mean like Windows Grep? That will be the most useful tool ever :)

I was wondering: I actually have a copy of the root Tutorials folder (or something) inside my Assets copy, will it get indexed as well?

CommanderZ
Oct 06, 2010, 01:33 AM
Do you mean like Windows Grep? That will be the most useful tool ever :)

Could you please explain what you mean?

The content search does simple string matching only (no wildcards or other stuff). I of course could use regexp matching instead, but that would slow down the search. Maybe...string matching would be used if there are no special chars (only letters) in the search query and regexp otherwise :)

Sounds like an idea, but I'm not sure it would be that useful. I am certainly not fluent enough with regexps to use them in my everyday practice.

I was wondering: I actually have a copy of the root Tutorials folder (or something) inside my Assets copy, will it get indexed as well?

Yes, any files you put into the Assets will be included in the tree and also in file name searches. The file content index however contains SQL, XML and LUA files only. I could add a few more extensions if you wish, the purpose of this is to prevent DDS and MP3 files from being indexed (only cca 800 of the 5000 files in the asset directory aree text files, the rest are mostly MP3s and DDSs...making like 99% of total Asset size).

db0
Oct 06, 2010, 11:55 AM
Hey there, thanks for this extension, very nice. Quick question (and I hope I'm not just being stupid) but how do I use the search in Vanilla Assets? Nevermind :)

CommanderZ
Oct 07, 2010, 05:52 AM
Update!

1.4 (7.10.2010)
- added prefix and regex search options

See the first post for download and instructions on how to use the new search options.

Szpilman
Oct 07, 2010, 09:50 AM
It's perfect, the Tutorials folder has only .Lua files where I care.

And now the search ability of your extension is unparalleled to the other tools people have been using so far. At least from my humble perspective :)

Thanks a lot for offering this to the community.

Afforess
Oct 07, 2010, 10:36 AM
Very Handy. Thanks!

jwallstone
Oct 07, 2010, 02:07 PM
This is amazing.

RandomPete
Oct 09, 2010, 08:50 AM
Thanks, what a massive time saver!

I'm finding a strange issue where if I edit any of the vanilla files with this extension active, CPU usage goes crazy and it takes several seconds to edit 1 character.

It would be really nice if you could make all the vanilla files read-only which would prevent this outright. I don't want to edit them - but sometimes this happens by accident when I've been looking at a whole bunch of XML files, it's easy to start editing the wrong one!

RandomPete
Oct 09, 2010, 08:52 AM
Oh - one more request. I've been starting to look at the various XML files in the resource directories. These can only be accessed after unpacking with Nexus. The resource folder isn't even inside the main Assets folder - so it'd be nice if they could show up in a future version of your extension!

Thanks again

The_J
Oct 09, 2010, 08:56 AM
Wow, this looks like a fantastic utility tool. Great work!

ps you should get the mods to move this to the proper sub forum so more people can find it ;)

Which is the correct subforum? The closest match is "Civ5 - Utility Programs", but I'm not sure whether it really fits.

I think so. It is somehow an utility, a program (extension) to enhance Civ5 modding, that counts.
Moved.

CommanderZ
Oct 09, 2010, 10:08 AM
I'm finding a strange issue where if I edit any of the vanilla files with this extension active, CPU usage goes crazy and it takes several seconds to edit 1 character.
I can't see how my extension could cause this. It doesn't do anything with files besides opening them (and of course the index has to be build when the extension is loaded).

It would be really nice if you could make all the vanilla files read-only which would prevent this outright. I don't want to edit them - but sometimes this happens by accident when I've been looking at a whole bunch of XML files, it's easy to start editing the wrong one!

This is an known issue and I'm looking into that (see this post (http://forums.civfanatics.com/showpost.php?p=9723847&postcount=11)). I have actually overwritten one vanilla file yesterday :(

Oh - one more request. I've been starting to look at the various XML files in the resource directories. These can only be accessed after unpacking with Nexus. The resource folder isn't even inside the main Assets folder - so it'd be nice if they could show up in a future version of your extension!

Create a subdirectory in the Assets dir and move the extracted resources there, these files will then be included into the tree and searches.

Moderator Action: Moved.

Thanks, this way this thread won't be on second page after ten hours of inactivity.

RandomPete
Oct 09, 2010, 01:09 PM
I can't see how my extension could cause this. It doesn't do anything with files besides opening them (and of course the index has to be build when the extension is loaded).


I certainly wouldn't expect it to but have you ever heard of these things called "bugs"? :lol: But seriously, yeah it's not happening now so it must have been a random glitch, I have a ton of different versions of Visual Studio installed and to be honest my PC needs a good reformatting, it goes a bit mad sometimes :)


This is an known issue and I'm looking into that (see this post (http://forums.civfanatics.com/showpost.php?p=9723847&postcount=11)). I have actually overwritten one vanilla file yesterday :(


Yeah it's a danger :S

For anybody who doesn't know, Steam has an option to verify game files. Right-click "Sid Meier's Civilization V" and select Properties. Go to the "Local Files" tab and "Verify Integrity of Game Cache". I believe that will repair files that have been changed or corrupted.


Create a subdirectory in the Assets dir and move the extracted resources there, these files will then be included into the tree and searches.


That sounds far too obvious ... surely there's a more complicated way? ;)

Drawmeus
Oct 10, 2010, 02:00 PM
This is awesome. I'm not normally one to +1 something, but you just saved me a ton of time.

CommanderZ
Oct 12, 2010, 01:19 PM
Update time!

1.5 (12.10.2010)
- added option to open files in external editor

See the first post for download and instructions on how to use the new feature.

JeBuS27
Oct 12, 2010, 01:29 PM
Update time!



See the first post for download and instructions on how to use the new feature.No luck with replacing the syntax highlighter, then?

CommanderZ
Oct 12, 2010, 02:16 PM
Oh, why would you think so? (http://forums.civfanatics.com/showthread.php?p=9763227#post9763227) ;)

JeBuS27
Oct 13, 2010, 06:36 AM
Slight issue with VAB. I have the Solution Explorer and Vanilla Assets windows open, but after docking VAB to the right side, where SE is, any docking changes I try to apply to SE get applied to VAB instead.

CommanderZ
Oct 13, 2010, 07:03 AM
Are you sure you are dragging the correct window? For example, if you have VAB and SE as tabs of one window and you want to separate them, you have to grab the window you want to drag by the tab handle, not by tool window's title area

JeBuS27
Oct 13, 2010, 07:04 AM
It happens even when they're separate windows and I use the little down arrow on the window title area.

CommanderZ
Oct 13, 2010, 07:16 AM
Ah, I see. Funny :)

Anyways, you can usually achieve the same window layout with dragging (I don't ever use the arrow), which seems to work.

I will also look at this (though I have no idea what could be causing it), thanks for reporting.

CommanderZ
Oct 13, 2010, 09:35 AM
Fixed. Firaxis obviously used the very same tool window creation wizard as I did. And neither of us bothered to change the default window ID :D

1.6 (13.10.2010)
- fixed the VA window being confused with Solution Explorer (reported by JeBuS27)

Thanks again for reporting.

VRBones
Oct 17, 2010, 03:34 AM
7) Go to View->Other Windows->Vanilla Assets
8) Find the CivilizationV.exe with the dialog box that pops up
9) You should now see a floating window with root asset directories. Dock it somewhere and you are done :)

Getting stuck when attempting to open the window, no dialog box pops up to continue to step 8. Tried a number of restarts and reinstalls, but nothing. Any ideas? Is there a way to manually set the location?

CommanderZ
Oct 17, 2010, 04:02 AM
Go to ModBuddy directory (for example "C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v sdk\ModBuddy"). There should be a directory MatejZabsky, create it if it doesn't exist. In it theere should be a text file ExecutablePath.txt (again, create it if there isn't one). Its only content is a path to the Assets directory. In my case

D:\games\Steam\steamapps\common\sid meier's civilization v/Assets

Are you sure the dialog didn't pop up first time you used the extension? It would be a serious bug. Please tell me if the directory and the text file were there or you had to create them.

VRBones
Oct 17, 2010, 08:30 AM
Please tell me if the directory and the text file were there or you had to create them.

Directory structure didn't exist. I created the text file and added the directory (identical apart from C:). The /Assets looked odd, so I tried it with '\' as well. Still no luck. Could it be that I'm the first to try 1.6 without upgrading from any previous version?

funkymunky
Oct 17, 2010, 08:45 AM
I cannot get your plugin to work either. Apparently, it installed into ModBuddy, because it shows up in the Extension Manager, but when I try to open it through the View menu, nothing happens.

I had to manually create the MatejZabsk\ExecutablePath.txt folder, because it was not created automatically, but still the assets browser will not show up. Any ideas?

CommanderZ
Oct 17, 2010, 09:04 AM
Fixed.

1.7 (17.10.2010)
- fixed the VA window not opening (reported by VRBones)

I feel hyper embarassed, testing has really never been my strongest virtue :(

Thank you for reporting the bug (and being patient).

VRBones
Oct 17, 2010, 09:26 AM
Yep, all working good here.
Quick note, I had to grab the update from your profile. I can't seem to locate it on the front page again.

Sorry for being picky, but I see this mod as almost essential to get going. I know you can browse the directories, but it feels so much more like an environment having the rest of the project exposed for reference. Keep up the good work!

CommanderZ
Oct 17, 2010, 09:34 AM
Quick note, I had to grab the update from your profile. I can't seem to locate it on the front page again.

Fixed, thanks for reporting.
Sorry for being picky, but I see this mod as almost essential to get going. I know you can browse the directories, but it feels so much more like an environment having the rest of the project exposed for reference. Keep up the good work!

Thanks.

manar
Oct 21, 2010, 04:03 AM
Hi CommanderZ,

Either I'm blind or the download is gone ! I have 1.6 installed and the VA window is not opening so I need 1.7 .

Thanks for the great work

CommanderZ
Oct 21, 2010, 04:44 AM
I uploaded it one again (dunno why it keeps disappearing). You can always DL it from the CivFanatics Download Database.

SamBC
Dec 31, 2010, 09:24 AM
So I just moved my Steam install (due to lack of space). Steam itself seems to be fine with all the new paths, but I had some headaches with the SDK. ModBuddy is now working, I think, but Vanilla Assets Browser is giving me some trouble. First, when I tried to view the vanilla assets list, it crashed ModBuddy. So, I uninstalled it and reinstalled it from a fresh download. Now it doesn't appear where it remembered to appear before, but I got to it through "other windows", but it's empty. I wasn't prompted to give it a new vanilla assets path, nor can I find a way to do so. When I had the empty list at the side of the window, I tried clicking the pin icon to mostly hide it again, and ModBuddy crashed.

Any ideas?

CommanderZ
Jan 16, 2011, 09:46 AM
Have you tried deleting the <ModBuddy directory>/MatejZabsky/ExecutablePath.txt file?

SamBC
Jan 18, 2011, 03:51 PM
Have you tried deleting the <ModBuddy directory>/MatejZabsky/ExecutablePath.txt file?
Does not appear to make a difference - the dialogue asking for the executable location mentioned in setup step 8 does not appear.

CommanderZ
Jan 19, 2011, 06:50 AM
Even if you do the following:

1) Close the Vanilla Assets window (with the cross)
2) Close ModBuddy
3) Delete the file (you may want to search the hard drive for files with the same name, the directories can be confused, because you moved the game). It should be in current working directory of the ModBuddy (so a shortcut may affect it with the "Start in" field).
4) Start ModBuddy
5) Open the VA window through the Tools menu
5) Profit?

If this fails, I will send you a build with some debugging printouts so I can see what is wrong.

SamBC
Jan 19, 2011, 07:45 AM
Well, that was weird.

Last thing last night, it crashed ModBuddy (as previously), ModBuddy restarted, and I didn't touch it. Just now I went to do what you suggested, and had to actually open the VanillaAssetsBrowser from the view menu, and when I did it prompted for the location again. Now it seems to be working fine.

CommanderZ
Jan 19, 2011, 10:18 AM
Glad to hear that :)

SamBC
Jan 19, 2011, 11:46 AM
It seems that it only noticed the path was missing once it crashed ModBuddy for the first time after deleting the path file.