Bossafs by boss302

$Date: 10/09/03 2:42p $
$Revision: 12 $

This program is an xpr/afs file tuner.
Much of the functionality of this program was taken from xprtune.

What this program allows you to do, is manipulate afs files, and xpr files.

The main dialog, prompts for a file. Either an xpr or afs file can be loaded.
Based on what type of file is loaded, the tree control will populate with the contained objects.
The information box, will contain information about the object currently selected in the tree control.
(in most cases)
The picture control will contain a preview of the selected object if one is available.
All operations from this dialog are done by right clicking on an object, and picking an option from the context menu.
If you right click on something and get no menu, then there are no functions available. There are several objects
that have disabled menu items that show in grey, that's because the feature isn't implemented yet.

Anyone that feels like writing a manual for this, I would appreciate it, as documentation is not one of my loves.
And I would also appreciate some feedback, what works, what doesn't etc.
------------------------------------------------------------------
Version 1.0.0.8 (they are all beta so why bother)
New features (not really, a couple of small things and some bug fixes)
Added a couple of status dialogs, so that when you export or import stuff, you get a dialog box that tells you 
How many were inported or exported.
Fixed a bug in the batch dds import.
Quite a bit of coding on the patch system has been integrated, but it's not enabled yet.

Upcoming features
1) Patch system, generate or apply patches to a whole xpr/afs or individual objects inside an afs
2) I would like to add a feature when rebuilding an xpr, where you get to pick transparency information beforehand.
3) Object preview in main window (I need some sample code, I don't know much about this 3d rendering any help will be appreciated)
4) Bundler functionality built in ? Or mdlhack ?

5) Material Property pages
	color0: 0.000 0.069 0.061 0.143
	color1: 1.000 1.000 1.000 1.000
	color2: 1.000 1.000 1.000 1.000
	color3: 0.486 0.350 0.446 1.000
	color4: 0.000 0.000 0.000 0.000
	power: 50.000
	ffff:     ff71597b (hex) normally 0xFFFFFFFF
6) Vertex Property Pages
	(w,x,y,z): 0.000000 5.124274 1.427846 14.569797
7) Cat Tuning

------------------------------------------------------------------
Version 1.0.0.7 Beta
New features
Batch import/export of dds files from xpr's and afs's in 3 different formats.
The 3 formats are: miteexpr, xpression, and bossafs. 
This batch import is FAST takes a little over 2 seconds to import a full set of nude textures (58 files).
DOA3 xprtune
This allows you to manipulate xpr files from doa3. No 256 bit transparency since we don't know how yet.
But you can automatically manipulate pad26,pad29,pad30 (as well as see there current values)
There is a little icon to indicate which mode your in at the top of the xprtune dialog.
The display is similar to xprtune, yes means one material transparent(1,1,1) no means 1 material (0,0,0)
Yes(4) means 4 materials (1,1,1) etc. ??? means the materials don't have matching values (1,1,1) 1,1,0 etc.
The current version set's 

------------------------------------------------------------------
Version 1.0.0.6 Beta
New features:
Cat tune is partially implemented but quite unusable (and disabled). 
XPR export and rebuild.
XPR export works similar to xpression it extracts all dds, vtf and 1 mdl file from an xpr.
These files are in the same format as the version of xpression I found on ninjahacker.

Here is how to rebuild an XPR.
First you must extract the xpr. You can do this from the afs file, or directly from the xpr.
Now you edit the files. 
*** All I have successfully edited is dds files.
You can change from DXT1 to DXT5, change dimensions add alpha channels.
There is a size limit to the dds file, I think it's 64K. There may also be a size limit to the xpr.
Once you edit whatever your going to edit, you then open the original xpr (not inside afs)
You pick rebuild.
Then you pick the directory where all the files you extracted are (your edits will be here also)
You will then be prompted for a new name (you are creating a new file)
Seconds later you have a new xpr. Import into afs file (you will most likely need resize) and done.

Here is a step by step example.
1) extract c:\temp\yaya.xpr from c:\yoyo.afs
2) extract all objects from c:\temp\yaya.xpr into c:\temp\objects
3) edit c:\temp\objects\yaya00.dds, change from DXT1 to DXT4 add alpha channel
4) import c:\temp\objects into c:\temp\yaya.xpr output to c:\temp\new\yaya.xpr
5) import c:\temp\new into c:\yoyo.afs
6) Modify transparency information of yaya.xpr inside yoyo.afs (you won't need to change dimensions or type)

Potential Issues:
Size of dds is too big, I have seen garbage on the screen I think it's a buffer overflow.
Size of xpr is too big, same issue buffer overflow.
I have no way to edit vtf or mdl files, and cannot test if editing them works. There are potentially buffer
overflow issues with these objects also.

Problems I have seen. 
1) I took one of Christies 2 piece suits (peridot), and made 3 of the 4 textures DXT5 with alpha channels. 
I did not resize the dds files, they had been DXT1. I rebuilt the xpr, set transparency, and imported the xpr 
the afs. Part of the crotch area of the suit appears quite garbled as if the dds information was scrambled.

2) I took ayane's ay00 figure, and took the 10 and 11 dds images (body front and body back) and doubled there size. 
I left them at DXT1, no alpha channel, I just doubled the dimensions. After rebuilding, importing, and transferring, 
Ayane renders quite strangely. Her arms and hands, neck feet and shins rendered with the same garbled texture 
as the crotch area described above.

3) I took ayane's ay00 figure, and doubled the dimensions of all textures. Rebuild, Import, ftp.
This time when I tried to use the xpr, the game locked tight.

We are going to have to experiment here.


Fixed several "hidden" undocumented features (read BUGS)
*** THIS IS BETA CODE ***
DON'T WORK ON FILES YOU DON'T HAVE COPIES OF.

-------------------------------------------------------------------
Version 1.0.0.5 Beta
New features:
Property pages for some objects.
These are for hacking, you could severly munge your afs file so be careful.
If an object has property pages, when you right button the object properties will be in the menu.
If it's not there I havn't implemented property pages for that object.

Afs Import/Export complete.
    Files are exported/imported as follows:
    First occurence of file.ext will be exported/imported to/from file.ext.
    Subsequent occurences of file.ext will be exported/imported to/from file.nnn.ext
    Where nnn is the afs object number for this entry.
	Example.
	if mdHt99ht.xpr is the Yodel bathing suit on Hitomi, and it's the first occurence in the file,
	and mdHt99ht.xpr is the Yodel bathing suit for the Manequin, and it's the second occurence in the file and it's object # 234
	The files will be exported (and imported) as mdHt99ht.xpr and mdHt99ht.234.xpr

-------------------------------------------------------------------
Version 1.0.0.4 Beta

All functionality of xprtune with new resizeable dialogs.
Ability to export and import SAME sized objects into afs file (single objects not directorys)
Find feature, right click on afs file and find dialog will do a case insensitive search of all EXPANDED objects.
If you have not exploded the xpr container, then it won't find yoda.xpr.
Descriptions
There is a file objects.txt that contains descriptions of objects. This file is a simple text file, and you can add or
edit to your hearts content. The format is simple NAME{space}description NAME is case sensitive, so if you add 
"yoda.xpr Yoda in Venus bathing suit"
And there is a file Yoda.xpr in the afs file, it won't find it.
You can xprtune an xpr file while it is inside an afs file.

	


*****************************************************************************************************************
Thanks to everyone who helped with xprtune, and everyone at ninjahacker.net for your support.
Special thanks to _mirage_ a great deal of my xpr and afs (almost all of it) code is based on his work.
If you have problems, you can usually find me on ninjahacker.net
