Difference between revisions of "TRE:TRE Breakdown"
(→STF - '''STrings File (Language)''') |
m (Reverted edits by Viaron (talk) to last revision by ThePowerking) |
||
(85 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
+ | <div style="border:0; margin: 0.2em 10px 10px;"> | ||
+ | <div style="background:#f9f9f9; padding:0px; border:1px solid #aaaaaa; margin-bottom:5px;"> | ||
+ | <div style="line-height:120%; padding:0.4em; background-color:#eeeeee; border-bottom:1px solid #aaaaaa;"> | ||
+ | <span style="color:#cf7606; font-size:200%;">'''Welcome to''' </span><span style="color:#005288; font-size:200%;">'''SWGANH Tre Sub-Files Documentation'''</span> | ||
+ | </div> | ||
+ | {| style="zborder-top:1px solid #aaaaaa;" width="100% border-collapse: collapse;" cellpadding=0 cellspacing=0 | ||
+ | |- align="center" valign="top" | ||
+ | | style="padding: 0.2em;" width="25%" | '''[[TreFiles History]]''' '''[[TreFile Template]]''' | ||
+ | |} | ||
+ | </div> | ||
+ | </div> | ||
==ANS== | ==ANS== | ||
Line 15: | Line 26: | ||
{{Box_TREformats|APT ''format''| | {{Box_TREformats|APT ''format''| | ||
<pre> | <pre> | ||
+ | APT File Format links files to the .msh format either by directly going to the .msh filename or going to the .lod which then links to the .msh's | ||
+ | [code] | ||
+ | FORM -| | ||
+ | |-APT FORM-| | ||
+ | |-0000Name | ||
+ | [/code] | ||
+ | Inside "0000Name" | ||
+ | "Path to LOD/MSH"<Null Terminator> | ||
− | + | EG | |
+ | appearance/lod/con_gen_organic_hide.lod<NULL> | ||
+ | or | ||
+ | appearance/mesh/con_newbie_crate.msh<NULL> | ||
</pre> | </pre> | ||
}} | }} | ||
Line 32: | Line 54: | ||
}} | }} | ||
− | ==CDF - '''Client Data | + | ==CDF - '''Client Data File'''== |
{{Box_TREformats|CDF ''format''| | {{Box_TREformats|CDF ''format''| | ||
<pre> | <pre> | ||
+ | This file contains the items or objects are associated with another object. | ||
− | + | Example: Spawning a Basic Camp from shared_scout_camp_s01.iff calls the | |
+ | Client Data File shared_scout_camp_s01.cdf that contains the items that are spawned | ||
+ | automatically. 2 Torches, cot, stove, 2 pots, and the tent. Any other items that are | ||
+ | needed will have to be spawn manually. Normally these are items that the player can | ||
+ | interact with. Example Chairs, terminals. | ||
</pre> | </pre> | ||
Line 68: | Line 95: | ||
{{Box_TREformats|CMP ''format''| | {{Box_TREformats|CMP ''format''| | ||
<pre> | <pre> | ||
− | + | * Form:CMPA | |
− | + | o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) | |
+ | + Form:APPR (Same as one in mesh format.) | ||
+ | + Form:RADR (Optional) | ||
+ | + Record:PART (One or more records) | ||
+ | # Filename of part mesh: null terminated ascii name. (Can reference .lod or .msh files.) | ||
+ | # 3x4 transform matrix - 12 32-bit float With index 3,7, and 11 being the x, y and z translation component. | ||
</pre> | </pre> | ||
}} | }} | ||
− | ==DDS - '''DirectDraw Surface File (Texture)'''== | + | ==[[TRE_DDSFileType|DDS - '''DirectDraw Surface File (Texture)''']]== |
Line 133: | Line 165: | ||
{{Box_TREformats|IFF ''format''| | {{Box_TREformats|IFF ''format''| | ||
<pre> | <pre> | ||
+ | http://www.szonye.com/bradd/iff.html - Overview of File Format | ||
+ | http://www.ibm.com/developerworks/power/library/pa-spec16/ - alternative Overview | ||
+ | IFF Files are made up of Chunk(s). Each Chunk follows the format: | ||
+ | Type (4 x Char) | ||
+ | Size (32 Bit Int Big-Endian) | ||
+ | Data (Length determined by Size) | ||
+ | (NOTE: Data lengths which are odd numbers are padded by a '0' which is not included in the Size (for 2 byte alignment) | ||
+ | however, SOE *seems* to have ignored this requirement) | ||
+ | |||
+ | Chunks can contain other (child) Chunks, or even complete .IFF Files. | ||
+ | |||
+ | IFF Files must start with types of either: 'FORM' (0x464F524D), 'LIST' (0x4C495354) or 'CAT ' (0x43415420). | ||
+ | |||
+ | Strictly speaking, IFF Files must have a single Root Chunk in the file to keep to the Standard, | ||
+ | however it is expected that Top Level Chunk may potentially co-exist in SOEs IFFs. | ||
+ | |||
+ | It is currently believed that all SOE IFFs start with FORM (LIST and CAT not required). | ||
+ | |||
+ | FORM Types are basically storage (Record) for other proprietary Chunks. | ||
+ | |||
+ | Every SOE FORM has an additional 32bit Sub Type taking up offsets 8-11 ie: | ||
+ | Type (4 x Char) | ||
+ | Size (32 Bit Int Big-Endian) | ||
+ | Sub-Type (4x Char) | ||
+ | Data (Length determined by Size) | ||
+ | |||
+ | This means, for SOE FORMs, the data starts at offset 12, and is Size-4 long. | ||
+ | |||
+ | ~ Known SOE Proprietary Chunks ~ | ||
+ | CRCT - List of 32bit SOE CRCs, no delimeter | ||
+ | STNG - List of Strings, delimited by 0x00 | ||
+ | DATA - Some sort of Value. In Lists it appears to be an item count | ||
+ | STRT - Hash Table IDs, 32bit, no delimeter | ||
+ | EMAP - List of 3 No. Strings, delimited by 0x00. Appear to be Event Related. "EventSource\0EventDestination\0ClientEffect" | ||
+ | 0000 - List of Strings (generally Filenames), delimited by 0x00 | ||
+ | |||
+ | ~ Example ~ | ||
+ | An Example SOE .IFF (Misc\planet_crc_string_table.iff) | ||
+ | FORM (Length 524, Subtype CSTB [0x43535442]) | ||
+ | *FORM (Length 512, Subtype 0000 [0x30303030]) | ||
+ | **DATA (Length, 4) | ||
+ | **CRCT (Length 100) | ||
+ | **STRT (Length 100) | ||
+ | **STNG (Length 272) | ||
</pre> | </pre> | ||
}} | }} | ||
Line 143: | Line 219: | ||
{{Box_TREformats|ILF ''format''| | {{Box_TREformats|ILF ''format''| | ||
<pre> | <pre> | ||
+ | What is an ILF file? | ||
+ | |||
+ | An Interior layout file or ILF is an SWG hexadecimal file that contains information on the position of objects relative to the selected interior space/cell. TREE has inbuilt functions to assist with these files, The ILF editor will open when the 'Edit File' button is clicked. | ||
+ | |||
+ | The ILF editor has two panes, the navigation pane and the editing pane. | ||
+ | |||
+ | The editing pane has 3 sections; the object information section, the coordinates section and the rotation section. | ||
+ | |||
+ | |||
+ | Opening an ILF | ||
+ | |||
+ | An ILF can be opened through the use of the file pane when a TRE/TOC is loaded. If a TRE/TOC is not loaded, an external ILF can be loaded through the 'Open IFF/ILF/WS' dialog. | ||
+ | |||
+ | Navigating an ILF's nodes | ||
+ | |||
+ | TREE is developed to be user friendly and similar to the Windows Explorer interface, An ILF node can be navigated through the use of the keyboard or mouse. | ||
+ | |||
+ | Mouse | ||
+ | |||
+ | Clicking once on a FORM node will expand it, clicking on a sub-node will open it in the editing pane, in larger ILFs there may also be scroll bars at the side and bottom of the navigating pane. ILF nodes do not have drag and drop editing as the order of nodes does not matter. | ||
+ | |||
+ | Keyboard | ||
+ | Using the left and right arrow keys on a FORM node will expand and collapse it respectively. Using the Up and down arrow keys will navigate through sub-nodes, pressing the left arrow key with a sub-node selected will cause the FORM node it is in to collapse. | ||
+ | |||
+ | Adding an ILF node | ||
+ | |||
+ | ILF nodes may be added through the use of a keyboard shortcut (Check article 'Shortcuts') or by using the 'Add Node' button located above the navigation pane. | ||
+ | |||
+ | Deleting an ILF node | ||
+ | |||
+ | ILF nodes may be removed through the use of a keyboard shortcut (Check article 'Shortcuts') or by using the 'Remove Node' button located above the navigation pane when a node is selected. | ||
+ | |||
+ | Modifying an ILF node's Value | ||
+ | Object Information | ||
+ | This contains two editable values; Object and Cell. | ||
+ | The Object box is for the objects IFF's file path. | ||
+ | The Cell box is for the particular cell where the object will be placed inside an interior, a cell name can be found in game by pressing CTRL+SHIFT+G. | ||
+ | Coordinates | ||
+ | The Coordinates section has three editable values; The X axis value, the Y axis value and the Z axis value. These control the position of the item relative to the cell/interior space. | ||
+ | Rotation | ||
+ | The Rotation section contains 3 editable values; Pitch, Yaw and Roll. It also contains one button which will launch the matrix calculator. | ||
+ | Saving an ILF | ||
+ | ILFs are normally saved under the SWG root in the interior layout file. For example C:\Program Files/StarWarsGalaxies/Interiorlayout/ | ||
</pre> | </pre> | ||
}} | }} | ||
Line 169: | Line 288: | ||
}} | }} | ||
− | ==LAY - ''' | + | ==LAY - '''Layer File'''== |
{{Box_TREformats|LAY ''format''| | {{Box_TREformats|LAY ''format''| | ||
Line 200: | Line 319: | ||
[namestring] //0 terminated | [namestring] //0 terminated | ||
+ | |||
+ | Links to MGN meshes. | ||
+ | Basicly it applies level of detail to MGN's depending on how far away you are. | ||
+ | |||
+ | [code] | ||
+ | FORM-| | ||
+ | |-MLODFORM-| | ||
+ | |-0000INFO | ||
+ | |-NAME | ||
+ | [/code] | ||
+ | |||
+ | |||
+ | 0000INFO | ||
+ | <2 bytes> | ||
+ | |||
+ | 2 Bytes represent how many NAME Forms there are, so if its 01 00, then there is 1 NAME form, if its 02 00 then there is 2, if its 0A then there is 10. | ||
+ | |||
+ | |||
+ | NAME | ||
+ | File Path to the MGN with a NULL Terminator | ||
+ | |||
+ | EG | ||
+ | appearance/mesh/ackbar_l0.mgn<NULL> | ||
</pre> | </pre> | ||
}} | }} | ||
Line 207: | Line 349: | ||
{{Box_TREformats|LOD ''format''| | {{Box_TREformats|LOD ''format''| | ||
<pre> | <pre> | ||
+ | * This file, like most SWG files, is based on the IFF format. | ||
+ | * This overview will skip going into detail about the IFF format in general and focus purely on the organization of the LOD form. | ||
+ | * If a Form/Record appears multiple times I will only define it the first time, unless its structure differs. | ||
+ | * This file format is still being explored, so take this information as a guide and realize that some assumptions made here may be incorrect or missing details. | ||
+ | * NOTE: All values are little-endian, unless otherwise noted. | ||
− | + | * Form:DTLA | |
− | + | o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form, but always seems to be 5,6 or 7) | |
+ | + Form:APPR (Same as one in mesh format.) | ||
+ | + Record:PIVT | ||
+ | # Filename of ???: null terminated ascii name. (Always seems to be 1 byte of 0x0) | ||
+ | + Record:INFO (Lists ranges for switch in/out of child models. The block of 3 values repeats, one for each child model. No.0/In/Out, No.1/In/Out, ... Number of child nodes is infoRecordSize/12) | ||
+ | # Child Number: 32-bit unsigned int. | ||
+ | # Switch in range: 32-bit float. | ||
+ | # Switch out range: 32-bit float. | ||
+ | + Form:DATA | ||
+ | # Record:CHLD (One child per near/far value in INFO record. 1 or more ) | ||
+ | * Child number: 32-bit unsigned int | ||
+ | * Filename of child model: null terminated ascii name. If the filename does not start with appearance/ then it must be added. | ||
+ | + Form:RADR | ||
+ | # Record:INFO | ||
+ | * Num IDTL forms: 32-bit unsigned int | ||
+ | # Form:IDTL (0 or more) | ||
+ | * Record:VERT (Number of vertices is vertRecordSize/12.) | ||
+ | o x: 32-bit float. | ||
+ | o y: 32-bit float. | ||
+ | o z: 32-bit float. | ||
+ | * Record:INDX (List of indices defining triangles using the vertices from the VERT record. Number of indices is indxRecordSize/4.) | ||
+ | o index: 32-bit unsigned. | ||
+ | + Form:TEST | ||
+ | # Record:INFO | ||
+ | * Num IDTL forms: 32-bit unsigned int | ||
+ | # Form: IDTL (0 or more) | ||
+ | + Form:WRIT | ||
+ | # Record:INFO | ||
+ | * Num IDTL forms: 32-bit unsigned int | ||
+ | # Form: IDTL (0 or more) | ||
</pre> | </pre> | ||
}} | }} | ||
Line 224: | Line 400: | ||
MGN? File 3d model information | MGN? File 3d model information | ||
+ | |||
+ | {{Box_TREformats|MGN ''format''| | ||
+ | <pre> | ||
+ | rollout SWG_roll "Model importer" ( | ||
+ | fn readInvLong f = ( | ||
+ | t1 = readbyte f #unsigned | ||
+ | t2 = readbyte f #unsigned | ||
+ | t3 = readbyte f #unsigned | ||
+ | t4 = readbyte f #unsigned | ||
+ | return (t4+t3*0x100+t2*0x10000+t1*0x1000000) | ||
+ | ) | ||
+ | |||
+ | fn readFORM f = ( | ||
+ | ofsForm = readInvLong f | ||
+ | hdr = readlong f | ||
+ | return hdr | ||
+ | ) | ||
+ | |||
+ | fn readPoint3 f sc = ( | ||
+ | datasize = readInvLong f | ||
+ | PT3Ary = #() | ||
+ | testbyte = readlong f | ||
+ | fseek f -4 #seek_cur | ||
+ | if (testbyte<65536)AND(testbyte>=0) then ( | ||
+ | for i = 1 to (datasize/16) do ( | ||
+ | idx = 1 + (readlong f) | ||
+ | vx = (readfloat f) * sc | ||
+ | vy = (readfloat f) * sc | ||
+ | vz = (readfloat f) * sc | ||
+ | PT3Ary[idx] = [vx,-vz,vy] | ||
+ | ) | ||
+ | for i = 1 to PT3Ary.count do | ||
+ | if PT3Ary[i] == undefined then PT3Ary[i] = [0,0,0] | ||
+ | ) else ( | ||
+ | for i = 1 to (datasize/12) do ( | ||
+ | vx = (readfloat f) * sc | ||
+ | vy = (readfloat f) * sc | ||
+ | vz = (readfloat f) * sc | ||
+ | append PT3Ary [vx,-vz,vy] | ||
+ | ) | ||
+ | ) | ||
+ | return PT3Ary | ||
+ | ) | ||
+ | |||
+ | fn readTCSD f = ( | ||
+ | datasize = readInvLong f | ||
+ | PT2Ary = #() | ||
+ | for i = 1 to (datasize/8) do ( | ||
+ | vx = readfloat f | ||
+ | vy = 1- (readfloat f) | ||
+ | append PT2Ary [vx,vy,0] | ||
+ | ) | ||
+ | return PT2Ary | ||
+ | ) | ||
+ | |||
+ | fn readPIDX f = ( | ||
+ | IndexAry = #() | ||
+ | datasize = readInvLong f | ||
+ | numIndex = readlong f | ||
+ | for i = 1 to numIndex do append IndexAry (1+(readlong f)) | ||
+ | return IndexAry | ||
+ | ) | ||
+ | |||
+ | fn readNIDX f = ( | ||
+ | IndexAry = #() | ||
+ | datasize = readInvLong f | ||
+ | for i = 1 to (datasize/4) do append IndexAry (1+(readlong f)) | ||
+ | return IndexAry | ||
+ | ) | ||
+ | |||
+ | fn readOITL f = ( | ||
+ | IdxAry = #() | ||
+ | Int3Ary = #() | ||
+ | datasize = readInvLong f | ||
+ | numdata = readlong f | ||
+ | for i = 1 to numdata do ( | ||
+ | append IdxAry (1+(readshort f)) | ||
+ | f1 = 1 + (readlong f) | ||
+ | f2 = 1 + (readlong f) | ||
+ | f3 = 1 + (readlong f) | ||
+ | append Int3Ary [f1,f2,f3] | ||
+ | ) | ||
+ | return #(IdxAry,Int3Ary) | ||
+ | ) | ||
+ | |||
+ | fn readITL f = ( | ||
+ | Int3Ary = #() | ||
+ | datasize = readInvLong f | ||
+ | numdata = readlong f | ||
+ | for i = 1 to numdata do ( | ||
+ | f1 = 1 + (readlong f) | ||
+ | f2 = 1 + (readlong f) | ||
+ | f3 = 1 + (readlong f) | ||
+ | append Int3Ary [f1,f2,f3] | ||
+ | ) | ||
+ | return #(undefined,Int3Ary) | ||
+ | ) | ||
+ | |||
+ | fn buildmesh VTary FCary NLary UVary PIDXary NIDXary = ( | ||
+ | for i = 1 to PIDXary.count do PIDXary[i] = VTary[(PIDXary[i])] | ||
+ | for i = 1 to NIDXary.count do NIDXary[i] = NLary[(NIDXary[i])] | ||
+ | if FCary[1] == undefined then msh = mesh vertices:PIDXary faces:FCary[2] | ||
+ | else msh = mesh vertices:PIDXary faces:FCary[2] materialIDs:FCary[1] | ||
+ | msh.numTVerts = UVary.count | ||
+ | buildTVFaces msh | ||
+ | for j = 1 to UVary.count do setTVert msh j UVary[j] | ||
+ | for j = 1 to FCary[2].count do setTVFace msh j FCary[2][j] | ||
+ | for j = 1 to NIDXary.count do setNormal msh j NIDXary[j] | ||
+ | return msh | ||
+ | ) | ||
+ | ---------------------------------------------------------------------------- | ||
+ | fn readDATA f numData sc = ( | ||
+ | datasize = readInvLong f | ||
+ | if datasize < 8 then ( | ||
+ | fseek f datasize #seek_cur | ||
+ | return undefined | ||
+ | ) | ||
+ | VTary = #() | ||
+ | NLary = #() | ||
+ | UVary = #() | ||
+ | sizeElement = datasize/numData | ||
+ | --format "V:% @[%]\n" sizeElement (ftell f) | ||
+ | for i = 1 to numData do ( | ||
+ | vx = (readfloat f)*sc; vy = (readfloat f)*sc; vz = (readfloat f)*sc | ||
+ | nx = readfloat f; ny = readfloat f; nz = readfloat f | ||
+ | -- | ||
+ | byteRead = 32 | ||
+ | case sizeElement of ( | ||
+ | 36: ( readlong f ; byteRead = 36 ) | ||
+ | 52: ( readlong f ; byteRead = 36 ) | ||
+ | 56: ( fseek f 16 #seek_cur ; byteRead = 48 ) | ||
+ | default: byteRead = 32 | ||
+ | ) | ||
+ | vu = readfloat f; vv = 1-(readfloat f) | ||
+ | fseek f (sizeElement-byteRead) #seek_cur | ||
+ | -- | ||
+ | append VTary [vx,-vz,vy] | ||
+ | append NLary [nx,-nz,ny] | ||
+ | append UVary [vu,vv,0] | ||
+ | ) | ||
+ | return #(VTary,NLary,UVary) | ||
+ | ) | ||
+ | fn readINDX f = ( | ||
+ | FCary = #() | ||
+ | datasize = readInvLong f | ||
+ | numIndex = readlong f | ||
+ | sizeElement = datasize / numIndex | ||
+ | for i = 1 to (numIndex/3) do ( | ||
+ | if sizeElement == 2 then ( | ||
+ | f1 = 1 + (readshort f #unsigned) | ||
+ | f2 = 1 + (readshort f #unsigned) | ||
+ | f3 = 1 + (readshort f #unsigned) | ||
+ | ) else if sizeElement == 4 then ( | ||
+ | f1 = 1 + (readlong f #unsigned) | ||
+ | f2 = 1 + (readlong f #unsigned) | ||
+ | f3 = 1 + (readlong f #unsigned) | ||
+ | ) else messagebox "error in face index" | ||
+ | append FCary [f1,f2,f3] | ||
+ | ) | ||
+ | return FCary | ||
+ | ) | ||
+ | fn buildmesh2 VTary FCary NLary UVary = ( | ||
+ | msh = mesh vertices:VTary faces:FCary | ||
+ | msh.numTVerts = UVary.count | ||
+ | buildTVFaces msh | ||
+ | for j = 1 to UVary.count do setTVert msh j UVary[j] | ||
+ | for j = 1 to FCary.count do setTVFace msh j FCary[j] | ||
+ | for j = 1 to NLary.count do setNormal msh j NLary[j] | ||
+ | return msh | ||
+ | ) | ||
+ | |||
+ | --GUI-- | ||
+ | spinner fscale "Scale : " fieldwidth:60 range:[0.001, 1000, 1] | ||
+ | button impMGN "Import MGN / MSH" width:150 Height:25 align:#center | ||
+ | label lbl1 "" | ||
+ | label lbl2 "by Fatduck" align:#right | ||
+ | |||
+ | on impMGN pressed do ( | ||
+ | fname = getOpenFileName caption:"Select Star Wars Galaxies Model file" types:"MGN File (*.mgn)|*.mgn|MSH File (*.msh)|*.msh|All Files (*.*)|*.*|" | ||
+ | if fname != undefined then ( | ||
+ | f = fopen fname "rb" | ||
+ | fseek f 0 #seek_end | ||
+ | ofsEOF = ftell f | ||
+ | fseek f 0 #seek_set | ||
+ | VTary = #() | ||
+ | UVary = #() | ||
+ | NLary = #() | ||
+ | FCary = #() | ||
+ | PIDXary = #() | ||
+ | NIDXary = #() | ||
+ | meshFlag = undefined | ||
+ | infoFlag = undefined | ||
+ | mshVert = 0 | ||
+ | do ( | ||
+ | header = readlong f | ||
+ | case header of ( | ||
+ | 0x58444E49: | ||
+ | ( | ||
+ | FCary = readINDX f | ||
+ | msh = buildmesh2 VTary FCary NLary UVary | ||
+ | ) | ||
+ | 0x41544144: | ||
+ | ( | ||
+ | rslt = readDATA f mshVert fscale.value | ||
+ | if rslt != undefined then ( | ||
+ | VTary = rslt[1] | ||
+ | NLary = rslt[2] | ||
+ | UVary = rslt[3] | ||
+ | ) | ||
+ | infoFlag = false | ||
+ | ) | ||
+ | 0x4D524F46: | ||
+ | ( | ||
+ | flg = readFORM f | ||
+ | if flg == 0x474D4B53 then meshFlag = true --SKMG | ||
+ | else if flg == 0x20544C42 then meshFlag = false --BLT | ||
+ | if flg == 0x41585456 then infoFlag = true --VTXA | ||
+ | ) | ||
+ | 0x4F464E49: | ||
+ | ( | ||
+ | if infoFlag == true then ( | ||
+ | fseek f 8 #seek_cur | ||
+ | mshVert = readlong f | ||
+ | ) else fseek f (readInvLong f) #seek_cur | ||
+ | ) | ||
+ | 0x4E534F50: | ||
+ | ( | ||
+ | if meshFlag == true then VTary = readPoint3 f fscale.value | ||
+ | else readPoint3 f fscale.value | ||
+ | ) | ||
+ | 0x4D524F4E: | ||
+ | ( | ||
+ | if meshFlag == true then NLary = readPoint3 f 1 | ||
+ | else readPoint3 f 1 | ||
+ | ) | ||
+ | 0x58444950: PIDXary = readPIDX f | ||
+ | 0x5844494E: NIDXary = readNIDX f | ||
+ | 0x44534354: UVary = readTCSD f | ||
+ | 0x4C54494F: | ||
+ | ( | ||
+ | FCary = readOITL f | ||
+ | msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary | ||
+ | ) | ||
+ | 0x204C5449: | ||
+ | ( | ||
+ | FCary = readITL f | ||
+ | msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary | ||
+ | ) | ||
+ | default: | ||
+ | ( | ||
+ | datasize = readInvLong f | ||
+ | fseek f datasize #seek_cur | ||
+ | ) | ||
+ | )--end case | ||
+ | ) while (ftell f) != ofsEOF | ||
+ | fclose f | ||
+ | )--end if fname | ||
+ | )--end on impMGN | ||
+ | |||
+ | )--end rollout SWG_roll | ||
+ | |||
+ | if Fatduck_SWG != undefined then closeRolloutFloater Fatduck_SWG | ||
+ | Fatduck_SWG = newRolloutFloater "Star Wars Galaxies" 200 175 10 70 | ||
+ | addRollout SWG_roll Fatduck_SWG | ||
+ | </pre> | ||
+ | }} | ||
==MKR== | ==MKR== | ||
Line 234: | Line 676: | ||
==MSH - '''mesh'''== | ==MSH - '''mesh'''== | ||
+ | {{Box_TREformats|MSH ''file breakdown''| | ||
+ | <pre> | ||
+ | This file, like most SWG files, is based on the IFF format. | ||
+ | This overview will skip going into detail about the IFF format in general and focus purely on the organization of the MESH form. | ||
+ | If a Form/Record appears multiple times I will only define it the first time, unless its structure differs. | ||
+ | This file format is still being explored, so take this information as a guide and realize that some assumptions made here may be incorrect or missing details. | ||
+ | If you discover something I missed or have an error correction, please send a message Xunil on the swgemu forums. | ||
+ | NOTE: All values are little-endian, unless otherwise noted. | ||
+ | |||
+ | Form:MESH | ||
+ | Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) | ||
+ | Form:APPR | ||
+ | Form:0003 | ||
+ | Form:EXBX (Bounding box) 1 or more required. | ||
+ | Form:0001 | ||
+ | Form:EXSP (Bounding sphere.) | ||
+ | Form:0001 | ||
+ | Record:SPHR | ||
+ | Record:BOX | ||
+ | Form:NULL | ||
+ | Form:EXSP (Optional additional Bounding sphere. Same format as previous.) | ||
+ | Form:XCYL | ||
+ | Form:0000 | ||
+ | Record:CYLN | ||
+ | Form:CMPT | ||
+ | Form:0000 | ||
+ | Form:CPST | ||
+ | Form:0000 | ||
+ | Form:CMSH (Coming soon.) | ||
+ | Form:CMPT (Coming soon.) | ||
+ | Form:EXBX | ||
+ | Form:EXSP | ||
+ | Form:XCYL | ||
+ | Form:CMSH (Coming soon.) | ||
+ | Form:DTAL (Coming soon.) | ||
+ | Form:HPTS (List of 0 or more attach point records.) | ||
+ | Record:HPNT | ||
+ | Form:FLOR | ||
+ | Form:DATA | ||
+ | Size of floor filename(including NULL): unsigned char | ||
+ | Floor filename - null terminated ascii string. | ||
+ | Form:INFO (Not sure yet.) | ||
+ | Form:SPS | ||
+ | Form:000# | ||
+ | Record:CNT | ||
+ | numGeode - 32-bit unsigned int. | ||
+ | Form:000# (In this case the # is the number of this geometry subtree) | ||
+ | Record:NAME | ||
+ | Shader Filename - NULL terminated ascii string. | ||
+ | Record:INFO | ||
+ | Unknown(num geometry forms?) - 32-bit unsigned int. | ||
+ | Form:000# | ||
+ | Record:INFO | ||
+ | Unknown - 32-bit unsigned int. | ||
+ | Unknown - 16-bit unsigned short. | ||
+ | FORM:VTXA | ||
+ | FORM:000# | ||
+ | Record:INFO | ||
+ | Unknown(FVF flags?) - 32-bit unsigned int. | ||
+ | numVertices - 32-bit unsigned short. | ||
+ | Record:DATA | ||
+ | Vertex Data | ||
+ | Record:INDX | ||
+ | Vertex indices | ||
+ | Record:SIDX (Optional) | ||
+ | Secondary vertex indices | ||
+ | Record:SPHR - Defines a sphere. | ||
+ | Sphere center xyz - 3 32-bit float. | ||
+ | Sphere radius - 32-bit float. | ||
+ | Record:BOX - Defines a box. | ||
+ | First corner xyz - 3 32-bit float. | ||
+ | Second corner xyz - 3 32-bit float. | ||
+ | Record:CYLN - Defines a cylinder. | ||
+ | Base xyz, radius, height?- 5 32-bit float. | ||
+ | Record:HPNT - Attach point. | ||
+ | 3 row x 4 col transform matrix - 12 32-bit float. | ||
+ | Null terminated ascii name - remainder of HPNT record size. | ||
+ | Vertex data | ||
+ | Before reading the vertex data the bytes per vertex needs to be computed. | ||
+ | BPV = (vertex DATA record size)/numVertices. | ||
+ | The observed vertex formats seen are as follows: | ||
+ | 32 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | 36 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | color argb - 4 unsigned char. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | 40 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | 44 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | color argb - 4 unsigned char. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | 48 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | 52 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | color argb - 4 unsigned char. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | 56 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | tex coords 3 uv - 2 32-bit floats. | ||
+ | 60 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | color argb - 4 unsigned char. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | tex coords 3 uv - 2 32-bit floats. | ||
+ | 64 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | tex coords 3 uv - 2 32-bit floats. | ||
+ | tex coords 4 uv - 2 32-bit floats. | ||
+ | 68 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | color argb - 4 unsigned char. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | tex coords 3 uv - 2 32-bit floats. | ||
+ | tex coords 4 uv - 2 32-bit floats. | ||
+ | 72 bpv | ||
+ | position xyz - 3 32-bit floats. | ||
+ | normal xyz - 3 32-bit floats. | ||
+ | tex coords 0 uv - 2 32-bit floats. | ||
+ | tex coords 1 uv - 2 32-bit floats. | ||
+ | tex coords 2 uv - 2 32-bit floats. | ||
+ | tex coords 3 uv - 2 32-bit floats. | ||
+ | tex coords 4 uv - 2 32-bit floats. | ||
+ | tex coords 5 uv - 2 32-bit floats. | ||
+ | Vertex index | ||
+ | Before reading the vertex indices the bytes per index needs to be computed. | ||
+ | BPI = (INDX record size - 4)/numIndices. | ||
+ | After the bpi is computed, the rest of the record is a series of unsigned short or unsigned int values that reference the vertices defined in the vertex DATA record. | ||
+ | So index 0,1,2 = triangle 0, index 3,4,5 = triangle 1, ... | ||
+ | |||
+ | Secondary Vertex index | ||
+ | Number of matrix/index/triangle sets: 32-bit unsigned int. | ||
+ | Matrix/index/triangle set. | ||
+ | Rotations? - 3 32-bit floats. | ||
+ | Number of indices: - 32-bit unsigned int. | ||
+ | Index: Same datatype as primary vertex index. | ||
+ | </pre> | ||
+ | }} | ||
{{Box_TREformats|MSH ''format''| | {{Box_TREformats|MSH ''format''| | ||
<pre> | <pre> | ||
+ | rollout SWG_roll "Model importer" ( | ||
+ | fn readInvLong f = ( | ||
+ | t1 = readbyte f #unsigned | ||
+ | t2 = readbyte f #unsigned | ||
+ | t3 = readbyte f #unsigned | ||
+ | t4 = readbyte f #unsigned | ||
+ | return (t4+t3*0x100+t2*0x10000+t1*0x1000000) | ||
+ | ) | ||
+ | |||
+ | fn readFORM f = ( | ||
+ | ofsForm = readInvLong f | ||
+ | hdr = readlong f | ||
+ | return hdr | ||
+ | ) | ||
+ | |||
+ | fn readPoint3 f sc = ( | ||
+ | datasize = readInvLong f | ||
+ | PT3Ary = #() | ||
+ | testbyte = readlong f | ||
+ | fseek f -4 #seek_cur | ||
+ | if (testbyte<65536)AND(testbyte>=0) then ( | ||
+ | for i = 1 to (datasize/16) do ( | ||
+ | idx = 1 + (readlong f) | ||
+ | vx = (readfloat f) * sc | ||
+ | vy = (readfloat f) * sc | ||
+ | vz = (readfloat f) * sc | ||
+ | PT3Ary[idx] = [vx,-vz,vy] | ||
+ | ) | ||
+ | for i = 1 to PT3Ary.count do | ||
+ | if PT3Ary[i] == undefined then PT3Ary[i] = [0,0,0] | ||
+ | ) else ( | ||
+ | for i = 1 to (datasize/12) do ( | ||
+ | vx = (readfloat f) * sc | ||
+ | vy = (readfloat f) * sc | ||
+ | vz = (readfloat f) * sc | ||
+ | append PT3Ary [vx,-vz,vy] | ||
+ | ) | ||
+ | ) | ||
+ | return PT3Ary | ||
+ | ) | ||
+ | |||
+ | fn readTCSD f = ( | ||
+ | datasize = readInvLong f | ||
+ | PT2Ary = #() | ||
+ | for i = 1 to (datasize/8) do ( | ||
+ | vx = readfloat f | ||
+ | vy = 1- (readfloat f) | ||
+ | append PT2Ary [vx,vy,0] | ||
+ | ) | ||
+ | return PT2Ary | ||
+ | ) | ||
+ | |||
+ | fn readPIDX f = ( | ||
+ | IndexAry = #() | ||
+ | datasize = readInvLong f | ||
+ | numIndex = readlong f | ||
+ | for i = 1 to numIndex do append IndexAry (1+(readlong f)) | ||
+ | return IndexAry | ||
+ | ) | ||
+ | |||
+ | fn readNIDX f = ( | ||
+ | IndexAry = #() | ||
+ | datasize = readInvLong f | ||
+ | for i = 1 to (datasize/4) do append IndexAry (1+(readlong f)) | ||
+ | return IndexAry | ||
+ | ) | ||
+ | |||
+ | fn readOITL f = ( | ||
+ | IdxAry = #() | ||
+ | Int3Ary = #() | ||
+ | datasize = readInvLong f | ||
+ | numdata = readlong f | ||
+ | for i = 1 to numdata do ( | ||
+ | append IdxAry (1+(readshort f)) | ||
+ | f1 = 1 + (readlong f) | ||
+ | f2 = 1 + (readlong f) | ||
+ | f3 = 1 + (readlong f) | ||
+ | append Int3Ary [f1,f2,f3] | ||
+ | ) | ||
+ | return #(IdxAry,Int3Ary) | ||
+ | ) | ||
+ | |||
+ | fn readITL f = ( | ||
+ | Int3Ary = #() | ||
+ | datasize = readInvLong f | ||
+ | numdata = readlong f | ||
+ | for i = 1 to numdata do ( | ||
+ | f1 = 1 + (readlong f) | ||
+ | f2 = 1 + (readlong f) | ||
+ | f3 = 1 + (readlong f) | ||
+ | append Int3Ary [f1,f2,f3] | ||
+ | ) | ||
+ | return #(undefined,Int3Ary) | ||
+ | ) | ||
+ | |||
+ | fn buildmesh VTary FCary NLary UVary PIDXary NIDXary = ( | ||
+ | for i = 1 to PIDXary.count do PIDXary[i] = VTary[(PIDXary[i])] | ||
+ | for i = 1 to NIDXary.count do NIDXary[i] = NLary[(NIDXary[i])] | ||
+ | if FCary[1] == undefined then msh = mesh vertices:PIDXary faces:FCary[2] | ||
+ | else msh = mesh vertices:PIDXary faces:FCary[2] materialIDs:FCary[1] | ||
+ | msh.numTVerts = UVary.count | ||
+ | buildTVFaces msh | ||
+ | for j = 1 to UVary.count do setTVert msh j UVary[j] | ||
+ | for j = 1 to FCary[2].count do setTVFace msh j FCary[2][j] | ||
+ | for j = 1 to NIDXary.count do setNormal msh j NIDXary[j] | ||
+ | return msh | ||
+ | ) | ||
+ | ---------------------------------------------------------------------------- | ||
+ | fn readDATA f numData sc = ( | ||
+ | datasize = readInvLong f | ||
+ | if datasize < 8 then ( | ||
+ | fseek f datasize #seek_cur | ||
+ | return undefined | ||
+ | ) | ||
+ | VTary = #() | ||
+ | NLary = #() | ||
+ | UVary = #() | ||
+ | sizeElement = datasize/numData | ||
+ | --format "V:% @[%]\n" sizeElement (ftell f) | ||
+ | for i = 1 to numData do ( | ||
+ | vx = (readfloat f)*sc; vy = (readfloat f)*sc; vz = (readfloat f)*sc | ||
+ | nx = readfloat f; ny = readfloat f; nz = readfloat f | ||
+ | -- | ||
+ | byteRead = 32 | ||
+ | case sizeElement of ( | ||
+ | 36: ( readlong f ; byteRead = 36 ) | ||
+ | 52: ( readlong f ; byteRead = 36 ) | ||
+ | 56: ( fseek f 16 #seek_cur ; byteRead = 48 ) | ||
+ | default: byteRead = 32 | ||
+ | ) | ||
+ | vu = readfloat f; vv = 1-(readfloat f) | ||
+ | fseek f (sizeElement-byteRead) #seek_cur | ||
+ | -- | ||
+ | append VTary [vx,-vz,vy] | ||
+ | append NLary [nx,-nz,ny] | ||
+ | append UVary [vu,vv,0] | ||
+ | ) | ||
+ | return #(VTary,NLary,UVary) | ||
+ | ) | ||
+ | fn readINDX f = ( | ||
+ | FCary = #() | ||
+ | datasize = readInvLong f | ||
+ | numIndex = readlong f | ||
+ | sizeElement = datasize / numIndex | ||
+ | for i = 1 to (numIndex/3) do ( | ||
+ | if sizeElement == 2 then ( | ||
+ | f1 = 1 + (readshort f #unsigned) | ||
+ | f2 = 1 + (readshort f #unsigned) | ||
+ | f3 = 1 + (readshort f #unsigned) | ||
+ | ) else if sizeElement == 4 then ( | ||
+ | f1 = 1 + (readlong f #unsigned) | ||
+ | f2 = 1 + (readlong f #unsigned) | ||
+ | f3 = 1 + (readlong f #unsigned) | ||
+ | ) else messagebox "error in face index" | ||
+ | append FCary [f1,f2,f3] | ||
+ | ) | ||
+ | return FCary | ||
+ | ) | ||
+ | fn buildmesh2 VTary FCary NLary UVary = ( | ||
+ | msh = mesh vertices:VTary faces:FCary | ||
+ | msh.numTVerts = UVary.count | ||
+ | buildTVFaces msh | ||
+ | for j = 1 to UVary.count do setTVert msh j UVary[j] | ||
+ | for j = 1 to FCary.count do setTVFace msh j FCary[j] | ||
+ | for j = 1 to NLary.count do setNormal msh j NLary[j] | ||
+ | return msh | ||
+ | ) | ||
+ | |||
+ | --GUI-- | ||
+ | spinner fscale "Scale : " fieldwidth:60 range:[0.001, 1000, 1] | ||
+ | button impMGN "Import MGN / MSH" width:150 Height:25 align:#center | ||
+ | label lbl1 "" | ||
+ | label lbl2 "by Fatduck" align:#right | ||
+ | on impMGN pressed do ( | ||
+ | fname = getOpenFileName caption:"Select Star Wars Galaxies Model file" types:"MGN File (*.mgn)|*.mgn|MSH File (*.msh)|*.msh|All Files (*.*)|*.*|" | ||
+ | if fname != undefined then ( | ||
+ | f = fopen fname "rb" | ||
+ | fseek f 0 #seek_end | ||
+ | ofsEOF = ftell f | ||
+ | fseek f 0 #seek_set | ||
+ | VTary = #() | ||
+ | UVary = #() | ||
+ | NLary = #() | ||
+ | FCary = #() | ||
+ | PIDXary = #() | ||
+ | NIDXary = #() | ||
+ | meshFlag = undefined | ||
+ | infoFlag = undefined | ||
+ | mshVert = 0 | ||
+ | do ( | ||
+ | header = readlong f | ||
+ | case header of ( | ||
+ | 0x58444E49: | ||
+ | ( | ||
+ | FCary = readINDX f | ||
+ | msh = buildmesh2 VTary FCary NLary UVary | ||
+ | ) | ||
+ | 0x41544144: | ||
+ | ( | ||
+ | rslt = readDATA f mshVert fscale.value | ||
+ | if rslt != undefined then ( | ||
+ | VTary = rslt[1] | ||
+ | NLary = rslt[2] | ||
+ | UVary = rslt[3] | ||
+ | ) | ||
+ | infoFlag = false | ||
+ | ) | ||
+ | 0x4D524F46: | ||
+ | ( | ||
+ | flg = readFORM f | ||
+ | if flg == 0x474D4B53 then meshFlag = true --SKMG | ||
+ | else if flg == 0x20544C42 then meshFlag = false --BLT | ||
+ | if flg == 0x41585456 then infoFlag = true --VTXA | ||
+ | ) | ||
+ | 0x4F464E49: | ||
+ | ( | ||
+ | if infoFlag == true then ( | ||
+ | fseek f 8 #seek_cur | ||
+ | mshVert = readlong f | ||
+ | ) else fseek f (readInvLong f) #seek_cur | ||
+ | ) | ||
+ | 0x4E534F50: | ||
+ | ( | ||
+ | if meshFlag == true then VTary = readPoint3 f fscale.value | ||
+ | else readPoint3 f fscale.value | ||
+ | ) | ||
+ | 0x4D524F4E: | ||
+ | ( | ||
+ | if meshFlag == true then NLary = readPoint3 f 1 | ||
+ | else readPoint3 f 1 | ||
+ | ) | ||
+ | 0x58444950: PIDXary = readPIDX f | ||
+ | 0x5844494E: NIDXary = readNIDX f | ||
+ | 0x44534354: UVary = readTCSD f | ||
+ | 0x4C54494F: | ||
+ | ( | ||
+ | FCary = readOITL f | ||
+ | msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary | ||
+ | ) | ||
+ | 0x204C5449: | ||
+ | ( | ||
+ | FCary = readITL f | ||
+ | msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary | ||
+ | ) | ||
+ | default: | ||
+ | ( | ||
+ | datasize = readInvLong f | ||
+ | fseek f datasize #seek_cur | ||
+ | ) | ||
+ | )--end case | ||
+ | ) while (ftell f) != ofsEOF | ||
+ | fclose f | ||
+ | )--end if fname | ||
+ | )--end on impMGN | ||
+ | )--end rollout SWG_roll | ||
+ | if Fatduck_SWG != undefined then closeRolloutFloater Fatduck_SWG | ||
+ | Fatduck_SWG = newRolloutFloater "Star Wars Galaxies" 200 175 10 70 | ||
+ | addRollout SWG_roll Fatduck_SWG | ||
</pre> | </pre> | ||
}} | }} | ||
Line 406: | Line 1,275: | ||
==POB== | ==POB== | ||
− | + | <pre> | |
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 02 d3 // 723 Form Count | ||
+ | 43 45 4c 4c 46 4f 52 4d // CELLFORM | ||
+ | 00 00 02 c7 // 711 count to end of form | ||
+ | 30 30 30 35 44 41 54 41 // 0005DATA | ||
+ | 00 00 00 a9 | ||
+ | 04 00 00 00 | ||
+ | 00 | ||
+ | 6d 61 69 6e 68 61 6e 67 61 72 // mainhangar | ||
+ | 00 | ||
+ | 61 70 70 65 61 72 61 6e 63 65 2f 6d 65 73 68 2f // appearance/mesh/ | ||
+ | 74 68 6d 5f 73 70 63 5f 73 74 61 72 5f 64 65 73 // thm_spc_star_des | ||
+ | 74 72 6f 79 65 72 5f 73 30 31 5f 72 31 5f 6d 61 // troyer_s01_r1_ma | ||
+ | 69 6e 68 61 6e 67 61 72 5f 6d 65 73 68 5f 72 31 // inhangar_mesh_r1 | ||
+ | 2e 6d 73 68 // .msh | ||
+ | 00 01 | ||
+ | 61 70 70 65 61 72 61 6e 63 65 // appearance | ||
+ | 2f 63 6f 6c 6c 69 73 69 6f 6e 2f 74 68 6d 5f 73 // /collision/thm_s | ||
+ | 70 63 5f 73 74 61 72 5f 64 65 73 74 72 6f 79 65 // pc_star_destroye | ||
+ | 72 5f 73 30 31 5f 72 31 5f 6d 61 69 6e 68 61 6e // r_s01_r1_mainhan | ||
+ | 67 61 72 5f 63 6f 6c 6c 69 73 69 6f 6e 5f 66 6c // gar_collision_fl | ||
+ | 6f 6f 72 30 2e 66 6c 72 // oor0.flr | ||
+ | 00 | ||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 04 | ||
+ | 4e 55 4c 4c 46 4f 52 4d // NULLFORM | ||
+ | 00 00 00 | ||
+ | 48 50 52 54 4c 30 30 30 34 // HPRTL0004 | ||
+ | 00 00 00 3c | ||
+ | 01 02 00 00 | ||
+ | 00 01 0c 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 46 4f 52 4d // FROM | ||
+ | 00 00 00 | ||
+ | 48 50 52 54 4c 30 30 30 34 // HPRTL0004 | ||
+ | 00 00 00 3c | ||
+ | 01 03 00 00 | ||
+ | 00 01 0a 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 | ||
+ | 48 50 52 54 4c 30 30 30 34 // HPRTL0004 | ||
+ | 00 00 00 3c | ||
+ | 01 04 00 00 | ||
+ | 00 01 09 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 | ||
+ | 48 50 52 54 4c 30 30 30 34 // HPRTL0004 | ||
+ | 00 00 00 3c | ||
+ | 01 05 00 00 | ||
+ | 00 01 02 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 4c 47 48 54 // LGHT | ||
+ | 00 00 00 be // 190 | ||
+ | 02 00 00 00 | ||
+ | 01 00 00 00 | ||
+ | 00 | ||
+ | 01 45 b3 3f // 1.40 R Lighting Color Like sun light but only shows on toon | ||
+ | 0a d7 b3 3f // 1.40 B Lighting Color | ||
+ | fe cf a5 3f // 1.30 G Lighting Color | ||
+ | 00 00 00 00 | ||
+ | 01 45 b3 3f // 1.40 R Lighting Color | ||
+ | 0a d7 b3 3f // 1.40 B Lighting Color | ||
+ | fe cf a5 3f // 1.30 G Lighting Color | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 80 | ||
+ | 00 00 00 80 | ||
+ | 00 f6 f3 be // -0.48 | ||
+ | 11 12 61 3f // 0.88 | ||
+ | 78 a0 51 43 // 209.63 | ||
+ | 00 00 00 00 | ||
+ | 11 12 61 bf // 0.88 | ||
+ | 00 f6 f3 be // -0.48 | ||
+ | 67 08 a8 c2 // -84.02 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 01 00 00 00 | ||
+ | 00 | ||
+ | d5 3e 97 3f // 1.18 R Lighting Color Like sun light but only shows on toon | ||
+ | 9e fb ad 3f // 1.36 B Lighting Color | ||
+ | 0a d7 b3 3f // 1.40 G Lighting Color | ||
+ | 00 00 00 00 | ||
+ | d5 3e 97 3f // 1.18 R Lighting Color | ||
+ | 9e fb ad 3f // 1.36 B Lighting Color | ||
+ | 0a d7 b3 3f // 1.40 G Lighting Color | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 80 | ||
+ | 00 00 00 00 | ||
+ | c2 19 f4 3e // 0.48 | ||
+ | 60 08 61 3f // 0.88 | ||
+ | 78 a0 51 43 // 209.63 | ||
+ | 00 00 00 00 | ||
+ | 60 08 61 bf // -0.88 | ||
+ | c2 19 f4 3e // 0.48 | ||
+ | 67 43 a3 c2 // -81.63 | ||
+ | 00 00 80 3f // 1 | ||
+ | 00 00 00 00 | ||
+ | 00 00 00 | ||
+ | </pre> | ||
==PRT== | ==PRT== | ||
Line 420: | Line 1,442: | ||
Playback File | Playback File | ||
− | ==QST== | + | ==[[TRE_QSTFileType|QST - '''QueST files''']]== |
− | + | QueST files are XML files describing journal quests. [[TRE_QSTFileType|Let's examine them here.]] | |
− | + | ||
==SAT== | ==SAT== | ||
Line 481: | Line 1,502: | ||
7B D6 12 E7 //?? | 7B D6 12 E7 //?? | ||
+ | |||
+ | |||
+ | SAT Format is used for linking MGN together with its Skeleton and Lat File (Lat File is a List of Animations) | ||
+ | |||
+ | |||
+ | [code] | ||
+ | FORM-| | ||
+ | |-SMATFORM-| | ||
+ | |-0003INFO | ||
+ | |-MSGN | ||
+ | |-SKTI | ||
+ | |-LATX | ||
+ | [/code] | ||
+ | |||
+ | Note: Sometimes it may have an extra FORM inside SMATFORM which will not be added to this documentation for now. | ||
+ | |||
+ | |||
+ | 0003INFO: | ||
+ | Structure: | ||
+ | <4 Byte> <4 Bytes> <1 Byte> | ||
+ | |||
+ | First 4 Bytes Represents how many lmg's there will be in the MSGN Format (LMG's link to MGN's) | ||
+ | Next 4 Bytes Represent How many Skeletons there are in the SKTI Format | ||
+ | Last Represents if a LATX Exists or not (00 or 01), if it doesn't then the LATX FORM Isn't needed. | ||
+ | |||
+ | MSGN: | ||
+ | File Path to the Appearance with a NULL Terminator | ||
+ | EG | ||
+ | appearance/mesh/bocatt_hue.lmg<NULL> | ||
+ | |||
+ | SKTI: | ||
+ | Links the Skeleton in and has a reference to the part of the body the Skeleton affects. | ||
+ | EG (note this has 2 Skeletons in) | ||
+ | appearance/skeleton/all_b.skt<NULL><NULL>appearance/skeleton/hum_m_face.skt<NULL>head<NULL> | ||
+ | |||
+ | The Face Skeleton only affects the head and is mentioned, where all_b.skt affects the entire body so its left "blank" | ||
+ | |||
+ | |||
+ | LATX: | ||
+ | First 2 bytes represent how many LATS & Skeletons will be in the file. | ||
+ | This Example has two (first two bytes are 02 00) | ||
+ | |||
+ | appearance/skeleton/all_b.skt<NULL>appearance/lat/all_m.lat<NULL> | ||
+ | appearance/skeleton/hum_m_face.skt<NULL>appearance/lat/hum_m_face.lat<NULL> | ||
+ | |||
+ | |||
+ | Links the Skeleton up with the Animation List. | ||
</pre> | </pre> | ||
}} | }} | ||
Line 486: | Line 1,554: | ||
==SFK== | ==SFK== | ||
− | SFK | + | {{Box_TREformats|SFK ''format''| |
+ | <pre> | ||
+ | SFK - Usually Used in Sound Forge/Sony Vegas | ||
− | + | Only exists in data_other and patch_01 | |
− | SFP | + | |
+ | Probably only there due to someone forgetting to "clean" it out when packing it (Suggested by someone else, makes the most sense) | ||
+ | </pre> | ||
+ | }} | ||
+ | |||
+ | ==SFP - Building Foot Print== | ||
+ | |||
+ | This file contains the info on building Footprints. One Block in game is 8m x 8m. | ||
+ | Still a few Unknowns | ||
+ | <pre> | ||
+ | Player Merchant Tent uses a 3 x 3 block | ||
+ | |||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 44 // total byte count | ||
+ | 46 4f 4f 54 46 4f 52 4d// FOOTFORM | ||
+ | 00 00 00 38 // byte count to end | ||
+ | 30 30 30 30 // UNK | ||
+ | 49 4e 46 4f // INFO | ||
+ | 00 00 00 18 // byte count for next section | ||
+ | 03 00 00 00 // 3 blocks | ||
+ | 03 00 00 00 // 3 blocks | ||
+ | 01 00 00 00 // UNK | ||
+ | 01 00 00 00 // UNK | ||
+ | 00 00 80 40 // float 4 | ||
+ | 00 00 80 40 // float 4 | ||
+ | 50 52 4e 54 // PRNT | ||
+ | 00 00 00 0c // byte count for next section | ||
+ | 48 46 48 00 // HFH | ||
+ | 46 46 46 00 // FFF | ||
+ | 48 46 48 00 // HFH | ||
+ | |||
+ | Small Tatooine House uses a 3 x 4 block | ||
+ | |||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 48 // total byte count | ||
+ | 46 4f 4f 54 46 4f 52 4d // FOOTFORM | ||
+ | 00 00 00 3c // byte count to end | ||
+ | 30 30 30 30 // UNK | ||
+ | 49 4e 46 4f // INFO | ||
+ | 00 00 00 18 // byte count for next section | ||
+ | 03 00 00 00 // 3 blocks | ||
+ | 04 00 00 00 // 4 blocks | ||
+ | 01 00 00 00 // UNK | ||
+ | 01 00 00 00 // UNK | ||
+ | 00 00 00 41 // float 8 | ||
+ | 00 00 00 41 // float 8 | ||
+ | 50 52 4e 54 // PRNT | ||
+ | 00 00 00 10 // byte count for next section | ||
+ | 48 48 48 00 // HHH | ||
+ | 46 46 46 00 // FFF | ||
+ | 46 46 46 00 // FFF | ||
+ | 46 46 46 00 // FFF | ||
+ | |||
+ | Med Tatooine House uses a 5 x 5 block | ||
+ | |||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 56 // total byte count | ||
+ | 46 4f 4f 54 46 4f 52 4d // FOOTFORM | ||
+ | 00 00 00 4a // byte count to end | ||
+ | 30 30 30 30 // unk | ||
+ | 49 4e 46 4f // INFO | ||
+ | 00 00 00 18 // byte count for next section | ||
+ | 05 00 00 00 // 5 blocks | ||
+ | 05 00 00 00 // 5 blocks | ||
+ | 02 00 00 00 // UNK | ||
+ | 02 00 00 00 // UNK | ||
+ | 00 00 00 41 // float 8 | ||
+ | 00 00 00 41 // float 8 | ||
+ | 50 52 4e 54 // PRNT | ||
+ | 00 00 00 1e // byte count for next section | ||
+ | 48 48 48 48 48 00 // HHHHH | ||
+ | 48 46 46 46 48 00 // HFFFH | ||
+ | 48 46 46 46 48 00 // HFFFH | ||
+ | 48 46 46 46 48 00 // HFFFH | ||
+ | 48 48 48 48 48 00 // HHHHH | ||
+ | |||
+ | |||
+ | Generic PA Hall uses a 7 x 8 block | ||
+ | |||
+ | 46 4f 52 4d // FORM | ||
+ | 00 00 00 78 // total byte count | ||
+ | 46 4f 4f 54 46 4f 52 4d // FOOTFORM | ||
+ | 00 00 00 6c // byte count to end | ||
+ | 30 30 30 30 // UNK | ||
+ | 49 4e 46 4f // INFO | ||
+ | 00 00 00 18 // byte count for next section | ||
+ | 07 00 00 00 // 7 blocks | ||
+ | 08 00 00 00 // 8 blocks | ||
+ | 03 00 00 00 // UNK | ||
+ | 03 00 00 00 // UNK | ||
+ | 00 00 00 41 // float 8 | ||
+ | 00 00 00 41 // float 8 | ||
+ | 50 52 4e 54 // PRNT | ||
+ | 00 00 00 40 // byte count for next section | ||
+ | 48 48 48 48 48 48 48 00 // HHHHHHH | ||
+ | 46 46 46 46 46 46 46 00 // FFFFFFF | ||
+ | 46 46 46 46 46 46 46 00 // FFFFFFF | ||
+ | 48 46 46 46 46 46 48 00 // HFFFFFH | ||
+ | 48 46 46 46 46 46 48 00 // HFFFFFH | ||
+ | 48 46 46 46 46 46 48 00 // HFFFFFH | ||
+ | 48 46 46 46 46 46 48 00 // HFFFFFH | ||
+ | 48 46 46 46 46 46 48 00 // HFFFFFH | ||
+ | |||
+ | H are the house green relief when in placement mode | ||
+ | F are the house foot print | ||
+ | 00 are just spacers to tell thats its the end of that footprint line | ||
+ | |||
+ | |||
+ | |||
+ | The Structure Footprint File lists information about how a structure appears during StructurePlacementMode. | ||
+ | |||
+ | It follows a basic IFF format, FORM type FOOT. The only FORM version seen is 0000. It then has two chunks: INFO and PRNT. | ||
+ | |||
+ | The INFO chunk is structured: | ||
+ | INT = rows | ||
+ | INT = columns | ||
+ | INT = the block to return x position from | ||
+ | INT = the block to return y position from | ||
+ | FLOAT = row to meter conversion ratio | ||
+ | FLOAT = column to meter conversion ratio | ||
+ | |||
+ | The PRNT chunk is structured as a list of null terminated strings. There are as many strings as the number of columns, and the length of the string is equal to the number of rows + 1 for the NULL byte. | ||
+ | |||
+ | Each byte in this string signifies a type: | ||
+ | 0x48 = H = Terrain can have non-collidable flora in this location, and still place a structure. | ||
+ | 0x46 = F = Terrain cannot have non-collidable flora in this location, or structure can not be placed. | ||
+ | 0x2E = . = Ignore this block of terrain when considering structure placement. | ||
+ | </pre> | ||
==SHT - '''shader'''== | ==SHT - '''shader'''== | ||
Line 502: | Line 1,699: | ||
}} | }} | ||
− | ==SKT== | + | ==SKT - Skeleton (MESH)== |
− | + | {{Box_TREformats|SKT ''format''| | |
− | + | <pre> | |
+ | * Form:SKTM | ||
+ | o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) | ||
+ | + Record: INFO | ||
+ | # Number of bones - 32-bit unsigned int | ||
+ | + Record: NAME | ||
+ | # Name of bone: Null terminated ascii string * (Number of bones). | ||
+ | + Record: PRNT | ||
+ | # Parent bone index - 32-bit integer * (Number of bones).(Index into bone list. -1 for no parent. One index for each bone.) | ||
+ | + Form: RPRE | ||
+ | # Pre-rotation quaternion - 4 32-bit float * (Number of bones). | ||
+ | + Form: RPST | ||
+ | # Post-rotation quaternion - 4 32-bit float * (Number of bones). | ||
+ | + Form: BPTR | ||
+ | # Bone position - 3 32-bit float * (Number of bones). XYZ position | ||
+ | + Form: BPRO | ||
+ | # Bone pose?? quaternion - 4 32-bit float * (Number of bones). | ||
+ | + Form: JROR | ||
+ | # Bone ??? - 32-bit int * (Number of bones). (Always seems to be 0.) | ||
+ | </pre> | ||
+ | }} | ||
==SND== | ==SND== | ||
Line 601: | Line 1,818: | ||
SSA? File | SSA? File | ||
− | ==STF - ''' | + | ==[[TRE_STFFileType|STF - '''Strings Table File (Language)''']]== |
− | + | ||
{{Box_TREformats|STF ''format''| | {{Box_TREformats|STF ''format''| | ||
+ | It contains all the game's strings. During network communications the strings are identificated with: filename without extension + code + ansi string id. | ||
<pre> | <pre> | ||
+ | Header: | ||
+ | [int] // STF file type header id (sequence: 0xCD 0xAB 0x00 0x00, value: 0x0000ABCD = 43981) | ||
+ | [byte] // useless? flag (might be a boolean, seen so far: 0x01 and 0x00) | ||
+ | [int] // next free index in file to add an item, always > items count (useless for us) | ||
+ | [int] // items count | ||
− | [ | + | Then items list, for each: |
− | [ | + | [int] // item index in the file (eg: 1, 2, 9, 3, 7, ...) |
− | [ | + | [int] // code (gesture?) |
− | [ | + | [int] // unicode digits count of the sentence (eg: 11) |
+ | [u_string] // 2 bytes per char (eg: "hello world" is 11 digits long, 22 bytes total) | ||
− | + | Then item's string ids, for each: | |
+ | [int] // item index in the file matching one in previous list (eg: 1, 2, 9, 3, 7, ...) | ||
+ | [int] // ascii digits count of the string id (eg: 12) | ||
+ | [a_string] // 1 byte per char (eg: "basic_answer" is 12 digits long, 12 bytes total) | ||
+ | </pre> | ||
+ | }}Understood at 80%. | ||
− | + | ==SWH== | |
− | + | ||
− | + | ||
− | + | ||
+ | {{Box_TREformats|SWH''format''| | ||
+ | <pre> | ||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
}} | }} | ||
− | == | + | ==TGA - '''Targa Texture'''== |
− | {{Box_TREformats| | + | |
+ | {{Box_TREformats|TGA ''format''| | ||
<pre> | <pre> | ||
Line 638: | Line 1,862: | ||
}} | }} | ||
− | + | Terrain files Are divided in 2 main sections. The terrain generator and the maps | |
− | {{Box_TREformats| | + | ==[[TRN (FileFormat)|TRN - '''Terrain File''']]== |
+ | [[Image:Trn layers.jpg]] | ||
+ | {{Box_TREformats|TRN ''format''| | ||
<pre> | <pre> | ||
Line 649: | Line 1,875: | ||
}} | }} | ||
− | |||
− | {{Box_TREformats| | + | ==TRT - '''Texture Renderer File'''== |
+ | |||
+ | {{Box_TREformats|TRT ''format''| | ||
<pre> | <pre> | ||
Line 689: | Line 1,916: | ||
}} | }} | ||
− | ==VSH - '''Vertex Shader Script''' | + | ==VSH - '''Vertex Shader Script'''== |
Line 710: | Line 1,937: | ||
}} | }} | ||
− | ==WS - '''world | + | ==WS - '''world snapshot'''== |
{{Box_TREformats|WS ''format''| | {{Box_TREformats|WS ''format''| | ||
Line 769: | Line 1,996: | ||
− | World | + | World Snapshot |
There is one .ws file per planet (none for space that I have found yet although it would seem applicable), containing a list of items found outdoors on each planets. This includes buildings, terminals, streetlights, fog/special effects, ruins, and so forth. Trees/plants/rocks are not included unless they are somehow unique or special. | There is one .ws file per planet (none for space that I have found yet although it would seem applicable), containing a list of items found outdoors on each planets. This includes buildings, terminals, streetlights, fog/special effects, ruins, and so forth. Trees/plants/rocks are not included unless they are somehow unique or special. |
Latest revision as of 00:42, 9 December 2014
Welcome to SWGANH Tre Sub-Files Documentation
TreFiles History TreFile Template |
Contents
- 1 ANS
- 2 APT - Appearance File
- 3 ASH
- 4 CDF - Client Data File
- 5 CEF - Client Effect file
- 6 CFG - Configuration file
- 7 CMP - Component File
- 8 DDS - DirectDraw Surface File (Texture)
- 9 EFT - Effect
- 10 FFE - Force Feedback File
- 11 FLR
- 12 IFF - Interchange Format File
- 13 ILF - Interior Layout File
- 14 INC - Include File
- 15 LAT
- 16 LAY - Layer File
- 17 LMG
- 18 LOD - level of detail
- 19 LSB
- 20 LTN
- 21 MGN
- 22 MKR
- 23 MP3
- 24 MSH - mesh
- 25 PAL - palette
- 26 PLN
- 27 POB
- 28 PRT
- 29 PSH
- 30 PST
- 31 QST - QueST files
- 32 SAT
- 33 SFK
- 34 SFP - Building Foot Print
- 35 SHT - shader
- 36 SKT - Skeleton (MESH)
- 37 SND
- 38 SPR
- 39 SSA
- 40 STF - Strings Table File (Language)
- 41 SWH
- 42 TGA - Targa Texture
- 43 TRN - Terrain File
- 44 TRT - Texture Renderer File
- 45 TRT - Texture Renderer File
- 46 TXT - Text File
- 47 UI - User Interface File
- 48 VSH - Vertex Shader Script
- 49 WAV - WAV Audio File
- 50 WS - world snapshot
ANS
File Type: ANS format |
|
APT - Appearance File
File Type: APT format |
APT File Format links files to the .msh format either by directly going to the .msh filename or going to the .lod which then links to the .msh's [code] FORM -| |-APT FORM-| |-0000Name [/code] Inside "0000Name" "Path to LOD/MSH"<Null Terminator> EG appearance/lod/con_gen_organic_hide.lod<NULL> or appearance/mesh/con_newbie_crate.msh<NULL> |
ASH
File Type: ASH format |
|
CDF - Client Data File
File Type: CDF format |
This file contains the items or objects are associated with another object. Example: Spawning a Basic Camp from shared_scout_camp_s01.iff calls the Client Data File shared_scout_camp_s01.cdf that contains the items that are spawned automatically. 2 Torches, cot, stove, 2 pots, and the tent. Any other items that are needed will have to be spawn manually. Normally these are items that the player can interact with. Example Chairs, terminals. |
CEF - Client Effect file
File Type: CEF format |
|
CFG - Configuration file
File Type: CFG format |
|
CMP - Component File
File Type: CMP format |
* Form:CMPA o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) + Form:APPR (Same as one in mesh format.) + Form:RADR (Optional) + Record:PART (One or more records) # Filename of part mesh: null terminated ascii name. (Can reference .lod or .msh files.) # 3x4 transform matrix - 12 32-bit float With index 3,7, and 11 being the x, y and z translation component. |
DDS - DirectDraw Surface File (Texture)
File Type: DDS format |
DirectDraw Surface File (texture) Download plugin for photoshop here: http://download.nvidia.com/developer/NVTextureSuite/Photoshop_Plugins_7.83.0629.1500.exe MSDN article on file format here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/dx9_graphics_reference_dds_file.asp |
EFT - Effect
File Type: EFT format |
- The first DATA record contains 2-bytes. The first byte is an unsigned char that represents the number of IMPL Forms in the file. The 2nd byte is currently unknown. - The PVSH form contains a record of 0000 which contains the full path of an HLSL vertex shader program. - The PPSH form contain a 0001 form which contains 1 DATA record and a variable number of PTXM forms. The DATA record is made up of 1 unsigned char (which indicates the number of PTXM records) followed by the full path of an HLSL pixel shader program. - Each PTXM form contains one 0002 record. The first byte of which is an unsigned char followed by a 4 char texture tag name. |
FFE - Force Feedback File
File Type: FFE format |
|
FLR
File Type: FLR format |
|
IFF - Interchange Format File
File Type: IFF format |
http://www.szonye.com/bradd/iff.html - Overview of File Format http://www.ibm.com/developerworks/power/library/pa-spec16/ - alternative Overview IFF Files are made up of Chunk(s). Each Chunk follows the format: Type (4 x Char) Size (32 Bit Int Big-Endian) Data (Length determined by Size) (NOTE: Data lengths which are odd numbers are padded by a '0' which is not included in the Size (for 2 byte alignment) however, SOE *seems* to have ignored this requirement) Chunks can contain other (child) Chunks, or even complete .IFF Files. IFF Files must start with types of either: 'FORM' (0x464F524D), 'LIST' (0x4C495354) or 'CAT ' (0x43415420). Strictly speaking, IFF Files must have a single Root Chunk in the file to keep to the Standard, however it is expected that Top Level Chunk may potentially co-exist in SOEs IFFs. It is currently believed that all SOE IFFs start with FORM (LIST and CAT not required). FORM Types are basically storage (Record) for other proprietary Chunks. Every SOE FORM has an additional 32bit Sub Type taking up offsets 8-11 ie: Type (4 x Char) Size (32 Bit Int Big-Endian) Sub-Type (4x Char) Data (Length determined by Size) This means, for SOE FORMs, the data starts at offset 12, and is Size-4 long. ~ Known SOE Proprietary Chunks ~ CRCT - List of 32bit SOE CRCs, no delimeter STNG - List of Strings, delimited by 0x00 DATA - Some sort of Value. In Lists it appears to be an item count STRT - Hash Table IDs, 32bit, no delimeter EMAP - List of 3 No. Strings, delimited by 0x00. Appear to be Event Related. "EventSource\0EventDestination\0ClientEffect" 0000 - List of Strings (generally Filenames), delimited by 0x00 ~ Example ~ An Example SOE .IFF (Misc\planet_crc_string_table.iff) FORM (Length 524, Subtype CSTB [0x43535442]) *FORM (Length 512, Subtype 0000 [0x30303030]) **DATA (Length, 4) **CRCT (Length 100) **STRT (Length 100) **STNG (Length 272) |
ILF - Interior Layout File
File Type: ILF format |
What is an ILF file? An Interior layout file or ILF is an SWG hexadecimal file that contains information on the position of objects relative to the selected interior space/cell. TREE has inbuilt functions to assist with these files, The ILF editor will open when the 'Edit File' button is clicked. The ILF editor has two panes, the navigation pane and the editing pane. The editing pane has 3 sections; the object information section, the coordinates section and the rotation section. Opening an ILF An ILF can be opened through the use of the file pane when a TRE/TOC is loaded. If a TRE/TOC is not loaded, an external ILF can be loaded through the 'Open IFF/ILF/WS' dialog. Navigating an ILF's nodes TREE is developed to be user friendly and similar to the Windows Explorer interface, An ILF node can be navigated through the use of the keyboard or mouse. Mouse Clicking once on a FORM node will expand it, clicking on a sub-node will open it in the editing pane, in larger ILFs there may also be scroll bars at the side and bottom of the navigating pane. ILF nodes do not have drag and drop editing as the order of nodes does not matter. Keyboard Using the left and right arrow keys on a FORM node will expand and collapse it respectively. Using the Up and down arrow keys will navigate through sub-nodes, pressing the left arrow key with a sub-node selected will cause the FORM node it is in to collapse. Adding an ILF node ILF nodes may be added through the use of a keyboard shortcut (Check article 'Shortcuts') or by using the 'Add Node' button located above the navigation pane. Deleting an ILF node ILF nodes may be removed through the use of a keyboard shortcut (Check article 'Shortcuts') or by using the 'Remove Node' button located above the navigation pane when a node is selected. Modifying an ILF node's Value Object Information This contains two editable values; Object and Cell. The Object box is for the objects IFF's file path. The Cell box is for the particular cell where the object will be placed inside an interior, a cell name can be found in game by pressing CTRL+SHIFT+G. Coordinates The Coordinates section has three editable values; The X axis value, the Y axis value and the Z axis value. These control the position of the item relative to the cell/interior space. Rotation The Rotation section contains 3 editable values; Pitch, Yaw and Roll. It also contains one button which will launch the matrix calculator. Saving an ILF ILFs are normally saved under the SWG root in the interior layout file. For example C:\Program Files/StarWarsGalaxies/Interiorlayout/ |
INC - Include File
File Type: INC format |
|
LAT
File Type: LAT format |
possible relation to MAYA Lattices |
LAY - Layer File
File Type: LAY format |
|
LMG
File Type: LMG format |
[FORM] [uint32] //formsize [MLOD] [FORM] [uint32] //formsize [0000] [INFO] [uint32] //infosize(2) [uint16] //name elements count [NAME] [uint32] //namesize [namestring] //0 terminated Links to MGN meshes. Basicly it applies level of detail to MGN's depending on how far away you are. [code] FORM-| |-MLODFORM-| |-0000INFO |-NAME [/code] 0000INFO <2 bytes> 2 Bytes represent how many NAME Forms there are, so if its 01 00, then there is 1 NAME form, if its 02 00 then there is 2, if its 0A then there is 10. NAME File Path to the MGN with a NULL Terminator EG appearance/mesh/ackbar_l0.mgn<NULL> |
LOD - level of detail
File Type: LOD format |
* This file, like most SWG files, is based on the IFF format. * This overview will skip going into detail about the IFF format in general and focus purely on the organization of the LOD form. * If a Form/Record appears multiple times I will only define it the first time, unless its structure differs. * This file format is still being explored, so take this information as a guide and realize that some assumptions made here may be incorrect or missing details. * NOTE: All values are little-endian, unless otherwise noted. * Form:DTLA o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form, but always seems to be 5,6 or 7) + Form:APPR (Same as one in mesh format.) + Record:PIVT # Filename of ???: null terminated ascii name. (Always seems to be 1 byte of 0x0) + Record:INFO (Lists ranges for switch in/out of child models. The block of 3 values repeats, one for each child model. No.0/In/Out, No.1/In/Out, ... Number of child nodes is infoRecordSize/12) # Child Number: 32-bit unsigned int. # Switch in range: 32-bit float. # Switch out range: 32-bit float. + Form:DATA # Record:CHLD (One child per near/far value in INFO record. 1 or more ) * Child number: 32-bit unsigned int * Filename of child model: null terminated ascii name. If the filename does not start with appearance/ then it must be added. + Form:RADR # Record:INFO * Num IDTL forms: 32-bit unsigned int # Form:IDTL (0 or more) * Record:VERT (Number of vertices is vertRecordSize/12.) o x: 32-bit float. o y: 32-bit float. o z: 32-bit float. * Record:INDX (List of indices defining triangles using the vertices from the VERT record. Number of indices is indxRecordSize/4.) o index: 32-bit unsigned. + Form:TEST # Record:INFO * Num IDTL forms: 32-bit unsigned int # Form: IDTL (0 or more) + Form:WRIT # Record:INFO * Num IDTL forms: 32-bit unsigned int # Form: IDTL (0 or more) |
LSB
LSB? File
LTN
LTN? File Something to do with lighting
MGN
MGN? File 3d model information
File Type: MGN format |
rollout SWG_roll "Model importer" ( fn readInvLong f = ( t1 = readbyte f #unsigned t2 = readbyte f #unsigned t3 = readbyte f #unsigned t4 = readbyte f #unsigned return (t4+t3*0x100+t2*0x10000+t1*0x1000000) ) fn readFORM f = ( ofsForm = readInvLong f hdr = readlong f return hdr ) fn readPoint3 f sc = ( datasize = readInvLong f PT3Ary = #() testbyte = readlong f fseek f -4 #seek_cur if (testbyte<65536)AND(testbyte>=0) then ( for i = 1 to (datasize/16) do ( idx = 1 + (readlong f) vx = (readfloat f) * sc vy = (readfloat f) * sc vz = (readfloat f) * sc PT3Ary[idx] = [vx,-vz,vy] ) for i = 1 to PT3Ary.count do if PT3Ary[i] == undefined then PT3Ary[i] = [0,0,0] ) else ( for i = 1 to (datasize/12) do ( vx = (readfloat f) * sc vy = (readfloat f) * sc vz = (readfloat f) * sc append PT3Ary [vx,-vz,vy] ) ) return PT3Ary ) fn readTCSD f = ( datasize = readInvLong f PT2Ary = #() for i = 1 to (datasize/8) do ( vx = readfloat f vy = 1- (readfloat f) append PT2Ary [vx,vy,0] ) return PT2Ary ) fn readPIDX f = ( IndexAry = #() datasize = readInvLong f numIndex = readlong f for i = 1 to numIndex do append IndexAry (1+(readlong f)) return IndexAry ) fn readNIDX f = ( IndexAry = #() datasize = readInvLong f for i = 1 to (datasize/4) do append IndexAry (1+(readlong f)) return IndexAry ) fn readOITL f = ( IdxAry = #() Int3Ary = #() datasize = readInvLong f numdata = readlong f for i = 1 to numdata do ( append IdxAry (1+(readshort f)) f1 = 1 + (readlong f) f2 = 1 + (readlong f) f3 = 1 + (readlong f) append Int3Ary [f1,f2,f3] ) return #(IdxAry,Int3Ary) ) fn readITL f = ( Int3Ary = #() datasize = readInvLong f numdata = readlong f for i = 1 to numdata do ( f1 = 1 + (readlong f) f2 = 1 + (readlong f) f3 = 1 + (readlong f) append Int3Ary [f1,f2,f3] ) return #(undefined,Int3Ary) ) fn buildmesh VTary FCary NLary UVary PIDXary NIDXary = ( for i = 1 to PIDXary.count do PIDXary[i] = VTary[(PIDXary[i])] for i = 1 to NIDXary.count do NIDXary[i] = NLary[(NIDXary[i])] if FCary[1] == undefined then msh = mesh vertices:PIDXary faces:FCary[2] else msh = mesh vertices:PIDXary faces:FCary[2] materialIDs:FCary[1] msh.numTVerts = UVary.count buildTVFaces msh for j = 1 to UVary.count do setTVert msh j UVary[j] for j = 1 to FCary[2].count do setTVFace msh j FCary[2][j] for j = 1 to NIDXary.count do setNormal msh j NIDXary[j] return msh ) ---------------------------------------------------------------------------- fn readDATA f numData sc = ( datasize = readInvLong f if datasize < 8 then ( fseek f datasize #seek_cur return undefined ) VTary = #() NLary = #() UVary = #() sizeElement = datasize/numData --format "V:% @[%]\n" sizeElement (ftell f) for i = 1 to numData do ( vx = (readfloat f)*sc; vy = (readfloat f)*sc; vz = (readfloat f)*sc nx = readfloat f; ny = readfloat f; nz = readfloat f -- byteRead = 32 case sizeElement of ( 36: ( readlong f ; byteRead = 36 ) 52: ( readlong f ; byteRead = 36 ) 56: ( fseek f 16 #seek_cur ; byteRead = 48 ) default: byteRead = 32 ) vu = readfloat f; vv = 1-(readfloat f) fseek f (sizeElement-byteRead) #seek_cur -- append VTary [vx,-vz,vy] append NLary [nx,-nz,ny] append UVary [vu,vv,0] ) return #(VTary,NLary,UVary) ) fn readINDX f = ( FCary = #() datasize = readInvLong f numIndex = readlong f sizeElement = datasize / numIndex for i = 1 to (numIndex/3) do ( if sizeElement == 2 then ( f1 = 1 + (readshort f #unsigned) f2 = 1 + (readshort f #unsigned) f3 = 1 + (readshort f #unsigned) ) else if sizeElement == 4 then ( f1 = 1 + (readlong f #unsigned) f2 = 1 + (readlong f #unsigned) f3 = 1 + (readlong f #unsigned) ) else messagebox "error in face index" append FCary [f1,f2,f3] ) return FCary ) fn buildmesh2 VTary FCary NLary UVary = ( msh = mesh vertices:VTary faces:FCary msh.numTVerts = UVary.count buildTVFaces msh for j = 1 to UVary.count do setTVert msh j UVary[j] for j = 1 to FCary.count do setTVFace msh j FCary[j] for j = 1 to NLary.count do setNormal msh j NLary[j] return msh ) --GUI-- spinner fscale "Scale : " fieldwidth:60 range:[0.001, 1000, 1] button impMGN "Import MGN / MSH" width:150 Height:25 align:#center label lbl1 "" label lbl2 "by Fatduck" align:#right on impMGN pressed do ( fname = getOpenFileName caption:"Select Star Wars Galaxies Model file" types:"MGN File (*.mgn)|*.mgn|MSH File (*.msh)|*.msh|All Files (*.*)|*.*|" if fname != undefined then ( f = fopen fname "rb" fseek f 0 #seek_end ofsEOF = ftell f fseek f 0 #seek_set VTary = #() UVary = #() NLary = #() FCary = #() PIDXary = #() NIDXary = #() meshFlag = undefined infoFlag = undefined mshVert = 0 do ( header = readlong f case header of ( 0x58444E49: ( FCary = readINDX f msh = buildmesh2 VTary FCary NLary UVary ) 0x41544144: ( rslt = readDATA f mshVert fscale.value if rslt != undefined then ( VTary = rslt[1] NLary = rslt[2] UVary = rslt[3] ) infoFlag = false ) 0x4D524F46: ( flg = readFORM f if flg == 0x474D4B53 then meshFlag = true --SKMG else if flg == 0x20544C42 then meshFlag = false --BLT if flg == 0x41585456 then infoFlag = true --VTXA ) 0x4F464E49: ( if infoFlag == true then ( fseek f 8 #seek_cur mshVert = readlong f ) else fseek f (readInvLong f) #seek_cur ) 0x4E534F50: ( if meshFlag == true then VTary = readPoint3 f fscale.value else readPoint3 f fscale.value ) 0x4D524F4E: ( if meshFlag == true then NLary = readPoint3 f 1 else readPoint3 f 1 ) 0x58444950: PIDXary = readPIDX f 0x5844494E: NIDXary = readNIDX f 0x44534354: UVary = readTCSD f 0x4C54494F: ( FCary = readOITL f msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary ) 0x204C5449: ( FCary = readITL f msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary ) default: ( datasize = readInvLong f fseek f datasize #seek_cur ) )--end case ) while (ftell f) != ofsEOF fclose f )--end if fname )--end on impMGN )--end rollout SWG_roll if Fatduck_SWG != undefined then closeRolloutFloater Fatduck_SWG Fatduck_SWG = newRolloutFloater "Star Wars Galaxies" 200 175 10 70 addRollout SWG_roll Fatduck_SWG |
MKR
Marker File
MP3
MP3 Audio File
MSH - mesh
File Type: MSH file breakdown |
This file, like most SWG files, is based on the IFF format. This overview will skip going into detail about the IFF format in general and focus purely on the organization of the MESH form. If a Form/Record appears multiple times I will only define it the first time, unless its structure differs. This file format is still being explored, so take this information as a guide and realize that some assumptions made here may be incorrect or missing details. If you discover something I missed or have an error correction, please send a message Xunil on the swgemu forums. NOTE: All values are little-endian, unless otherwise noted. Form:MESH Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) Form:APPR Form:0003 Form:EXBX (Bounding box) 1 or more required. Form:0001 Form:EXSP (Bounding sphere.) Form:0001 Record:SPHR Record:BOX Form:NULL Form:EXSP (Optional additional Bounding sphere. Same format as previous.) Form:XCYL Form:0000 Record:CYLN Form:CMPT Form:0000 Form:CPST Form:0000 Form:CMSH (Coming soon.) Form:CMPT (Coming soon.) Form:EXBX Form:EXSP Form:XCYL Form:CMSH (Coming soon.) Form:DTAL (Coming soon.) Form:HPTS (List of 0 or more attach point records.) Record:HPNT Form:FLOR Form:DATA Size of floor filename(including NULL): unsigned char Floor filename - null terminated ascii string. Form:INFO (Not sure yet.) Form:SPS Form:000# Record:CNT numGeode - 32-bit unsigned int. Form:000# (In this case the # is the number of this geometry subtree) Record:NAME Shader Filename - NULL terminated ascii string. Record:INFO Unknown(num geometry forms?) - 32-bit unsigned int. Form:000# Record:INFO Unknown - 32-bit unsigned int. Unknown - 16-bit unsigned short. FORM:VTXA FORM:000# Record:INFO Unknown(FVF flags?) - 32-bit unsigned int. numVertices - 32-bit unsigned short. Record:DATA Vertex Data Record:INDX Vertex indices Record:SIDX (Optional) Secondary vertex indices Record:SPHR - Defines a sphere. Sphere center xyz - 3 32-bit float. Sphere radius - 32-bit float. Record:BOX - Defines a box. First corner xyz - 3 32-bit float. Second corner xyz - 3 32-bit float. Record:CYLN - Defines a cylinder. Base xyz, radius, height?- 5 32-bit float. Record:HPNT - Attach point. 3 row x 4 col transform matrix - 12 32-bit float. Null terminated ascii name - remainder of HPNT record size. Vertex data Before reading the vertex data the bytes per vertex needs to be computed. BPV = (vertex DATA record size)/numVertices. The observed vertex formats seen are as follows: 32 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. 36 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. color argb - 4 unsigned char. tex coords 0 uv - 2 32-bit floats. 40 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. 44 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. color argb - 4 unsigned char. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. 48 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. 52 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. color argb - 4 unsigned char. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. 56 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. tex coords 3 uv - 2 32-bit floats. 60 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. color argb - 4 unsigned char. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. tex coords 3 uv - 2 32-bit floats. 64 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. tex coords 3 uv - 2 32-bit floats. tex coords 4 uv - 2 32-bit floats. 68 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. color argb - 4 unsigned char. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. tex coords 3 uv - 2 32-bit floats. tex coords 4 uv - 2 32-bit floats. 72 bpv position xyz - 3 32-bit floats. normal xyz - 3 32-bit floats. tex coords 0 uv - 2 32-bit floats. tex coords 1 uv - 2 32-bit floats. tex coords 2 uv - 2 32-bit floats. tex coords 3 uv - 2 32-bit floats. tex coords 4 uv - 2 32-bit floats. tex coords 5 uv - 2 32-bit floats. Vertex index Before reading the vertex indices the bytes per index needs to be computed. BPI = (INDX record size - 4)/numIndices. After the bpi is computed, the rest of the record is a series of unsigned short or unsigned int values that reference the vertices defined in the vertex DATA record. So index 0,1,2 = triangle 0, index 3,4,5 = triangle 1, ... Secondary Vertex index Number of matrix/index/triangle sets: 32-bit unsigned int. Matrix/index/triangle set. Rotations? - 3 32-bit floats. Number of indices: - 32-bit unsigned int. Index: Same datatype as primary vertex index. |
File Type: MSH format |
rollout SWG_roll "Model importer" ( fn readInvLong f = ( t1 = readbyte f #unsigned t2 = readbyte f #unsigned t3 = readbyte f #unsigned t4 = readbyte f #unsigned return (t4+t3*0x100+t2*0x10000+t1*0x1000000) ) fn readFORM f = ( ofsForm = readInvLong f hdr = readlong f return hdr ) fn readPoint3 f sc = ( datasize = readInvLong f PT3Ary = #() testbyte = readlong f fseek f -4 #seek_cur if (testbyte<65536)AND(testbyte>=0) then ( for i = 1 to (datasize/16) do ( idx = 1 + (readlong f) vx = (readfloat f) * sc vy = (readfloat f) * sc vz = (readfloat f) * sc PT3Ary[idx] = [vx,-vz,vy] ) for i = 1 to PT3Ary.count do if PT3Ary[i] == undefined then PT3Ary[i] = [0,0,0] ) else ( for i = 1 to (datasize/12) do ( vx = (readfloat f) * sc vy = (readfloat f) * sc vz = (readfloat f) * sc append PT3Ary [vx,-vz,vy] ) ) return PT3Ary ) fn readTCSD f = ( datasize = readInvLong f PT2Ary = #() for i = 1 to (datasize/8) do ( vx = readfloat f vy = 1- (readfloat f) append PT2Ary [vx,vy,0] ) return PT2Ary ) fn readPIDX f = ( IndexAry = #() datasize = readInvLong f numIndex = readlong f for i = 1 to numIndex do append IndexAry (1+(readlong f)) return IndexAry ) fn readNIDX f = ( IndexAry = #() datasize = readInvLong f for i = 1 to (datasize/4) do append IndexAry (1+(readlong f)) return IndexAry ) fn readOITL f = ( IdxAry = #() Int3Ary = #() datasize = readInvLong f numdata = readlong f for i = 1 to numdata do ( append IdxAry (1+(readshort f)) f1 = 1 + (readlong f) f2 = 1 + (readlong f) f3 = 1 + (readlong f) append Int3Ary [f1,f2,f3] ) return #(IdxAry,Int3Ary) ) fn readITL f = ( Int3Ary = #() datasize = readInvLong f numdata = readlong f for i = 1 to numdata do ( f1 = 1 + (readlong f) f2 = 1 + (readlong f) f3 = 1 + (readlong f) append Int3Ary [f1,f2,f3] ) return #(undefined,Int3Ary) ) fn buildmesh VTary FCary NLary UVary PIDXary NIDXary = ( for i = 1 to PIDXary.count do PIDXary[i] = VTary[(PIDXary[i])] for i = 1 to NIDXary.count do NIDXary[i] = NLary[(NIDXary[i])] if FCary[1] == undefined then msh = mesh vertices:PIDXary faces:FCary[2] else msh = mesh vertices:PIDXary faces:FCary[2] materialIDs:FCary[1] msh.numTVerts = UVary.count buildTVFaces msh for j = 1 to UVary.count do setTVert msh j UVary[j] for j = 1 to FCary[2].count do setTVFace msh j FCary[2][j] for j = 1 to NIDXary.count do setNormal msh j NIDXary[j] return msh ) ---------------------------------------------------------------------------- fn readDATA f numData sc = ( datasize = readInvLong f if datasize < 8 then ( fseek f datasize #seek_cur return undefined ) VTary = #() NLary = #() UVary = #() sizeElement = datasize/numData --format "V:% @[%]\n" sizeElement (ftell f) for i = 1 to numData do ( vx = (readfloat f)*sc; vy = (readfloat f)*sc; vz = (readfloat f)*sc nx = readfloat f; ny = readfloat f; nz = readfloat f -- byteRead = 32 case sizeElement of ( 36: ( readlong f ; byteRead = 36 ) 52: ( readlong f ; byteRead = 36 ) 56: ( fseek f 16 #seek_cur ; byteRead = 48 ) default: byteRead = 32 ) vu = readfloat f; vv = 1-(readfloat f) fseek f (sizeElement-byteRead) #seek_cur -- append VTary [vx,-vz,vy] append NLary [nx,-nz,ny] append UVary [vu,vv,0] ) return #(VTary,NLary,UVary) ) fn readINDX f = ( FCary = #() datasize = readInvLong f numIndex = readlong f sizeElement = datasize / numIndex for i = 1 to (numIndex/3) do ( if sizeElement == 2 then ( f1 = 1 + (readshort f #unsigned) f2 = 1 + (readshort f #unsigned) f3 = 1 + (readshort f #unsigned) ) else if sizeElement == 4 then ( f1 = 1 + (readlong f #unsigned) f2 = 1 + (readlong f #unsigned) f3 = 1 + (readlong f #unsigned) ) else messagebox "error in face index" append FCary [f1,f2,f3] ) return FCary ) fn buildmesh2 VTary FCary NLary UVary = ( msh = mesh vertices:VTary faces:FCary msh.numTVerts = UVary.count buildTVFaces msh for j = 1 to UVary.count do setTVert msh j UVary[j] for j = 1 to FCary.count do setTVFace msh j FCary[j] for j = 1 to NLary.count do setNormal msh j NLary[j] return msh ) --GUI-- spinner fscale "Scale : " fieldwidth:60 range:[0.001, 1000, 1] button impMGN "Import MGN / MSH" width:150 Height:25 align:#center label lbl1 "" label lbl2 "by Fatduck" align:#right on impMGN pressed do ( fname = getOpenFileName caption:"Select Star Wars Galaxies Model file" types:"MGN File (*.mgn)|*.mgn|MSH File (*.msh)|*.msh|All Files (*.*)|*.*|" if fname != undefined then ( f = fopen fname "rb" fseek f 0 #seek_end ofsEOF = ftell f fseek f 0 #seek_set VTary = #() UVary = #() NLary = #() FCary = #() PIDXary = #() NIDXary = #() meshFlag = undefined infoFlag = undefined mshVert = 0 do ( header = readlong f case header of ( 0x58444E49: ( FCary = readINDX f msh = buildmesh2 VTary FCary NLary UVary ) 0x41544144: ( rslt = readDATA f mshVert fscale.value if rslt != undefined then ( VTary = rslt[1] NLary = rslt[2] UVary = rslt[3] ) infoFlag = false ) 0x4D524F46: ( flg = readFORM f if flg == 0x474D4B53 then meshFlag = true --SKMG else if flg == 0x20544C42 then meshFlag = false --BLT if flg == 0x41585456 then infoFlag = true --VTXA ) 0x4F464E49: ( if infoFlag == true then ( fseek f 8 #seek_cur mshVert = readlong f ) else fseek f (readInvLong f) #seek_cur ) 0x4E534F50: ( if meshFlag == true then VTary = readPoint3 f fscale.value else readPoint3 f fscale.value ) 0x4D524F4E: ( if meshFlag == true then NLary = readPoint3 f 1 else readPoint3 f 1 ) 0x58444950: PIDXary = readPIDX f 0x5844494E: NIDXary = readNIDX f 0x44534354: UVary = readTCSD f 0x4C54494F: ( FCary = readOITL f msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary ) 0x204C5449: ( FCary = readITL f msh = buildmesh VTary FCary NLary UVary PIDXary NIDXary ) default: ( datasize = readInvLong f fseek f datasize #seek_cur ) )--end case ) while (ftell f) != ofsEOF fclose f )--end if fname )--end on impMGN )--end rollout SWG_roll if Fatduck_SWG != undefined then closeRolloutFloater Fatduck_SWG Fatduck_SWG = newRolloutFloater "Star Wars Galaxies" 200 175 10 70 addRollout SWG_roll Fatduck_SWG |
PAL - palette
Palette File
PAL Editor can be downloaded here -> http://mods.mandalorians.de/system/infusions/pro_download_panel/download.php?did=16
File Type: PAL format |
52 49 46 46 // RIFF 10 01 00 00 // size (int 32) 50 40 4c 20 // Pal 64 61 74 61 // Data 40 00 00 00 // size (int 32) // Here starts the color pallate 00 03 // uint16 version 40 00 // uint16 pallette colors count(64) // This is were the swg pallet editor start's showing were the colors are cc cc cc 00 // uint32 (RGBA) b7 b7 b7 00 // a3 a3 a3 00 // 8e 8e 8e 00 // 92 23 23 00 // 84 1f 1f 00 // 77 1b 1b 00 // 69 17 17 00 // 65 61 82 00 // 54 50 85 00 // 44 3e 89 00 // 33 2d 8c 00 // d4 d6 47 00 // b8 ba 36 00 // 9d 9f 26 00 // 81 83 15 00 // 58 a5 64 00 // 45 91 51 00 // 31 7c 3d 00 // df b4 3e 00 // b9 94 2f 00 // 92 73 1f 00 // 6c 53 10 00 // 71 a5 a5 00 // 5b 95 95 00 // 44 86 86 00 // 2e 76 76 00 // 75 61 76 00 // 72 4d 78 00 // 6e 38 7b 00 // 6b 24 7d 00 // 7d b0 c0 00 // 69 95 a3 00 // 54 7b 87 00 // 40 60 6a 00 // cd 7a 37 00 // a9 64 2c 00 // 84 4d 21 00 // 60 37 16 00 // d4 83 83 00 // a5 5e 5e 00 // 87 42 42 00 // 5f 2d 2d 00 // 93 73 1b 00 // 7c 60 18 00 // 5a 45 0e 00 // dd d8 c0 00 // bd b9 a4 00 // 9e 9a 88 00 // 7e 7b 6c 00 // 91 6d 6d 00 // 76 59 59 00 // 5c 44 44 00 // 41 30 30 00 // 75 61 76 00 // 6b 4d 6c 00 // 60 39 62 00 // 56 25 58 00 // a6 c1 71 00 // 8e a6 61 00 // 77 8a 50 00 // 5f 6f 40 00 // |
PLN
Planet File
POB
46 4f 52 4d // FORM 00 00 02 d3 // 723 Form Count 43 45 4c 4c 46 4f 52 4d // CELLFORM 00 00 02 c7 // 711 count to end of form 30 30 30 35 44 41 54 41 // 0005DATA 00 00 00 a9 04 00 00 00 00 6d 61 69 6e 68 61 6e 67 61 72 // mainhangar 00 61 70 70 65 61 72 61 6e 63 65 2f 6d 65 73 68 2f // appearance/mesh/ 74 68 6d 5f 73 70 63 5f 73 74 61 72 5f 64 65 73 // thm_spc_star_des 74 72 6f 79 65 72 5f 73 30 31 5f 72 31 5f 6d 61 // troyer_s01_r1_ma 69 6e 68 61 6e 67 61 72 5f 6d 65 73 68 5f 72 31 // inhangar_mesh_r1 2e 6d 73 68 // .msh 00 01 61 70 70 65 61 72 61 6e 63 65 // appearance 2f 63 6f 6c 6c 69 73 69 6f 6e 2f 74 68 6d 5f 73 // /collision/thm_s 70 63 5f 73 74 61 72 5f 64 65 73 74 72 6f 79 65 // pc_star_destroye 72 5f 73 30 31 5f 72 31 5f 6d 61 69 6e 68 61 6e // r_s01_r1_mainhan 67 61 72 5f 63 6f 6c 6c 69 73 69 6f 6e 5f 66 6c // gar_collision_fl 6f 6f 72 30 2e 66 6c 72 // oor0.flr 00 46 4f 52 4d // FORM 00 00 00 04 4e 55 4c 4c 46 4f 52 4d // NULLFORM 00 00 00 48 50 52 54 4c 30 30 30 34 // HPRTL0004 00 00 00 3c 01 02 00 00 00 01 0c 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 46 4f 52 4d // FROM 00 00 00 48 50 52 54 4c 30 30 30 34 // HPRTL0004 00 00 00 3c 01 03 00 00 00 01 0a 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 46 4f 52 4d // FORM 00 00 00 48 50 52 54 4c 30 30 30 34 // HPRTL0004 00 00 00 3c 01 04 00 00 00 01 09 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 46 4f 52 4d // FORM 00 00 00 48 50 52 54 4c 30 30 30 34 // HPRTL0004 00 00 00 3c 01 05 00 00 00 01 02 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f // 1 00 00 00 00 4c 47 48 54 // LGHT 00 00 00 be // 190 02 00 00 00 01 00 00 00 00 01 45 b3 3f // 1.40 R Lighting Color Like sun light but only shows on toon 0a d7 b3 3f // 1.40 B Lighting Color fe cf a5 3f // 1.30 G Lighting Color 00 00 00 00 01 45 b3 3f // 1.40 R Lighting Color 0a d7 b3 3f // 1.40 B Lighting Color fe cf a5 3f // 1.30 G Lighting Color 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 80 00 f6 f3 be // -0.48 11 12 61 3f // 0.88 78 a0 51 43 // 209.63 00 00 00 00 11 12 61 bf // 0.88 00 f6 f3 be // -0.48 67 08 a8 c2 // -84.02 00 00 80 3f // 1 00 00 00 00 00 00 00 00 01 00 00 00 00 d5 3e 97 3f // 1.18 R Lighting Color Like sun light but only shows on toon 9e fb ad 3f // 1.36 B Lighting Color 0a d7 b3 3f // 1.40 G Lighting Color 00 00 00 00 d5 3e 97 3f // 1.18 R Lighting Color 9e fb ad 3f // 1.36 B Lighting Color 0a d7 b3 3f // 1.40 G Lighting Color 00 00 80 3f // 1 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 c2 19 f4 3e // 0.48 60 08 61 3f // 0.88 78 a0 51 43 // 209.63 00 00 00 00 60 08 61 bf // -0.88 c2 19 f4 3e // 0.48 67 43 a3 c2 // -81.63 00 00 80 3f // 1 00 00 00 00 00 00 00
PRT
Particle File
PSH
Pixel Shader? File
PST
Playback File
QST - QueST files
QueST files are XML files describing journal quests. Let's examine them here.
SAT
File Type: SAT format |
'WSNP' FORM (ws file) - FORM - NODS - size - offset to stringtable ---------------------------------------------------- 46 4F 52 4D //FORM 00 00 04 E4 //formsize 53 4D 41 54 //SMAT 46 4F 52 4D //FORM 00 00 04 D8 //formsize 30 30 30 30 //0000 44 41 54 41 //DATA 00 00 00 34 //datasize 01 A7 15 00 //id 00 00 00 00 //parentid 70 00 00 00 //strtable index 00 00 00 00 //ox D4 15 1E BE //oY 00 00 00 00 //oz 51 EE 7C 3F //ow 00 00 00 00 //scale?? 38 CA A0 45 //x 00 00 AF 43 //y EE DE B2 C4 //z 00 00 00 44 //type? 7B D6 12 E7 //?? SAT Format is used for linking MGN together with its Skeleton and Lat File (Lat File is a List of Animations) [code] FORM-| |-SMATFORM-| |-0003INFO |-MSGN |-SKTI |-LATX [/code] Note: Sometimes it may have an extra FORM inside SMATFORM which will not be added to this documentation for now. 0003INFO: Structure: <4 Byte> <4 Bytes> <1 Byte> First 4 Bytes Represents how many lmg's there will be in the MSGN Format (LMG's link to MGN's) Next 4 Bytes Represent How many Skeletons there are in the SKTI Format Last Represents if a LATX Exists or not (00 or 01), if it doesn't then the LATX FORM Isn't needed. MSGN: File Path to the Appearance with a NULL Terminator EG appearance/mesh/bocatt_hue.lmg<NULL> SKTI: Links the Skeleton in and has a reference to the part of the body the Skeleton affects. EG (note this has 2 Skeletons in) appearance/skeleton/all_b.skt<NULL><NULL>appearance/skeleton/hum_m_face.skt<NULL>head<NULL> The Face Skeleton only affects the head and is mentioned, where all_b.skt affects the entire body so its left "blank" LATX: First 2 bytes represent how many LATS & Skeletons will be in the file. This Example has two (first two bytes are 02 00) appearance/skeleton/all_b.skt<NULL>appearance/lat/all_m.lat<NULL> appearance/skeleton/hum_m_face.skt<NULL>appearance/lat/hum_m_face.lat<NULL> Links the Skeleton up with the Animation List. |
SFK
File Type: SFK format |
SFK - Usually Used in Sound Forge/Sony Vegas Only exists in data_other and patch_01 Probably only there due to someone forgetting to "clean" it out when packing it (Suggested by someone else, makes the most sense) |
SFP - Building Foot Print
This file contains the info on building Footprints. One Block in game is 8m x 8m. Still a few Unknowns
Player Merchant Tent uses a 3 x 3 block 46 4f 52 4d // FORM 00 00 00 44 // total byte count 46 4f 4f 54 46 4f 52 4d// FOOTFORM 00 00 00 38 // byte count to end 30 30 30 30 // UNK 49 4e 46 4f // INFO 00 00 00 18 // byte count for next section 03 00 00 00 // 3 blocks 03 00 00 00 // 3 blocks 01 00 00 00 // UNK 01 00 00 00 // UNK 00 00 80 40 // float 4 00 00 80 40 // float 4 50 52 4e 54 // PRNT 00 00 00 0c // byte count for next section 48 46 48 00 // HFH 46 46 46 00 // FFF 48 46 48 00 // HFH Small Tatooine House uses a 3 x 4 block 46 4f 52 4d // FORM 00 00 00 48 // total byte count 46 4f 4f 54 46 4f 52 4d // FOOTFORM 00 00 00 3c // byte count to end 30 30 30 30 // UNK 49 4e 46 4f // INFO 00 00 00 18 // byte count for next section 03 00 00 00 // 3 blocks 04 00 00 00 // 4 blocks 01 00 00 00 // UNK 01 00 00 00 // UNK 00 00 00 41 // float 8 00 00 00 41 // float 8 50 52 4e 54 // PRNT 00 00 00 10 // byte count for next section 48 48 48 00 // HHH 46 46 46 00 // FFF 46 46 46 00 // FFF 46 46 46 00 // FFF Med Tatooine House uses a 5 x 5 block 46 4f 52 4d // FORM 00 00 00 56 // total byte count 46 4f 4f 54 46 4f 52 4d // FOOTFORM 00 00 00 4a // byte count to end 30 30 30 30 // unk 49 4e 46 4f // INFO 00 00 00 18 // byte count for next section 05 00 00 00 // 5 blocks 05 00 00 00 // 5 blocks 02 00 00 00 // UNK 02 00 00 00 // UNK 00 00 00 41 // float 8 00 00 00 41 // float 8 50 52 4e 54 // PRNT 00 00 00 1e // byte count for next section 48 48 48 48 48 00 // HHHHH 48 46 46 46 48 00 // HFFFH 48 46 46 46 48 00 // HFFFH 48 46 46 46 48 00 // HFFFH 48 48 48 48 48 00 // HHHHH Generic PA Hall uses a 7 x 8 block 46 4f 52 4d // FORM 00 00 00 78 // total byte count 46 4f 4f 54 46 4f 52 4d // FOOTFORM 00 00 00 6c // byte count to end 30 30 30 30 // UNK 49 4e 46 4f // INFO 00 00 00 18 // byte count for next section 07 00 00 00 // 7 blocks 08 00 00 00 // 8 blocks 03 00 00 00 // UNK 03 00 00 00 // UNK 00 00 00 41 // float 8 00 00 00 41 // float 8 50 52 4e 54 // PRNT 00 00 00 40 // byte count for next section 48 48 48 48 48 48 48 00 // HHHHHHH 46 46 46 46 46 46 46 00 // FFFFFFF 46 46 46 46 46 46 46 00 // FFFFFFF 48 46 46 46 46 46 48 00 // HFFFFFH 48 46 46 46 46 46 48 00 // HFFFFFH 48 46 46 46 46 46 48 00 // HFFFFFH 48 46 46 46 46 46 48 00 // HFFFFFH 48 46 46 46 46 46 48 00 // HFFFFFH H are the house green relief when in placement mode F are the house foot print 00 are just spacers to tell thats its the end of that footprint line The Structure Footprint File lists information about how a structure appears during StructurePlacementMode. It follows a basic IFF format, FORM type FOOT. The only FORM version seen is 0000. It then has two chunks: INFO and PRNT. The INFO chunk is structured: INT = rows INT = columns INT = the block to return x position from INT = the block to return y position from FLOAT = row to meter conversion ratio FLOAT = column to meter conversion ratio The PRNT chunk is structured as a list of null terminated strings. There are as many strings as the number of columns, and the length of the string is equal to the number of rows + 1 for the NULL byte. Each byte in this string signifies a type: 0x48 = H = Terrain can have non-collidable flora in this location, and still place a structure. 0x46 = F = Terrain cannot have non-collidable flora in this location, or structure can not be placed. 0x2E = . = Ignore this block of terrain when considering structure placement.
SHT - shader
File Type: SHT format |
|
SKT - Skeleton (MESH)
File Type: SKT format |
* Form:SKTM o Form:000# (The # is an ASCII numerical character, not sure of the meaning for this form.) + Record: INFO # Number of bones - 32-bit unsigned int + Record: NAME # Name of bone: Null terminated ascii string * (Number of bones). + Record: PRNT # Parent bone index - 32-bit integer * (Number of bones).(Index into bone list. -1 for no parent. One index for each bone.) + Form: RPRE # Pre-rotation quaternion - 4 32-bit float * (Number of bones). + Form: RPST # Post-rotation quaternion - 4 32-bit float * (Number of bones). + Form: BPTR # Bone position - 3 32-bit float * (Number of bones). XYZ position + Form: BPRO # Bone pose?? quaternion - 4 32-bit float * (Number of bones). + Form: JROR # Bone ??? - 32-bit int * (Number of bones). (Always seems to be 0.) |
SND
File Type: SND format |
46 4f 52 4d // FORM (Element) 00 00 00 a7 // Length Of Data that Follows (Count starts after this byte) (a7 = 167) 53 44 32 44 // SD2D (Element) 30 30 30 33 // 0003 (Version ?) 00 00 00 9b // string length 73 61 6d 70 6c 65 2f 61 6d 62 5f 63 6c 6f 6e 69 6e 67 5f 66 61 63 69 6c 69 74 79 5f 69 6e 74 5f 6c 70 2e 77 61 76 00 00 // sample/amb_cloning_facility_int_lp.wav 00 00 00 00 // ? 00 00 00 00 00 C0 // Bitrate (192) 3F // Volume ? 00 00 C0 // Bitrate (192) (Again?) 3F // Volume ? FF FF FF FF FF FF FF FF // ? 00 00 00 00 00 00 00 00 00 00 C0 // Bitrate (192) (Again?) 3F // Volume ? 00 00 C0 // Bitrate (192) (Again?) 3F // Volume ? 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3F 00 00 80 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 CD CC CC 3D |
SPR
Sprite File
SSA
SSA? File
STF - Strings Table File (Language)
File Type: STF format |
It contains all the game's strings. During network communications the strings are identificated with: filename without extension + code + ansi string id. Header: [int] // STF file type header id (sequence: 0xCD 0xAB 0x00 0x00, value: 0x0000ABCD = 43981) [byte] // useless? flag (might be a boolean, seen so far: 0x01 and 0x00) [int] // next free index in file to add an item, always > items count (useless for us) [int] // items count Then items list, for each: [int] // item index in the file (eg: 1, 2, 9, 3, 7, ...) [int] // code (gesture?) [int] // unicode digits count of the sentence (eg: 11) [u_string] // 2 bytes per char (eg: "hello world" is 11 digits long, 22 bytes total) Then item's string ids, for each: [int] // item index in the file matching one in previous list (eg: 1, 2, 9, 3, 7, ...) [int] // ascii digits count of the string id (eg: 12) [a_string] // 1 byte per char (eg: "basic_answer" is 12 digits long, 12 bytes total) |
Understood at 80%.
SWH
File Type: SWHformat |
|
TGA - Targa Texture
File Type: TGA format |
|
Terrain files Are divided in 2 main sections. The terrain generator and the maps
TRN - Terrain File
File Type: TRN format |
|
TRT - Texture Renderer File
File Type: TRT format |
|
TRT - Texture Renderer File
File Type: TRT format |
|
TXT - Text File
File Type: TXT format |
|
UI - User Interface File
File Type: UI format |
|
VSH - Vertex Shader Script
File Type: VSH format |
(Shader City - Possible App to open the Vertex Shader Scripts) |
WAV - WAV Audio File
File Type: WAV format |
|
WS - world snapshot
File Type: WS format |
'WSNP' FORM (ws file) - FORM - NODS - size - offset to stringtable ---------------------------------------------------- 46 4F 52 4D //FORM 00 00 04 E4 //formsize 4E 4F 44 45 //NODE 46 4F 52 4D //FORM 00 00 04 D8 //formsize 30 30 30 30 //0000 44 41 54 41 //DATA 00 00 00 34 //datasize 01 A7 15 00 //id 00 00 00 00 //parentid 70 00 00 00 //strtable index 00 00 00 00 //ox D4 15 1E BE //oY 00 00 00 00 //oz 51 EE 7C 3F //ow 00 00 00 00 //scale?? 38 CA A0 45 //x 00 00 AF 43 //y EE DE B2 C4 //z 00 00 00 44 //type? 7B D6 12 E7 //?? |
World Snapshot
There is one .ws file per planet (none for space that I have found yet although it would seem applicable), containing a list of items found outdoors on each planets. This includes buildings, terminals, streetlights, fog/special effects, ruins, and so forth. Trees/plants/rocks are not included unless they are somehow unique or special.